{-# 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.GamesParks.CreateSnapshot -- 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 snapshot of the game configuration. module Amazonka.GamesParks.CreateSnapshot ( -- * Creating a Request CreateSnapshot (..), newCreateSnapshot, -- * Request Lenses createSnapshot_description, createSnapshot_gameName, -- * Destructuring the Response CreateSnapshotResponse (..), newCreateSnapshotResponse, -- * Response Lenses createSnapshotResponse_snapshot, createSnapshotResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.GamesParks.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newCreateSnapshot' smart constructor. data CreateSnapshot = CreateSnapshot' { -- | The description of the snapshot. description :: Prelude.Maybe Prelude.Text, -- | The name of the game. gameName :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateSnapshot' 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: -- -- 'description', 'createSnapshot_description' - The description of the snapshot. -- -- 'gameName', 'createSnapshot_gameName' - The name of the game. newCreateSnapshot :: -- | 'gameName' Prelude.Text -> CreateSnapshot newCreateSnapshot pGameName_ = CreateSnapshot' { description = Prelude.Nothing, gameName = pGameName_ } -- | The description of the snapshot. createSnapshot_description :: Lens.Lens' CreateSnapshot (Prelude.Maybe Prelude.Text) createSnapshot_description = Lens.lens (\CreateSnapshot' {description} -> description) (\s@CreateSnapshot' {} a -> s {description = a} :: CreateSnapshot) -- | The name of the game. createSnapshot_gameName :: Lens.Lens' CreateSnapshot Prelude.Text createSnapshot_gameName = Lens.lens (\CreateSnapshot' {gameName} -> gameName) (\s@CreateSnapshot' {} a -> s {gameName = a} :: CreateSnapshot) instance Core.AWSRequest CreateSnapshot where type AWSResponse CreateSnapshot = CreateSnapshotResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> CreateSnapshotResponse' Prelude.<$> (x Data..?> "Snapshot") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CreateSnapshot where hashWithSalt _salt CreateSnapshot' {..} = _salt `Prelude.hashWithSalt` description `Prelude.hashWithSalt` gameName instance Prelude.NFData CreateSnapshot where rnf CreateSnapshot' {..} = Prelude.rnf description `Prelude.seq` Prelude.rnf gameName instance Data.ToHeaders CreateSnapshot where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON CreateSnapshot where toJSON CreateSnapshot' {..} = Data.object ( Prelude.catMaybes [("Description" Data..=) Prelude.<$> description] ) instance Data.ToPath CreateSnapshot where toPath CreateSnapshot' {..} = Prelude.mconcat ["/game/", Data.toBS gameName, "/snapshot"] instance Data.ToQuery CreateSnapshot where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newCreateSnapshotResponse' smart constructor. data CreateSnapshotResponse = CreateSnapshotResponse' { -- | Properties that provide details of the created snapshot. snapshot :: Prelude.Maybe SnapshotDetails, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateSnapshotResponse' 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', 'createSnapshotResponse_snapshot' - Properties that provide details of the created snapshot. -- -- 'httpStatus', 'createSnapshotResponse_httpStatus' - The response's http status code. newCreateSnapshotResponse :: -- | 'httpStatus' Prelude.Int -> CreateSnapshotResponse newCreateSnapshotResponse pHttpStatus_ = CreateSnapshotResponse' { snapshot = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | Properties that provide details of the created snapshot. createSnapshotResponse_snapshot :: Lens.Lens' CreateSnapshotResponse (Prelude.Maybe SnapshotDetails) createSnapshotResponse_snapshot = Lens.lens (\CreateSnapshotResponse' {snapshot} -> snapshot) (\s@CreateSnapshotResponse' {} a -> s {snapshot = a} :: CreateSnapshotResponse) -- | The response's http status code. createSnapshotResponse_httpStatus :: Lens.Lens' CreateSnapshotResponse Prelude.Int createSnapshotResponse_httpStatus = Lens.lens (\CreateSnapshotResponse' {httpStatus} -> httpStatus) (\s@CreateSnapshotResponse' {} a -> s {httpStatus = a} :: CreateSnapshotResponse) instance Prelude.NFData CreateSnapshotResponse where rnf CreateSnapshotResponse' {..} = Prelude.rnf snapshot `Prelude.seq` Prelude.rnf httpStatus