{-# 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.RAM.AssociateResourceShare
-- 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)
--
-- Associates the specified resource share with the specified principals
-- and resources.
module Amazonka.RAM.AssociateResourceShare
  ( -- * Creating a Request
    AssociateResourceShare (..),
    newAssociateResourceShare,

    -- * Request Lenses
    associateResourceShare_clientToken,
    associateResourceShare_principals,
    associateResourceShare_resourceArns,
    associateResourceShare_resourceShareArn,

    -- * Destructuring the Response
    AssociateResourceShareResponse (..),
    newAssociateResourceShareResponse,

    -- * Response Lenses
    associateResourceShareResponse_clientToken,
    associateResourceShareResponse_resourceShareAssociations,
    associateResourceShareResponse_httpStatus,
  )
where

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

-- | /See:/ 'newAssociateResourceShare' smart constructor.
data AssociateResourceShare = AssociateResourceShare'
  { -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    AssociateResourceShare -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The principals to associate with the resource share. The possible values
    -- are:
    --
    -- -   An Amazon Web Services account ID
    --
    -- -   An Amazon Resource Name (ARN) of an organization in Organizations
    --
    -- -   An ARN of an organizational unit (OU) in Organizations
    --
    -- -   An ARN of an IAM role
    --
    -- -   An ARN of an IAM user
    --
    -- Not all resource types can be shared with IAM roles and IAM users. For
    -- more information, see
    -- <https://docs.aws.amazon.com/ram/latest/userguide/permissions.html#permissions-rbp-supported-resource-types Sharing with IAM roles and IAM users>
    -- in the /Resource Access Manager User Guide/.
    AssociateResourceShare -> Maybe [Text]
principals :: Prelude.Maybe [Prelude.Text],
    -- | The Amazon Resource Names (ARNs) of the resources.
    AssociateResourceShare -> Maybe [Text]
resourceArns :: Prelude.Maybe [Prelude.Text],
    -- | The Amazon Resource Name (ARN) of the resource share.
    AssociateResourceShare -> Text
resourceShareArn :: Prelude.Text
  }
  deriving (AssociateResourceShare -> AssociateResourceShare -> Bool
(AssociateResourceShare -> AssociateResourceShare -> Bool)
-> (AssociateResourceShare -> AssociateResourceShare -> Bool)
-> Eq AssociateResourceShare
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateResourceShare -> AssociateResourceShare -> Bool
$c/= :: AssociateResourceShare -> AssociateResourceShare -> Bool
== :: AssociateResourceShare -> AssociateResourceShare -> Bool
$c== :: AssociateResourceShare -> AssociateResourceShare -> Bool
Prelude.Eq, ReadPrec [AssociateResourceShare]
ReadPrec AssociateResourceShare
Int -> ReadS AssociateResourceShare
ReadS [AssociateResourceShare]
(Int -> ReadS AssociateResourceShare)
-> ReadS [AssociateResourceShare]
-> ReadPrec AssociateResourceShare
-> ReadPrec [AssociateResourceShare]
-> Read AssociateResourceShare
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateResourceShare]
$creadListPrec :: ReadPrec [AssociateResourceShare]
readPrec :: ReadPrec AssociateResourceShare
$creadPrec :: ReadPrec AssociateResourceShare
readList :: ReadS [AssociateResourceShare]
$creadList :: ReadS [AssociateResourceShare]
readsPrec :: Int -> ReadS AssociateResourceShare
$creadsPrec :: Int -> ReadS AssociateResourceShare
Prelude.Read, Int -> AssociateResourceShare -> ShowS
[AssociateResourceShare] -> ShowS
AssociateResourceShare -> String
(Int -> AssociateResourceShare -> ShowS)
-> (AssociateResourceShare -> String)
-> ([AssociateResourceShare] -> ShowS)
-> Show AssociateResourceShare
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateResourceShare] -> ShowS
$cshowList :: [AssociateResourceShare] -> ShowS
show :: AssociateResourceShare -> String
$cshow :: AssociateResourceShare -> String
showsPrec :: Int -> AssociateResourceShare -> ShowS
$cshowsPrec :: Int -> AssociateResourceShare -> ShowS
Prelude.Show, (forall x. AssociateResourceShare -> Rep AssociateResourceShare x)
-> (forall x.
    Rep AssociateResourceShare x -> AssociateResourceShare)
-> Generic AssociateResourceShare
forall x. Rep AssociateResourceShare x -> AssociateResourceShare
forall x. AssociateResourceShare -> Rep AssociateResourceShare x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateResourceShare x -> AssociateResourceShare
$cfrom :: forall x. AssociateResourceShare -> Rep AssociateResourceShare x
Prelude.Generic)

-- |
-- Create a value of 'AssociateResourceShare' 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:
--
-- 'clientToken', 'associateResourceShare_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'principals', 'associateResourceShare_principals' - The principals to associate with the resource share. The possible values
-- are:
--
-- -   An Amazon Web Services account ID
--
-- -   An Amazon Resource Name (ARN) of an organization in Organizations
--
-- -   An ARN of an organizational unit (OU) in Organizations
--
-- -   An ARN of an IAM role
--
-- -   An ARN of an IAM user
--
-- Not all resource types can be shared with IAM roles and IAM users. For
-- more information, see
-- <https://docs.aws.amazon.com/ram/latest/userguide/permissions.html#permissions-rbp-supported-resource-types Sharing with IAM roles and IAM users>
-- in the /Resource Access Manager User Guide/.
--
-- 'resourceArns', 'associateResourceShare_resourceArns' - The Amazon Resource Names (ARNs) of the resources.
--
-- 'resourceShareArn', 'associateResourceShare_resourceShareArn' - The Amazon Resource Name (ARN) of the resource share.
newAssociateResourceShare ::
  -- | 'resourceShareArn'
  Prelude.Text ->
  AssociateResourceShare
newAssociateResourceShare :: Text -> AssociateResourceShare
newAssociateResourceShare Text
pResourceShareArn_ =
  AssociateResourceShare' :: Maybe Text
-> Maybe [Text] -> Maybe [Text] -> Text -> AssociateResourceShare
AssociateResourceShare'
    { $sel:clientToken:AssociateResourceShare' :: Maybe Text
clientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:principals:AssociateResourceShare' :: Maybe [Text]
principals = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArns:AssociateResourceShare' :: Maybe [Text]
resourceArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceShareArn:AssociateResourceShare' :: Text
resourceShareArn = Text
pResourceShareArn_
    }

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
associateResourceShare_clientToken :: Lens.Lens' AssociateResourceShare (Prelude.Maybe Prelude.Text)
associateResourceShare_clientToken :: (Maybe Text -> f (Maybe Text))
-> AssociateResourceShare -> f AssociateResourceShare
associateResourceShare_clientToken = (AssociateResourceShare -> Maybe Text)
-> (AssociateResourceShare -> Maybe Text -> AssociateResourceShare)
-> Lens
     AssociateResourceShare
     AssociateResourceShare
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceShare' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:AssociateResourceShare' :: AssociateResourceShare -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: AssociateResourceShare
s@AssociateResourceShare' {} Maybe Text
a -> AssociateResourceShare
s {$sel:clientToken:AssociateResourceShare' :: Maybe Text
clientToken = Maybe Text
a} :: AssociateResourceShare)

-- | The principals to associate with the resource share. The possible values
-- are:
--
-- -   An Amazon Web Services account ID
--
-- -   An Amazon Resource Name (ARN) of an organization in Organizations
--
-- -   An ARN of an organizational unit (OU) in Organizations
--
-- -   An ARN of an IAM role
--
-- -   An ARN of an IAM user
--
-- Not all resource types can be shared with IAM roles and IAM users. For
-- more information, see
-- <https://docs.aws.amazon.com/ram/latest/userguide/permissions.html#permissions-rbp-supported-resource-types Sharing with IAM roles and IAM users>
-- in the /Resource Access Manager User Guide/.
associateResourceShare_principals :: Lens.Lens' AssociateResourceShare (Prelude.Maybe [Prelude.Text])
associateResourceShare_principals :: (Maybe [Text] -> f (Maybe [Text]))
-> AssociateResourceShare -> f AssociateResourceShare
associateResourceShare_principals = (AssociateResourceShare -> Maybe [Text])
-> (AssociateResourceShare
    -> Maybe [Text] -> AssociateResourceShare)
-> Lens
     AssociateResourceShare
     AssociateResourceShare
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceShare' {Maybe [Text]
principals :: Maybe [Text]
$sel:principals:AssociateResourceShare' :: AssociateResourceShare -> Maybe [Text]
principals} -> Maybe [Text]
principals) (\s :: AssociateResourceShare
s@AssociateResourceShare' {} Maybe [Text]
a -> AssociateResourceShare
s {$sel:principals:AssociateResourceShare' :: Maybe [Text]
principals = Maybe [Text]
a} :: AssociateResourceShare) ((Maybe [Text] -> f (Maybe [Text]))
 -> AssociateResourceShare -> f AssociateResourceShare)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AssociateResourceShare
-> f AssociateResourceShare
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 Amazon Resource Names (ARNs) of the resources.
associateResourceShare_resourceArns :: Lens.Lens' AssociateResourceShare (Prelude.Maybe [Prelude.Text])
associateResourceShare_resourceArns :: (Maybe [Text] -> f (Maybe [Text]))
-> AssociateResourceShare -> f AssociateResourceShare
associateResourceShare_resourceArns = (AssociateResourceShare -> Maybe [Text])
-> (AssociateResourceShare
    -> Maybe [Text] -> AssociateResourceShare)
-> Lens
     AssociateResourceShare
     AssociateResourceShare
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceShare' {Maybe [Text]
resourceArns :: Maybe [Text]
$sel:resourceArns:AssociateResourceShare' :: AssociateResourceShare -> Maybe [Text]
resourceArns} -> Maybe [Text]
resourceArns) (\s :: AssociateResourceShare
s@AssociateResourceShare' {} Maybe [Text]
a -> AssociateResourceShare
s {$sel:resourceArns:AssociateResourceShare' :: Maybe [Text]
resourceArns = Maybe [Text]
a} :: AssociateResourceShare) ((Maybe [Text] -> f (Maybe [Text]))
 -> AssociateResourceShare -> f AssociateResourceShare)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AssociateResourceShare
-> f AssociateResourceShare
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 Amazon Resource Name (ARN) of the resource share.
associateResourceShare_resourceShareArn :: Lens.Lens' AssociateResourceShare Prelude.Text
associateResourceShare_resourceShareArn :: (Text -> f Text)
-> AssociateResourceShare -> f AssociateResourceShare
associateResourceShare_resourceShareArn = (AssociateResourceShare -> Text)
-> (AssociateResourceShare -> Text -> AssociateResourceShare)
-> Lens AssociateResourceShare AssociateResourceShare Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceShare' {Text
resourceShareArn :: Text
$sel:resourceShareArn:AssociateResourceShare' :: AssociateResourceShare -> Text
resourceShareArn} -> Text
resourceShareArn) (\s :: AssociateResourceShare
s@AssociateResourceShare' {} Text
a -> AssociateResourceShare
s {$sel:resourceShareArn:AssociateResourceShare' :: Text
resourceShareArn = Text
a} :: AssociateResourceShare)

instance Core.AWSRequest AssociateResourceShare where
  type
    AWSResponse AssociateResourceShare =
      AssociateResourceShareResponse
  request :: AssociateResourceShare -> Request AssociateResourceShare
request = Service -> AssociateResourceShare -> Request AssociateResourceShare
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AssociateResourceShare
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateResourceShare)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse AssociateResourceShare))
-> Logger
-> Service
-> Proxy AssociateResourceShare
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateResourceShare)))
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
-> Maybe [ResourceShareAssociation]
-> Int
-> AssociateResourceShareResponse
AssociateResourceShareResponse'
            (Maybe Text
 -> Maybe [ResourceShareAssociation]
 -> Int
 -> AssociateResourceShareResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ResourceShareAssociation]
      -> Int -> AssociateResourceShareResponse)
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
"clientToken")
            Either
  String
  (Maybe [ResourceShareAssociation]
   -> Int -> AssociateResourceShareResponse)
-> Either String (Maybe [ResourceShareAssociation])
-> Either String (Int -> AssociateResourceShareResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [ResourceShareAssociation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resourceShareAssociations"
                            Either String (Maybe (Maybe [ResourceShareAssociation]))
-> Maybe [ResourceShareAssociation]
-> Either String (Maybe [ResourceShareAssociation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResourceShareAssociation]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> AssociateResourceShareResponse)
-> Either String Int
-> Either String AssociateResourceShareResponse
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 AssociateResourceShare

instance Prelude.NFData AssociateResourceShare

instance Core.ToHeaders AssociateResourceShare where
  toHeaders :: AssociateResourceShare -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AssociateResourceShare -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 AssociateResourceShare where
  toJSON :: AssociateResourceShare -> Value
toJSON AssociateResourceShare' {Maybe [Text]
Maybe Text
Text
resourceShareArn :: Text
resourceArns :: Maybe [Text]
principals :: Maybe [Text]
clientToken :: Maybe Text
$sel:resourceShareArn:AssociateResourceShare' :: AssociateResourceShare -> Text
$sel:resourceArns:AssociateResourceShare' :: AssociateResourceShare -> Maybe [Text]
$sel:principals:AssociateResourceShare' :: AssociateResourceShare -> Maybe [Text]
$sel:clientToken:AssociateResourceShare' :: AssociateResourceShare -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" 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
clientToken,
            (Text
"principals" 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]
principals,
            (Text
"resourceArns" 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]
resourceArns,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"resourceShareArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceShareArn)
          ]
      )

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

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

-- | /See:/ 'newAssociateResourceShareResponse' smart constructor.
data AssociateResourceShareResponse = AssociateResourceShareResponse'
  { -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    AssociateResourceShareResponse -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the associations.
    AssociateResourceShareResponse -> Maybe [ResourceShareAssociation]
resourceShareAssociations :: Prelude.Maybe [ResourceShareAssociation],
    -- | The response's http status code.
    AssociateResourceShareResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AssociateResourceShareResponse
-> AssociateResourceShareResponse -> Bool
(AssociateResourceShareResponse
 -> AssociateResourceShareResponse -> Bool)
-> (AssociateResourceShareResponse
    -> AssociateResourceShareResponse -> Bool)
-> Eq AssociateResourceShareResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateResourceShareResponse
-> AssociateResourceShareResponse -> Bool
$c/= :: AssociateResourceShareResponse
-> AssociateResourceShareResponse -> Bool
== :: AssociateResourceShareResponse
-> AssociateResourceShareResponse -> Bool
$c== :: AssociateResourceShareResponse
-> AssociateResourceShareResponse -> Bool
Prelude.Eq, ReadPrec [AssociateResourceShareResponse]
ReadPrec AssociateResourceShareResponse
Int -> ReadS AssociateResourceShareResponse
ReadS [AssociateResourceShareResponse]
(Int -> ReadS AssociateResourceShareResponse)
-> ReadS [AssociateResourceShareResponse]
-> ReadPrec AssociateResourceShareResponse
-> ReadPrec [AssociateResourceShareResponse]
-> Read AssociateResourceShareResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateResourceShareResponse]
$creadListPrec :: ReadPrec [AssociateResourceShareResponse]
readPrec :: ReadPrec AssociateResourceShareResponse
$creadPrec :: ReadPrec AssociateResourceShareResponse
readList :: ReadS [AssociateResourceShareResponse]
$creadList :: ReadS [AssociateResourceShareResponse]
readsPrec :: Int -> ReadS AssociateResourceShareResponse
$creadsPrec :: Int -> ReadS AssociateResourceShareResponse
Prelude.Read, Int -> AssociateResourceShareResponse -> ShowS
[AssociateResourceShareResponse] -> ShowS
AssociateResourceShareResponse -> String
(Int -> AssociateResourceShareResponse -> ShowS)
-> (AssociateResourceShareResponse -> String)
-> ([AssociateResourceShareResponse] -> ShowS)
-> Show AssociateResourceShareResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateResourceShareResponse] -> ShowS
$cshowList :: [AssociateResourceShareResponse] -> ShowS
show :: AssociateResourceShareResponse -> String
$cshow :: AssociateResourceShareResponse -> String
showsPrec :: Int -> AssociateResourceShareResponse -> ShowS
$cshowsPrec :: Int -> AssociateResourceShareResponse -> ShowS
Prelude.Show, (forall x.
 AssociateResourceShareResponse
 -> Rep AssociateResourceShareResponse x)
-> (forall x.
    Rep AssociateResourceShareResponse x
    -> AssociateResourceShareResponse)
-> Generic AssociateResourceShareResponse
forall x.
Rep AssociateResourceShareResponse x
-> AssociateResourceShareResponse
forall x.
AssociateResourceShareResponse
-> Rep AssociateResourceShareResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateResourceShareResponse x
-> AssociateResourceShareResponse
$cfrom :: forall x.
AssociateResourceShareResponse
-> Rep AssociateResourceShareResponse x
Prelude.Generic)

-- |
-- Create a value of 'AssociateResourceShareResponse' 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:
--
-- 'clientToken', 'associateResourceShareResponse_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'resourceShareAssociations', 'associateResourceShareResponse_resourceShareAssociations' - Information about the associations.
--
-- 'httpStatus', 'associateResourceShareResponse_httpStatus' - The response's http status code.
newAssociateResourceShareResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateResourceShareResponse
newAssociateResourceShareResponse :: Int -> AssociateResourceShareResponse
newAssociateResourceShareResponse Int
pHttpStatus_ =
  AssociateResourceShareResponse' :: Maybe Text
-> Maybe [ResourceShareAssociation]
-> Int
-> AssociateResourceShareResponse
AssociateResourceShareResponse'
    { $sel:clientToken:AssociateResourceShareResponse' :: Maybe Text
clientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceShareAssociations:AssociateResourceShareResponse' :: Maybe [ResourceShareAssociation]
resourceShareAssociations = Maybe [ResourceShareAssociation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateResourceShareResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
associateResourceShareResponse_clientToken :: Lens.Lens' AssociateResourceShareResponse (Prelude.Maybe Prelude.Text)
associateResourceShareResponse_clientToken :: (Maybe Text -> f (Maybe Text))
-> AssociateResourceShareResponse
-> f AssociateResourceShareResponse
associateResourceShareResponse_clientToken = (AssociateResourceShareResponse -> Maybe Text)
-> (AssociateResourceShareResponse
    -> Maybe Text -> AssociateResourceShareResponse)
-> Lens
     AssociateResourceShareResponse
     AssociateResourceShareResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceShareResponse' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:AssociateResourceShareResponse' :: AssociateResourceShareResponse -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: AssociateResourceShareResponse
s@AssociateResourceShareResponse' {} Maybe Text
a -> AssociateResourceShareResponse
s {$sel:clientToken:AssociateResourceShareResponse' :: Maybe Text
clientToken = Maybe Text
a} :: AssociateResourceShareResponse)

-- | Information about the associations.
associateResourceShareResponse_resourceShareAssociations :: Lens.Lens' AssociateResourceShareResponse (Prelude.Maybe [ResourceShareAssociation])
associateResourceShareResponse_resourceShareAssociations :: (Maybe [ResourceShareAssociation]
 -> f (Maybe [ResourceShareAssociation]))
-> AssociateResourceShareResponse
-> f AssociateResourceShareResponse
associateResourceShareResponse_resourceShareAssociations = (AssociateResourceShareResponse
 -> Maybe [ResourceShareAssociation])
-> (AssociateResourceShareResponse
    -> Maybe [ResourceShareAssociation]
    -> AssociateResourceShareResponse)
-> Lens
     AssociateResourceShareResponse
     AssociateResourceShareResponse
     (Maybe [ResourceShareAssociation])
     (Maybe [ResourceShareAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceShareResponse' {Maybe [ResourceShareAssociation]
resourceShareAssociations :: Maybe [ResourceShareAssociation]
$sel:resourceShareAssociations:AssociateResourceShareResponse' :: AssociateResourceShareResponse -> Maybe [ResourceShareAssociation]
resourceShareAssociations} -> Maybe [ResourceShareAssociation]
resourceShareAssociations) (\s :: AssociateResourceShareResponse
s@AssociateResourceShareResponse' {} Maybe [ResourceShareAssociation]
a -> AssociateResourceShareResponse
s {$sel:resourceShareAssociations:AssociateResourceShareResponse' :: Maybe [ResourceShareAssociation]
resourceShareAssociations = Maybe [ResourceShareAssociation]
a} :: AssociateResourceShareResponse) ((Maybe [ResourceShareAssociation]
  -> f (Maybe [ResourceShareAssociation]))
 -> AssociateResourceShareResponse
 -> f AssociateResourceShareResponse)
-> ((Maybe [ResourceShareAssociation]
     -> f (Maybe [ResourceShareAssociation]))
    -> Maybe [ResourceShareAssociation]
    -> f (Maybe [ResourceShareAssociation]))
-> (Maybe [ResourceShareAssociation]
    -> f (Maybe [ResourceShareAssociation]))
-> AssociateResourceShareResponse
-> f AssociateResourceShareResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceShareAssociation]
  [ResourceShareAssociation]
  [ResourceShareAssociation]
  [ResourceShareAssociation]
-> Iso
     (Maybe [ResourceShareAssociation])
     (Maybe [ResourceShareAssociation])
     (Maybe [ResourceShareAssociation])
     (Maybe [ResourceShareAssociation])
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
  [ResourceShareAssociation]
  [ResourceShareAssociation]
  [ResourceShareAssociation]
  [ResourceShareAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    AssociateResourceShareResponse