{-# 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.Redshift.CreateClusterSnapshot -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates a manual snapshot of the specified cluster. The cluster must be -- in the @available@ state. -- -- For more information about working with snapshots, go to -- -- in the /Amazon Redshift Cluster Management Guide/. module Amazonka.Redshift.CreateClusterSnapshot ( -- * Creating a Request CreateClusterSnapshot (..), newCreateClusterSnapshot, -- * Request Lenses createClusterSnapshot_manualSnapshotRetentionPeriod, createClusterSnapshot_tags, createClusterSnapshot_snapshotIdentifier, createClusterSnapshot_clusterIdentifier, -- * Destructuring the Response CreateClusterSnapshotResponse (..), newCreateClusterSnapshotResponse, -- * Response Lenses createClusterSnapshotResponse_snapshot, createClusterSnapshotResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import Amazonka.Redshift.Types import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | -- -- /See:/ 'newCreateClusterSnapshot' smart constructor. data CreateClusterSnapshot = CreateClusterSnapshot' { -- | The number of days that a manual snapshot is retained. If the value is -- -1, the manual snapshot is retained indefinitely. -- -- The value must be either -1 or an integer between 1 and 3,653. -- -- The default value is -1. manualSnapshotRetentionPeriod :: Prelude.Maybe Prelude.Int, -- | A list of tag instances. tags :: Prelude.Maybe [Tag], -- | A unique identifier for the snapshot that you are requesting. This -- identifier must be unique for all snapshots within the Amazon Web -- Services account. -- -- Constraints: -- -- - Cannot be null, empty, or blank -- -- - Must contain from 1 to 255 alphanumeric characters or hyphens -- -- - First character must be a letter -- -- - Cannot end with a hyphen or contain two consecutive hyphens -- -- Example: @my-snapshot-id@ snapshotIdentifier :: Prelude.Text, -- | The cluster identifier for which you want a snapshot. clusterIdentifier :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateClusterSnapshot' 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: -- -- 'manualSnapshotRetentionPeriod', 'createClusterSnapshot_manualSnapshotRetentionPeriod' - The number of days that a manual snapshot is retained. If the value is -- -1, the manual snapshot is retained indefinitely. -- -- The value must be either -1 or an integer between 1 and 3,653. -- -- The default value is -1. -- -- 'tags', 'createClusterSnapshot_tags' - A list of tag instances. -- -- 'snapshotIdentifier', 'createClusterSnapshot_snapshotIdentifier' - A unique identifier for the snapshot that you are requesting. This -- identifier must be unique for all snapshots within the Amazon Web -- Services account. -- -- Constraints: -- -- - Cannot be null, empty, or blank -- -- - Must contain from 1 to 255 alphanumeric characters or hyphens -- -- - First character must be a letter -- -- - Cannot end with a hyphen or contain two consecutive hyphens -- -- Example: @my-snapshot-id@ -- -- 'clusterIdentifier', 'createClusterSnapshot_clusterIdentifier' - The cluster identifier for which you want a snapshot. newCreateClusterSnapshot :: -- | 'snapshotIdentifier' Prelude.Text -> -- | 'clusterIdentifier' Prelude.Text -> CreateClusterSnapshot newCreateClusterSnapshot pSnapshotIdentifier_ pClusterIdentifier_ = CreateClusterSnapshot' { manualSnapshotRetentionPeriod = Prelude.Nothing, tags = Prelude.Nothing, snapshotIdentifier = pSnapshotIdentifier_, clusterIdentifier = pClusterIdentifier_ } -- | The number of days that a manual snapshot is retained. If the value is -- -1, the manual snapshot is retained indefinitely. -- -- The value must be either -1 or an integer between 1 and 3,653. -- -- The default value is -1. createClusterSnapshot_manualSnapshotRetentionPeriod :: Lens.Lens' CreateClusterSnapshot (Prelude.Maybe Prelude.Int) createClusterSnapshot_manualSnapshotRetentionPeriod = Lens.lens (\CreateClusterSnapshot' {manualSnapshotRetentionPeriod} -> manualSnapshotRetentionPeriod) (\s@CreateClusterSnapshot' {} a -> s {manualSnapshotRetentionPeriod = a} :: CreateClusterSnapshot) -- | A list of tag instances. createClusterSnapshot_tags :: Lens.Lens' CreateClusterSnapshot (Prelude.Maybe [Tag]) createClusterSnapshot_tags = Lens.lens (\CreateClusterSnapshot' {tags} -> tags) (\s@CreateClusterSnapshot' {} a -> s {tags = a} :: CreateClusterSnapshot) Prelude.. Lens.mapping Lens.coerced -- | A unique identifier for the snapshot that you are requesting. This -- identifier must be unique for all snapshots within the Amazon Web -- Services account. -- -- Constraints: -- -- - Cannot be null, empty, or blank -- -- - Must contain from 1 to 255 alphanumeric characters or hyphens -- -- - First character must be a letter -- -- - Cannot end with a hyphen or contain two consecutive hyphens -- -- Example: @my-snapshot-id@ createClusterSnapshot_snapshotIdentifier :: Lens.Lens' CreateClusterSnapshot Prelude.Text createClusterSnapshot_snapshotIdentifier = Lens.lens (\CreateClusterSnapshot' {snapshotIdentifier} -> snapshotIdentifier) (\s@CreateClusterSnapshot' {} a -> s {snapshotIdentifier = a} :: CreateClusterSnapshot) -- | The cluster identifier for which you want a snapshot. createClusterSnapshot_clusterIdentifier :: Lens.Lens' CreateClusterSnapshot Prelude.Text createClusterSnapshot_clusterIdentifier = Lens.lens (\CreateClusterSnapshot' {clusterIdentifier} -> clusterIdentifier) (\s@CreateClusterSnapshot' {} a -> s {clusterIdentifier = a} :: CreateClusterSnapshot) instance Core.AWSRequest CreateClusterSnapshot where type AWSResponse CreateClusterSnapshot = CreateClusterSnapshotResponse request overrides = Request.postQuery (overrides defaultService) response = Response.receiveXMLWrapper "CreateClusterSnapshotResult" ( \s h x -> CreateClusterSnapshotResponse' Prelude.<$> (x Data..@? "Snapshot") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CreateClusterSnapshot where hashWithSalt _salt CreateClusterSnapshot' {..} = _salt `Prelude.hashWithSalt` manualSnapshotRetentionPeriod `Prelude.hashWithSalt` tags `Prelude.hashWithSalt` snapshotIdentifier `Prelude.hashWithSalt` clusterIdentifier instance Prelude.NFData CreateClusterSnapshot where rnf CreateClusterSnapshot' {..} = Prelude.rnf manualSnapshotRetentionPeriod `Prelude.seq` Prelude.rnf tags `Prelude.seq` Prelude.rnf snapshotIdentifier `Prelude.seq` Prelude.rnf clusterIdentifier instance Data.ToHeaders CreateClusterSnapshot where toHeaders = Prelude.const Prelude.mempty instance Data.ToPath CreateClusterSnapshot where toPath = Prelude.const "/" instance Data.ToQuery CreateClusterSnapshot where toQuery CreateClusterSnapshot' {..} = Prelude.mconcat [ "Action" Data.=: ("CreateClusterSnapshot" :: Prelude.ByteString), "Version" Data.=: ("2012-12-01" :: Prelude.ByteString), "ManualSnapshotRetentionPeriod" Data.=: manualSnapshotRetentionPeriod, "Tags" Data.=: Data.toQuery (Data.toQueryList "Tag" Prelude.<$> tags), "SnapshotIdentifier" Data.=: snapshotIdentifier, "ClusterIdentifier" Data.=: clusterIdentifier ] -- | /See:/ 'newCreateClusterSnapshotResponse' smart constructor. data CreateClusterSnapshotResponse = CreateClusterSnapshotResponse' { snapshot :: Prelude.Maybe Snapshot, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateClusterSnapshotResponse' 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: -- -- 'snapshot', 'createClusterSnapshotResponse_snapshot' - Undocumented member. -- -- 'httpStatus', 'createClusterSnapshotResponse_httpStatus' - The response's http status code. newCreateClusterSnapshotResponse :: -- | 'httpStatus' Prelude.Int -> CreateClusterSnapshotResponse newCreateClusterSnapshotResponse pHttpStatus_ = CreateClusterSnapshotResponse' { snapshot = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | Undocumented member. createClusterSnapshotResponse_snapshot :: Lens.Lens' CreateClusterSnapshotResponse (Prelude.Maybe Snapshot) createClusterSnapshotResponse_snapshot = Lens.lens (\CreateClusterSnapshotResponse' {snapshot} -> snapshot) (\s@CreateClusterSnapshotResponse' {} a -> s {snapshot = a} :: CreateClusterSnapshotResponse) -- | The response's http status code. createClusterSnapshotResponse_httpStatus :: Lens.Lens' CreateClusterSnapshotResponse Prelude.Int createClusterSnapshotResponse_httpStatus = Lens.lens (\CreateClusterSnapshotResponse' {httpStatus} -> httpStatus) (\s@CreateClusterSnapshotResponse' {} a -> s {httpStatus = a} :: CreateClusterSnapshotResponse) instance Prelude.NFData CreateClusterSnapshotResponse where rnf CreateClusterSnapshotResponse' {..} = Prelude.rnf snapshot `Prelude.seq` Prelude.rnf httpStatus