{-# 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.SSMSAP.GetApplication -- 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 an application registered with AWS Systems Manager for SAP. It also -- returns the components of the application. module Amazonka.SSMSAP.GetApplication ( -- * Creating a Request GetApplication (..), newGetApplication, -- * Request Lenses getApplication_applicationArn, getApplication_applicationId, -- * Destructuring the Response GetApplicationResponse (..), newGetApplicationResponse, -- * Response Lenses getApplicationResponse_application, getApplicationResponse_tags, getApplicationResponse_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.SSMSAP.Types -- | /See:/ 'newGetApplication' smart constructor. data GetApplication = GetApplication' { applicationArn :: Prelude.Maybe Prelude.Text, applicationId :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetApplication' 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: -- -- 'applicationArn', 'getApplication_applicationArn' - -- -- 'applicationId', 'getApplication_applicationId' - newGetApplication :: GetApplication newGetApplication = GetApplication' { applicationArn = Prelude.Nothing, applicationId = Prelude.Nothing } getApplication_applicationArn :: Lens.Lens' GetApplication (Prelude.Maybe Prelude.Text) getApplication_applicationArn = Lens.lens (\GetApplication' {applicationArn} -> applicationArn) (\s@GetApplication' {} a -> s {applicationArn = a} :: GetApplication) getApplication_applicationId :: Lens.Lens' GetApplication (Prelude.Maybe Prelude.Text) getApplication_applicationId = Lens.lens (\GetApplication' {applicationId} -> applicationId) (\s@GetApplication' {} a -> s {applicationId = a} :: GetApplication) instance Core.AWSRequest GetApplication where type AWSResponse GetApplication = GetApplicationResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetApplicationResponse' Prelude.<$> (x Data..?> "Application") Prelude.<*> (x Data..?> "Tags" Core..!@ Prelude.mempty) Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable GetApplication where hashWithSalt _salt GetApplication' {..} = _salt `Prelude.hashWithSalt` applicationArn `Prelude.hashWithSalt` applicationId instance Prelude.NFData GetApplication where rnf GetApplication' {..} = Prelude.rnf applicationArn `Prelude.seq` Prelude.rnf applicationId instance Data.ToHeaders GetApplication where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON GetApplication where toJSON GetApplication' {..} = Data.object ( Prelude.catMaybes [ ("ApplicationArn" Data..=) Prelude.<$> applicationArn, ("ApplicationId" Data..=) Prelude.<$> applicationId ] ) instance Data.ToPath GetApplication where toPath = Prelude.const "/get-application" instance Data.ToQuery GetApplication where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newGetApplicationResponse' smart constructor. data GetApplicationResponse = GetApplicationResponse' { application :: Prelude.Maybe Application, tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text), -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetApplicationResponse' 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: -- -- 'application', 'getApplicationResponse_application' - -- -- 'tags', 'getApplicationResponse_tags' - -- -- 'httpStatus', 'getApplicationResponse_httpStatus' - The response's http status code. newGetApplicationResponse :: -- | 'httpStatus' Prelude.Int -> GetApplicationResponse newGetApplicationResponse pHttpStatus_ = GetApplicationResponse' { application = Prelude.Nothing, tags = Prelude.Nothing, httpStatus = pHttpStatus_ } getApplicationResponse_application :: Lens.Lens' GetApplicationResponse (Prelude.Maybe Application) getApplicationResponse_application = Lens.lens (\GetApplicationResponse' {application} -> application) (\s@GetApplicationResponse' {} a -> s {application = a} :: GetApplicationResponse) getApplicationResponse_tags :: Lens.Lens' GetApplicationResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)) getApplicationResponse_tags = Lens.lens (\GetApplicationResponse' {tags} -> tags) (\s@GetApplicationResponse' {} a -> s {tags = a} :: GetApplicationResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. getApplicationResponse_httpStatus :: Lens.Lens' GetApplicationResponse Prelude.Int getApplicationResponse_httpStatus = Lens.lens (\GetApplicationResponse' {httpStatus} -> httpStatus) (\s@GetApplicationResponse' {} a -> s {httpStatus = a} :: GetApplicationResponse) instance Prelude.NFData GetApplicationResponse where rnf GetApplicationResponse' {..} = Prelude.rnf application `Prelude.seq` Prelude.rnf tags `Prelude.seq` Prelude.rnf httpStatus