{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.APIGateway.Types.Resource
-- 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)
module Amazonka.APIGateway.Types.Resource where

import Amazonka.APIGateway.Types.Method
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents an API resource.
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html Create an API>
--
-- /See:/ 'newResource' smart constructor.
data Resource = Resource'
  { -- | The last path segment for this resource.
    Resource -> Maybe Text
pathPart :: Prelude.Maybe Prelude.Text,
    -- | The full path for this resource.
    Resource -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The resource\'s identifier.
    Resource -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Gets an API resource\'s method of a given HTTP verb.
    --
    -- The resource methods are a map of methods indexed by methods\' HTTP
    -- verbs enabled on the resource. This method map is included in the
    -- @200 OK@ response of the
    -- @GET \/restapis\/{restapi_id}\/resources\/{resource_id}@ or
    -- @GET \/restapis\/{restapi_id}\/resources\/{resource_id}?embed=methods@
    -- request.
    --
    -- ==== Example: Get the GET method of an API resource
    --
    -- ===== Request
    --
    -- > GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20170223T031827Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20170223/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
    --
    -- ===== Response
    --
    -- > { "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", "name": "integration", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-{rel}.html", "name": "method", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", "name": "methodresponse", "templated": true } ], "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET", "name": "GET", "title": "GET" }, "integration:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "method:integration": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "method:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "methodresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/{status_code}", "templated": true } }, "apiKeyRequired": false, "authorizationType": "NONE", "httpMethod": "GET", "_embedded": { "method:integration": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integration:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integrationresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/{status_code}", "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "3kzxbg5sa2", "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestParameters": { "integration.request.header.Content-Type": "'application/x-amz-json-1.1'" }, "requestTemplates": { "application/json": "{\n}" }, "type": "AWS", "uri": "arn:aws:apigateway:us-east-1:kinesis:action/ListStreams", "_embedded": { "integration:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.Content-Type": "'application/xml'" }, "responseTemplates": { "application/json": "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" }, "statusCode": "200" } } }, "method:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "methodresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" }, "methodresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" } }, "responseModels": { "application/json": "Empty" }, "responseParameters": { "method.response.header.Content-Type": false }, "statusCode": "200" } } }
    --
    -- If the @OPTIONS@ is enabled on the resource, you can follow the example
    -- here to get that method. Just replace the @GET@ of the last path segment
    -- in the request URL with @OPTIONS@.
    Resource -> Maybe (HashMap Text Method)
resourceMethods :: Prelude.Maybe (Prelude.HashMap Prelude.Text Method),
    -- | The parent resource\'s identifier.
    Resource -> Maybe Text
parentId :: Prelude.Maybe Prelude.Text
  }
  deriving (Resource -> Resource -> Bool
(Resource -> Resource -> Bool)
-> (Resource -> Resource -> Bool) -> Eq Resource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Resource -> Resource -> Bool
$c/= :: Resource -> Resource -> Bool
== :: Resource -> Resource -> Bool
$c== :: Resource -> Resource -> Bool
Prelude.Eq, ReadPrec [Resource]
ReadPrec Resource
Int -> ReadS Resource
ReadS [Resource]
(Int -> ReadS Resource)
-> ReadS [Resource]
-> ReadPrec Resource
-> ReadPrec [Resource]
-> Read Resource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Resource]
$creadListPrec :: ReadPrec [Resource]
readPrec :: ReadPrec Resource
$creadPrec :: ReadPrec Resource
readList :: ReadS [Resource]
$creadList :: ReadS [Resource]
readsPrec :: Int -> ReadS Resource
$creadsPrec :: Int -> ReadS Resource
Prelude.Read, Int -> Resource -> ShowS
[Resource] -> ShowS
Resource -> String
(Int -> Resource -> ShowS)
-> (Resource -> String) -> ([Resource] -> ShowS) -> Show Resource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Resource] -> ShowS
$cshowList :: [Resource] -> ShowS
show :: Resource -> String
$cshow :: Resource -> String
showsPrec :: Int -> Resource -> ShowS
$cshowsPrec :: Int -> Resource -> ShowS
Prelude.Show, (forall x. Resource -> Rep Resource x)
-> (forall x. Rep Resource x -> Resource) -> Generic Resource
forall x. Rep Resource x -> Resource
forall x. Resource -> Rep Resource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Resource x -> Resource
$cfrom :: forall x. Resource -> Rep Resource x
Prelude.Generic)

-- |
-- Create a value of 'Resource' 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:
--
-- 'pathPart', 'resource_pathPart' - The last path segment for this resource.
--
-- 'path', 'resource_path' - The full path for this resource.
--
-- 'id', 'resource_id' - The resource\'s identifier.
--
-- 'resourceMethods', 'resource_resourceMethods' - Gets an API resource\'s method of a given HTTP verb.
--
-- The resource methods are a map of methods indexed by methods\' HTTP
-- verbs enabled on the resource. This method map is included in the
-- @200 OK@ response of the
-- @GET \/restapis\/{restapi_id}\/resources\/{resource_id}@ or
-- @GET \/restapis\/{restapi_id}\/resources\/{resource_id}?embed=methods@
-- request.
--
-- ==== Example: Get the GET method of an API resource
--
-- ===== Request
--
-- > GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20170223T031827Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20170223/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- > { "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", "name": "integration", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-{rel}.html", "name": "method", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", "name": "methodresponse", "templated": true } ], "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET", "name": "GET", "title": "GET" }, "integration:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "method:integration": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "method:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "methodresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/{status_code}", "templated": true } }, "apiKeyRequired": false, "authorizationType": "NONE", "httpMethod": "GET", "_embedded": { "method:integration": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integration:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integrationresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/{status_code}", "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "3kzxbg5sa2", "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestParameters": { "integration.request.header.Content-Type": "'application/x-amz-json-1.1'" }, "requestTemplates": { "application/json": "{\n}" }, "type": "AWS", "uri": "arn:aws:apigateway:us-east-1:kinesis:action/ListStreams", "_embedded": { "integration:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.Content-Type": "'application/xml'" }, "responseTemplates": { "application/json": "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" }, "statusCode": "200" } } }, "method:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "methodresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" }, "methodresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" } }, "responseModels": { "application/json": "Empty" }, "responseParameters": { "method.response.header.Content-Type": false }, "statusCode": "200" } } }
--
-- If the @OPTIONS@ is enabled on the resource, you can follow the example
-- here to get that method. Just replace the @GET@ of the last path segment
-- in the request URL with @OPTIONS@.
--
-- 'parentId', 'resource_parentId' - The parent resource\'s identifier.
newResource ::
  Resource
newResource :: Resource
newResource =
  Resource' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Method)
-> Maybe Text
-> Resource
Resource'
    { $sel:pathPart:Resource' :: Maybe Text
pathPart = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:path:Resource' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:Resource' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceMethods:Resource' :: Maybe (HashMap Text Method)
resourceMethods = Maybe (HashMap Text Method)
forall a. Maybe a
Prelude.Nothing,
      $sel:parentId:Resource' :: Maybe Text
parentId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The last path segment for this resource.
resource_pathPart :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_pathPart :: (Maybe Text -> f (Maybe Text)) -> Resource -> f Resource
resource_pathPart = (Resource -> Maybe Text)
-> (Resource -> Maybe Text -> Resource)
-> Lens Resource Resource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
pathPart :: Maybe Text
$sel:pathPart:Resource' :: Resource -> Maybe Text
pathPart} -> Maybe Text
pathPart) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:pathPart:Resource' :: Maybe Text
pathPart = Maybe Text
a} :: Resource)

-- | The full path for this resource.
resource_path :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_path :: (Maybe Text -> f (Maybe Text)) -> Resource -> f Resource
resource_path = (Resource -> Maybe Text)
-> (Resource -> Maybe Text -> Resource)
-> Lens Resource Resource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
path :: Maybe Text
$sel:path:Resource' :: Resource -> Maybe Text
path} -> Maybe Text
path) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:path:Resource' :: Maybe Text
path = Maybe Text
a} :: Resource)

-- | The resource\'s identifier.
resource_id :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_id :: (Maybe Text -> f (Maybe Text)) -> Resource -> f Resource
resource_id = (Resource -> Maybe Text)
-> (Resource -> Maybe Text -> Resource)
-> Lens Resource Resource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
id :: Maybe Text
$sel:id:Resource' :: Resource -> Maybe Text
id} -> Maybe Text
id) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:id:Resource' :: Maybe Text
id = Maybe Text
a} :: Resource)

-- | Gets an API resource\'s method of a given HTTP verb.
--
-- The resource methods are a map of methods indexed by methods\' HTTP
-- verbs enabled on the resource. This method map is included in the
-- @200 OK@ response of the
-- @GET \/restapis\/{restapi_id}\/resources\/{resource_id}@ or
-- @GET \/restapis\/{restapi_id}\/resources\/{resource_id}?embed=methods@
-- request.
--
-- ==== Example: Get the GET method of an API resource
--
-- ===== Request
--
-- > GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20170223T031827Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20170223/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- > { "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", "name": "integration", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-{rel}.html", "name": "method", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", "name": "methodresponse", "templated": true } ], "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET", "name": "GET", "title": "GET" }, "integration:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "method:integration": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "method:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "methodresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/{status_code}", "templated": true } }, "apiKeyRequired": false, "authorizationType": "NONE", "httpMethod": "GET", "_embedded": { "method:integration": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integration:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integrationresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/{status_code}", "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "3kzxbg5sa2", "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestParameters": { "integration.request.header.Content-Type": "'application/x-amz-json-1.1'" }, "requestTemplates": { "application/json": "{\n}" }, "type": "AWS", "uri": "arn:aws:apigateway:us-east-1:kinesis:action/ListStreams", "_embedded": { "integration:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.Content-Type": "'application/xml'" }, "responseTemplates": { "application/json": "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" }, "statusCode": "200" } } }, "method:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "methodresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" }, "methodresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" } }, "responseModels": { "application/json": "Empty" }, "responseParameters": { "method.response.header.Content-Type": false }, "statusCode": "200" } } }
--
-- If the @OPTIONS@ is enabled on the resource, you can follow the example
-- here to get that method. Just replace the @GET@ of the last path segment
-- in the request URL with @OPTIONS@.
resource_resourceMethods :: Lens.Lens' Resource (Prelude.Maybe (Prelude.HashMap Prelude.Text Method))
resource_resourceMethods :: (Maybe (HashMap Text Method) -> f (Maybe (HashMap Text Method)))
-> Resource -> f Resource
resource_resourceMethods = (Resource -> Maybe (HashMap Text Method))
-> (Resource -> Maybe (HashMap Text Method) -> Resource)
-> Lens
     Resource
     Resource
     (Maybe (HashMap Text Method))
     (Maybe (HashMap Text Method))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe (HashMap Text Method)
resourceMethods :: Maybe (HashMap Text Method)
$sel:resourceMethods:Resource' :: Resource -> Maybe (HashMap Text Method)
resourceMethods} -> Maybe (HashMap Text Method)
resourceMethods) (\s :: Resource
s@Resource' {} Maybe (HashMap Text Method)
a -> Resource
s {$sel:resourceMethods:Resource' :: Maybe (HashMap Text Method)
resourceMethods = Maybe (HashMap Text Method)
a} :: Resource) ((Maybe (HashMap Text Method) -> f (Maybe (HashMap Text Method)))
 -> Resource -> f Resource)
-> ((Maybe (HashMap Text Method)
     -> f (Maybe (HashMap Text Method)))
    -> Maybe (HashMap Text Method) -> f (Maybe (HashMap Text Method)))
-> (Maybe (HashMap Text Method) -> f (Maybe (HashMap Text Method)))
-> Resource
-> f Resource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Method)
  (HashMap Text Method)
  (HashMap Text Method)
  (HashMap Text Method)
-> Iso
     (Maybe (HashMap Text Method))
     (Maybe (HashMap Text Method))
     (Maybe (HashMap Text Method))
     (Maybe (HashMap Text Method))
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
  (HashMap Text Method)
  (HashMap Text Method)
  (HashMap Text Method)
  (HashMap Text Method)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The parent resource\'s identifier.
resource_parentId :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_parentId :: (Maybe Text -> f (Maybe Text)) -> Resource -> f Resource
resource_parentId = (Resource -> Maybe Text)
-> (Resource -> Maybe Text -> Resource)
-> Lens Resource Resource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
parentId :: Maybe Text
$sel:parentId:Resource' :: Resource -> Maybe Text
parentId} -> Maybe Text
parentId) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:parentId:Resource' :: Maybe Text
parentId = Maybe Text
a} :: Resource)

instance Core.FromJSON Resource where
  parseJSON :: Value -> Parser Resource
parseJSON =
    String -> (Object -> Parser Resource) -> Value -> Parser Resource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Resource"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Method)
-> Maybe Text
-> Resource
Resource'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Method)
 -> Maybe Text
 -> Resource)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Method)
      -> Maybe Text
      -> Resource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pathPart")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Method)
   -> Maybe Text
   -> Resource)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Method) -> Maybe Text -> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"path")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Method) -> Maybe Text -> Resource)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Method) -> Maybe Text -> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
            Parser (Maybe (HashMap Text Method) -> Maybe Text -> Resource)
-> Parser (Maybe (HashMap Text Method))
-> Parser (Maybe Text -> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Method)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceMethods"
                            Parser (Maybe (Maybe (HashMap Text Method)))
-> Maybe (HashMap Text Method)
-> Parser (Maybe (HashMap Text Method))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Method)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> Resource)
-> Parser (Maybe Text) -> Parser Resource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"parentId")
      )

instance Prelude.Hashable Resource

instance Prelude.NFData Resource