{-# 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.Support.DescribeAttachment -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Returns the attachment that has the specified ID. Attachments can -- include screenshots, error logs, or other files that describe your -- issue. Attachment IDs are generated by the case management system when -- you add an attachment to a case or case communication. Attachment IDs -- are returned in the AttachmentDetails objects that are returned by the -- DescribeCommunications operation. -- -- - You must have a Business, Enterprise On-Ramp, or Enterprise Support -- plan to use the Amazon Web Services Support API. -- -- - If you call the Amazon Web Services Support API from an account that -- doesn\'t have a Business, Enterprise On-Ramp, or Enterprise Support -- plan, the @SubscriptionRequiredException@ error message appears. For -- information about changing your support plan, see -- . module Amazonka.Support.DescribeAttachment ( -- * Creating a Request DescribeAttachment (..), newDescribeAttachment, -- * Request Lenses describeAttachment_attachmentId, -- * Destructuring the Response DescribeAttachmentResponse (..), newDescribeAttachmentResponse, -- * Response Lenses describeAttachmentResponse_attachment, describeAttachmentResponse_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.Support.Types -- | /See:/ 'newDescribeAttachment' smart constructor. data DescribeAttachment = DescribeAttachment' { -- | The ID of the attachment to return. Attachment IDs are returned by the -- DescribeCommunications operation. attachmentId :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'DescribeAttachment' 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: -- -- 'attachmentId', 'describeAttachment_attachmentId' - The ID of the attachment to return. Attachment IDs are returned by the -- DescribeCommunications operation. newDescribeAttachment :: -- | 'attachmentId' Prelude.Text -> DescribeAttachment newDescribeAttachment pAttachmentId_ = DescribeAttachment' {attachmentId = pAttachmentId_} -- | The ID of the attachment to return. Attachment IDs are returned by the -- DescribeCommunications operation. describeAttachment_attachmentId :: Lens.Lens' DescribeAttachment Prelude.Text describeAttachment_attachmentId = Lens.lens (\DescribeAttachment' {attachmentId} -> attachmentId) (\s@DescribeAttachment' {} a -> s {attachmentId = a} :: DescribeAttachment) instance Core.AWSRequest DescribeAttachment where type AWSResponse DescribeAttachment = DescribeAttachmentResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> DescribeAttachmentResponse' Prelude.<$> (x Data..?> "attachment") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable DescribeAttachment where hashWithSalt _salt DescribeAttachment' {..} = _salt `Prelude.hashWithSalt` attachmentId instance Prelude.NFData DescribeAttachment where rnf DescribeAttachment' {..} = Prelude.rnf attachmentId instance Data.ToHeaders DescribeAttachment where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AWSSupport_20130415.DescribeAttachment" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON DescribeAttachment where toJSON DescribeAttachment' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("attachmentId" Data..= attachmentId)] ) instance Data.ToPath DescribeAttachment where toPath = Prelude.const "/" instance Data.ToQuery DescribeAttachment where toQuery = Prelude.const Prelude.mempty -- | The content and file name of the attachment returned by the -- DescribeAttachment operation. -- -- /See:/ 'newDescribeAttachmentResponse' smart constructor. data DescribeAttachmentResponse = DescribeAttachmentResponse' { -- | This object includes the attachment content and file name. -- -- In the previous response syntax, the value for the @data@ parameter -- appears as @blob@, which is represented as a base64-encoded string. The -- value for @fileName@ is the name of the attachment, such as -- @troubleshoot-screenshot.png@. attachment :: Prelude.Maybe Attachment, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'DescribeAttachmentResponse' 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: -- -- 'attachment', 'describeAttachmentResponse_attachment' - This object includes the attachment content and file name. -- -- In the previous response syntax, the value for the @data@ parameter -- appears as @blob@, which is represented as a base64-encoded string. The -- value for @fileName@ is the name of the attachment, such as -- @troubleshoot-screenshot.png@. -- -- 'httpStatus', 'describeAttachmentResponse_httpStatus' - The response's http status code. newDescribeAttachmentResponse :: -- | 'httpStatus' Prelude.Int -> DescribeAttachmentResponse newDescribeAttachmentResponse pHttpStatus_ = DescribeAttachmentResponse' { attachment = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | This object includes the attachment content and file name. -- -- In the previous response syntax, the value for the @data@ parameter -- appears as @blob@, which is represented as a base64-encoded string. The -- value for @fileName@ is the name of the attachment, such as -- @troubleshoot-screenshot.png@. describeAttachmentResponse_attachment :: Lens.Lens' DescribeAttachmentResponse (Prelude.Maybe Attachment) describeAttachmentResponse_attachment = Lens.lens (\DescribeAttachmentResponse' {attachment} -> attachment) (\s@DescribeAttachmentResponse' {} a -> s {attachment = a} :: DescribeAttachmentResponse) -- | The response's http status code. describeAttachmentResponse_httpStatus :: Lens.Lens' DescribeAttachmentResponse Prelude.Int describeAttachmentResponse_httpStatus = Lens.lens (\DescribeAttachmentResponse' {httpStatus} -> httpStatus) (\s@DescribeAttachmentResponse' {} a -> s {httpStatus = a} :: DescribeAttachmentResponse) instance Prelude.NFData DescribeAttachmentResponse where rnf DescribeAttachmentResponse' {..} = Prelude.rnf attachment `Prelude.seq` Prelude.rnf httpStatus