1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package glacier
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
10	"github.com/aws/aws-sdk-go-v2/service/glacier/types"
11	"github.com/aws/smithy-go/middleware"
12	smithyhttp "github.com/aws/smithy-go/transport/http"
13)
14
15// This operation returns information about a job you previously initiated,
16// including the job initiation date, the user who initiated the job, the job
17// status code/message and the Amazon SNS topic to notify after Amazon S3 Glacier
18// (Glacier) completes the job. For more information about initiating a job, see
19// InitiateJob. This operation enables you to check the status of your job.
20// However, it is strongly recommended that you set up an Amazon SNS topic and
21// specify it in your initiate job request so that Glacier can notify the topic
22// after it completes the job. A job ID will not expire for at least 24 hours after
23// Glacier completes the job. An AWS account has full permission to perform all
24// operations (actions). However, AWS Identity and Access Management (IAM) users
25// don't have any permissions by default. You must grant them explicit permission
26// to perform specific actions. For more information, see Access Control Using AWS
27// Identity and Access Management (IAM)
28// (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html).
29// For more information about using this operation, see the documentation for the
30// underlying REST API Describe Job
31// (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-describe-job-get.html)
32// in the Amazon Glacier Developer Guide.
33func (c *Client) DescribeJob(ctx context.Context, params *DescribeJobInput, optFns ...func(*Options)) (*DescribeJobOutput, error) {
34	if params == nil {
35		params = &DescribeJobInput{}
36	}
37
38	result, metadata, err := c.invokeOperation(ctx, "DescribeJob", params, optFns, addOperationDescribeJobMiddlewares)
39	if err != nil {
40		return nil, err
41	}
42
43	out := result.(*DescribeJobOutput)
44	out.ResultMetadata = metadata
45	return out, nil
46}
47
48// Provides options for retrieving a job description.
49type DescribeJobInput struct {
50
51	// The AccountId value is the AWS account ID of the account that owns the vault.
52	// You can either specify an AWS account ID or optionally a single '-' (hyphen), in
53	// which case Amazon S3 Glacier uses the AWS account ID associated with the
54	// credentials used to sign the request. If you use an account ID, do not include
55	// any hyphens ('-') in the ID.
56	//
57	// This member is required.
58	AccountId *string
59
60	// The ID of the job to describe.
61	//
62	// This member is required.
63	JobId *string
64
65	// The name of the vault.
66	//
67	// This member is required.
68	VaultName *string
69}
70
71// Contains the description of an Amazon S3 Glacier job.
72type DescribeJobOutput struct {
73
74	// The job type. This value is either ArchiveRetrieval, InventoryRetrieval, or
75	// Select.
76	Action types.ActionCode
77
78	// The archive ID requested for a select job or archive retrieval. Otherwise, this
79	// field is null.
80	ArchiveId *string
81
82	// The SHA256 tree hash of the entire archive for an archive retrieval. For
83	// inventory retrieval or select jobs, this field is null.
84	ArchiveSHA256TreeHash *string
85
86	// For an archive retrieval job, this value is the size in bytes of the archive
87	// being requested for download. For an inventory retrieval or select job, this
88	// value is null.
89	ArchiveSizeInBytes *int64
90
91	// The job status. When a job is completed, you get the job's output using Get Job
92	// Output (GET output).
93	Completed bool
94
95	// The UTC time that the job request completed. While the job is in progress, the
96	// value is null.
97	CompletionDate *string
98
99	// The UTC date when the job was created. This value is a string representation of
100	// ISO 8601 date format, for example "2012-03-20T17:03:43.221Z".
101	CreationDate *string
102
103	// Parameters used for range inventory retrieval.
104	InventoryRetrievalParameters *types.InventoryRetrievalJobDescription
105
106	// For an inventory retrieval job, this value is the size in bytes of the inventory
107	// requested for download. For an archive retrieval or select job, this value is
108	// null.
109	InventorySizeInBytes *int64
110
111	// The job description provided when initiating the job.
112	JobDescription *string
113
114	// An opaque string that identifies an Amazon S3 Glacier job.
115	JobId *string
116
117	// Contains the job output location.
118	JobOutputPath *string
119
120	// Contains the location where the data from the select job is stored.
121	OutputLocation *types.OutputLocation
122
123	// The retrieved byte range for archive retrieval jobs in the form
124	// StartByteValue-EndByteValue. If no range was specified in the archive retrieval,
125	// then the whole archive is retrieved. In this case, StartByteValue equals 0 and
126	// EndByteValue equals the size of the archive minus 1. For inventory retrieval or
127	// select jobs, this field is null.
128	RetrievalByteRange *string
129
130	// For an archive retrieval job, this value is the checksum of the archive.
131	// Otherwise, this value is null. The SHA256 tree hash value for the requested
132	// range of an archive. If the InitiateJob request for an archive specified a
133	// tree-hash aligned range, then this field returns a value. If the whole archive
134	// is retrieved, this value is the same as the ArchiveSHA256TreeHash value. This
135	// field is null for the following:
136	//
137	// * Archive retrieval jobs that specify a range
138	// that is not tree-hash aligned
139	//
140	// * Archival jobs that specify a range that is
141	// equal to the whole archive, when the job status is InProgress
142	//
143	// * Inventory
144	// jobs
145	//
146	// * Select jobs
147	SHA256TreeHash *string
148
149	// An Amazon SNS topic that receives notification.
150	SNSTopic *string
151
152	// Contains the parameters used for a select.
153	SelectParameters *types.SelectParameters
154
155	// The status code can be InProgress, Succeeded, or Failed, and indicates the
156	// status of the job.
157	StatusCode types.StatusCode
158
159	// A friendly message that describes the job status.
160	StatusMessage *string
161
162	// The tier to use for a select or an archive retrieval. Valid values are
163	// Expedited, Standard, or Bulk. Standard is the default.
164	Tier *string
165
166	// The Amazon Resource Name (ARN) of the vault from which an archive retrieval was
167	// requested.
168	VaultARN *string
169
170	// Metadata pertaining to the operation's result.
171	ResultMetadata middleware.Metadata
172}
173
174func addOperationDescribeJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
175	err = stack.Serialize.Add(&awsRestjson1_serializeOpDescribeJob{}, middleware.After)
176	if err != nil {
177		return err
178	}
179	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDescribeJob{}, middleware.After)
180	if err != nil {
181		return err
182	}
183	if err = addSetLoggerMiddleware(stack, options); err != nil {
184		return err
185	}
186	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
187		return err
188	}
189	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
190		return err
191	}
192	if err = addResolveEndpointMiddleware(stack, options); err != nil {
193		return err
194	}
195	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
196		return err
197	}
198	if err = addRetryMiddlewares(stack, options); err != nil {
199		return err
200	}
201	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
202		return err
203	}
204	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
205		return err
206	}
207	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
208		return err
209	}
210	if err = addClientUserAgent(stack); err != nil {
211		return err
212	}
213	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
214		return err
215	}
216	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
217		return err
218	}
219	if err = addOpDescribeJobValidationMiddleware(stack); err != nil {
220		return err
221	}
222	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeJob(options.Region), middleware.Before); err != nil {
223		return err
224	}
225	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
226		return err
227	}
228	if err = addResponseErrorMiddleware(stack); err != nil {
229		return err
230	}
231	if err = glaciercust.AddTreeHashMiddleware(stack); err != nil {
232		return err
233	}
234	if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
235		return err
236	}
237	if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
238		return err
239	}
240	if err = addRequestResponseLogging(stack, options); err != nil {
241		return err
242	}
243	return nil
244}
245
246func newServiceMetadataMiddleware_opDescribeJob(region string) *awsmiddleware.RegisterServiceMetadata {
247	return &awsmiddleware.RegisterServiceMetadata{
248		Region:        region,
249		ServiceID:     ServiceID,
250		SigningName:   "glacier",
251		OperationName: "DescribeJob",
252	}
253}
254