Debian Codegraph @

crt/aws-c-s3/include/aws/s3/s3express_credentials_provider.h

raw symbols SCIP
1 #ifndef AWS_S3EXPRESS_CREDENTIALS_PROVIDER_H
2 #define AWS_S3EXPRESS_CREDENTIALS_PROVIDER_H
3
4 /**
5 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 * SPDX-License-Identifier: Apache-2.0.
7 */
8
9 #include <aws/auth/credentials.h>
10 #include <aws/common/ref_count.h>
11 #include <aws/s3/s3.h>
12
13 AWS_PUSH_SANE_WARNING_LEVEL
14
15 struct aws_s3_client;
16 struct aws_s3express_credentials_provider;
17
18 struct aws_credentials_properties_s3express {
19 /**
20 * Required.
21 * The host address of the s3 bucket for the request.
22 */
23 struct aws_byte_cursor host;
24 /**
25 * Optional.
26 * The region of the bucket.
27 * If empty, the region of the S3 client will be used.
28 */
29 struct aws_byte_cursor region;
30
31 struct aws_http_headers *headers;
32 };
33
34 struct aws_s3express_credentials_provider_vtable {
35 /**
36 * Implementation for S3 Express provider to get S3 Express credentials
37 */
38 int (*get_credentials)(
39 struct aws_s3express_credentials_provider *provider,
40 const struct aws_credentials *original_credentials,
41 const struct aws_credentials_properties_s3express *properties,
42 aws_on_get_credentials_callback_fn callback,
43 void *user_data);
44
45 /**
46 * Implementation to destroy the provider.
47 */
48 void (*destroy)(struct aws_s3express_credentials_provider *provider);
49 };
50
51 struct aws_s3express_credentials_provider {
52 struct aws_s3express_credentials_provider_vtable *vtable;
53 struct aws_allocator *allocator;
54 /* Optional callback for shutdown complete of the provider */
55 aws_simple_completion_callback *shutdown_complete_callback;
56 void *shutdown_user_data;
57 void *impl;
58 struct aws_ref_count ref_count;
59 };
60
61 AWS_EXTERN_C_BEGIN
62
63 AWS_S3_API
64 struct aws_s3express_credentials_provider *aws_s3express_credentials_provider_release(
65 struct aws_s3express_credentials_provider *provider);
66
67 /**
68 * To initialize the provider with basic vtable and refcount. And hook up the refcount with vtable functions.
69 *
70 * @param provider
71 * @param allocator
72 * @param vtable
73 * @param impl Optional, the impl for the provider
74 * @return AWS_S3_API
75 */
76 AWS_S3_API
77 void aws_s3express_credentials_provider_init_base(
78 struct aws_s3express_credentials_provider *provider,
79 struct aws_allocator *allocator,
80 struct aws_s3express_credentials_provider_vtable *vtable,
81 void *impl);
82
83 /**
84 * Async function for retrieving specific credentials based on properties.
85 *
86 * @param provider aws_s3express_credentials_provider provider to source from
87 * @param original_credentials The credentials used to derive the credentials for S3 Express.
88 * @param properties Specific properties for credentials being fetched.
89 * @param user_data user data to pass to the completion callback
90 *
91 * callback will only be invoked if-and-only-if the return value was AWS_OP_SUCCESS.
92 *
93 */
94 AWS_S3_API int aws_s3express_credentials_provider_get_credentials(
95 struct aws_s3express_credentials_provider *provider,
96 const struct aws_credentials *original_credentials,
97 const struct aws_credentials_properties_s3express *properties,
98 aws_on_get_credentials_callback_fn callback,
99 void *user_data);
100
101 AWS_EXTERN_C_END
102 AWS_POP_SANE_WARNING_LEVEL
103
104 #endif /* AWS_S3EXPRESS_CREDENTIALS_PROVIDER_H */