{-# 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.ListComponents -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Lists all the components registered with AWS Systems Manager for SAP. -- -- This operation returns paginated results. module Amazonka.SSMSAP.ListComponents ( -- * Creating a Request ListComponents (..), newListComponents, -- * Request Lenses listComponents_applicationId, listComponents_maxResults, listComponents_nextToken, -- * Destructuring the Response ListComponentsResponse (..), newListComponentsResponse, -- * Response Lenses listComponentsResponse_components, listComponentsResponse_nextToken, listComponentsResponse_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:/ 'newListComponents' smart constructor. data ListComponents = ListComponents' { applicationId :: Prelude.Maybe Prelude.Text, maxResults :: Prelude.Maybe Prelude.Natural, nextToken :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListComponents' 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: -- -- 'applicationId', 'listComponents_applicationId' - -- -- 'maxResults', 'listComponents_maxResults' - -- -- 'nextToken', 'listComponents_nextToken' - newListComponents :: ListComponents newListComponents = ListComponents' { applicationId = Prelude.Nothing, maxResults = Prelude.Nothing, nextToken = Prelude.Nothing } listComponents_applicationId :: Lens.Lens' ListComponents (Prelude.Maybe Prelude.Text) listComponents_applicationId = Lens.lens (\ListComponents' {applicationId} -> applicationId) (\s@ListComponents' {} a -> s {applicationId = a} :: ListComponents) listComponents_maxResults :: Lens.Lens' ListComponents (Prelude.Maybe Prelude.Natural) listComponents_maxResults = Lens.lens (\ListComponents' {maxResults} -> maxResults) (\s@ListComponents' {} a -> s {maxResults = a} :: ListComponents) listComponents_nextToken :: Lens.Lens' ListComponents (Prelude.Maybe Prelude.Text) listComponents_nextToken = Lens.lens (\ListComponents' {nextToken} -> nextToken) (\s@ListComponents' {} a -> s {nextToken = a} :: ListComponents) instance Core.AWSPager ListComponents where page rq rs | Core.stop ( rs Lens.^? listComponentsResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listComponentsResponse_components Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listComponents_nextToken Lens..~ rs Lens.^? listComponentsResponse_nextToken Prelude.. Lens._Just instance Core.AWSRequest ListComponents where type AWSResponse ListComponents = ListComponentsResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListComponentsResponse' Prelude.<$> (x Data..?> "Components" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "NextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListComponents where hashWithSalt _salt ListComponents' {..} = _salt `Prelude.hashWithSalt` applicationId `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken instance Prelude.NFData ListComponents where rnf ListComponents' {..} = Prelude.rnf applicationId `Prelude.seq` Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken instance Data.ToHeaders ListComponents where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListComponents where toJSON ListComponents' {..} = Data.object ( Prelude.catMaybes [ ("ApplicationId" Data..=) Prelude.<$> applicationId, ("MaxResults" Data..=) Prelude.<$> maxResults, ("NextToken" Data..=) Prelude.<$> nextToken ] ) instance Data.ToPath ListComponents where toPath = Prelude.const "/list-components" instance Data.ToQuery ListComponents where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newListComponentsResponse' smart constructor. data ListComponentsResponse = ListComponentsResponse' { components :: Prelude.Maybe [ComponentSummary], nextToken :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListComponentsResponse' 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: -- -- 'components', 'listComponentsResponse_components' - -- -- 'nextToken', 'listComponentsResponse_nextToken' - -- -- 'httpStatus', 'listComponentsResponse_httpStatus' - The response's http status code. newListComponentsResponse :: -- | 'httpStatus' Prelude.Int -> ListComponentsResponse newListComponentsResponse pHttpStatus_ = ListComponentsResponse' { components = Prelude.Nothing, nextToken = Prelude.Nothing, httpStatus = pHttpStatus_ } listComponentsResponse_components :: Lens.Lens' ListComponentsResponse (Prelude.Maybe [ComponentSummary]) listComponentsResponse_components = Lens.lens (\ListComponentsResponse' {components} -> components) (\s@ListComponentsResponse' {} a -> s {components = a} :: ListComponentsResponse) Prelude.. Lens.mapping Lens.coerced listComponentsResponse_nextToken :: Lens.Lens' ListComponentsResponse (Prelude.Maybe Prelude.Text) listComponentsResponse_nextToken = Lens.lens (\ListComponentsResponse' {nextToken} -> nextToken) (\s@ListComponentsResponse' {} a -> s {nextToken = a} :: ListComponentsResponse) -- | The response's http status code. listComponentsResponse_httpStatus :: Lens.Lens' ListComponentsResponse Prelude.Int listComponentsResponse_httpStatus = Lens.lens (\ListComponentsResponse' {httpStatus} -> httpStatus) (\s@ListComponentsResponse' {} a -> s {httpStatus = a} :: ListComponentsResponse) instance Prelude.NFData ListComponentsResponse where rnf ListComponentsResponse' {..} = Prelude.rnf components `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus