{-# 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.DataSync.CreateLocationObjectStorage
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an endpoint for a self-managed object storage bucket. For more
-- information about self-managed object storage locations, see
-- <https://docs.aws.amazon.com/datasync/latest/userguide/create-object-location.html Creating a location for object storage>.
module Amazonka.DataSync.CreateLocationObjectStorage
  ( -- * Creating a Request
    CreateLocationObjectStorage (..),
    newCreateLocationObjectStorage,

    -- * Request Lenses
    createLocationObjectStorage_serverPort,
    createLocationObjectStorage_serverProtocol,
    createLocationObjectStorage_secretKey,
    createLocationObjectStorage_subdirectory,
    createLocationObjectStorage_accessKey,
    createLocationObjectStorage_tags,
    createLocationObjectStorage_serverHostname,
    createLocationObjectStorage_bucketName,
    createLocationObjectStorage_agentArns,

    -- * Destructuring the Response
    CreateLocationObjectStorageResponse (..),
    newCreateLocationObjectStorageResponse,

    -- * Response Lenses
    createLocationObjectStorageResponse_locationArn,
    createLocationObjectStorageResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataSync.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | CreateLocationObjectStorageRequest
--
-- /See:/ 'newCreateLocationObjectStorage' smart constructor.
data CreateLocationObjectStorage = CreateLocationObjectStorage'
  { -- | The port that your self-managed object storage server accepts inbound
    -- network traffic on. The server port is set by default to TCP 80 (HTTP)
    -- or TCP 443 (HTTPS). You can specify a custom port if your self-managed
    -- object storage server requires one.
    CreateLocationObjectStorage -> Maybe Natural
serverPort :: Prelude.Maybe Prelude.Natural,
    -- | The protocol that the object storage server uses to communicate. Valid
    -- values are HTTP or HTTPS.
    CreateLocationObjectStorage -> Maybe ObjectStorageServerProtocol
serverProtocol :: Prelude.Maybe ObjectStorageServerProtocol,
    -- | Optional. The secret key is used if credentials are required to access
    -- the self-managed object storage server. If your object storage requires
    -- a user name and password to authenticate, use @AccessKey@ and
    -- @SecretKey@ to provide the user name and password, respectively.
    CreateLocationObjectStorage -> Maybe (Sensitive Text)
secretKey :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The subdirectory in the self-managed object storage server that is used
    -- to read data from.
    CreateLocationObjectStorage -> Maybe Text
subdirectory :: Prelude.Maybe Prelude.Text,
    -- | Optional. The access key is used if credentials are required to access
    -- the self-managed object storage server. If your object storage requires
    -- a user name and password to authenticate, use @AccessKey@ and
    -- @SecretKey@ to provide the user name and password, respectively.
    CreateLocationObjectStorage -> Maybe Text
accessKey :: Prelude.Maybe Prelude.Text,
    -- | The key-value pair that represents the tag that you want to add to the
    -- location. The value can be an empty string. We recommend using tags to
    -- name your resources.
    CreateLocationObjectStorage -> Maybe [TagListEntry]
tags :: Prelude.Maybe [TagListEntry],
    -- | The name of the self-managed object storage server. This value is the IP
    -- address or Domain Name Service (DNS) name of the object storage server.
    -- An agent uses this host name to mount the object storage server in a
    -- network.
    CreateLocationObjectStorage -> Text
serverHostname :: Prelude.Text,
    -- | The bucket on the self-managed object storage server that is used to
    -- read data from.
    CreateLocationObjectStorage -> Text
bucketName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the agents associated with the
    -- self-managed object storage server location.
    CreateLocationObjectStorage -> NonEmpty Text
agentArns :: Prelude.NonEmpty Prelude.Text
  }
  deriving (CreateLocationObjectStorage -> CreateLocationObjectStorage -> Bool
(CreateLocationObjectStorage
 -> CreateLocationObjectStorage -> Bool)
-> (CreateLocationObjectStorage
    -> CreateLocationObjectStorage -> Bool)
-> Eq CreateLocationObjectStorage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLocationObjectStorage -> CreateLocationObjectStorage -> Bool
$c/= :: CreateLocationObjectStorage -> CreateLocationObjectStorage -> Bool
== :: CreateLocationObjectStorage -> CreateLocationObjectStorage -> Bool
$c== :: CreateLocationObjectStorage -> CreateLocationObjectStorage -> Bool
Prelude.Eq, Int -> CreateLocationObjectStorage -> ShowS
[CreateLocationObjectStorage] -> ShowS
CreateLocationObjectStorage -> String
(Int -> CreateLocationObjectStorage -> ShowS)
-> (CreateLocationObjectStorage -> String)
-> ([CreateLocationObjectStorage] -> ShowS)
-> Show CreateLocationObjectStorage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLocationObjectStorage] -> ShowS
$cshowList :: [CreateLocationObjectStorage] -> ShowS
show :: CreateLocationObjectStorage -> String
$cshow :: CreateLocationObjectStorage -> String
showsPrec :: Int -> CreateLocationObjectStorage -> ShowS
$cshowsPrec :: Int -> CreateLocationObjectStorage -> ShowS
Prelude.Show, (forall x.
 CreateLocationObjectStorage -> Rep CreateLocationObjectStorage x)
-> (forall x.
    Rep CreateLocationObjectStorage x -> CreateLocationObjectStorage)
-> Generic CreateLocationObjectStorage
forall x.
Rep CreateLocationObjectStorage x -> CreateLocationObjectStorage
forall x.
CreateLocationObjectStorage -> Rep CreateLocationObjectStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLocationObjectStorage x -> CreateLocationObjectStorage
$cfrom :: forall x.
CreateLocationObjectStorage -> Rep CreateLocationObjectStorage x
Prelude.Generic)

-- |
-- Create a value of 'CreateLocationObjectStorage' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'serverPort', 'createLocationObjectStorage_serverPort' - The port that your self-managed object storage server accepts inbound
-- network traffic on. The server port is set by default to TCP 80 (HTTP)
-- or TCP 443 (HTTPS). You can specify a custom port if your self-managed
-- object storage server requires one.
--
-- 'serverProtocol', 'createLocationObjectStorage_serverProtocol' - The protocol that the object storage server uses to communicate. Valid
-- values are HTTP or HTTPS.
--
-- 'secretKey', 'createLocationObjectStorage_secretKey' - Optional. The secret key is used if credentials are required to access
-- the self-managed object storage server. If your object storage requires
-- a user name and password to authenticate, use @AccessKey@ and
-- @SecretKey@ to provide the user name and password, respectively.
--
-- 'subdirectory', 'createLocationObjectStorage_subdirectory' - The subdirectory in the self-managed object storage server that is used
-- to read data from.
--
-- 'accessKey', 'createLocationObjectStorage_accessKey' - Optional. The access key is used if credentials are required to access
-- the self-managed object storage server. If your object storage requires
-- a user name and password to authenticate, use @AccessKey@ and
-- @SecretKey@ to provide the user name and password, respectively.
--
-- 'tags', 'createLocationObjectStorage_tags' - The key-value pair that represents the tag that you want to add to the
-- location. The value can be an empty string. We recommend using tags to
-- name your resources.
--
-- 'serverHostname', 'createLocationObjectStorage_serverHostname' - The name of the self-managed object storage server. This value is the IP
-- address or Domain Name Service (DNS) name of the object storage server.
-- An agent uses this host name to mount the object storage server in a
-- network.
--
-- 'bucketName', 'createLocationObjectStorage_bucketName' - The bucket on the self-managed object storage server that is used to
-- read data from.
--
-- 'agentArns', 'createLocationObjectStorage_agentArns' - The Amazon Resource Name (ARN) of the agents associated with the
-- self-managed object storage server location.
newCreateLocationObjectStorage ::
  -- | 'serverHostname'
  Prelude.Text ->
  -- | 'bucketName'
  Prelude.Text ->
  -- | 'agentArns'
  Prelude.NonEmpty Prelude.Text ->
  CreateLocationObjectStorage
newCreateLocationObjectStorage :: Text -> Text -> NonEmpty Text -> CreateLocationObjectStorage
newCreateLocationObjectStorage
  Text
pServerHostname_
  Text
pBucketName_
  NonEmpty Text
pAgentArns_ =
    CreateLocationObjectStorage' :: Maybe Natural
-> Maybe ObjectStorageServerProtocol
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Text
-> Maybe [TagListEntry]
-> Text
-> Text
-> NonEmpty Text
-> CreateLocationObjectStorage
CreateLocationObjectStorage'
      { $sel:serverPort:CreateLocationObjectStorage' :: Maybe Natural
serverPort =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:serverProtocol:CreateLocationObjectStorage' :: Maybe ObjectStorageServerProtocol
serverProtocol = Maybe ObjectStorageServerProtocol
forall a. Maybe a
Prelude.Nothing,
        $sel:secretKey:CreateLocationObjectStorage' :: Maybe (Sensitive Text)
secretKey = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:subdirectory:CreateLocationObjectStorage' :: Maybe Text
subdirectory = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:accessKey:CreateLocationObjectStorage' :: Maybe Text
accessKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateLocationObjectStorage' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
forall a. Maybe a
Prelude.Nothing,
        $sel:serverHostname:CreateLocationObjectStorage' :: Text
serverHostname = Text
pServerHostname_,
        $sel:bucketName:CreateLocationObjectStorage' :: Text
bucketName = Text
pBucketName_,
        $sel:agentArns:CreateLocationObjectStorage' :: NonEmpty Text
agentArns = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pAgentArns_
      }

-- | The port that your self-managed object storage server accepts inbound
-- network traffic on. The server port is set by default to TCP 80 (HTTP)
-- or TCP 443 (HTTPS). You can specify a custom port if your self-managed
-- object storage server requires one.
createLocationObjectStorage_serverPort :: Lens.Lens' CreateLocationObjectStorage (Prelude.Maybe Prelude.Natural)
createLocationObjectStorage_serverPort :: (Maybe Natural -> f (Maybe Natural))
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_serverPort = (CreateLocationObjectStorage -> Maybe Natural)
-> (CreateLocationObjectStorage
    -> Maybe Natural -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage
     CreateLocationObjectStorage
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Maybe Natural
serverPort :: Maybe Natural
$sel:serverPort:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe Natural
serverPort} -> Maybe Natural
serverPort) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Maybe Natural
a -> CreateLocationObjectStorage
s {$sel:serverPort:CreateLocationObjectStorage' :: Maybe Natural
serverPort = Maybe Natural
a} :: CreateLocationObjectStorage)

-- | The protocol that the object storage server uses to communicate. Valid
-- values are HTTP or HTTPS.
createLocationObjectStorage_serverProtocol :: Lens.Lens' CreateLocationObjectStorage (Prelude.Maybe ObjectStorageServerProtocol)
createLocationObjectStorage_serverProtocol :: (Maybe ObjectStorageServerProtocol
 -> f (Maybe ObjectStorageServerProtocol))
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_serverProtocol = (CreateLocationObjectStorage -> Maybe ObjectStorageServerProtocol)
-> (CreateLocationObjectStorage
    -> Maybe ObjectStorageServerProtocol
    -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage
     CreateLocationObjectStorage
     (Maybe ObjectStorageServerProtocol)
     (Maybe ObjectStorageServerProtocol)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Maybe ObjectStorageServerProtocol
serverProtocol :: Maybe ObjectStorageServerProtocol
$sel:serverProtocol:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe ObjectStorageServerProtocol
serverProtocol} -> Maybe ObjectStorageServerProtocol
serverProtocol) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Maybe ObjectStorageServerProtocol
a -> CreateLocationObjectStorage
s {$sel:serverProtocol:CreateLocationObjectStorage' :: Maybe ObjectStorageServerProtocol
serverProtocol = Maybe ObjectStorageServerProtocol
a} :: CreateLocationObjectStorage)

-- | Optional. The secret key is used if credentials are required to access
-- the self-managed object storage server. If your object storage requires
-- a user name and password to authenticate, use @AccessKey@ and
-- @SecretKey@ to provide the user name and password, respectively.
createLocationObjectStorage_secretKey :: Lens.Lens' CreateLocationObjectStorage (Prelude.Maybe Prelude.Text)
createLocationObjectStorage_secretKey :: (Maybe Text -> f (Maybe Text))
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_secretKey = (CreateLocationObjectStorage -> Maybe (Sensitive Text))
-> (CreateLocationObjectStorage
    -> Maybe (Sensitive Text) -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage
     CreateLocationObjectStorage
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Maybe (Sensitive Text)
secretKey :: Maybe (Sensitive Text)
$sel:secretKey:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe (Sensitive Text)
secretKey} -> Maybe (Sensitive Text)
secretKey) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Maybe (Sensitive Text)
a -> CreateLocationObjectStorage
s {$sel:secretKey:CreateLocationObjectStorage' :: Maybe (Sensitive Text)
secretKey = Maybe (Sensitive Text)
a} :: CreateLocationObjectStorage) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateLocationObjectStorage -> f CreateLocationObjectStorage)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateLocationObjectStorage
-> f CreateLocationObjectStorage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The subdirectory in the self-managed object storage server that is used
-- to read data from.
createLocationObjectStorage_subdirectory :: Lens.Lens' CreateLocationObjectStorage (Prelude.Maybe Prelude.Text)
createLocationObjectStorage_subdirectory :: (Maybe Text -> f (Maybe Text))
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_subdirectory = (CreateLocationObjectStorage -> Maybe Text)
-> (CreateLocationObjectStorage
    -> Maybe Text -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage
     CreateLocationObjectStorage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Maybe Text
subdirectory :: Maybe Text
$sel:subdirectory:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe Text
subdirectory} -> Maybe Text
subdirectory) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Maybe Text
a -> CreateLocationObjectStorage
s {$sel:subdirectory:CreateLocationObjectStorage' :: Maybe Text
subdirectory = Maybe Text
a} :: CreateLocationObjectStorage)

-- | Optional. The access key is used if credentials are required to access
-- the self-managed object storage server. If your object storage requires
-- a user name and password to authenticate, use @AccessKey@ and
-- @SecretKey@ to provide the user name and password, respectively.
createLocationObjectStorage_accessKey :: Lens.Lens' CreateLocationObjectStorage (Prelude.Maybe Prelude.Text)
createLocationObjectStorage_accessKey :: (Maybe Text -> f (Maybe Text))
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_accessKey = (CreateLocationObjectStorage -> Maybe Text)
-> (CreateLocationObjectStorage
    -> Maybe Text -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage
     CreateLocationObjectStorage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Maybe Text
accessKey :: Maybe Text
$sel:accessKey:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe Text
accessKey} -> Maybe Text
accessKey) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Maybe Text
a -> CreateLocationObjectStorage
s {$sel:accessKey:CreateLocationObjectStorage' :: Maybe Text
accessKey = Maybe Text
a} :: CreateLocationObjectStorage)

-- | The key-value pair that represents the tag that you want to add to the
-- location. The value can be an empty string. We recommend using tags to
-- name your resources.
createLocationObjectStorage_tags :: Lens.Lens' CreateLocationObjectStorage (Prelude.Maybe [TagListEntry])
createLocationObjectStorage_tags :: (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_tags = (CreateLocationObjectStorage -> Maybe [TagListEntry])
-> (CreateLocationObjectStorage
    -> Maybe [TagListEntry] -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage
     CreateLocationObjectStorage
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Maybe [TagListEntry]
tags :: Maybe [TagListEntry]
$sel:tags:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe [TagListEntry]
tags} -> Maybe [TagListEntry]
tags) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Maybe [TagListEntry]
a -> CreateLocationObjectStorage
s {$sel:tags:CreateLocationObjectStorage' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
a} :: CreateLocationObjectStorage) ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
 -> CreateLocationObjectStorage -> f CreateLocationObjectStorage)
-> ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
    -> Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateLocationObjectStorage
-> f CreateLocationObjectStorage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TagListEntry] [TagListEntry] [TagListEntry] [TagListEntry]
-> Iso
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [TagListEntry] [TagListEntry] [TagListEntry] [TagListEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the self-managed object storage server. This value is the IP
-- address or Domain Name Service (DNS) name of the object storage server.
-- An agent uses this host name to mount the object storage server in a
-- network.
createLocationObjectStorage_serverHostname :: Lens.Lens' CreateLocationObjectStorage Prelude.Text
createLocationObjectStorage_serverHostname :: (Text -> f Text)
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_serverHostname = (CreateLocationObjectStorage -> Text)
-> (CreateLocationObjectStorage
    -> Text -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage CreateLocationObjectStorage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Text
serverHostname :: Text
$sel:serverHostname:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Text
serverHostname} -> Text
serverHostname) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Text
a -> CreateLocationObjectStorage
s {$sel:serverHostname:CreateLocationObjectStorage' :: Text
serverHostname = Text
a} :: CreateLocationObjectStorage)

-- | The bucket on the self-managed object storage server that is used to
-- read data from.
createLocationObjectStorage_bucketName :: Lens.Lens' CreateLocationObjectStorage Prelude.Text
createLocationObjectStorage_bucketName :: (Text -> f Text)
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_bucketName = (CreateLocationObjectStorage -> Text)
-> (CreateLocationObjectStorage
    -> Text -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage CreateLocationObjectStorage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {Text
bucketName :: Text
$sel:bucketName:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Text
bucketName} -> Text
bucketName) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} Text
a -> CreateLocationObjectStorage
s {$sel:bucketName:CreateLocationObjectStorage' :: Text
bucketName = Text
a} :: CreateLocationObjectStorage)

-- | The Amazon Resource Name (ARN) of the agents associated with the
-- self-managed object storage server location.
createLocationObjectStorage_agentArns :: Lens.Lens' CreateLocationObjectStorage (Prelude.NonEmpty Prelude.Text)
createLocationObjectStorage_agentArns :: (NonEmpty Text -> f (NonEmpty Text))
-> CreateLocationObjectStorage -> f CreateLocationObjectStorage
createLocationObjectStorage_agentArns = (CreateLocationObjectStorage -> NonEmpty Text)
-> (CreateLocationObjectStorage
    -> NonEmpty Text -> CreateLocationObjectStorage)
-> Lens
     CreateLocationObjectStorage
     CreateLocationObjectStorage
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorage' {NonEmpty Text
agentArns :: NonEmpty Text
$sel:agentArns:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> NonEmpty Text
agentArns} -> NonEmpty Text
agentArns) (\s :: CreateLocationObjectStorage
s@CreateLocationObjectStorage' {} NonEmpty Text
a -> CreateLocationObjectStorage
s {$sel:agentArns:CreateLocationObjectStorage' :: NonEmpty Text
agentArns = NonEmpty Text
a} :: CreateLocationObjectStorage) ((NonEmpty Text -> f (NonEmpty Text))
 -> CreateLocationObjectStorage -> f CreateLocationObjectStorage)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateLocationObjectStorage
-> f CreateLocationObjectStorage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateLocationObjectStorage where
  type
    AWSResponse CreateLocationObjectStorage =
      CreateLocationObjectStorageResponse
  request :: CreateLocationObjectStorage -> Request CreateLocationObjectStorage
request = Service
-> CreateLocationObjectStorage
-> Request CreateLocationObjectStorage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLocationObjectStorage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLocationObjectStorage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLocationObjectStorage))
-> Logger
-> Service
-> Proxy CreateLocationObjectStorage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLocationObjectStorage)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateLocationObjectStorageResponse
CreateLocationObjectStorageResponse'
            (Maybe Text -> Int -> CreateLocationObjectStorageResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLocationObjectStorageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LocationArn")
            Either String (Int -> CreateLocationObjectStorageResponse)
-> Either String Int
-> Either String CreateLocationObjectStorageResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateLocationObjectStorage

instance Prelude.NFData CreateLocationObjectStorage

instance Core.ToHeaders CreateLocationObjectStorage where
  toHeaders :: CreateLocationObjectStorage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateLocationObjectStorage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"FmrsService.CreateLocationObjectStorage" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateLocationObjectStorage where
  toJSON :: CreateLocationObjectStorage -> Value
toJSON CreateLocationObjectStorage' {Maybe Natural
Maybe [TagListEntry]
Maybe Text
Maybe (Sensitive Text)
Maybe ObjectStorageServerProtocol
NonEmpty Text
Text
agentArns :: NonEmpty Text
bucketName :: Text
serverHostname :: Text
tags :: Maybe [TagListEntry]
accessKey :: Maybe Text
subdirectory :: Maybe Text
secretKey :: Maybe (Sensitive Text)
serverProtocol :: Maybe ObjectStorageServerProtocol
serverPort :: Maybe Natural
$sel:agentArns:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> NonEmpty Text
$sel:bucketName:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Text
$sel:serverHostname:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Text
$sel:tags:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe [TagListEntry]
$sel:accessKey:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe Text
$sel:subdirectory:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe Text
$sel:secretKey:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe (Sensitive Text)
$sel:serverProtocol:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe ObjectStorageServerProtocol
$sel:serverPort:CreateLocationObjectStorage' :: CreateLocationObjectStorage -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ServerPort" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
serverPort,
            (Text
"ServerProtocol" Text -> ObjectStorageServerProtocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ObjectStorageServerProtocol -> Pair)
-> Maybe ObjectStorageServerProtocol -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ObjectStorageServerProtocol
serverProtocol,
            (Text
"SecretKey" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
secretKey,
            (Text
"Subdirectory" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subdirectory,
            (Text
"AccessKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accessKey,
            (Text
"Tags" Text -> [TagListEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TagListEntry] -> Pair) -> Maybe [TagListEntry] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagListEntry]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ServerHostname" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverHostname),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AgentArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
agentArns)
          ]
      )

instance Core.ToPath CreateLocationObjectStorage where
  toPath :: CreateLocationObjectStorage -> ByteString
toPath = ByteString -> CreateLocationObjectStorage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateLocationObjectStorage where
  toQuery :: CreateLocationObjectStorage -> QueryString
toQuery = QueryString -> CreateLocationObjectStorage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | CreateLocationObjectStorageResponse
--
-- /See:/ 'newCreateLocationObjectStorageResponse' smart constructor.
data CreateLocationObjectStorageResponse = CreateLocationObjectStorageResponse'
  { -- | The Amazon Resource Name (ARN) of the agents associated with the
    -- self-managed object storage server location.
    CreateLocationObjectStorageResponse -> Maybe Text
locationArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateLocationObjectStorageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateLocationObjectStorageResponse
-> CreateLocationObjectStorageResponse -> Bool
(CreateLocationObjectStorageResponse
 -> CreateLocationObjectStorageResponse -> Bool)
-> (CreateLocationObjectStorageResponse
    -> CreateLocationObjectStorageResponse -> Bool)
-> Eq CreateLocationObjectStorageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLocationObjectStorageResponse
-> CreateLocationObjectStorageResponse -> Bool
$c/= :: CreateLocationObjectStorageResponse
-> CreateLocationObjectStorageResponse -> Bool
== :: CreateLocationObjectStorageResponse
-> CreateLocationObjectStorageResponse -> Bool
$c== :: CreateLocationObjectStorageResponse
-> CreateLocationObjectStorageResponse -> Bool
Prelude.Eq, ReadPrec [CreateLocationObjectStorageResponse]
ReadPrec CreateLocationObjectStorageResponse
Int -> ReadS CreateLocationObjectStorageResponse
ReadS [CreateLocationObjectStorageResponse]
(Int -> ReadS CreateLocationObjectStorageResponse)
-> ReadS [CreateLocationObjectStorageResponse]
-> ReadPrec CreateLocationObjectStorageResponse
-> ReadPrec [CreateLocationObjectStorageResponse]
-> Read CreateLocationObjectStorageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLocationObjectStorageResponse]
$creadListPrec :: ReadPrec [CreateLocationObjectStorageResponse]
readPrec :: ReadPrec CreateLocationObjectStorageResponse
$creadPrec :: ReadPrec CreateLocationObjectStorageResponse
readList :: ReadS [CreateLocationObjectStorageResponse]
$creadList :: ReadS [CreateLocationObjectStorageResponse]
readsPrec :: Int -> ReadS CreateLocationObjectStorageResponse
$creadsPrec :: Int -> ReadS CreateLocationObjectStorageResponse
Prelude.Read, Int -> CreateLocationObjectStorageResponse -> ShowS
[CreateLocationObjectStorageResponse] -> ShowS
CreateLocationObjectStorageResponse -> String
(Int -> CreateLocationObjectStorageResponse -> ShowS)
-> (CreateLocationObjectStorageResponse -> String)
-> ([CreateLocationObjectStorageResponse] -> ShowS)
-> Show CreateLocationObjectStorageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLocationObjectStorageResponse] -> ShowS
$cshowList :: [CreateLocationObjectStorageResponse] -> ShowS
show :: CreateLocationObjectStorageResponse -> String
$cshow :: CreateLocationObjectStorageResponse -> String
showsPrec :: Int -> CreateLocationObjectStorageResponse -> ShowS
$cshowsPrec :: Int -> CreateLocationObjectStorageResponse -> ShowS
Prelude.Show, (forall x.
 CreateLocationObjectStorageResponse
 -> Rep CreateLocationObjectStorageResponse x)
-> (forall x.
    Rep CreateLocationObjectStorageResponse x
    -> CreateLocationObjectStorageResponse)
-> Generic CreateLocationObjectStorageResponse
forall x.
Rep CreateLocationObjectStorageResponse x
-> CreateLocationObjectStorageResponse
forall x.
CreateLocationObjectStorageResponse
-> Rep CreateLocationObjectStorageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLocationObjectStorageResponse x
-> CreateLocationObjectStorageResponse
$cfrom :: forall x.
CreateLocationObjectStorageResponse
-> Rep CreateLocationObjectStorageResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateLocationObjectStorageResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'locationArn', 'createLocationObjectStorageResponse_locationArn' - The Amazon Resource Name (ARN) of the agents associated with the
-- self-managed object storage server location.
--
-- 'httpStatus', 'createLocationObjectStorageResponse_httpStatus' - The response's http status code.
newCreateLocationObjectStorageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLocationObjectStorageResponse
newCreateLocationObjectStorageResponse :: Int -> CreateLocationObjectStorageResponse
newCreateLocationObjectStorageResponse Int
pHttpStatus_ =
  CreateLocationObjectStorageResponse' :: Maybe Text -> Int -> CreateLocationObjectStorageResponse
CreateLocationObjectStorageResponse'
    { $sel:locationArn:CreateLocationObjectStorageResponse' :: Maybe Text
locationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLocationObjectStorageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the agents associated with the
-- self-managed object storage server location.
createLocationObjectStorageResponse_locationArn :: Lens.Lens' CreateLocationObjectStorageResponse (Prelude.Maybe Prelude.Text)
createLocationObjectStorageResponse_locationArn :: (Maybe Text -> f (Maybe Text))
-> CreateLocationObjectStorageResponse
-> f CreateLocationObjectStorageResponse
createLocationObjectStorageResponse_locationArn = (CreateLocationObjectStorageResponse -> Maybe Text)
-> (CreateLocationObjectStorageResponse
    -> Maybe Text -> CreateLocationObjectStorageResponse)
-> Lens
     CreateLocationObjectStorageResponse
     CreateLocationObjectStorageResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorageResponse' {Maybe Text
locationArn :: Maybe Text
$sel:locationArn:CreateLocationObjectStorageResponse' :: CreateLocationObjectStorageResponse -> Maybe Text
locationArn} -> Maybe Text
locationArn) (\s :: CreateLocationObjectStorageResponse
s@CreateLocationObjectStorageResponse' {} Maybe Text
a -> CreateLocationObjectStorageResponse
s {$sel:locationArn:CreateLocationObjectStorageResponse' :: Maybe Text
locationArn = Maybe Text
a} :: CreateLocationObjectStorageResponse)

-- | The response's http status code.
createLocationObjectStorageResponse_httpStatus :: Lens.Lens' CreateLocationObjectStorageResponse Prelude.Int
createLocationObjectStorageResponse_httpStatus :: (Int -> f Int)
-> CreateLocationObjectStorageResponse
-> f CreateLocationObjectStorageResponse
createLocationObjectStorageResponse_httpStatus = (CreateLocationObjectStorageResponse -> Int)
-> (CreateLocationObjectStorageResponse
    -> Int -> CreateLocationObjectStorageResponse)
-> Lens
     CreateLocationObjectStorageResponse
     CreateLocationObjectStorageResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationObjectStorageResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLocationObjectStorageResponse' :: CreateLocationObjectStorageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLocationObjectStorageResponse
s@CreateLocationObjectStorageResponse' {} Int
a -> CreateLocationObjectStorageResponse
s {$sel:httpStatus:CreateLocationObjectStorageResponse' :: Int
httpStatus = Int
a} :: CreateLocationObjectStorageResponse)

instance
  Prelude.NFData
    CreateLocationObjectStorageResponse