{-# 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.ECRPublic.SetRepositoryPolicy
-- 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)
--
-- Applies a repository policy to the specified public repository to
-- control access permissions. For more information, see
-- <https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policies.html Amazon ECR Repository Policies>
-- in the /Amazon Elastic Container Registry User Guide/.
module Amazonka.ECRPublic.SetRepositoryPolicy
  ( -- * Creating a Request
    SetRepositoryPolicy (..),
    newSetRepositoryPolicy,

    -- * Request Lenses
    setRepositoryPolicy_force,
    setRepositoryPolicy_registryId,
    setRepositoryPolicy_repositoryName,
    setRepositoryPolicy_policyText,

    -- * Destructuring the Response
    SetRepositoryPolicyResponse (..),
    newSetRepositoryPolicyResponse,

    -- * Response Lenses
    setRepositoryPolicyResponse_registryId,
    setRepositoryPolicyResponse_repositoryName,
    setRepositoryPolicyResponse_policyText,
    setRepositoryPolicyResponse_httpStatus,
  )
where

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

-- | /See:/ 'newSetRepositoryPolicy' smart constructor.
data SetRepositoryPolicy = SetRepositoryPolicy'
  { -- | If the policy you are attempting to set on a repository policy would
    -- prevent you from setting another policy in the future, you must force
    -- the SetRepositoryPolicy operation. This is intended to prevent
    -- accidental repository lock outs.
    SetRepositoryPolicy -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
    -- | The AWS account ID associated with the registry that contains the
    -- repository. If you do not specify a registry, the default public
    -- registry is assumed.
    SetRepositoryPolicy -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository to receive the policy.
    SetRepositoryPolicy -> Text
repositoryName :: Prelude.Text,
    -- | The JSON repository policy text to apply to the repository. For more
    -- information, see
    -- <https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html Amazon ECR Repository Policies>
    -- in the /Amazon Elastic Container Registry User Guide/.
    SetRepositoryPolicy -> Text
policyText :: Prelude.Text
  }
  deriving (SetRepositoryPolicy -> SetRepositoryPolicy -> Bool
(SetRepositoryPolicy -> SetRepositoryPolicy -> Bool)
-> (SetRepositoryPolicy -> SetRepositoryPolicy -> Bool)
-> Eq SetRepositoryPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetRepositoryPolicy -> SetRepositoryPolicy -> Bool
$c/= :: SetRepositoryPolicy -> SetRepositoryPolicy -> Bool
== :: SetRepositoryPolicy -> SetRepositoryPolicy -> Bool
$c== :: SetRepositoryPolicy -> SetRepositoryPolicy -> Bool
Prelude.Eq, ReadPrec [SetRepositoryPolicy]
ReadPrec SetRepositoryPolicy
Int -> ReadS SetRepositoryPolicy
ReadS [SetRepositoryPolicy]
(Int -> ReadS SetRepositoryPolicy)
-> ReadS [SetRepositoryPolicy]
-> ReadPrec SetRepositoryPolicy
-> ReadPrec [SetRepositoryPolicy]
-> Read SetRepositoryPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetRepositoryPolicy]
$creadListPrec :: ReadPrec [SetRepositoryPolicy]
readPrec :: ReadPrec SetRepositoryPolicy
$creadPrec :: ReadPrec SetRepositoryPolicy
readList :: ReadS [SetRepositoryPolicy]
$creadList :: ReadS [SetRepositoryPolicy]
readsPrec :: Int -> ReadS SetRepositoryPolicy
$creadsPrec :: Int -> ReadS SetRepositoryPolicy
Prelude.Read, Int -> SetRepositoryPolicy -> ShowS
[SetRepositoryPolicy] -> ShowS
SetRepositoryPolicy -> String
(Int -> SetRepositoryPolicy -> ShowS)
-> (SetRepositoryPolicy -> String)
-> ([SetRepositoryPolicy] -> ShowS)
-> Show SetRepositoryPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetRepositoryPolicy] -> ShowS
$cshowList :: [SetRepositoryPolicy] -> ShowS
show :: SetRepositoryPolicy -> String
$cshow :: SetRepositoryPolicy -> String
showsPrec :: Int -> SetRepositoryPolicy -> ShowS
$cshowsPrec :: Int -> SetRepositoryPolicy -> ShowS
Prelude.Show, (forall x. SetRepositoryPolicy -> Rep SetRepositoryPolicy x)
-> (forall x. Rep SetRepositoryPolicy x -> SetRepositoryPolicy)
-> Generic SetRepositoryPolicy
forall x. Rep SetRepositoryPolicy x -> SetRepositoryPolicy
forall x. SetRepositoryPolicy -> Rep SetRepositoryPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetRepositoryPolicy x -> SetRepositoryPolicy
$cfrom :: forall x. SetRepositoryPolicy -> Rep SetRepositoryPolicy x
Prelude.Generic)

-- |
-- Create a value of 'SetRepositoryPolicy' 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:
--
-- 'force', 'setRepositoryPolicy_force' - If the policy you are attempting to set on a repository policy would
-- prevent you from setting another policy in the future, you must force
-- the SetRepositoryPolicy operation. This is intended to prevent
-- accidental repository lock outs.
--
-- 'registryId', 'setRepositoryPolicy_registryId' - The AWS account ID associated with the registry that contains the
-- repository. If you do not specify a registry, the default public
-- registry is assumed.
--
-- 'repositoryName', 'setRepositoryPolicy_repositoryName' - The name of the repository to receive the policy.
--
-- 'policyText', 'setRepositoryPolicy_policyText' - The JSON repository policy text to apply to the repository. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html Amazon ECR Repository Policies>
-- in the /Amazon Elastic Container Registry User Guide/.
newSetRepositoryPolicy ::
  -- | 'repositoryName'
  Prelude.Text ->
  -- | 'policyText'
  Prelude.Text ->
  SetRepositoryPolicy
newSetRepositoryPolicy :: Text -> Text -> SetRepositoryPolicy
newSetRepositoryPolicy Text
pRepositoryName_ Text
pPolicyText_ =
  SetRepositoryPolicy' :: Maybe Bool -> Maybe Text -> Text -> Text -> SetRepositoryPolicy
SetRepositoryPolicy'
    { $sel:force:SetRepositoryPolicy' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:registryId:SetRepositoryPolicy' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:SetRepositoryPolicy' :: Text
repositoryName = Text
pRepositoryName_,
      $sel:policyText:SetRepositoryPolicy' :: Text
policyText = Text
pPolicyText_
    }

-- | If the policy you are attempting to set on a repository policy would
-- prevent you from setting another policy in the future, you must force
-- the SetRepositoryPolicy operation. This is intended to prevent
-- accidental repository lock outs.
setRepositoryPolicy_force :: Lens.Lens' SetRepositoryPolicy (Prelude.Maybe Prelude.Bool)
setRepositoryPolicy_force :: (Maybe Bool -> f (Maybe Bool))
-> SetRepositoryPolicy -> f SetRepositoryPolicy
setRepositoryPolicy_force = (SetRepositoryPolicy -> Maybe Bool)
-> (SetRepositoryPolicy -> Maybe Bool -> SetRepositoryPolicy)
-> Lens
     SetRepositoryPolicy SetRepositoryPolicy (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRepositoryPolicy' {Maybe Bool
force :: Maybe Bool
$sel:force:SetRepositoryPolicy' :: SetRepositoryPolicy -> Maybe Bool
force} -> Maybe Bool
force) (\s :: SetRepositoryPolicy
s@SetRepositoryPolicy' {} Maybe Bool
a -> SetRepositoryPolicy
s {$sel:force:SetRepositoryPolicy' :: Maybe Bool
force = Maybe Bool
a} :: SetRepositoryPolicy)

-- | The AWS account ID associated with the registry that contains the
-- repository. If you do not specify a registry, the default public
-- registry is assumed.
setRepositoryPolicy_registryId :: Lens.Lens' SetRepositoryPolicy (Prelude.Maybe Prelude.Text)
setRepositoryPolicy_registryId :: (Maybe Text -> f (Maybe Text))
-> SetRepositoryPolicy -> f SetRepositoryPolicy
setRepositoryPolicy_registryId = (SetRepositoryPolicy -> Maybe Text)
-> (SetRepositoryPolicy -> Maybe Text -> SetRepositoryPolicy)
-> Lens
     SetRepositoryPolicy SetRepositoryPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRepositoryPolicy' {Maybe Text
registryId :: Maybe Text
$sel:registryId:SetRepositoryPolicy' :: SetRepositoryPolicy -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: SetRepositoryPolicy
s@SetRepositoryPolicy' {} Maybe Text
a -> SetRepositoryPolicy
s {$sel:registryId:SetRepositoryPolicy' :: Maybe Text
registryId = Maybe Text
a} :: SetRepositoryPolicy)

-- | The name of the repository to receive the policy.
setRepositoryPolicy_repositoryName :: Lens.Lens' SetRepositoryPolicy Prelude.Text
setRepositoryPolicy_repositoryName :: (Text -> f Text) -> SetRepositoryPolicy -> f SetRepositoryPolicy
setRepositoryPolicy_repositoryName = (SetRepositoryPolicy -> Text)
-> (SetRepositoryPolicy -> Text -> SetRepositoryPolicy)
-> Lens SetRepositoryPolicy SetRepositoryPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRepositoryPolicy' {Text
repositoryName :: Text
$sel:repositoryName:SetRepositoryPolicy' :: SetRepositoryPolicy -> Text
repositoryName} -> Text
repositoryName) (\s :: SetRepositoryPolicy
s@SetRepositoryPolicy' {} Text
a -> SetRepositoryPolicy
s {$sel:repositoryName:SetRepositoryPolicy' :: Text
repositoryName = Text
a} :: SetRepositoryPolicy)

-- | The JSON repository policy text to apply to the repository. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html Amazon ECR Repository Policies>
-- in the /Amazon Elastic Container Registry User Guide/.
setRepositoryPolicy_policyText :: Lens.Lens' SetRepositoryPolicy Prelude.Text
setRepositoryPolicy_policyText :: (Text -> f Text) -> SetRepositoryPolicy -> f SetRepositoryPolicy
setRepositoryPolicy_policyText = (SetRepositoryPolicy -> Text)
-> (SetRepositoryPolicy -> Text -> SetRepositoryPolicy)
-> Lens SetRepositoryPolicy SetRepositoryPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRepositoryPolicy' {Text
policyText :: Text
$sel:policyText:SetRepositoryPolicy' :: SetRepositoryPolicy -> Text
policyText} -> Text
policyText) (\s :: SetRepositoryPolicy
s@SetRepositoryPolicy' {} Text
a -> SetRepositoryPolicy
s {$sel:policyText:SetRepositoryPolicy' :: Text
policyText = Text
a} :: SetRepositoryPolicy)

instance Core.AWSRequest SetRepositoryPolicy where
  type
    AWSResponse SetRepositoryPolicy =
      SetRepositoryPolicyResponse
  request :: SetRepositoryPolicy -> Request SetRepositoryPolicy
request = Service -> SetRepositoryPolicy -> Request SetRepositoryPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SetRepositoryPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetRepositoryPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SetRepositoryPolicy))
-> Logger
-> Service
-> Proxy SetRepositoryPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetRepositoryPolicy)))
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 Text -> Maybe Text -> Int -> SetRepositoryPolicyResponse
SetRepositoryPolicyResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> SetRepositoryPolicyResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> SetRepositoryPolicyResponse)
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
"registryId")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> SetRepositoryPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> SetRepositoryPolicyResponse)
forall (f :: * -> *) a b. Applicative f => 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
"repositoryName")
            Either String (Maybe Text -> Int -> SetRepositoryPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> SetRepositoryPolicyResponse)
forall (f :: * -> *) a b. Applicative f => 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
"policyText")
            Either String (Int -> SetRepositoryPolicyResponse)
-> Either String Int -> Either String SetRepositoryPolicyResponse
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 SetRepositoryPolicy

instance Prelude.NFData SetRepositoryPolicy

instance Core.ToHeaders SetRepositoryPolicy where
  toHeaders :: SetRepositoryPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SetRepositoryPolicy -> 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
"SpencerFrontendService.SetRepositoryPolicy" ::
                          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 SetRepositoryPolicy where
  toJSON :: SetRepositoryPolicy -> Value
toJSON SetRepositoryPolicy' {Maybe Bool
Maybe Text
Text
policyText :: Text
repositoryName :: Text
registryId :: Maybe Text
force :: Maybe Bool
$sel:policyText:SetRepositoryPolicy' :: SetRepositoryPolicy -> Text
$sel:repositoryName:SetRepositoryPolicy' :: SetRepositoryPolicy -> Text
$sel:registryId:SetRepositoryPolicy' :: SetRepositoryPolicy -> Maybe Text
$sel:force:SetRepositoryPolicy' :: SetRepositoryPolicy -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"force" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force,
            (Text
"registryId" 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
registryId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"policyText" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policyText)
          ]
      )

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

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

-- | /See:/ 'newSetRepositoryPolicyResponse' smart constructor.
data SetRepositoryPolicyResponse = SetRepositoryPolicyResponse'
  { -- | The registry ID associated with the request.
    SetRepositoryPolicyResponse -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The repository name associated with the request.
    SetRepositoryPolicyResponse -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text,
    -- | The JSON repository policy text applied to the repository.
    SetRepositoryPolicyResponse -> Maybe Text
policyText :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    SetRepositoryPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SetRepositoryPolicyResponse -> SetRepositoryPolicyResponse -> Bool
(SetRepositoryPolicyResponse
 -> SetRepositoryPolicyResponse -> Bool)
-> (SetRepositoryPolicyResponse
    -> SetRepositoryPolicyResponse -> Bool)
-> Eq SetRepositoryPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetRepositoryPolicyResponse -> SetRepositoryPolicyResponse -> Bool
$c/= :: SetRepositoryPolicyResponse -> SetRepositoryPolicyResponse -> Bool
== :: SetRepositoryPolicyResponse -> SetRepositoryPolicyResponse -> Bool
$c== :: SetRepositoryPolicyResponse -> SetRepositoryPolicyResponse -> Bool
Prelude.Eq, ReadPrec [SetRepositoryPolicyResponse]
ReadPrec SetRepositoryPolicyResponse
Int -> ReadS SetRepositoryPolicyResponse
ReadS [SetRepositoryPolicyResponse]
(Int -> ReadS SetRepositoryPolicyResponse)
-> ReadS [SetRepositoryPolicyResponse]
-> ReadPrec SetRepositoryPolicyResponse
-> ReadPrec [SetRepositoryPolicyResponse]
-> Read SetRepositoryPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetRepositoryPolicyResponse]
$creadListPrec :: ReadPrec [SetRepositoryPolicyResponse]
readPrec :: ReadPrec SetRepositoryPolicyResponse
$creadPrec :: ReadPrec SetRepositoryPolicyResponse
readList :: ReadS [SetRepositoryPolicyResponse]
$creadList :: ReadS [SetRepositoryPolicyResponse]
readsPrec :: Int -> ReadS SetRepositoryPolicyResponse
$creadsPrec :: Int -> ReadS SetRepositoryPolicyResponse
Prelude.Read, Int -> SetRepositoryPolicyResponse -> ShowS
[SetRepositoryPolicyResponse] -> ShowS
SetRepositoryPolicyResponse -> String
(Int -> SetRepositoryPolicyResponse -> ShowS)
-> (SetRepositoryPolicyResponse -> String)
-> ([SetRepositoryPolicyResponse] -> ShowS)
-> Show SetRepositoryPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetRepositoryPolicyResponse] -> ShowS
$cshowList :: [SetRepositoryPolicyResponse] -> ShowS
show :: SetRepositoryPolicyResponse -> String
$cshow :: SetRepositoryPolicyResponse -> String
showsPrec :: Int -> SetRepositoryPolicyResponse -> ShowS
$cshowsPrec :: Int -> SetRepositoryPolicyResponse -> ShowS
Prelude.Show, (forall x.
 SetRepositoryPolicyResponse -> Rep SetRepositoryPolicyResponse x)
-> (forall x.
    Rep SetRepositoryPolicyResponse x -> SetRepositoryPolicyResponse)
-> Generic SetRepositoryPolicyResponse
forall x.
Rep SetRepositoryPolicyResponse x -> SetRepositoryPolicyResponse
forall x.
SetRepositoryPolicyResponse -> Rep SetRepositoryPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetRepositoryPolicyResponse x -> SetRepositoryPolicyResponse
$cfrom :: forall x.
SetRepositoryPolicyResponse -> Rep SetRepositoryPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'SetRepositoryPolicyResponse' 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:
--
-- 'registryId', 'setRepositoryPolicyResponse_registryId' - The registry ID associated with the request.
--
-- 'repositoryName', 'setRepositoryPolicyResponse_repositoryName' - The repository name associated with the request.
--
-- 'policyText', 'setRepositoryPolicyResponse_policyText' - The JSON repository policy text applied to the repository.
--
-- 'httpStatus', 'setRepositoryPolicyResponse_httpStatus' - The response's http status code.
newSetRepositoryPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SetRepositoryPolicyResponse
newSetRepositoryPolicyResponse :: Int -> SetRepositoryPolicyResponse
newSetRepositoryPolicyResponse Int
pHttpStatus_ =
  SetRepositoryPolicyResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> SetRepositoryPolicyResponse
SetRepositoryPolicyResponse'
    { $sel:registryId:SetRepositoryPolicyResponse' :: Maybe Text
registryId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:SetRepositoryPolicyResponse' :: Maybe Text
repositoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyText:SetRepositoryPolicyResponse' :: Maybe Text
policyText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SetRepositoryPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The registry ID associated with the request.
setRepositoryPolicyResponse_registryId :: Lens.Lens' SetRepositoryPolicyResponse (Prelude.Maybe Prelude.Text)
setRepositoryPolicyResponse_registryId :: (Maybe Text -> f (Maybe Text))
-> SetRepositoryPolicyResponse -> f SetRepositoryPolicyResponse
setRepositoryPolicyResponse_registryId = (SetRepositoryPolicyResponse -> Maybe Text)
-> (SetRepositoryPolicyResponse
    -> Maybe Text -> SetRepositoryPolicyResponse)
-> Lens
     SetRepositoryPolicyResponse
     SetRepositoryPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRepositoryPolicyResponse' {Maybe Text
registryId :: Maybe Text
$sel:registryId:SetRepositoryPolicyResponse' :: SetRepositoryPolicyResponse -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: SetRepositoryPolicyResponse
s@SetRepositoryPolicyResponse' {} Maybe Text
a -> SetRepositoryPolicyResponse
s {$sel:registryId:SetRepositoryPolicyResponse' :: Maybe Text
registryId = Maybe Text
a} :: SetRepositoryPolicyResponse)

-- | The repository name associated with the request.
setRepositoryPolicyResponse_repositoryName :: Lens.Lens' SetRepositoryPolicyResponse (Prelude.Maybe Prelude.Text)
setRepositoryPolicyResponse_repositoryName :: (Maybe Text -> f (Maybe Text))
-> SetRepositoryPolicyResponse -> f SetRepositoryPolicyResponse
setRepositoryPolicyResponse_repositoryName = (SetRepositoryPolicyResponse -> Maybe Text)
-> (SetRepositoryPolicyResponse
    -> Maybe Text -> SetRepositoryPolicyResponse)
-> Lens
     SetRepositoryPolicyResponse
     SetRepositoryPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRepositoryPolicyResponse' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:SetRepositoryPolicyResponse' :: SetRepositoryPolicyResponse -> Maybe Text
repositoryName} -> Maybe Text
repositoryName) (\s :: SetRepositoryPolicyResponse
s@SetRepositoryPolicyResponse' {} Maybe Text
a -> SetRepositoryPolicyResponse
s {$sel:repositoryName:SetRepositoryPolicyResponse' :: Maybe Text
repositoryName = Maybe Text
a} :: SetRepositoryPolicyResponse)

-- | The JSON repository policy text applied to the repository.
setRepositoryPolicyResponse_policyText :: Lens.Lens' SetRepositoryPolicyResponse (Prelude.Maybe Prelude.Text)
setRepositoryPolicyResponse_policyText :: (Maybe Text -> f (Maybe Text))
-> SetRepositoryPolicyResponse -> f SetRepositoryPolicyResponse
setRepositoryPolicyResponse_policyText = (SetRepositoryPolicyResponse -> Maybe Text)
-> (SetRepositoryPolicyResponse
    -> Maybe Text -> SetRepositoryPolicyResponse)
-> Lens
     SetRepositoryPolicyResponse
     SetRepositoryPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRepositoryPolicyResponse' {Maybe Text
policyText :: Maybe Text
$sel:policyText:SetRepositoryPolicyResponse' :: SetRepositoryPolicyResponse -> Maybe Text
policyText} -> Maybe Text
policyText) (\s :: SetRepositoryPolicyResponse
s@SetRepositoryPolicyResponse' {} Maybe Text
a -> SetRepositoryPolicyResponse
s {$sel:policyText:SetRepositoryPolicyResponse' :: Maybe Text
policyText = Maybe Text
a} :: SetRepositoryPolicyResponse)

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

instance Prelude.NFData SetRepositoryPolicyResponse