{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Grafana.Types
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
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]
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
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. 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'
{ $sel:licenseType:AssociateLicense' :: LicenseType
licenseType = LicenseType
pLicenseType_,
$sel:workspaceId:AssociateLicense' :: Text
workspaceId = Text
pWorkspaceId_
}
associateLicense_licenseType :: Lens.Lens' AssociateLicense LicenseType
associateLicense_licenseType :: Lens' AssociateLicense LicenseType
associateLicense_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 :: Lens' AssociateLicense Text
associateLicense_workspaceId = 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 :: (Service -> Service)
-> AssociateLicense -> Request AssociateLicense
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateLicense
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateLicense)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> WorkspaceDescription -> AssociateLicenseResponse
AssociateLicenseResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"workspace")
)
instance Prelude.Hashable AssociateLicense where
hashWithSalt :: Int -> AssociateLicense -> Int
hashWithSalt Int
_salt AssociateLicense' {Text
LicenseType
workspaceId :: Text
licenseType :: LicenseType
$sel:workspaceId:AssociateLicense' :: AssociateLicense -> Text
$sel:licenseType:AssociateLicense' :: AssociateLicense -> LicenseType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LicenseType
licenseType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workspaceId
instance Prelude.NFData AssociateLicense where
rnf :: AssociateLicense -> ()
rnf AssociateLicense' {Text
LicenseType
workspaceId :: Text
licenseType :: LicenseType
$sel:workspaceId:AssociateLicense' :: AssociateLicense -> Text
$sel:licenseType:AssociateLicense' :: AssociateLicense -> LicenseType
..} =
forall a. NFData a => a -> ()
Prelude.rnf LicenseType
licenseType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workspaceId
instance Data.ToHeaders AssociateLicense where
toHeaders :: AssociateLicense -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AssociateLicense where
toJSON :: AssociateLicense -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)
instance Data.ToPath AssociateLicense where
toPath :: AssociateLicense -> ByteString
toPath AssociateLicense' {Text
LicenseType
workspaceId :: Text
licenseType :: LicenseType
$sel:workspaceId:AssociateLicense' :: AssociateLicense -> Text
$sel:licenseType:AssociateLicense' :: AssociateLicense -> LicenseType
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/workspaces/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
workspaceId,
ByteString
"/licenses/",
forall a. ToByteString a => a -> ByteString
Data.toBS LicenseType
licenseType
]
instance Data.ToQuery AssociateLicense where
toQuery :: AssociateLicense -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AssociateLicenseResponse = AssociateLicenseResponse'
{
AssociateLicenseResponse -> Int
httpStatus :: Prelude.Int,
AssociateLicenseResponse -> WorkspaceDescription
workspace :: WorkspaceDescription
}
deriving (AssociateLicenseResponse -> AssociateLicenseResponse -> Bool
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
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.
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'
{ $sel:httpStatus:AssociateLicenseResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:workspace:AssociateLicenseResponse' :: WorkspaceDescription
workspace = WorkspaceDescription
pWorkspace_
}
associateLicenseResponse_httpStatus :: Lens.Lens' AssociateLicenseResponse Prelude.Int
associateLicenseResponse_httpStatus :: Lens' AssociateLicenseResponse Int
associateLicenseResponse_httpStatus = 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 :: Lens' AssociateLicenseResponse WorkspaceDescription
associateLicenseResponse_workspace = 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 where
rnf :: AssociateLicenseResponse -> ()
rnf AssociateLicenseResponse' {Int
WorkspaceDescription
workspace :: WorkspaceDescription
httpStatus :: Int
$sel:workspace:AssociateLicenseResponse' :: AssociateLicenseResponse -> WorkspaceDescription
$sel:httpStatus:AssociateLicenseResponse' :: AssociateLicenseResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WorkspaceDescription
workspace