{-# 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.Route53AutoNaming.GetService -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Gets the settings for a specified service. module Amazonka.Route53AutoNaming.GetService ( -- * Creating a Request GetService (..), newGetService, -- * Request Lenses getService_id, -- * Destructuring the Response GetServiceResponse (..), newGetServiceResponse, -- * Response Lenses getServiceResponse_service, getServiceResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response import Amazonka.Route53AutoNaming.Types -- | /See:/ 'newGetService' smart constructor. data GetService = GetService' { -- | The ID of the service that you want to get settings for. id :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetService' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'id', 'getService_id' - The ID of the service that you want to get settings for. newGetService :: -- | 'id' Prelude.Text -> GetService newGetService pId_ = GetService' {id = pId_} -- | The ID of the service that you want to get settings for. getService_id :: Lens.Lens' GetService Prelude.Text getService_id = Lens.lens (\GetService' {id} -> id) (\s@GetService' {} a -> s {id = a} :: GetService) instance Core.AWSRequest GetService where type AWSResponse GetService = GetServiceResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetServiceResponse' Prelude.<$> (x Data..?> "Service") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable GetService where hashWithSalt _salt GetService' {..} = _salt `Prelude.hashWithSalt` id instance Prelude.NFData GetService where rnf GetService' {..} = Prelude.rnf id instance Data.ToHeaders GetService where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "Route53AutoNaming_v20170314.GetService" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON GetService where toJSON GetService' {..} = Data.object (Prelude.catMaybes [Prelude.Just ("Id" Data..= id)]) instance Data.ToPath GetService where toPath = Prelude.const "/" instance Data.ToQuery GetService where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newGetServiceResponse' smart constructor. data GetServiceResponse = GetServiceResponse' { -- | A complex type that contains information about the service. service :: Prelude.Maybe ServiceInfo, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetServiceResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'service', 'getServiceResponse_service' - A complex type that contains information about the service. -- -- 'httpStatus', 'getServiceResponse_httpStatus' - The response's http status code. newGetServiceResponse :: -- | 'httpStatus' Prelude.Int -> GetServiceResponse newGetServiceResponse pHttpStatus_ = GetServiceResponse' { service = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | A complex type that contains information about the service. getServiceResponse_service :: Lens.Lens' GetServiceResponse (Prelude.Maybe ServiceInfo) getServiceResponse_service = Lens.lens (\GetServiceResponse' {service} -> service) (\s@GetServiceResponse' {} a -> s {service = a} :: GetServiceResponse) -- | The response's http status code. getServiceResponse_httpStatus :: Lens.Lens' GetServiceResponse Prelude.Int getServiceResponse_httpStatus = Lens.lens (\GetServiceResponse' {httpStatus} -> httpStatus) (\s@GetServiceResponse' {} a -> s {httpStatus = a} :: GetServiceResponse) instance Prelude.NFData GetServiceResponse where rnf GetServiceResponse' {..} = Prelude.rnf service `Prelude.seq` Prelude.rnf httpStatus