{-# 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.DLM.GetLifecyclePolicy -- 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 detailed information about the specified lifecycle policy. module Amazonka.DLM.GetLifecyclePolicy ( -- * Creating a Request GetLifecyclePolicy (..), newGetLifecyclePolicy, -- * Request Lenses getLifecyclePolicy_policyId, -- * Destructuring the Response GetLifecyclePolicyResponse (..), newGetLifecyclePolicyResponse, -- * Response Lenses getLifecyclePolicyResponse_policy, getLifecyclePolicyResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import Amazonka.DLM.Types import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newGetLifecyclePolicy' smart constructor. data GetLifecyclePolicy = GetLifecyclePolicy' { -- | The identifier of the lifecycle policy. policyId :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetLifecyclePolicy' 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: -- -- 'policyId', 'getLifecyclePolicy_policyId' - The identifier of the lifecycle policy. newGetLifecyclePolicy :: -- | 'policyId' Prelude.Text -> GetLifecyclePolicy newGetLifecyclePolicy pPolicyId_ = GetLifecyclePolicy' {policyId = pPolicyId_} -- | The identifier of the lifecycle policy. getLifecyclePolicy_policyId :: Lens.Lens' GetLifecyclePolicy Prelude.Text getLifecyclePolicy_policyId = Lens.lens (\GetLifecyclePolicy' {policyId} -> policyId) (\s@GetLifecyclePolicy' {} a -> s {policyId = a} :: GetLifecyclePolicy) instance Core.AWSRequest GetLifecyclePolicy where type AWSResponse GetLifecyclePolicy = GetLifecyclePolicyResponse request overrides = Request.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetLifecyclePolicyResponse' Prelude.<$> (x Data..?> "Policy") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable GetLifecyclePolicy where hashWithSalt _salt GetLifecyclePolicy' {..} = _salt `Prelude.hashWithSalt` policyId instance Prelude.NFData GetLifecyclePolicy where rnf GetLifecyclePolicy' {..} = Prelude.rnf policyId instance Data.ToHeaders GetLifecyclePolicy where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath GetLifecyclePolicy where toPath GetLifecyclePolicy' {..} = Prelude.mconcat ["/policies/", Data.toBS policyId, "/"] instance Data.ToQuery GetLifecyclePolicy where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newGetLifecyclePolicyResponse' smart constructor. data GetLifecyclePolicyResponse = GetLifecyclePolicyResponse' { -- | Detailed information about the lifecycle policy. policy :: Prelude.Maybe LifecyclePolicy, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetLifecyclePolicyResponse' 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', 'getLifecyclePolicyResponse_policy' - Detailed information about the lifecycle policy. -- -- 'httpStatus', 'getLifecyclePolicyResponse_httpStatus' - The response's http status code. newGetLifecyclePolicyResponse :: -- | 'httpStatus' Prelude.Int -> GetLifecyclePolicyResponse newGetLifecyclePolicyResponse pHttpStatus_ = GetLifecyclePolicyResponse' { policy = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | Detailed information about the lifecycle policy. getLifecyclePolicyResponse_policy :: Lens.Lens' GetLifecyclePolicyResponse (Prelude.Maybe LifecyclePolicy) getLifecyclePolicyResponse_policy = Lens.lens (\GetLifecyclePolicyResponse' {policy} -> policy) (\s@GetLifecyclePolicyResponse' {} a -> s {policy = a} :: GetLifecyclePolicyResponse) -- | The response's http status code. getLifecyclePolicyResponse_httpStatus :: Lens.Lens' GetLifecyclePolicyResponse Prelude.Int getLifecyclePolicyResponse_httpStatus = Lens.lens (\GetLifecyclePolicyResponse' {httpStatus} -> httpStatus) (\s@GetLifecyclePolicyResponse' {} a -> s {httpStatus = a} :: GetLifecyclePolicyResponse) instance Prelude.NFData GetLifecyclePolicyResponse where rnf GetLifecyclePolicyResponse' {..} = Prelude.rnf policy `Prelude.seq` Prelude.rnf httpStatus