{-# 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.DirectoryService.CreateTrust
-- 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)
--
-- Directory Service for Microsoft Active Directory allows you to configure
-- trust relationships. For example, you can establish a trust between your
-- Managed Microsoft AD directory, and your existing self-managed Microsoft
-- Active Directory. This would allow you to provide users and groups
-- access to resources in either domain, with a single set of credentials.
--
-- This action initiates the creation of the Amazon Web Services side of a
-- trust relationship between an Managed Microsoft AD directory and an
-- external domain. You can create either a forest trust or an external
-- trust.
module Amazonka.DirectoryService.CreateTrust
  ( -- * Creating a Request
    CreateTrust (..),
    newCreateTrust,

    -- * Request Lenses
    createTrust_conditionalForwarderIpAddrs,
    createTrust_trustType,
    createTrust_selectiveAuth,
    createTrust_directoryId,
    createTrust_remoteDomainName,
    createTrust_trustPassword,
    createTrust_trustDirection,

    -- * Destructuring the Response
    CreateTrustResponse (..),
    newCreateTrustResponse,

    -- * Response Lenses
    createTrustResponse_trustId,
    createTrustResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.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

-- | Directory Service for Microsoft Active Directory allows you to configure
-- trust relationships. For example, you can establish a trust between your
-- Managed Microsoft AD directory, and your existing self-managed Microsoft
-- Active Directory. This would allow you to provide users and groups
-- access to resources in either domain, with a single set of credentials.
--
-- This action initiates the creation of the Amazon Web Services side of a
-- trust relationship between an Managed Microsoft AD directory and an
-- external domain.
--
-- /See:/ 'newCreateTrust' smart constructor.
data CreateTrust = CreateTrust'
  { -- | The IP addresses of the remote DNS server associated with
    -- RemoteDomainName.
    CreateTrust -> Maybe [Text]
conditionalForwarderIpAddrs :: Prelude.Maybe [Prelude.Text],
    -- | The trust relationship type. @Forest@ is the default.
    CreateTrust -> Maybe TrustType
trustType :: Prelude.Maybe TrustType,
    -- | Optional parameter to enable selective authentication for the trust.
    CreateTrust -> Maybe SelectiveAuth
selectiveAuth :: Prelude.Maybe SelectiveAuth,
    -- | The Directory ID of the Managed Microsoft AD directory for which to
    -- establish the trust relationship.
    CreateTrust -> Text
directoryId :: Prelude.Text,
    -- | The Fully Qualified Domain Name (FQDN) of the external domain for which
    -- to create the trust relationship.
    CreateTrust -> Text
remoteDomainName :: Prelude.Text,
    -- | The trust password. The must be the same password that was used when
    -- creating the trust relationship on the external domain.
    CreateTrust -> Sensitive Text
trustPassword :: Core.Sensitive Prelude.Text,
    -- | The direction of the trust relationship.
    CreateTrust -> TrustDirection
trustDirection :: TrustDirection
  }
  deriving (CreateTrust -> CreateTrust -> Bool
(CreateTrust -> CreateTrust -> Bool)
-> (CreateTrust -> CreateTrust -> Bool) -> Eq CreateTrust
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrust -> CreateTrust -> Bool
$c/= :: CreateTrust -> CreateTrust -> Bool
== :: CreateTrust -> CreateTrust -> Bool
$c== :: CreateTrust -> CreateTrust -> Bool
Prelude.Eq, Int -> CreateTrust -> ShowS
[CreateTrust] -> ShowS
CreateTrust -> String
(Int -> CreateTrust -> ShowS)
-> (CreateTrust -> String)
-> ([CreateTrust] -> ShowS)
-> Show CreateTrust
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrust] -> ShowS
$cshowList :: [CreateTrust] -> ShowS
show :: CreateTrust -> String
$cshow :: CreateTrust -> String
showsPrec :: Int -> CreateTrust -> ShowS
$cshowsPrec :: Int -> CreateTrust -> ShowS
Prelude.Show, (forall x. CreateTrust -> Rep CreateTrust x)
-> (forall x. Rep CreateTrust x -> CreateTrust)
-> Generic CreateTrust
forall x. Rep CreateTrust x -> CreateTrust
forall x. CreateTrust -> Rep CreateTrust x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrust x -> CreateTrust
$cfrom :: forall x. CreateTrust -> Rep CreateTrust x
Prelude.Generic)

-- |
-- Create a value of 'CreateTrust' 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:
--
-- 'conditionalForwarderIpAddrs', 'createTrust_conditionalForwarderIpAddrs' - The IP addresses of the remote DNS server associated with
-- RemoteDomainName.
--
-- 'trustType', 'createTrust_trustType' - The trust relationship type. @Forest@ is the default.
--
-- 'selectiveAuth', 'createTrust_selectiveAuth' - Optional parameter to enable selective authentication for the trust.
--
-- 'directoryId', 'createTrust_directoryId' - The Directory ID of the Managed Microsoft AD directory for which to
-- establish the trust relationship.
--
-- 'remoteDomainName', 'createTrust_remoteDomainName' - The Fully Qualified Domain Name (FQDN) of the external domain for which
-- to create the trust relationship.
--
-- 'trustPassword', 'createTrust_trustPassword' - The trust password. The must be the same password that was used when
-- creating the trust relationship on the external domain.
--
-- 'trustDirection', 'createTrust_trustDirection' - The direction of the trust relationship.
newCreateTrust ::
  -- | 'directoryId'
  Prelude.Text ->
  -- | 'remoteDomainName'
  Prelude.Text ->
  -- | 'trustPassword'
  Prelude.Text ->
  -- | 'trustDirection'
  TrustDirection ->
  CreateTrust
newCreateTrust :: Text -> Text -> Text -> TrustDirection -> CreateTrust
newCreateTrust
  Text
pDirectoryId_
  Text
pRemoteDomainName_
  Text
pTrustPassword_
  TrustDirection
pTrustDirection_ =
    CreateTrust' :: Maybe [Text]
-> Maybe TrustType
-> Maybe SelectiveAuth
-> Text
-> Text
-> Sensitive Text
-> TrustDirection
-> CreateTrust
CreateTrust'
      { $sel:conditionalForwarderIpAddrs:CreateTrust' :: Maybe [Text]
conditionalForwarderIpAddrs =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:trustType:CreateTrust' :: Maybe TrustType
trustType = Maybe TrustType
forall a. Maybe a
Prelude.Nothing,
        $sel:selectiveAuth:CreateTrust' :: Maybe SelectiveAuth
selectiveAuth = Maybe SelectiveAuth
forall a. Maybe a
Prelude.Nothing,
        $sel:directoryId:CreateTrust' :: Text
directoryId = Text
pDirectoryId_,
        $sel:remoteDomainName:CreateTrust' :: Text
remoteDomainName = Text
pRemoteDomainName_,
        $sel:trustPassword:CreateTrust' :: Sensitive Text
trustPassword =
          Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pTrustPassword_,
        $sel:trustDirection:CreateTrust' :: TrustDirection
trustDirection = TrustDirection
pTrustDirection_
      }

-- | The IP addresses of the remote DNS server associated with
-- RemoteDomainName.
createTrust_conditionalForwarderIpAddrs :: Lens.Lens' CreateTrust (Prelude.Maybe [Prelude.Text])
createTrust_conditionalForwarderIpAddrs :: (Maybe [Text] -> f (Maybe [Text])) -> CreateTrust -> f CreateTrust
createTrust_conditionalForwarderIpAddrs = (CreateTrust -> Maybe [Text])
-> (CreateTrust -> Maybe [Text] -> CreateTrust)
-> Lens CreateTrust CreateTrust (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrust' {Maybe [Text]
conditionalForwarderIpAddrs :: Maybe [Text]
$sel:conditionalForwarderIpAddrs:CreateTrust' :: CreateTrust -> Maybe [Text]
conditionalForwarderIpAddrs} -> Maybe [Text]
conditionalForwarderIpAddrs) (\s :: CreateTrust
s@CreateTrust' {} Maybe [Text]
a -> CreateTrust
s {$sel:conditionalForwarderIpAddrs:CreateTrust' :: Maybe [Text]
conditionalForwarderIpAddrs = Maybe [Text]
a} :: CreateTrust) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateTrust -> f CreateTrust)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateTrust
-> f CreateTrust
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The trust relationship type. @Forest@ is the default.
createTrust_trustType :: Lens.Lens' CreateTrust (Prelude.Maybe TrustType)
createTrust_trustType :: (Maybe TrustType -> f (Maybe TrustType))
-> CreateTrust -> f CreateTrust
createTrust_trustType = (CreateTrust -> Maybe TrustType)
-> (CreateTrust -> Maybe TrustType -> CreateTrust)
-> Lens CreateTrust CreateTrust (Maybe TrustType) (Maybe TrustType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrust' {Maybe TrustType
trustType :: Maybe TrustType
$sel:trustType:CreateTrust' :: CreateTrust -> Maybe TrustType
trustType} -> Maybe TrustType
trustType) (\s :: CreateTrust
s@CreateTrust' {} Maybe TrustType
a -> CreateTrust
s {$sel:trustType:CreateTrust' :: Maybe TrustType
trustType = Maybe TrustType
a} :: CreateTrust)

-- | Optional parameter to enable selective authentication for the trust.
createTrust_selectiveAuth :: Lens.Lens' CreateTrust (Prelude.Maybe SelectiveAuth)
createTrust_selectiveAuth :: (Maybe SelectiveAuth -> f (Maybe SelectiveAuth))
-> CreateTrust -> f CreateTrust
createTrust_selectiveAuth = (CreateTrust -> Maybe SelectiveAuth)
-> (CreateTrust -> Maybe SelectiveAuth -> CreateTrust)
-> Lens
     CreateTrust CreateTrust (Maybe SelectiveAuth) (Maybe SelectiveAuth)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrust' {Maybe SelectiveAuth
selectiveAuth :: Maybe SelectiveAuth
$sel:selectiveAuth:CreateTrust' :: CreateTrust -> Maybe SelectiveAuth
selectiveAuth} -> Maybe SelectiveAuth
selectiveAuth) (\s :: CreateTrust
s@CreateTrust' {} Maybe SelectiveAuth
a -> CreateTrust
s {$sel:selectiveAuth:CreateTrust' :: Maybe SelectiveAuth
selectiveAuth = Maybe SelectiveAuth
a} :: CreateTrust)

-- | The Directory ID of the Managed Microsoft AD directory for which to
-- establish the trust relationship.
createTrust_directoryId :: Lens.Lens' CreateTrust Prelude.Text
createTrust_directoryId :: (Text -> f Text) -> CreateTrust -> f CreateTrust
createTrust_directoryId = (CreateTrust -> Text)
-> (CreateTrust -> Text -> CreateTrust)
-> Lens CreateTrust CreateTrust Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrust' {Text
directoryId :: Text
$sel:directoryId:CreateTrust' :: CreateTrust -> Text
directoryId} -> Text
directoryId) (\s :: CreateTrust
s@CreateTrust' {} Text
a -> CreateTrust
s {$sel:directoryId:CreateTrust' :: Text
directoryId = Text
a} :: CreateTrust)

-- | The Fully Qualified Domain Name (FQDN) of the external domain for which
-- to create the trust relationship.
createTrust_remoteDomainName :: Lens.Lens' CreateTrust Prelude.Text
createTrust_remoteDomainName :: (Text -> f Text) -> CreateTrust -> f CreateTrust
createTrust_remoteDomainName = (CreateTrust -> Text)
-> (CreateTrust -> Text -> CreateTrust)
-> Lens CreateTrust CreateTrust Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrust' {Text
remoteDomainName :: Text
$sel:remoteDomainName:CreateTrust' :: CreateTrust -> Text
remoteDomainName} -> Text
remoteDomainName) (\s :: CreateTrust
s@CreateTrust' {} Text
a -> CreateTrust
s {$sel:remoteDomainName:CreateTrust' :: Text
remoteDomainName = Text
a} :: CreateTrust)

-- | The trust password. The must be the same password that was used when
-- creating the trust relationship on the external domain.
createTrust_trustPassword :: Lens.Lens' CreateTrust Prelude.Text
createTrust_trustPassword :: (Text -> f Text) -> CreateTrust -> f CreateTrust
createTrust_trustPassword = (CreateTrust -> Sensitive Text)
-> (CreateTrust -> Sensitive Text -> CreateTrust)
-> Lens CreateTrust CreateTrust (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrust' {Sensitive Text
trustPassword :: Sensitive Text
$sel:trustPassword:CreateTrust' :: CreateTrust -> Sensitive Text
trustPassword} -> Sensitive Text
trustPassword) (\s :: CreateTrust
s@CreateTrust' {} Sensitive Text
a -> CreateTrust
s {$sel:trustPassword:CreateTrust' :: Sensitive Text
trustPassword = Sensitive Text
a} :: CreateTrust) ((Sensitive Text -> f (Sensitive Text))
 -> CreateTrust -> f CreateTrust)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateTrust
-> f CreateTrust
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The direction of the trust relationship.
createTrust_trustDirection :: Lens.Lens' CreateTrust TrustDirection
createTrust_trustDirection :: (TrustDirection -> f TrustDirection)
-> CreateTrust -> f CreateTrust
createTrust_trustDirection = (CreateTrust -> TrustDirection)
-> (CreateTrust -> TrustDirection -> CreateTrust)
-> Lens CreateTrust CreateTrust TrustDirection TrustDirection
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrust' {TrustDirection
trustDirection :: TrustDirection
$sel:trustDirection:CreateTrust' :: CreateTrust -> TrustDirection
trustDirection} -> TrustDirection
trustDirection) (\s :: CreateTrust
s@CreateTrust' {} TrustDirection
a -> CreateTrust
s {$sel:trustDirection:CreateTrust' :: TrustDirection
trustDirection = TrustDirection
a} :: CreateTrust)

instance Core.AWSRequest CreateTrust where
  type AWSResponse CreateTrust = CreateTrustResponse
  request :: CreateTrust -> Request CreateTrust
request = Service -> CreateTrust -> Request CreateTrust
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateTrust
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTrust)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateTrust))
-> Logger
-> Service
-> Proxy CreateTrust
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTrust)))
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 -> CreateTrustResponse
CreateTrustResponse'
            (Maybe Text -> Int -> CreateTrustResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateTrustResponse)
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
"TrustId")
            Either String (Int -> CreateTrustResponse)
-> Either String Int -> Either String CreateTrustResponse
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 CreateTrust

instance Prelude.NFData CreateTrust

instance Core.ToHeaders CreateTrust where
  toHeaders :: CreateTrust -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateTrust -> 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
"DirectoryService_20150416.CreateTrust" ::
                          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 CreateTrust where
  toJSON :: CreateTrust -> Value
toJSON CreateTrust' {Maybe [Text]
Maybe SelectiveAuth
Maybe TrustType
Text
Sensitive Text
TrustDirection
trustDirection :: TrustDirection
trustPassword :: Sensitive Text
remoteDomainName :: Text
directoryId :: Text
selectiveAuth :: Maybe SelectiveAuth
trustType :: Maybe TrustType
conditionalForwarderIpAddrs :: Maybe [Text]
$sel:trustDirection:CreateTrust' :: CreateTrust -> TrustDirection
$sel:trustPassword:CreateTrust' :: CreateTrust -> Sensitive Text
$sel:remoteDomainName:CreateTrust' :: CreateTrust -> Text
$sel:directoryId:CreateTrust' :: CreateTrust -> Text
$sel:selectiveAuth:CreateTrust' :: CreateTrust -> Maybe SelectiveAuth
$sel:trustType:CreateTrust' :: CreateTrust -> Maybe TrustType
$sel:conditionalForwarderIpAddrs:CreateTrust' :: CreateTrust -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ConditionalForwarderIpAddrs" 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]
conditionalForwarderIpAddrs,
            (Text
"TrustType" Text -> TrustType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TrustType -> Pair) -> Maybe TrustType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TrustType
trustType,
            (Text
"SelectiveAuth" Text -> SelectiveAuth -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SelectiveAuth -> Pair) -> Maybe SelectiveAuth -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SelectiveAuth
selectiveAuth,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RemoteDomainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
remoteDomainName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TrustPassword" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
trustPassword),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"TrustDirection" Text -> TrustDirection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TrustDirection
trustDirection)
          ]
      )

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

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

-- | The result of a CreateTrust request.
--
-- /See:/ 'newCreateTrustResponse' smart constructor.
data CreateTrustResponse = CreateTrustResponse'
  { -- | A unique identifier for the trust relationship that was created.
    CreateTrustResponse -> Maybe Text
trustId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateTrustResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateTrustResponse -> CreateTrustResponse -> Bool
(CreateTrustResponse -> CreateTrustResponse -> Bool)
-> (CreateTrustResponse -> CreateTrustResponse -> Bool)
-> Eq CreateTrustResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrustResponse -> CreateTrustResponse -> Bool
$c/= :: CreateTrustResponse -> CreateTrustResponse -> Bool
== :: CreateTrustResponse -> CreateTrustResponse -> Bool
$c== :: CreateTrustResponse -> CreateTrustResponse -> Bool
Prelude.Eq, ReadPrec [CreateTrustResponse]
ReadPrec CreateTrustResponse
Int -> ReadS CreateTrustResponse
ReadS [CreateTrustResponse]
(Int -> ReadS CreateTrustResponse)
-> ReadS [CreateTrustResponse]
-> ReadPrec CreateTrustResponse
-> ReadPrec [CreateTrustResponse]
-> Read CreateTrustResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTrustResponse]
$creadListPrec :: ReadPrec [CreateTrustResponse]
readPrec :: ReadPrec CreateTrustResponse
$creadPrec :: ReadPrec CreateTrustResponse
readList :: ReadS [CreateTrustResponse]
$creadList :: ReadS [CreateTrustResponse]
readsPrec :: Int -> ReadS CreateTrustResponse
$creadsPrec :: Int -> ReadS CreateTrustResponse
Prelude.Read, Int -> CreateTrustResponse -> ShowS
[CreateTrustResponse] -> ShowS
CreateTrustResponse -> String
(Int -> CreateTrustResponse -> ShowS)
-> (CreateTrustResponse -> String)
-> ([CreateTrustResponse] -> ShowS)
-> Show CreateTrustResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrustResponse] -> ShowS
$cshowList :: [CreateTrustResponse] -> ShowS
show :: CreateTrustResponse -> String
$cshow :: CreateTrustResponse -> String
showsPrec :: Int -> CreateTrustResponse -> ShowS
$cshowsPrec :: Int -> CreateTrustResponse -> ShowS
Prelude.Show, (forall x. CreateTrustResponse -> Rep CreateTrustResponse x)
-> (forall x. Rep CreateTrustResponse x -> CreateTrustResponse)
-> Generic CreateTrustResponse
forall x. Rep CreateTrustResponse x -> CreateTrustResponse
forall x. CreateTrustResponse -> Rep CreateTrustResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrustResponse x -> CreateTrustResponse
$cfrom :: forall x. CreateTrustResponse -> Rep CreateTrustResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateTrustResponse' 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:
--
-- 'trustId', 'createTrustResponse_trustId' - A unique identifier for the trust relationship that was created.
--
-- 'httpStatus', 'createTrustResponse_httpStatus' - The response's http status code.
newCreateTrustResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateTrustResponse
newCreateTrustResponse :: Int -> CreateTrustResponse
newCreateTrustResponse Int
pHttpStatus_ =
  CreateTrustResponse' :: Maybe Text -> Int -> CreateTrustResponse
CreateTrustResponse'
    { $sel:trustId:CreateTrustResponse' :: Maybe Text
trustId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateTrustResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A unique identifier for the trust relationship that was created.
createTrustResponse_trustId :: Lens.Lens' CreateTrustResponse (Prelude.Maybe Prelude.Text)
createTrustResponse_trustId :: (Maybe Text -> f (Maybe Text))
-> CreateTrustResponse -> f CreateTrustResponse
createTrustResponse_trustId = (CreateTrustResponse -> Maybe Text)
-> (CreateTrustResponse -> Maybe Text -> CreateTrustResponse)
-> Lens
     CreateTrustResponse CreateTrustResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrustResponse' {Maybe Text
trustId :: Maybe Text
$sel:trustId:CreateTrustResponse' :: CreateTrustResponse -> Maybe Text
trustId} -> Maybe Text
trustId) (\s :: CreateTrustResponse
s@CreateTrustResponse' {} Maybe Text
a -> CreateTrustResponse
s {$sel:trustId:CreateTrustResponse' :: Maybe Text
trustId = Maybe Text
a} :: CreateTrustResponse)

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

instance Prelude.NFData CreateTrustResponse