{-# 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.Snowball.CancelJob -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Cancels the specified job. You can only cancel a job before its -- @JobState@ value changes to @PreparingAppliance@. Requesting the -- @ListJobs@ or @DescribeJob@ action returns a job\'s @JobState@ as part -- of the response element data returned. module Amazonka.Snowball.CancelJob ( -- * Creating a Request CancelJob (..), newCancelJob, -- * Request Lenses cancelJob_jobId, -- * Destructuring the Response CancelJobResponse (..), newCancelJobResponse, -- * Response Lenses cancelJobResponse_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.Snowball.Types -- | /See:/ 'newCancelJob' smart constructor. data CancelJob = CancelJob' { -- | The 39-character job ID for the job that you want to cancel, for example -- @JID123e4567-e89b-12d3-a456-426655440000@. jobId :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CancelJob' 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: -- -- 'jobId', 'cancelJob_jobId' - The 39-character job ID for the job that you want to cancel, for example -- @JID123e4567-e89b-12d3-a456-426655440000@. newCancelJob :: -- | 'jobId' Prelude.Text -> CancelJob newCancelJob pJobId_ = CancelJob' {jobId = pJobId_} -- | The 39-character job ID for the job that you want to cancel, for example -- @JID123e4567-e89b-12d3-a456-426655440000@. cancelJob_jobId :: Lens.Lens' CancelJob Prelude.Text cancelJob_jobId = Lens.lens (\CancelJob' {jobId} -> jobId) (\s@CancelJob' {} a -> s {jobId = a} :: CancelJob) instance Core.AWSRequest CancelJob where type AWSResponse CancelJob = CancelJobResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveEmpty ( \s h x -> CancelJobResponse' Prelude.<$> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CancelJob where hashWithSalt _salt CancelJob' {..} = _salt `Prelude.hashWithSalt` jobId instance Prelude.NFData CancelJob where rnf CancelJob' {..} = Prelude.rnf jobId instance Data.ToHeaders CancelJob where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AWSIESnowballJobManagementService.CancelJob" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON CancelJob where toJSON CancelJob' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("JobId" Data..= jobId)] ) instance Data.ToPath CancelJob where toPath = Prelude.const "/" instance Data.ToQuery CancelJob where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newCancelJobResponse' smart constructor. data CancelJobResponse = CancelJobResponse' { -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CancelJobResponse' 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: -- -- 'httpStatus', 'cancelJobResponse_httpStatus' - The response's http status code. newCancelJobResponse :: -- | 'httpStatus' Prelude.Int -> CancelJobResponse newCancelJobResponse pHttpStatus_ = CancelJobResponse' {httpStatus = pHttpStatus_} -- | The response's http status code. cancelJobResponse_httpStatus :: Lens.Lens' CancelJobResponse Prelude.Int cancelJobResponse_httpStatus = Lens.lens (\CancelJobResponse' {httpStatus} -> httpStatus) (\s@CancelJobResponse' {} a -> s {httpStatus = a} :: CancelJobResponse) instance Prelude.NFData CancelJobResponse where rnf CancelJobResponse' {..} = Prelude.rnf httpStatus