Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 PresignHeadObject Support #1318

Closed
bdwyertech opened this issue Jun 27, 2021 · 2 comments · Fixed by #1346
Closed

S3 PresignHeadObject Support #1318

bdwyertech opened this issue Jun 27, 2021 · 2 comments · Fixed by #1346
Assignees
Labels
feature-request A feature should be added or improved.

Comments

@bdwyertech
Copy link

bdwyertech commented Jun 27, 2021

Wondering if we could get a client function added for creating a presigned HeadObject request for S3.

This is to fill a gap vs the v1 SDK which had the Presign function for all request types.

// PresignHeadObject is used to generate a presigned HTTP Request which contains
// presigned URL, signed headers and HTTP method used.
func (c *PresignClient) PresignHeadObject(ctx context.Context, params *HeadObjectInput, optFns ...func(*PresignOptions)) (*v4.PresignedHTTPRequest, error) {
	if params == nil {
		params = &HeadObjectInput{}
	}
	options := c.options.copy()
	for _, fn := range optFns {
		fn(&options)
	}
	clientOptFns := append(options.ClientOptions, withNopHTTPClientAPIOption)

	result, _, err := c.client.invokeOperation(ctx, "HeadObject", params, clientOptFns,
		c.client.addOperationHeadObjectMiddlewares,
		presignConverter(options).convertToPresignMiddleware,
		addHeadObjectPayloadAsUnsigned,
	)
	if err != nil {
		return nil, err
	}

	out := result.(*v4.PresignedHTTPRequest)
	return out, nil
}

func addHeadObjectPayloadAsUnsigned(stack *middleware.Stack, options Options) error {
	v4.RemoveContentSHA256HeaderMiddleware(stack)
	v4.RemoveComputePayloadSHA256Middleware(stack)
	return v4.AddUnsignedPayloadMiddleware(stack)
}
@bdwyertech bdwyertech added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 27, 2021
@KaibaLopez
Copy link
Contributor

@bdwyertech ,
Thanks for bringing this up. We'll look into adding into an upcoming release.

@KaibaLopez KaibaLopez removed the needs-triage This issue or PR still needs to be triaged. label Jul 15, 2021
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants