{-# 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 #-}
module Amazonka.Grafana.AssociateLicense
(
AssociateLicense (..),
newAssociateLicense,
associateLicense_licenseType,
associateLicense_workspaceId,
AssociateLicenseResponse (..),
newAssociateLicenseResponse,
associateLicenseResponse_httpStatus,
associateLicenseResponse_workspace,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Grafana.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
data AssociateLicense = AssociateLicense'
{
AssociateLicense -> LicenseType
licenseType :: LicenseType,
AssociateLicense -> Text
workspaceId :: Prelude.Text
}
deriving (AssociateLicense -> AssociateLicense -> Bool
(AssociateLicense -> AssociateLicense -> Bool)
-> (AssociateLicense -> AssociateLicense -> Bool)
-> Eq AssociateLicense
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateLicense -> AssociateLicense -> Bool
$c/= :: AssociateLicense -> AssociateLicense -> Bool
== :: AssociateLicense -> AssociateLicense -> Bool
$c== :: AssociateLicense -> AssociateLicense -> Bool
Prelude.Eq, ReadPrec [AssociateLicense]
ReadPrec AssociateLicense
Int -> ReadS AssociateLicense
ReadS [AssociateLicense]
(Int -> ReadS AssociateLicense)
-> ReadS [AssociateLicense]
-> ReadPrec AssociateLicense
-> ReadPrec [AssociateLicense]
-> Read AssociateLicense
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateLicense]
$creadListPrec :: ReadPrec [AssociateLicense]
readPrec :: ReadPrec AssociateLicense
$creadPrec :: ReadPrec AssociateLicense
readList :: ReadS [AssociateLicense]
$creadList :: ReadS [AssociateLicense]
readsPrec :: Int -> ReadS AssociateLicense
$creadsPrec :: Int -> ReadS AssociateLicense
Prelude.Read, Int -> AssociateLicense -> ShowS
[AssociateLicense] -> ShowS
AssociateLicense -> String
(Int -> AssociateLicense -> ShowS)
-> (AssociateLicense -> String)
-> ([AssociateLicense] -> ShowS)
-> Show AssociateLicense
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateLicense] -> ShowS
$cshowList :: [AssociateLicense] -> ShowS
show :: AssociateLicense -> String
$cshow :: AssociateLicense -> String
showsPrec :: Int -> AssociateLicense -> ShowS
$cshowsPrec :: Int -> AssociateLicense -> ShowS
Prelude.Show, (forall x. AssociateLicense -> Rep AssociateLicense x)
-> (forall x. Rep AssociateLicense x -> AssociateLicense)
-> Generic AssociateLicense
forall x. Rep AssociateLicense x -> AssociateLicense
forall x. AssociateLicense -> Rep AssociateLicense x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateLicense x -> AssociateLicense
$cfrom :: forall x. AssociateLicense -> Rep AssociateLicense x
Prelude.Generic)
newAssociateLicense ::
LicenseType ->
Prelude.Text ->
AssociateLicense
newAssociateLicense :: LicenseType -> Text -> AssociateLicense
newAssociateLicense LicenseType
pLicenseType_ Text
pWorkspaceId_ =
AssociateLicense' :: LicenseType -> Text -> AssociateLicense
AssociateLicense'
{ $sel:licenseType:AssociateLicense' :: LicenseType
licenseType = LicenseType
pLicenseType_,
$sel:workspaceId:AssociateLicense' :: Text
workspaceId = Text
pWorkspaceId_
}
associateLicense_licenseType :: Lens.Lens' AssociateLicense LicenseType
associateLicense_licenseType :: (LicenseType -> f LicenseType)
-> AssociateLicense -> f AssociateLicense
associateLicense_licenseType = (AssociateLicense -> LicenseType)
-> (AssociateLicense -> LicenseType -> AssociateLicense)
-> Lens AssociateLicense AssociateLicense LicenseType LicenseType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateLicense' {LicenseType
licenseType :: LicenseType
$sel:licenseType:AssociateLicense' :: AssociateLicense -> LicenseType
licenseType} -> LicenseType
licenseType) (\s :: AssociateLicense
s@AssociateLicense' {} LicenseType
a -> AssociateLicense
s {$sel:licenseType:AssociateLicense' :: LicenseType
licenseType = LicenseType
a} :: AssociateLicense)
associateLicense_workspaceId :: Lens.Lens' AssociateLicense Prelude.Text
associateLicense_workspaceId :: (Text -> f Text) -> AssociateLicense -> f AssociateLicense
associateLicense_workspaceId = (AssociateLicense -> Text)
-> (AssociateLicense -> Text -> AssociateLicense)
-> Lens AssociateLicense AssociateLicense Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateLicense' {Text
workspaceId :: Text
$sel:workspaceId:AssociateLicense' :: AssociateLicense -> Text
workspaceId} -> Text
workspaceId) (\s :: AssociateLicense
s@AssociateLicense' {} Text
a -> AssociateLicense
s {$sel:workspaceId:AssociateLicense' :: Text
workspaceId = Text
a} :: AssociateLicense)
instance Core.AWSRequest AssociateLicense where
type
AWSResponse AssociateLicense =
AssociateLicenseResponse
request :: AssociateLicense -> Request AssociateLicense
request = Service -> AssociateLicense -> Request AssociateLicense
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateLicense
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateLicense)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateLicense))
-> Logger
-> Service
-> Proxy AssociateLicense
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateLicense)))
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 -> WorkspaceDescription -> AssociateLicenseResponse
AssociateLicenseResponse'
(Int -> WorkspaceDescription -> AssociateLicenseResponse)
-> Either String Int
-> Either String (WorkspaceDescription -> AssociateLicenseResponse)
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 (WorkspaceDescription -> AssociateLicenseResponse)
-> Either String WorkspaceDescription
-> Either String AssociateLicenseResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String WorkspaceDescription
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"workspace")
)
instance Prelude.Hashable AssociateLicense
instance Prelude.NFData AssociateLicense
instance Core.ToHeaders AssociateLicense where
toHeaders :: AssociateLicense -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateLicense -> 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 AssociateLicense where
toJSON :: AssociateLicense -> Value
toJSON = Value -> AssociateLicense -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath AssociateLicense where
toPath :: AssociateLicense -> ByteString
toPath AssociateLicense' {Text
LicenseType
workspaceId :: Text
licenseType :: LicenseType
$sel:workspaceId:AssociateLicense' :: AssociateLicense -> Text
$sel:licenseType:AssociateLicense' :: AssociateLicense -> LicenseType
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/workspaces/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId,
ByteString
"/licenses/",
LicenseType -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS LicenseType
licenseType
]
instance Core.ToQuery AssociateLicense where
toQuery :: AssociateLicense -> QueryString
toQuery = QueryString -> AssociateLicense -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateLicenseResponse = AssociateLicenseResponse'
{
AssociateLicenseResponse -> Int
httpStatus :: Prelude.Int,
AssociateLicenseResponse -> WorkspaceDescription
workspace :: WorkspaceDescription
}
deriving (AssociateLicenseResponse -> AssociateLicenseResponse -> Bool
(AssociateLicenseResponse -> AssociateLicenseResponse -> Bool)
-> (AssociateLicenseResponse -> AssociateLicenseResponse -> Bool)
-> Eq AssociateLicenseResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateLicenseResponse -> AssociateLicenseResponse -> Bool
$c/= :: AssociateLicenseResponse -> AssociateLicenseResponse -> Bool
== :: AssociateLicenseResponse -> AssociateLicenseResponse -> Bool
$c== :: AssociateLicenseResponse -> AssociateLicenseResponse -> Bool
Prelude.Eq, Int -> AssociateLicenseResponse -> ShowS
[AssociateLicenseResponse] -> ShowS
AssociateLicenseResponse -> String
(Int -> AssociateLicenseResponse -> ShowS)
-> (AssociateLicenseResponse -> String)
-> ([AssociateLicenseResponse] -> ShowS)
-> Show AssociateLicenseResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateLicenseResponse] -> ShowS
$cshowList :: [AssociateLicenseResponse] -> ShowS
show :: AssociateLicenseResponse -> String
$cshow :: AssociateLicenseResponse -> String
showsPrec :: Int -> AssociateLicenseResponse -> ShowS
$cshowsPrec :: Int -> AssociateLicenseResponse -> ShowS
Prelude.Show, (forall x.
AssociateLicenseResponse -> Rep AssociateLicenseResponse x)
-> (forall x.
Rep AssociateLicenseResponse x -> AssociateLicenseResponse)
-> Generic AssociateLicenseResponse
forall x.
Rep AssociateLicenseResponse x -> AssociateLicenseResponse
forall x.
AssociateLicenseResponse -> Rep AssociateLicenseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateLicenseResponse x -> AssociateLicenseResponse
$cfrom :: forall x.
AssociateLicenseResponse -> Rep AssociateLicenseResponse x
Prelude.Generic)
newAssociateLicenseResponse ::
Prelude.Int ->
WorkspaceDescription ->
AssociateLicenseResponse
newAssociateLicenseResponse :: Int -> WorkspaceDescription -> AssociateLicenseResponse
newAssociateLicenseResponse Int
pHttpStatus_ WorkspaceDescription
pWorkspace_ =
AssociateLicenseResponse' :: Int -> WorkspaceDescription -> AssociateLicenseResponse
AssociateLicenseResponse'
{ $sel:httpStatus:AssociateLicenseResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:workspace:AssociateLicenseResponse' :: WorkspaceDescription
workspace = WorkspaceDescription
pWorkspace_
}
associateLicenseResponse_httpStatus :: Lens.Lens' AssociateLicenseResponse Prelude.Int
associateLicenseResponse_httpStatus :: (Int -> f Int)
-> AssociateLicenseResponse -> f AssociateLicenseResponse
associateLicenseResponse_httpStatus = (AssociateLicenseResponse -> Int)
-> (AssociateLicenseResponse -> Int -> AssociateLicenseResponse)
-> Lens AssociateLicenseResponse AssociateLicenseResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateLicenseResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateLicenseResponse' :: AssociateLicenseResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateLicenseResponse
s@AssociateLicenseResponse' {} Int
a -> AssociateLicenseResponse
s {$sel:httpStatus:AssociateLicenseResponse' :: Int
httpStatus = Int
a} :: AssociateLicenseResponse)
associateLicenseResponse_workspace :: Lens.Lens' AssociateLicenseResponse WorkspaceDescription
associateLicenseResponse_workspace :: (WorkspaceDescription -> f WorkspaceDescription)
-> AssociateLicenseResponse -> f AssociateLicenseResponse
associateLicenseResponse_workspace = (AssociateLicenseResponse -> WorkspaceDescription)
-> (AssociateLicenseResponse
-> WorkspaceDescription -> AssociateLicenseResponse)
-> Lens
AssociateLicenseResponse
AssociateLicenseResponse
WorkspaceDescription
WorkspaceDescription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateLicenseResponse' {WorkspaceDescription
workspace :: WorkspaceDescription
$sel:workspace:AssociateLicenseResponse' :: AssociateLicenseResponse -> WorkspaceDescription
workspace} -> WorkspaceDescription
workspace) (\s :: AssociateLicenseResponse
s@AssociateLicenseResponse' {} WorkspaceDescription
a -> AssociateLicenseResponse
s {$sel:workspace:AssociateLicenseResponse' :: WorkspaceDescription
workspace = WorkspaceDescription
a} :: AssociateLicenseResponse)
instance Prelude.NFData AssociateLicenseResponse