{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.MigrationHubReFactorSpaces.GetResourcePolicy -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Gets the resource-based permission policy that is set for the given -- environment. module Amazonka.MigrationHubReFactorSpaces.GetResourcePolicy ( -- * Creating a Request GetResourcePolicy (..), newGetResourcePolicy, -- * Request Lenses getResourcePolicy_identifier, -- * Destructuring the Response GetResourcePolicyResponse (..), newGetResourcePolicyResponse, -- * Response Lenses getResourcePolicyResponse_policy, getResourcePolicyResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.MigrationHubReFactorSpaces.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newGetResourcePolicy' smart constructor. data GetResourcePolicy = GetResourcePolicy' { -- | The Amazon Resource Name (ARN) of the resource associated with the -- policy. identifier :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetResourcePolicy' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'identifier', 'getResourcePolicy_identifier' - The Amazon Resource Name (ARN) of the resource associated with the -- policy. newGetResourcePolicy :: -- | 'identifier' Prelude.Text -> GetResourcePolicy newGetResourcePolicy pIdentifier_ = GetResourcePolicy' {identifier = pIdentifier_} -- | The Amazon Resource Name (ARN) of the resource associated with the -- policy. getResourcePolicy_identifier :: Lens.Lens' GetResourcePolicy Prelude.Text getResourcePolicy_identifier = Lens.lens (\GetResourcePolicy' {identifier} -> identifier) (\s@GetResourcePolicy' {} a -> s {identifier = a} :: GetResourcePolicy) instance Core.AWSRequest GetResourcePolicy where type AWSResponse GetResourcePolicy = GetResourcePolicyResponse request overrides = Request.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetResourcePolicyResponse' Prelude.<$> (x Data..?> "Policy") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable GetResourcePolicy where hashWithSalt _salt GetResourcePolicy' {..} = _salt `Prelude.hashWithSalt` identifier instance Prelude.NFData GetResourcePolicy where rnf GetResourcePolicy' {..} = Prelude.rnf identifier instance Data.ToHeaders GetResourcePolicy where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath GetResourcePolicy where toPath GetResourcePolicy' {..} = Prelude.mconcat ["/resourcepolicy/", Data.toBS identifier] instance Data.ToQuery GetResourcePolicy where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newGetResourcePolicyResponse' smart constructor. data GetResourcePolicyResponse = GetResourcePolicyResponse' { -- | A JSON-formatted string for an Amazon Web Services resource-based -- policy. policy :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetResourcePolicyResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'policy', 'getResourcePolicyResponse_policy' - A JSON-formatted string for an Amazon Web Services resource-based -- policy. -- -- 'httpStatus', 'getResourcePolicyResponse_httpStatus' - The response's http status code. newGetResourcePolicyResponse :: -- | 'httpStatus' Prelude.Int -> GetResourcePolicyResponse newGetResourcePolicyResponse pHttpStatus_ = GetResourcePolicyResponse' { policy = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | A JSON-formatted string for an Amazon Web Services resource-based -- policy. getResourcePolicyResponse_policy :: Lens.Lens' GetResourcePolicyResponse (Prelude.Maybe Prelude.Text) getResourcePolicyResponse_policy = Lens.lens (\GetResourcePolicyResponse' {policy} -> policy) (\s@GetResourcePolicyResponse' {} a -> s {policy = a} :: GetResourcePolicyResponse) -- | The response's http status code. getResourcePolicyResponse_httpStatus :: Lens.Lens' GetResourcePolicyResponse Prelude.Int getResourcePolicyResponse_httpStatus = Lens.lens (\GetResourcePolicyResponse' {httpStatus} -> httpStatus) (\s@GetResourcePolicyResponse' {} a -> s {httpStatus = a} :: GetResourcePolicyResponse) instance Prelude.NFData GetResourcePolicyResponse where rnf GetResourcePolicyResponse' {..} = Prelude.rnf policy `Prelude.seq` Prelude.rnf httpStatus