{-# 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.Snowball.CreateAddress -- 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 an address for a Snow device to be shipped to. In most regions, -- addresses are validated at the time of creation. The address you provide -- must be located within the serviceable area of your region. If the -- address is invalid or unsupported, then an exception is thrown. module Amazonka.Snowball.CreateAddress ( -- * Creating a Request CreateAddress (..), newCreateAddress, -- * Request Lenses createAddress_address, -- * Destructuring the Response CreateAddressResponse (..), newCreateAddressResponse, -- * Response Lenses createAddressResponse_addressId, createAddressResponse_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 qualified Amazonka.Request as Request import qualified Amazonka.Response as Response import Amazonka.Snowball.Types -- | /See:/ 'newCreateAddress' smart constructor. data CreateAddress = CreateAddress' { -- | The address that you want the Snow device shipped to. address :: Address } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateAddress' 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: -- -- 'address', 'createAddress_address' - The address that you want the Snow device shipped to. newCreateAddress :: -- | 'address' Address -> CreateAddress newCreateAddress pAddress_ = CreateAddress' {address = pAddress_} -- | The address that you want the Snow device shipped to. createAddress_address :: Lens.Lens' CreateAddress Address createAddress_address = Lens.lens (\CreateAddress' {address} -> address) (\s@CreateAddress' {} a -> s {address = a} :: CreateAddress) instance Core.AWSRequest CreateAddress where type AWSResponse CreateAddress = CreateAddressResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> CreateAddressResponse' Prelude.<$> (x Data..?> "AddressId") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CreateAddress where hashWithSalt _salt CreateAddress' {..} = _salt `Prelude.hashWithSalt` address instance Prelude.NFData CreateAddress where rnf CreateAddress' {..} = Prelude.rnf address instance Data.ToHeaders CreateAddress where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AWSIESnowballJobManagementService.CreateAddress" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON CreateAddress where toJSON CreateAddress' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("Address" Data..= address)] ) instance Data.ToPath CreateAddress where toPath = Prelude.const "/" instance Data.ToQuery CreateAddress where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newCreateAddressResponse' smart constructor. data CreateAddressResponse = CreateAddressResponse' { -- | The automatically generated ID for a specific address. You\'ll use this -- ID when you create a job to specify which address you want the Snow -- device for that job shipped to. addressId :: 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 'CreateAddressResponse' 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: -- -- 'addressId', 'createAddressResponse_addressId' - The automatically generated ID for a specific address. You\'ll use this -- ID when you create a job to specify which address you want the Snow -- device for that job shipped to. -- -- 'httpStatus', 'createAddressResponse_httpStatus' - The response's http status code. newCreateAddressResponse :: -- | 'httpStatus' Prelude.Int -> CreateAddressResponse newCreateAddressResponse pHttpStatus_ = CreateAddressResponse' { addressId = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The automatically generated ID for a specific address. You\'ll use this -- ID when you create a job to specify which address you want the Snow -- device for that job shipped to. createAddressResponse_addressId :: Lens.Lens' CreateAddressResponse (Prelude.Maybe Prelude.Text) createAddressResponse_addressId = Lens.lens (\CreateAddressResponse' {addressId} -> addressId) (\s@CreateAddressResponse' {} a -> s {addressId = a} :: CreateAddressResponse) -- | The response's http status code. createAddressResponse_httpStatus :: Lens.Lens' CreateAddressResponse Prelude.Int createAddressResponse_httpStatus = Lens.lens (\CreateAddressResponse' {httpStatus} -> httpStatus) (\s@CreateAddressResponse' {} a -> s {httpStatus = a} :: CreateAddressResponse) instance Prelude.NFData CreateAddressResponse where rnf CreateAddressResponse' {..} = Prelude.rnf addressId `Prelude.seq` Prelude.rnf httpStatus