{-# 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.Proton.UpdateServiceInstance
-- 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)
--
-- Update a service instance.
--
-- There are four modes for updating a service instance as described in the
-- following. The @deploymentType@ field defines the mode.
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     new spec that you provide. Only requested parameters are updated.
--     /Don’t/ include minor or major version parameters when you use this
--     @deployment-type@.
--
-- []
--     @MINOR_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     published, recommended (latest) minor version of the current major
--     version in use, by default. You can also specify a different minor
--     version of the current major version in use.
--
-- []
--     @MAJOR_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     published, recommended (latest) major and minor version of the
--     current template, by default. You can also specify a different major
--     version that is higher than the major version in use and a minor
--     version (optional).
module Amazonka.Proton.UpdateServiceInstance
  ( -- * Creating a Request
    UpdateServiceInstance (..),
    newUpdateServiceInstance,

    -- * Request Lenses
    updateServiceInstance_spec,
    updateServiceInstance_templateMinorVersion,
    updateServiceInstance_templateMajorVersion,
    updateServiceInstance_deploymentType,
    updateServiceInstance_name,
    updateServiceInstance_serviceName,

    -- * Destructuring the Response
    UpdateServiceInstanceResponse (..),
    newUpdateServiceInstanceResponse,

    -- * Response Lenses
    updateServiceInstanceResponse_httpStatus,
    updateServiceInstanceResponse_serviceInstance,
  )
where

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

-- | /See:/ 'newUpdateServiceInstance' smart constructor.
data UpdateServiceInstance = UpdateServiceInstance'
  { -- | The formatted specification that defines the service instance update.
    UpdateServiceInstance -> Maybe (Sensitive Text)
spec :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The minor version of the service template to update.
    UpdateServiceInstance -> Maybe Text
templateMinorVersion :: Prelude.Maybe Prelude.Text,
    -- | The major version of the service template to update.
    UpdateServiceInstance -> Maybe Text
templateMajorVersion :: Prelude.Maybe Prelude.Text,
    -- | The deployment type.
    --
    -- There are four modes for updating a service instance as described in the
    -- following. The @deploymentType@ field defines the mode.
    --
    -- []
    --     @NONE@
    --
    --     In this mode, a deployment /doesn\'t/ occur. Only the requested
    --     metadata parameters are updated.
    --
    -- []
    --     @CURRENT_VERSION@
    --
    --     In this mode, the service instance is deployed and updated with the
    --     new spec that you provide. Only requested parameters are updated.
    --     /Don’t/ include minor or major version parameters when you use this
    --     @deployment-type@.
    --
    -- []
    --     @MINOR_VERSION@
    --
    --     In this mode, the service instance is deployed and updated with the
    --     published, recommended (latest) minor version of the current major
    --     version in use, by default. You can also specify a different minor
    --     version of the current major version in use.
    --
    -- []
    --     @MAJOR_VERSION@
    --
    --     In this mode, the service instance is deployed and updated with the
    --     published, recommended (latest) major and minor version of the
    --     current template, by default. You can also specify a different major
    --     version that is higher than the major version in use and a minor
    --     version (optional).
    UpdateServiceInstance -> DeploymentUpdateType
deploymentType :: DeploymentUpdateType,
    -- | The name of the service instance to update.
    UpdateServiceInstance -> Text
name :: Prelude.Text,
    -- | The name of the service that the service instance belongs to.
    UpdateServiceInstance -> Text
serviceName :: Prelude.Text
  }
  deriving (UpdateServiceInstance -> UpdateServiceInstance -> Bool
(UpdateServiceInstance -> UpdateServiceInstance -> Bool)
-> (UpdateServiceInstance -> UpdateServiceInstance -> Bool)
-> Eq UpdateServiceInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateServiceInstance -> UpdateServiceInstance -> Bool
$c/= :: UpdateServiceInstance -> UpdateServiceInstance -> Bool
== :: UpdateServiceInstance -> UpdateServiceInstance -> Bool
$c== :: UpdateServiceInstance -> UpdateServiceInstance -> Bool
Prelude.Eq, Int -> UpdateServiceInstance -> ShowS
[UpdateServiceInstance] -> ShowS
UpdateServiceInstance -> String
(Int -> UpdateServiceInstance -> ShowS)
-> (UpdateServiceInstance -> String)
-> ([UpdateServiceInstance] -> ShowS)
-> Show UpdateServiceInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateServiceInstance] -> ShowS
$cshowList :: [UpdateServiceInstance] -> ShowS
show :: UpdateServiceInstance -> String
$cshow :: UpdateServiceInstance -> String
showsPrec :: Int -> UpdateServiceInstance -> ShowS
$cshowsPrec :: Int -> UpdateServiceInstance -> ShowS
Prelude.Show, (forall x. UpdateServiceInstance -> Rep UpdateServiceInstance x)
-> (forall x. Rep UpdateServiceInstance x -> UpdateServiceInstance)
-> Generic UpdateServiceInstance
forall x. Rep UpdateServiceInstance x -> UpdateServiceInstance
forall x. UpdateServiceInstance -> Rep UpdateServiceInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateServiceInstance x -> UpdateServiceInstance
$cfrom :: forall x. UpdateServiceInstance -> Rep UpdateServiceInstance x
Prelude.Generic)

-- |
-- Create a value of 'UpdateServiceInstance' 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:
--
-- 'spec', 'updateServiceInstance_spec' - The formatted specification that defines the service instance update.
--
-- 'templateMinorVersion', 'updateServiceInstance_templateMinorVersion' - The minor version of the service template to update.
--
-- 'templateMajorVersion', 'updateServiceInstance_templateMajorVersion' - The major version of the service template to update.
--
-- 'deploymentType', 'updateServiceInstance_deploymentType' - The deployment type.
--
-- There are four modes for updating a service instance as described in the
-- following. The @deploymentType@ field defines the mode.
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     new spec that you provide. Only requested parameters are updated.
--     /Don’t/ include minor or major version parameters when you use this
--     @deployment-type@.
--
-- []
--     @MINOR_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     published, recommended (latest) minor version of the current major
--     version in use, by default. You can also specify a different minor
--     version of the current major version in use.
--
-- []
--     @MAJOR_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     published, recommended (latest) major and minor version of the
--     current template, by default. You can also specify a different major
--     version that is higher than the major version in use and a minor
--     version (optional).
--
-- 'name', 'updateServiceInstance_name' - The name of the service instance to update.
--
-- 'serviceName', 'updateServiceInstance_serviceName' - The name of the service that the service instance belongs to.
newUpdateServiceInstance ::
  -- | 'deploymentType'
  DeploymentUpdateType ->
  -- | 'name'
  Prelude.Text ->
  -- | 'serviceName'
  Prelude.Text ->
  UpdateServiceInstance
newUpdateServiceInstance :: DeploymentUpdateType -> Text -> Text -> UpdateServiceInstance
newUpdateServiceInstance
  DeploymentUpdateType
pDeploymentType_
  Text
pName_
  Text
pServiceName_ =
    UpdateServiceInstance' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Text
-> DeploymentUpdateType
-> Text
-> Text
-> UpdateServiceInstance
UpdateServiceInstance'
      { $sel:spec:UpdateServiceInstance' :: Maybe (Sensitive Text)
spec = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:templateMinorVersion:UpdateServiceInstance' :: Maybe Text
templateMinorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:templateMajorVersion:UpdateServiceInstance' :: Maybe Text
templateMajorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:deploymentType:UpdateServiceInstance' :: DeploymentUpdateType
deploymentType = DeploymentUpdateType
pDeploymentType_,
        $sel:name:UpdateServiceInstance' :: Text
name = Text
pName_,
        $sel:serviceName:UpdateServiceInstance' :: Text
serviceName = Text
pServiceName_
      }

-- | The formatted specification that defines the service instance update.
updateServiceInstance_spec :: Lens.Lens' UpdateServiceInstance (Prelude.Maybe Prelude.Text)
updateServiceInstance_spec :: (Maybe Text -> f (Maybe Text))
-> UpdateServiceInstance -> f UpdateServiceInstance
updateServiceInstance_spec = (UpdateServiceInstance -> Maybe (Sensitive Text))
-> (UpdateServiceInstance
    -> Maybe (Sensitive Text) -> UpdateServiceInstance)
-> Lens
     UpdateServiceInstance
     UpdateServiceInstance
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceInstance' {Maybe (Sensitive Text)
spec :: Maybe (Sensitive Text)
$sel:spec:UpdateServiceInstance' :: UpdateServiceInstance -> Maybe (Sensitive Text)
spec} -> Maybe (Sensitive Text)
spec) (\s :: UpdateServiceInstance
s@UpdateServiceInstance' {} Maybe (Sensitive Text)
a -> UpdateServiceInstance
s {$sel:spec:UpdateServiceInstance' :: Maybe (Sensitive Text)
spec = Maybe (Sensitive Text)
a} :: UpdateServiceInstance) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UpdateServiceInstance -> f UpdateServiceInstance)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UpdateServiceInstance
-> f UpdateServiceInstance
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 minor version of the service template to update.
updateServiceInstance_templateMinorVersion :: Lens.Lens' UpdateServiceInstance (Prelude.Maybe Prelude.Text)
updateServiceInstance_templateMinorVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateServiceInstance -> f UpdateServiceInstance
updateServiceInstance_templateMinorVersion = (UpdateServiceInstance -> Maybe Text)
-> (UpdateServiceInstance -> Maybe Text -> UpdateServiceInstance)
-> Lens
     UpdateServiceInstance
     UpdateServiceInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceInstance' {Maybe Text
templateMinorVersion :: Maybe Text
$sel:templateMinorVersion:UpdateServiceInstance' :: UpdateServiceInstance -> Maybe Text
templateMinorVersion} -> Maybe Text
templateMinorVersion) (\s :: UpdateServiceInstance
s@UpdateServiceInstance' {} Maybe Text
a -> UpdateServiceInstance
s {$sel:templateMinorVersion:UpdateServiceInstance' :: Maybe Text
templateMinorVersion = Maybe Text
a} :: UpdateServiceInstance)

-- | The major version of the service template to update.
updateServiceInstance_templateMajorVersion :: Lens.Lens' UpdateServiceInstance (Prelude.Maybe Prelude.Text)
updateServiceInstance_templateMajorVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateServiceInstance -> f UpdateServiceInstance
updateServiceInstance_templateMajorVersion = (UpdateServiceInstance -> Maybe Text)
-> (UpdateServiceInstance -> Maybe Text -> UpdateServiceInstance)
-> Lens
     UpdateServiceInstance
     UpdateServiceInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceInstance' {Maybe Text
templateMajorVersion :: Maybe Text
$sel:templateMajorVersion:UpdateServiceInstance' :: UpdateServiceInstance -> Maybe Text
templateMajorVersion} -> Maybe Text
templateMajorVersion) (\s :: UpdateServiceInstance
s@UpdateServiceInstance' {} Maybe Text
a -> UpdateServiceInstance
s {$sel:templateMajorVersion:UpdateServiceInstance' :: Maybe Text
templateMajorVersion = Maybe Text
a} :: UpdateServiceInstance)

-- | The deployment type.
--
-- There are four modes for updating a service instance as described in the
-- following. The @deploymentType@ field defines the mode.
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     new spec that you provide. Only requested parameters are updated.
--     /Don’t/ include minor or major version parameters when you use this
--     @deployment-type@.
--
-- []
--     @MINOR_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     published, recommended (latest) minor version of the current major
--     version in use, by default. You can also specify a different minor
--     version of the current major version in use.
--
-- []
--     @MAJOR_VERSION@
--
--     In this mode, the service instance is deployed and updated with the
--     published, recommended (latest) major and minor version of the
--     current template, by default. You can also specify a different major
--     version that is higher than the major version in use and a minor
--     version (optional).
updateServiceInstance_deploymentType :: Lens.Lens' UpdateServiceInstance DeploymentUpdateType
updateServiceInstance_deploymentType :: (DeploymentUpdateType -> f DeploymentUpdateType)
-> UpdateServiceInstance -> f UpdateServiceInstance
updateServiceInstance_deploymentType = (UpdateServiceInstance -> DeploymentUpdateType)
-> (UpdateServiceInstance
    -> DeploymentUpdateType -> UpdateServiceInstance)
-> Lens
     UpdateServiceInstance
     UpdateServiceInstance
     DeploymentUpdateType
     DeploymentUpdateType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceInstance' {DeploymentUpdateType
deploymentType :: DeploymentUpdateType
$sel:deploymentType:UpdateServiceInstance' :: UpdateServiceInstance -> DeploymentUpdateType
deploymentType} -> DeploymentUpdateType
deploymentType) (\s :: UpdateServiceInstance
s@UpdateServiceInstance' {} DeploymentUpdateType
a -> UpdateServiceInstance
s {$sel:deploymentType:UpdateServiceInstance' :: DeploymentUpdateType
deploymentType = DeploymentUpdateType
a} :: UpdateServiceInstance)

-- | The name of the service instance to update.
updateServiceInstance_name :: Lens.Lens' UpdateServiceInstance Prelude.Text
updateServiceInstance_name :: (Text -> f Text)
-> UpdateServiceInstance -> f UpdateServiceInstance
updateServiceInstance_name = (UpdateServiceInstance -> Text)
-> (UpdateServiceInstance -> Text -> UpdateServiceInstance)
-> Lens UpdateServiceInstance UpdateServiceInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceInstance' {Text
name :: Text
$sel:name:UpdateServiceInstance' :: UpdateServiceInstance -> Text
name} -> Text
name) (\s :: UpdateServiceInstance
s@UpdateServiceInstance' {} Text
a -> UpdateServiceInstance
s {$sel:name:UpdateServiceInstance' :: Text
name = Text
a} :: UpdateServiceInstance)

-- | The name of the service that the service instance belongs to.
updateServiceInstance_serviceName :: Lens.Lens' UpdateServiceInstance Prelude.Text
updateServiceInstance_serviceName :: (Text -> f Text)
-> UpdateServiceInstance -> f UpdateServiceInstance
updateServiceInstance_serviceName = (UpdateServiceInstance -> Text)
-> (UpdateServiceInstance -> Text -> UpdateServiceInstance)
-> Lens UpdateServiceInstance UpdateServiceInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceInstance' {Text
serviceName :: Text
$sel:serviceName:UpdateServiceInstance' :: UpdateServiceInstance -> Text
serviceName} -> Text
serviceName) (\s :: UpdateServiceInstance
s@UpdateServiceInstance' {} Text
a -> UpdateServiceInstance
s {$sel:serviceName:UpdateServiceInstance' :: Text
serviceName = Text
a} :: UpdateServiceInstance)

instance Core.AWSRequest UpdateServiceInstance where
  type
    AWSResponse UpdateServiceInstance =
      UpdateServiceInstanceResponse
  request :: UpdateServiceInstance -> Request UpdateServiceInstance
request = Service -> UpdateServiceInstance -> Request UpdateServiceInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateServiceInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateServiceInstance)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateServiceInstance))
-> Logger
-> Service
-> Proxy UpdateServiceInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateServiceInstance)))
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 ->
          Int -> ServiceInstance -> UpdateServiceInstanceResponse
UpdateServiceInstanceResponse'
            (Int -> ServiceInstance -> UpdateServiceInstanceResponse)
-> Either String Int
-> Either String (ServiceInstance -> UpdateServiceInstanceResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (ServiceInstance -> UpdateServiceInstanceResponse)
-> Either String ServiceInstance
-> Either String UpdateServiceInstanceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ServiceInstance
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"serviceInstance")
      )

instance Prelude.Hashable UpdateServiceInstance

instance Prelude.NFData UpdateServiceInstance

instance Core.ToHeaders UpdateServiceInstance where
  toHeaders :: UpdateServiceInstance -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateServiceInstance -> 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
"AwsProton20200720.UpdateServiceInstance" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateServiceInstance where
  toJSON :: UpdateServiceInstance -> Value
toJSON UpdateServiceInstance' {Maybe Text
Maybe (Sensitive Text)
Text
DeploymentUpdateType
serviceName :: Text
name :: Text
deploymentType :: DeploymentUpdateType
templateMajorVersion :: Maybe Text
templateMinorVersion :: Maybe Text
spec :: Maybe (Sensitive Text)
$sel:serviceName:UpdateServiceInstance' :: UpdateServiceInstance -> Text
$sel:name:UpdateServiceInstance' :: UpdateServiceInstance -> Text
$sel:deploymentType:UpdateServiceInstance' :: UpdateServiceInstance -> DeploymentUpdateType
$sel:templateMajorVersion:UpdateServiceInstance' :: UpdateServiceInstance -> Maybe Text
$sel:templateMinorVersion:UpdateServiceInstance' :: UpdateServiceInstance -> Maybe Text
$sel:spec:UpdateServiceInstance' :: UpdateServiceInstance -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"spec" 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)
spec,
            (Text
"templateMinorVersion" 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
templateMinorVersion,
            (Text
"templateMajorVersion" 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
templateMajorVersion,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"deploymentType" Text -> DeploymentUpdateType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeploymentUpdateType
deploymentType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"serviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceName)
          ]
      )

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

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

-- | /See:/ 'newUpdateServiceInstanceResponse' smart constructor.
data UpdateServiceInstanceResponse = UpdateServiceInstanceResponse'
  { -- | The response's http status code.
    UpdateServiceInstanceResponse -> Int
httpStatus :: Prelude.Int,
    -- | The service instance summary data returned by AWS Proton.
    UpdateServiceInstanceResponse -> ServiceInstance
serviceInstance :: ServiceInstance
  }
  deriving (UpdateServiceInstanceResponse
-> UpdateServiceInstanceResponse -> Bool
(UpdateServiceInstanceResponse
 -> UpdateServiceInstanceResponse -> Bool)
-> (UpdateServiceInstanceResponse
    -> UpdateServiceInstanceResponse -> Bool)
-> Eq UpdateServiceInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateServiceInstanceResponse
-> UpdateServiceInstanceResponse -> Bool
$c/= :: UpdateServiceInstanceResponse
-> UpdateServiceInstanceResponse -> Bool
== :: UpdateServiceInstanceResponse
-> UpdateServiceInstanceResponse -> Bool
$c== :: UpdateServiceInstanceResponse
-> UpdateServiceInstanceResponse -> Bool
Prelude.Eq, Int -> UpdateServiceInstanceResponse -> ShowS
[UpdateServiceInstanceResponse] -> ShowS
UpdateServiceInstanceResponse -> String
(Int -> UpdateServiceInstanceResponse -> ShowS)
-> (UpdateServiceInstanceResponse -> String)
-> ([UpdateServiceInstanceResponse] -> ShowS)
-> Show UpdateServiceInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateServiceInstanceResponse] -> ShowS
$cshowList :: [UpdateServiceInstanceResponse] -> ShowS
show :: UpdateServiceInstanceResponse -> String
$cshow :: UpdateServiceInstanceResponse -> String
showsPrec :: Int -> UpdateServiceInstanceResponse -> ShowS
$cshowsPrec :: Int -> UpdateServiceInstanceResponse -> ShowS
Prelude.Show, (forall x.
 UpdateServiceInstanceResponse
 -> Rep UpdateServiceInstanceResponse x)
-> (forall x.
    Rep UpdateServiceInstanceResponse x
    -> UpdateServiceInstanceResponse)
-> Generic UpdateServiceInstanceResponse
forall x.
Rep UpdateServiceInstanceResponse x
-> UpdateServiceInstanceResponse
forall x.
UpdateServiceInstanceResponse
-> Rep UpdateServiceInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateServiceInstanceResponse x
-> UpdateServiceInstanceResponse
$cfrom :: forall x.
UpdateServiceInstanceResponse
-> Rep UpdateServiceInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateServiceInstanceResponse' 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:
--
-- 'httpStatus', 'updateServiceInstanceResponse_httpStatus' - The response's http status code.
--
-- 'serviceInstance', 'updateServiceInstanceResponse_serviceInstance' - The service instance summary data returned by AWS Proton.
newUpdateServiceInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'serviceInstance'
  ServiceInstance ->
  UpdateServiceInstanceResponse
newUpdateServiceInstanceResponse :: Int -> ServiceInstance -> UpdateServiceInstanceResponse
newUpdateServiceInstanceResponse
  Int
pHttpStatus_
  ServiceInstance
pServiceInstance_ =
    UpdateServiceInstanceResponse' :: Int -> ServiceInstance -> UpdateServiceInstanceResponse
UpdateServiceInstanceResponse'
      { $sel:httpStatus:UpdateServiceInstanceResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:serviceInstance:UpdateServiceInstanceResponse' :: ServiceInstance
serviceInstance = ServiceInstance
pServiceInstance_
      }

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

-- | The service instance summary data returned by AWS Proton.
updateServiceInstanceResponse_serviceInstance :: Lens.Lens' UpdateServiceInstanceResponse ServiceInstance
updateServiceInstanceResponse_serviceInstance :: (ServiceInstance -> f ServiceInstance)
-> UpdateServiceInstanceResponse -> f UpdateServiceInstanceResponse
updateServiceInstanceResponse_serviceInstance = (UpdateServiceInstanceResponse -> ServiceInstance)
-> (UpdateServiceInstanceResponse
    -> ServiceInstance -> UpdateServiceInstanceResponse)
-> Lens
     UpdateServiceInstanceResponse
     UpdateServiceInstanceResponse
     ServiceInstance
     ServiceInstance
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceInstanceResponse' {ServiceInstance
serviceInstance :: ServiceInstance
$sel:serviceInstance:UpdateServiceInstanceResponse' :: UpdateServiceInstanceResponse -> ServiceInstance
serviceInstance} -> ServiceInstance
serviceInstance) (\s :: UpdateServiceInstanceResponse
s@UpdateServiceInstanceResponse' {} ServiceInstance
a -> UpdateServiceInstanceResponse
s {$sel:serviceInstance:UpdateServiceInstanceResponse' :: ServiceInstance
serviceInstance = ServiceInstance
a} :: UpdateServiceInstanceResponse)

instance Prelude.NFData UpdateServiceInstanceResponse