diff --git a/include/aws/auth/auth.h b/include/aws/auth/auth.h new file mode 100644 index 0000000000000000000000000000000000000000..fcd50cd09279cf6154ebd0aa5b1c36727cf505dd --- /dev/null +++ b/include/aws/auth/auth.h @@ -0,0 +1,94 @@ +#ifndef AWS_AUTH_AUTH_H +#define AWS_AUTH_AUTH_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_C_AUTH_PACKAGE_ID 6 + +/** + * Auth-specific error codes + */ +enum aws_auth_errors { + AWS_AUTH_PROFILE_PARSE_RECOVERABLE_ERROR = AWS_ERROR_SDKUTILS_PARSE_RECOVERABLE, + AWS_AUTH_PROFILE_PARSE_FATAL_ERROR = AWS_ERROR_SDKUTILS_PARSE_FATAL, + AWS_AUTH_SIGNING_UNSUPPORTED_ALGORITHM = AWS_ERROR_ENUM_BEGIN_RANGE(AWS_C_AUTH_PACKAGE_ID), + AWS_AUTH_SIGNING_MISMATCHED_CONFIGURATION, + AWS_AUTH_SIGNING_NO_CREDENTIALS, + AWS_AUTH_SIGNING_ILLEGAL_REQUEST_QUERY_PARAM, + AWS_AUTH_SIGNING_ILLEGAL_REQUEST_HEADER, + AWS_AUTH_SIGNING_INVALID_CONFIGURATION, + AWS_AUTH_CREDENTIALS_PROVIDER_INVALID_ENVIRONMENT, + AWS_AUTH_CREDENTIALS_PROVIDER_INVALID_DELEGATE, + AWS_AUTH_CREDENTIALS_PROVIDER_PROFILE_SOURCE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_IMDS_SOURCE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_STS_SOURCE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_HTTP_STATUS_FAILURE, + AWS_AUTH_PROVIDER_PARSER_UNEXPECTED_RESPONSE, + AWS_AUTH_CREDENTIALS_PROVIDER_ECS_SOURCE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_X509_SOURCE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_PROCESS_SOURCE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_STS_WEB_IDENTITY_SOURCE_FAILURE, + AWS_AUTH_SIGNING_UNSUPPORTED_SIGNATURE_TYPE, + AWS_AUTH_SIGNING_MISSING_PREVIOUS_SIGNATURE, + AWS_AUTH_SIGNING_INVALID_CREDENTIALS, + AWS_AUTH_CANONICAL_REQUEST_MISMATCH, + AWS_AUTH_SIGV4A_SIGNATURE_VALIDATION_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_COGNITO_SOURCE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_DELEGATE_FAILURE, + AWS_AUTH_SSO_TOKEN_PROVIDER_SOURCE_FAILURE, + AWS_AUTH_SSO_TOKEN_INVALID, + AWS_AUTH_SSO_TOKEN_EXPIRED, + AWS_AUTH_CREDENTIALS_PROVIDER_SSO_SOURCE_FAILURE, + AWS_AUTH_IMDS_CLIENT_SOURCE_FAILURE, + AWS_AUTH_PROFILE_STS_CREDENTIALS_PROVIDER_CYCLE_FAILURE, + AWS_AUTH_CREDENTIALS_PROVIDER_ECS_INVALID_TOKEN_FILE_PATH, + AWS_AUTH_CREDENTIALS_PROVIDER_ECS_INVALID_HOST, + + AWS_AUTH_ERROR_END_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_AUTH_PACKAGE_ID) +}; + +/** + * Auth-specific logging subjects + */ +enum aws_auth_log_subject { + AWS_LS_AUTH_GENERAL = AWS_LOG_SUBJECT_BEGIN_RANGE(AWS_C_AUTH_PACKAGE_ID), + AWS_LS_AUTH_PROFILE, + AWS_LS_AUTH_CREDENTIALS_PROVIDER, + AWS_LS_AUTH_SIGNING, + AWS_LS_IMDS_CLIENT, + + AWS_LS_AUTH_LAST = AWS_LOG_SUBJECT_END_RANGE(AWS_C_AUTH_PACKAGE_ID) +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes internal datastructures used by aws-c-auth. + * Must be called before using any functionality in aws-c-auth. + * + * @param allocator memory allocator to use for any module-level memory allocation + */ +AWS_AUTH_API +void aws_auth_library_init(struct aws_allocator *allocator); + +/** + * Clean up internal datastructures used by aws-c-auth. + * Must not be called until application is done using functionality in aws-c-auth. + */ +AWS_AUTH_API +void aws_auth_library_clean_up(void); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_AUTH_AUTH_H */ diff --git a/include/aws/auth/aws_imds_client.h b/include/aws/auth/aws_imds_client.h new file mode 100644 index 0000000000000000000000000000000000000000..f9f5580f2edba5c1c6751d72fe5332982732ac10 --- /dev/null +++ b/include/aws/auth/aws_imds_client.h @@ -0,0 +1,489 @@ +#ifndef AWS_AUTH_IMDS_CLIENT_H +#define AWS_AUTH_IMDS_CLIENT_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +typedef void(aws_imds_client_shutdown_completed_fn)(void *user_data); + +/** + * Optional callback and user data to be invoked when an imds client has fully shut down + */ +struct aws_imds_client_shutdown_options { + aws_imds_client_shutdown_completed_fn *shutdown_callback; + void *shutdown_user_data; +}; + +/** + * Configuration options when creating an imds client + */ +struct aws_imds_client_options { + /* + * Completion callback to be invoked when the client has fully shut down + */ + struct aws_imds_client_shutdown_options shutdown_options; + + /* + * Client bootstrap to use when this client makes network connections + */ + struct aws_client_bootstrap *bootstrap; + + /* + * Retry strategy instance that governs how failed requests are retried + */ + struct aws_retry_strategy *retry_strategy; + + /* + * What version of the imds protocol to use + * + * Defaults to IMDS_PROTOCOL_V2 + */ + enum aws_imds_protocol_version imds_version; + + /* + * If true, fallback from v2 to v1 will be disabled for all cases + */ + bool ec2_metadata_v1_disabled; + + /* + * Table holding all cross-system functional dependencies for an imds client. + * + * For mocking the http layer in tests, leave NULL otherwise + */ + struct aws_auth_http_system_vtable *function_table; +}; + +/* + * Standard callback for instance metadata queries + */ +typedef void( + aws_imds_client_on_get_resource_callback_fn)(const struct aws_byte_buf *resource, int error_code, void *user_data); + +/** + * https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html + */ +struct aws_imds_iam_profile { + struct aws_date_time last_updated; + struct aws_byte_cursor instance_profile_arn; + struct aws_byte_cursor instance_profile_id; +}; + +/** + * Block of per-instance EC2-specific data + * + * https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html + */ +struct aws_imds_instance_info { + /* an array of aws_byte_cursor */ + struct aws_array_list marketplace_product_codes; + struct aws_byte_cursor availability_zone; + struct aws_byte_cursor private_ip; + struct aws_byte_cursor version; + struct aws_byte_cursor instance_id; + /* an array of aws_byte_cursor */ + struct aws_array_list billing_products; + struct aws_byte_cursor instance_type; + struct aws_byte_cursor account_id; + struct aws_byte_cursor image_id; + struct aws_date_time pending_time; + struct aws_byte_cursor architecture; + struct aws_byte_cursor kernel_id; + struct aws_byte_cursor ramdisk_id; + struct aws_byte_cursor region; +}; + +/* the item typed stored in array is pointer to aws_byte_cursor */ +typedef void( + aws_imds_client_on_get_array_callback_fn)(const struct aws_array_list *array, int error_code, void *user_data); + +typedef void(aws_imds_client_on_get_credentials_callback_fn)( + const struct aws_credentials *credentials, + int error_code, + void *user_data); + +typedef void(aws_imds_client_on_get_iam_profile_callback_fn)( + const struct aws_imds_iam_profile *iam_profile_info, + int error_code, + void *user_data); + +typedef void(aws_imds_client_on_get_instance_info_callback_fn)( + const struct aws_imds_instance_info *instance_info, + int error_code, + void *user_data); + +/** + * AWS EC2 Metadata Client is used to retrieve AWS EC2 Instance Metadata info. + */ +struct aws_imds_client; + +AWS_EXTERN_C_BEGIN + +/** + * Creates a new imds client + * + * @param allocator memory allocator to use for creation and queries + * @param options configuration options for the imds client + * + * @return a newly-constructed imds client, or NULL on failure + */ +AWS_AUTH_API +struct aws_imds_client *aws_imds_client_new( + struct aws_allocator *allocator, + const struct aws_imds_client_options *options); + +/** + * Increments the ref count on the client + * + * @param client imds client to acquire a reference to + */ +AWS_AUTH_API +void aws_imds_client_acquire(struct aws_imds_client *client); + +/** + * Decrements the ref count on the client + * + * @param client imds client to release a reference to + */ +AWS_AUTH_API +void aws_imds_client_release(struct aws_imds_client *client); + +/** + * Queries a generic resource (string) from the ec2 instance metadata document + * + * @param client imds client to use for the query + * @param resource_path path of the resource to query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_resource_async( + struct aws_imds_client *client, + struct aws_byte_cursor resource_path, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the ami id of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_ami_id( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the ami launch index of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_ami_launch_index( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the ami manifest path of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_ami_manifest_path( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the list of ancestor ami ids of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_ancestor_ami_ids( + struct aws_imds_client *client, + aws_imds_client_on_get_array_callback_fn callback, + void *user_data); + +/** + * Gets the instance-action of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_instance_action( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the instance id of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_instance_id( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the instance type of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_instance_type( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the mac address of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_mac_address( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the private ip address of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_private_ip_address( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the availability zone of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_availability_zone( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the product codes of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_product_codes( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the public key of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_public_key( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the ramdisk id of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_ramdisk_id( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the reservation id of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_reservation_id( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the list of the security groups of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_security_groups( + struct aws_imds_client *client, + aws_imds_client_on_get_array_callback_fn callback, + void *user_data); + +/** + * Gets the list of block device mappings of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_block_device_mapping( + struct aws_imds_client *client, + aws_imds_client_on_get_array_callback_fn callback, + void *user_data); + +/** + * Gets the attached iam role of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_attached_iam_role( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets temporary credentials based on the attached iam role of the ec2 instance + * + * @param client imds client to use for the query + * @param iam_role_name iam role name to get temporary credentials through + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_credentials( + struct aws_imds_client *client, + struct aws_byte_cursor iam_role_name, + aws_imds_client_on_get_credentials_callback_fn callback, + void *user_data); + +/** + * Gets the iam profile information of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_iam_profile( + struct aws_imds_client *client, + aws_imds_client_on_get_iam_profile_callback_fn callback, + void *user_data); + +/** + * Gets the user data of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_user_data( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the signature of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_instance_signature( + struct aws_imds_client *client, + aws_imds_client_on_get_resource_callback_fn callback, + void *user_data); + +/** + * Gets the instance information data block of the ec2 instance from the instance metadata document + * + * @param client imds client to use for the query + * @param callback callback function to invoke on query success or failure + * @param user_data opaque data to invoke the completion callback with + * @return AWS_OP_SUCCESS if the query was successfully started, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_imds_client_get_instance_info( + struct aws_imds_client *client, + aws_imds_client_on_get_instance_info_callback_fn callback, + void *user_data); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_AUTH_IMDS_CLIENT_H */ diff --git a/include/aws/auth/credentials.h b/include/aws/auth/credentials.h new file mode 100644 index 0000000000000000000000000000000000000000..ce87c9c4a17eb8b5fe9ed41c31fc7bd5691dfe63 --- /dev/null +++ b/include/aws/auth/credentials.h @@ -0,0 +1,1277 @@ +#ifndef AWS_AUTH_CREDENTIALS_H +#define AWS_AUTH_CREDENTIALS_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_client_bootstrap; +struct aws_auth_http_system_vtable; +struct aws_credentials; +struct aws_credentials_provider; +struct aws_ecc_key_pair; +struct aws_string; + +extern const uint16_t aws_sts_assume_role_default_duration_secs; + +/* + * Signature for the credentials sourcing callback + */ +typedef void(aws_on_get_credentials_callback_fn)(struct aws_credentials *credentials, int error_code, void *user_data); + +typedef int(aws_credentials_provider_get_credentials_fn)( + struct aws_credentials_provider *provider, + aws_on_get_credentials_callback_fn callback, + void *user_data); +typedef void(aws_credentials_provider_destroy_fn)(struct aws_credentials_provider *provider); + +/* + * Common function table that all credentials provider implementations must support + */ +struct aws_credentials_provider_vtable { + aws_credentials_provider_get_credentials_fn *get_credentials; + aws_credentials_provider_destroy_fn *destroy; +}; + +typedef void(aws_credentials_provider_shutdown_completed_fn)(void *user_data); + +/* + * All credentials providers support an optional shutdown callback that + * gets invoked, with appropriate user data, when the resources used by the provider + * are no longer in use. For example, the imds provider uses this to + * signal when it is no longer using the client bootstrap used in its + * internal connection manager. + */ +struct aws_credentials_provider_shutdown_options { + aws_credentials_provider_shutdown_completed_fn *shutdown_callback; + void *shutdown_user_data; +}; + +/** + * A baseclass for credentials providers. A credentials provider is an object that has an asynchronous + * query function for retrieving AWS credentials. + * + * Ref-counted. Thread-safe. + */ +struct aws_credentials_provider { + struct aws_credentials_provider_vtable *vtable; + struct aws_allocator *allocator; + struct aws_credentials_provider_shutdown_options shutdown_options; + void *impl; + struct aws_atomic_var ref_count; +}; + +/* + * Config structs for creating all the different credentials providers + */ + +/** + * Configuration options for a provider that returns a fixed set of credentials + */ +struct aws_credentials_provider_static_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + struct aws_byte_cursor access_key_id; + struct aws_byte_cursor secret_access_key; + struct aws_byte_cursor session_token; + struct aws_byte_cursor account_id; +}; + +/** + * Configuration options for a provider that returns credentials based on environment variable values + */ +struct aws_credentials_provider_environment_options { + struct aws_credentials_provider_shutdown_options shutdown_options; +}; + +/** + * Configuration options for a provider that sources credentials from the aws config and credentials files + * (by default ~/.aws/config and ~/.aws/credentials) + */ +struct aws_credentials_provider_profile_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Override of what profile to use to source credentials from ('default' by default) + */ + struct aws_byte_cursor profile_name_override; + + /* + * Override path to the profile config file (~/.aws/config by default) + */ + struct aws_byte_cursor config_file_name_override; + + /* + * Override path to the profile credentials file (~/.aws/credentials by default) + */ + struct aws_byte_cursor credentials_file_name_override; + + /** + * (Optional) + * Use a cached merged profile collection. A merge collection has both config file + * (~/.aws/config) and credentials file based profile collection (~/.aws/credentials) using + * `aws_profile_collection_new_from_merge`. + * If this option is provided, `config_file_name_override` and `credentials_file_name_override` will be ignored. + */ + struct aws_profile_collection *profile_collection_cached; + + /* + * Bootstrap to use for any network connections made while sourcing credentials (for example, + * a profile that uses assume-role will need to hit STS) + */ + struct aws_client_bootstrap *bootstrap; + + /* + * Client TLS context to use for any secure network connections made while sourcing credentials + * (for example, a profile that uses assume-role will need to hit STS). + * + * If a TLS context is needed, and you did not pass one in, it will be created automatically. + * However, you are encouraged to pass in a shared one since these are expensive objects. + * If using BYO_CRYPTO, you must provide the TLS context since it cannot be created automatically. + */ + struct aws_tls_ctx *tls_ctx; + + /* For mocking the http layer in tests, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; +}; + +/** + * Configuration options for a provider that functions as a caching decorator. Credentials sourced through this + * provider will be cached within it until their expiration time. When the cached credentials expire, new + * credentials will be fetched when next queried. + */ +struct aws_credentials_provider_cached_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * The provider to cache credentials query results from + */ + struct aws_credentials_provider *source; + + /* + * An optional expiration time period for sourced credentials. For a given set of cached credentials, + * the refresh time period will be the minimum of this time and any expiration timestamp on the credentials + * themselves. + */ + uint64_t refresh_time_in_milliseconds; + + /* For mocking, leave NULL otherwise */ + aws_io_clock_fn *high_res_clock_fn; + aws_io_clock_fn *system_clock_fn; +}; + +/** + * Configuration options for a provider that queries, in order, a list of providers. This provider uses the + * first set of credentials successfully queried. Providers are queried one at a time; a provider is not queried + * until the preceding provider has failed to source credentials. + */ +struct aws_credentials_provider_chain_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Pointer to an array of credentials providers to use + */ + struct aws_credentials_provider **providers; + + /* + * Number of elements in the array of credentials providers + */ + size_t provider_count; +}; + +/* + * EC2 IMDS_V1 takes one http request to get resource, while IMDS_V2 takes one more token (Http PUT) request + * to get secure token used in following request. + */ +enum aws_imds_protocol_version { + /** + * Defaults to IMDS_PROTOCOL_V2. It can be set to either one and IMDS Client + * will figure out (by looking at response code) which protocol an instance + * is using. But a more clear setting will reduce unnecessary network request. + */ + IMDS_PROTOCOL_V2, + IMDS_PROTOCOL_V1, +}; + +/** + * Configuration options for the provider that sources credentials from ec2 instance metadata + */ +struct aws_credentials_provider_imds_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Connection bootstrap to use for any network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /* + * Which version of the imds query protocol to use. + */ + enum aws_imds_protocol_version imds_version; + + /* + * If true, fallback from v2 to v1 will be disabled for all cases + */ + bool ec2_metadata_v1_disabled; + + /* For mocking the http layer in tests, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; +}; + +/* + * Configuration options for the provider that sources credentials from ECS container metadata. + * The ECS creds provider can be used to access creds via either a relative URI to a fixed endpoint + * (http://169.254.170.2) or via a full URI specified by environment variables (in order of priority): + * AWS_CONTAINER_CREDENTIALS_RELATIVE_URI + * AWS_CONTAINER_CREDENTIALS_FULL_URI + * + *`AWS_CONTAINER_CREDENTIALS_FULL_URI` URL must satisfy one of the following: + * 1. The URL begins with `https`. + * 2. The resolved IP address is within the loopback CIDR (IPv4 127.0.0.0/8, IPv6 ::1/128), ECS container address + * (169.254.170.2), or EKS Pod Identity address (169.254.170.23 or fd00:ec2::23). + * + * For the Authorization token, there are two ways (in order of priority): + * 1. AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE (an env var which contains the absolute path to the token file. The file + * will be re-read for each call to get credentials.) + * 2. AWS_CONTAINER_AUTHORIZATION_TOKEN (an env var that contains a static auth token) + */ +struct aws_credentials_provider_ecs_environment_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * (Required) + * Connection bootstrap to use for any network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /* + * (Required) + * Client TLS context to use when making a query. This will only be used if the AWS_CONTAINER_CREDENTIALS_FULL_URI + * is set and starts with https + */ + struct aws_tls_ctx *tls_ctx; + + /* For mocking the http layer in tests, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; +}; + +/* + * Configuration options for the provider that sources credentials from ECS container metadata. + * This options struct doesn't read anything from the environment and requires everything to be explicitly passed in. If + * you need to read properties from the environment, use the `aws_credentials_provider_ecs_environment_options`. + * + *`host` must satisfy one of the following: + * 1. tls_context is set + * 2. The resolved IP address is within the loopback CIDR (IPv4 127.0.0.0/8, IPv6 ::1/128), ECS container address + * (169.254.170.2), or EKS Pod Identity address (169.254.170.23 or fd00:ec2::23). + */ +struct aws_credentials_provider_ecs_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Connection bootstrap to use for any network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /* + * Host to query credentials from + */ + struct aws_byte_cursor host; + + /* + * Http path and query string for the credentials query + */ + struct aws_byte_cursor path_and_query; + + /* + * Authorization token file path to include in the credentials query. The file will be re-read for each call to + * get_credentials. + * This has higher priority than `auth_token`. + */ + struct aws_byte_cursor auth_token_file_path; + + /* + * Authorization token to include in the credentials query. + * No effect if `auth_token_file_path` is set. + */ + struct aws_byte_cursor auth_token; + + /* + * Client TLS context to use when making query. + * If set, port 443 is used. If NULL, port 80 is used. + */ + struct aws_tls_ctx *tls_ctx; + + /* For mocking the http layer in tests, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; + + /* + * Port to query credentials from. If zero, 80/443 will be used based on whether or not tls is enabled. + */ + uint32_t port; +}; + +/** + * Configuration options for the X509 credentials provider + * + * The x509 credentials provider sources temporary credentials from AWS IoT Core using TLS mutual authentication. + * See details: https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html + * An end to end demo with detailed steps can be found here: + * https://aws.amazon.com/blogs/security/how-to-eliminate-the-need-for-hardcoded-aws-credentials-in-devices-by-using-the-aws-iot-credentials-provider/ + */ +struct aws_credentials_provider_x509_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Connection bootstrap to use for any network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /* TLS connection options that have been initialized with your x509 certificate and private key */ + const struct aws_tls_connection_options *tls_connection_options; + + /* IoT thing name you registered with AWS IOT for your device, it will be used in http request header */ + struct aws_byte_cursor thing_name; + + /* Iot role alias you created with AWS IoT for your IAM role, it will be used in http request path */ + struct aws_byte_cursor role_alias; + + /** + * Per-account X509 credentials sourcing endpoint. + */ + struct aws_byte_cursor endpoint; + + /** + * (Optional) Http proxy configuration for the http request that fetches credentials + */ + const struct aws_http_proxy_options *proxy_options; + + /* For mocking the http layer in tests, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; +}; + +/** + * Configuration options for the STS web identity provider + * + * Sts with web identity credentials provider sources a set of temporary security credentials for users who have been + * authenticated in a mobile or web application with a web identity provider. + * Example providers include Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible + * identity provider like Elastic Kubernetes Service + * https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html + * The required parameters used in the request (region, roleArn, sessionName, tokenFilePath) are automatically resolved + * by SDK from envrionment variables or config file if not set. + --------------------------------------------------------------------------------- + | Parameter | Environment Variable Name | Config File Property Name | + ---------------------------------------------------------------------------------- + | region | AWS_REGION/AWS_DEFAULT_REGION| region | + | role_arn | AWS_ROLE_ARN | role_arn | + | role_session_name | AWS_ROLE_SESSION_NAME | role_session_name | + | token_file_path | AWS_WEB_IDENTITY_TOKEN_FILE | web_identity_token_file | + |--------------------------------------------------------------------------------| + * The order of resolution is the following + * 1. Parameters + * 2. Environment Variables (in case of region, the AWS_REGION is preferred over the AWS_DEFAULT_REGION) + * 3. Config File + */ +struct aws_credentials_provider_sts_web_identity_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Connection bootstrap to use for any network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /** + * (Optional) + * Use a cached config profile collection. You can also pass a merged collection. + */ + struct aws_profile_collection *config_profile_collection_cached; + + /* + * Client TLS context to use when querying STS web identity provider. + * Required. + */ + struct aws_tls_ctx *tls_ctx; + + /* For mocking the http layer in tests, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; + + /* + * (Optional) + * Override of what profile to use, if not set, 'default' will be used. + */ + struct aws_byte_cursor profile_name_override; + + /* + * (Optional) + * Override of region, if not set, it will be resolved from env or profile. + */ + struct aws_byte_cursor region; + /* + * (Optional) + * Override of role_arn, if not set, it will be resolved from env or profile. + */ + struct aws_byte_cursor role_arn; + /* + * (Optional) + * Override of role_session_name, if not set, it will be resolved from env or profile. + */ + struct aws_byte_cursor role_session_name; + /* + * (Optional) + * Override of token_file_path, if not set, it will be resolved from env or profile. + */ + struct aws_byte_cursor token_file_path; +}; + +/* + * Configuration for the SSOCredentialsProvider that sends a GetRoleCredentialsRequest to the AWS Single + * Sign-On Service to maintain short-lived sessions to use for authentication. + * + * https://docs.aws.amazon.com/sdkref/latest/guide/feature-sso-credentials.html + */ +struct aws_credentials_provider_sso_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Override of what profile to use to source credentials from ('default' by default) + */ + struct aws_byte_cursor profile_name_override; + + /* + * Override path to the profile config file (~/.aws/config by default) + */ + struct aws_byte_cursor config_file_name_override; + + /** + * (Optional) + * Use a cached config profile collection. You can also pass a merged collection. + * config_file_name_override will be ignored if this option is provided. + */ + struct aws_profile_collection *config_file_cached; + + /* + * Connection bootstrap to use for any network connections made while sourcing credentials + * Required. + */ + struct aws_client_bootstrap *bootstrap; + + /* + * Client TLS context to use when querying SSO provider. + * Required. + */ + struct aws_tls_ctx *tls_ctx; + + /* For mocking, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; + aws_io_clock_fn *system_clock_fn; +}; + +/** + * Configuration options for the STS credentials provider. + * STS Credentials Provider will try to automatically resolve the region and use a regional STS endpoint if successful. + * The region resolution order is the following: + * 1. AWS_REGION environment variable + * 2. AWS_DEFAULT_REGION environment variable + * 3. The region property in the config file. + */ +struct aws_credentials_provider_sts_options { + /* + * Connection bootstrap to use for any network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /* + * Client TLS context to use when querying STS. + * Required. + */ + struct aws_tls_ctx *tls_ctx; + + /* + * Credentials provider to be used to sign the requests made to STS to fetch credentials. + */ + struct aws_credentials_provider *creds_provider; + + /* + * Arn of the role to assume by fetching credentials for + */ + struct aws_byte_cursor role_arn; + + /* + * Assumed role session identifier to be associated with the sourced credentials + */ + struct aws_byte_cursor session_name; + + /* + * (Optional) Unique identifier for assuming a role in another account + */ + struct aws_byte_cursor external_id; + + /* + * How long sourced credentials should remain valid for, in seconds. 900 is the minimum allowed value. + */ + uint16_t duration_seconds; + + /** + * (Optional) Http proxy configuration for the AssumeRole http request that fetches credentials + */ + const struct aws_http_proxy_options *http_proxy_options; + + /** + * (Optional) + * Uses a cached config file profile collection (~/.aws/config). You can also pass a merged profile collection, + * which contains both a config file and a credentials file. + * If provided, config_file_name_override is ignored. + */ + struct aws_profile_collection *profile_collection_cached; + + /* + * (Optional) + * Override of what profile to use; if not set, 'default' will be used. + */ + struct aws_byte_cursor profile_name_override; + + /* + * (Optional) + * Override path to the profile config file (~/.aws/config by default). + */ + struct aws_byte_cursor config_file_name_override; + + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* For mocking, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; + aws_io_clock_fn *system_clock_fn; +}; + +/** + * + * Configuration options for the process credentials provider + * + * The process credentials provider sources credentials from running a command or process. + * The command to run is sourced from a profile in the AWS config file, using the standard + * profile selection rules. The profile key the command is read from is "credential_process." + * E.g.: + * [default] + * credential_process=/opt/amazon/bin/my-credential-fetcher --argsA=abc + * On successfully running the command, the output should be a json data with the following + * format: + * { + "Version": 1, + "AccessKeyId": "accesskey", + "SecretAccessKey": "secretAccessKey" + "SessionToken": "....", + "Expiration": "2019-05-29T00:21:43Z" + } + * Version here identifies the command output format version. + */ +struct aws_credentials_provider_process_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + /** + * In which profile name to look for credential_process, + * if not provided, we will try environment variable: AWS_PROFILE. + */ + struct aws_byte_cursor profile_to_use; + + /** + * (Optional) + * Use a cached config profile collection. You can also pass a merged collection. + */ + struct aws_profile_collection *config_profile_collection_cached; +}; + +/** + * Configuration options for the default credentials provider chain. + */ +struct aws_credentials_provider_chain_default_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /* + * Connection bootstrap to use for any network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /* + * Client TLS context to use for any secure network connections made while sourcing credentials. + * + * If not provided the default chain will construct a new one, but these + * are expensive objects so you are encouraged to pass in a shared one. + * + * Must be provided if using BYO_CRYPTO. + */ + struct aws_tls_ctx *tls_ctx; + + /** + * (Optional) + * Use a cached merged profile collection. A merge collection has both config file + * (~/.aws/config) and credentials file based profile collection (~/.aws/credentials) using + * `aws_profile_collection_new_from_merge`. + */ + struct aws_profile_collection *profile_collection_cached; + + /* + * (Optional) + * Override of what profile to use, if not set, 'default' will be used. + */ + struct aws_byte_cursor profile_name_override; + + /* + * (Optional) + * If enabled, the Environment Credentials Provider is not added to the chain. + */ + bool skip_environment_credentials_provider; +}; + +typedef int(aws_credentials_provider_delegate_get_credentials_fn)( + void *delegate_user_data, + aws_on_get_credentials_callback_fn callback, + void *callback_user_data); + +/** + * Configuration options for the delegate credentials provider. + */ +struct aws_credentials_provider_delegate_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /** + * Delegated get_credentials() callback. + */ + aws_credentials_provider_delegate_get_credentials_fn *get_credentials; + + /** + * User data for delegated callbacks. + */ + void *delegate_user_data; +}; + +/** + * A (string) pair defining an identity provider and a valid login token sourced from it. + */ +struct aws_cognito_identity_provider_token_pair { + + /** + * Name of an identity provider + */ + struct aws_byte_cursor identity_provider_name; + + /** + * Valid login token source from the identity provider + */ + struct aws_byte_cursor identity_provider_token; +}; + +typedef void(aws_credentials_provider_cognito_get_token_pairs_completion_fn)( + struct aws_cognito_identity_provider_token_pair *logins, + size_t login_count, + int error_code, + void *completion_user_data); + +typedef int(aws_credentials_provider_cognito_get_token_pairs_async_fn)( + void *get_token_pairs_user_data, + aws_credentials_provider_cognito_get_token_pairs_completion_fn *completion_callback, + void *completion_user_data); + +/** + * Configuration options needed to create a Cognito-based Credentials Provider + */ +struct aws_credentials_provider_cognito_options { + struct aws_credentials_provider_shutdown_options shutdown_options; + + /** + * Cognito service regional endpoint to source credentials from. + */ + struct aws_byte_cursor endpoint; + + /** + * Cognito identity to fetch credentials relative to. + */ + struct aws_byte_cursor identity; + + /** + * Optional set of identity provider token pairs to allow for authenticated identity access. + */ + struct aws_cognito_identity_provider_token_pair *logins; + size_t login_count; + + /** + * Optional ARN of the role to be assumed when multiple roles were received in the token from the identity provider. + */ + struct aws_byte_cursor *custom_role_arn; + + /** + * Connection bootstrap to use for network connections made while sourcing credentials + */ + struct aws_client_bootstrap *bootstrap; + + /** + * Client TLS context to use when querying cognito credentials. + * Required. + */ + struct aws_tls_ctx *tls_ctx; + + /** + * (Optional) Http proxy configuration for the http request that fetches credentials + */ + const struct aws_http_proxy_options *http_proxy_options; + + /* For mocking the http layer in tests, leave NULL otherwise */ + struct aws_auth_http_system_vtable *function_table; + + /** + * Optional async function to allow for dynamic augmentation of the token pair set on a per-request basis. + */ + aws_credentials_provider_cognito_get_token_pairs_async_fn *get_token_pairs; + + /** + * User data that should be passed in to the get_token_pairs function as the first parameter. In practice, this + * will be a reference to a CRT binding object. + */ + void *get_token_pairs_user_data; +}; + +/** + * Configuration options for `aws_credentials_new_with_options` + */ +struct aws_credentials_options { + + /* Value for the aws access key id field */ + struct aws_byte_cursor access_key_id_cursor; + /* Value for the secret access key field */ + struct aws_byte_cursor secret_access_key_cursor; + /* (Optional) security token associated with the credentials */ + struct aws_byte_cursor session_token_cursor; + /* (Optional) account id associated with the credentials */ + struct aws_byte_cursor account_id_cursor; + /* Time point, in seconds since epoch, that the credentials will no longer be valid. + * For credentials that do not expire, use UINT64_MAX. */ + uint64_t expiration_timepoint_seconds; +}; + +AWS_EXTERN_C_BEGIN + +/* + * Credentials APIs + * + * expiration_timepoint_seconds is the timepoint, in seconds since epoch, that the credentials will no longer + * be valid. For credentials that do not expire, use UINT64_MAX. + */ + +/** + * Creates a new set of aws credentials + * + * @param allocator memory allocator to use + * @param access_key_id_cursor value for the aws access key id field + * @param secret_access_key_cursor value for the secret access key field + * @param session_token_cursor (optional) security token associated with the credentials + * @param expiration_timepoint_seconds timepoint, in seconds since epoch, that the credentials will no longer + * be valid past. For credentials that do not expire, use UINT64_MAX + * + * @return a valid credentials object, or NULL + */ +AWS_AUTH_API +struct aws_credentials *aws_credentials_new( + struct aws_allocator *allocator, + struct aws_byte_cursor access_key_id_cursor, + struct aws_byte_cursor secret_access_key_cursor, + struct aws_byte_cursor session_token_cursor, + uint64_t expiration_timepoint_seconds); + +/** + * Creates a new set of aws credentials with account_id + * + * @param allocator memory allocator to use + * @param access_key_id_cursor value for the aws access key id field + * @param secret_access_key_cursor value for the secret access key field + * @param session_token_cursor (optional) security token associated with the credentials + * @param account_id (optional) value for the account_id field + * @param expiration_timepoint_seconds timepoint, in seconds since epoch, that the credentials will no longer + * be valid past. For credentials that do not expire, use UINT64_MAX + * + * @return a valid credentials object, or NULL + */ +AWS_AUTH_API +struct aws_credentials *aws_credentials_new_with_options( + struct aws_allocator *allocator, + const struct aws_credentials_options *options); + +/** + * Creates a new set of aws anonymous credentials. + * Use Anonymous credentials, when you want to skip the signing process. + * + * @param allocator memory allocator to use + * + * @return a valid credentials object, or NULL + */ +AWS_AUTH_API +struct aws_credentials *aws_credentials_new_anonymous(struct aws_allocator *allocator); + +/** + * Creates a new set of AWS credentials + * + * @param allocator memory allocator to use + * @param access_key_id value for the aws access key id field + * @param secret_access_key value for the secret access key field + * @param session_token (optional) security token associated with the credentials + * @param expiration_timepoint_seconds timepoint, in seconds since epoch, that the credentials will no longer + * be valid past. For credentials that do not expire, use UINT64_MAX + * + * @return a valid credentials object, or NULL + */ +AWS_AUTH_API +struct aws_credentials *aws_credentials_new_from_string( + struct aws_allocator *allocator, + const struct aws_string *access_key_id, + const struct aws_string *secret_access_key, + const struct aws_string *session_token, + uint64_t expiration_timepoint_seconds); + +/** + * Creates a set of AWS credentials that includes an ECC key pair. These credentials do not have a value for + * the secret access key; the ecc key takes over that field's role in sigv4a signing. + * + * @param allocator memory allocator to use for all memory allocation + * @param access_key_id access key id for the credential set + * @param ecc_key ecc key to use during signing when using these credentials + * @param session_token (optional) session token associated with the credentials + * @param expiration_timepoint_in_seconds (optional) if session-based, time at which these credentials expire + * @return a new pair of AWS credentials, or NULL + */ +AWS_AUTH_API +struct aws_credentials *aws_credentials_new_ecc( + struct aws_allocator *allocator, + struct aws_byte_cursor access_key_id, + struct aws_ecc_key_pair *ecc_key, + struct aws_byte_cursor session_token, + uint64_t expiration_timepoint_in_seconds); + +/* + * Takes a pair of AWS credentials and performs the sigv4a key expansion algorithm to generate a unique + * ecc P256 key pair based on the credentials. The ecc key is written to the buffer in DER format. + * + * Sigv4a signing takes the raw DER-encoded ecc key as an optional parameter in signing (if not present, + * key expansion will be done for the caller before signing). + */ +AWS_AUTH_API +struct aws_credentials *aws_credentials_new_ecc_from_aws_credentials( + struct aws_allocator *allocator, + const struct aws_credentials *credentials); + +/** + * Add a reference to some credentials + * + * @param credentials credentials to increment the ref count on + */ +AWS_AUTH_API +void aws_credentials_acquire(const struct aws_credentials *credentials); + +/** + * Remove a reference to some credentials + * + * @param credentials credentials to decrement the ref count on + */ +AWS_AUTH_API +void aws_credentials_release(const struct aws_credentials *credentials); + +/** + * Get the AWS access key id from a set of credentials + * + * @param credentials credentials to get the access key id from + * @return a byte cursor to the access key id + */ +AWS_AUTH_API +struct aws_byte_cursor aws_credentials_get_access_key_id(const struct aws_credentials *credentials); + +/** + * Get the AWS secret access key from a set of credentials + * + * @param credentials credentials to get the secret access key from + * @return a byte cursor to the secret access key + */ +AWS_AUTH_API +struct aws_byte_cursor aws_credentials_get_secret_access_key(const struct aws_credentials *credentials); + +/** + * Get the AWS session token from a set of credentials + * + * @param credentials credentials to get the session token from + * @return a byte cursor to the session token or an empty byte cursor if there is no session token + */ +AWS_AUTH_API +struct aws_byte_cursor aws_credentials_get_session_token(const struct aws_credentials *credentials); + +/** + * Get the AWS account id from a set of credentials + * + * @param credentials to get the account id from + * @return a byte cursor to the account id or an empty byte cursor if there is no account id + */ +AWS_AUTH_API +struct aws_byte_cursor aws_credentials_get_account_id(const struct aws_credentials *credentials); + +/** + * Get the expiration timepoint (in seconds since epoch) associated with a set of credentials + * + * @param credentials credentials to get the expiration timepoint for + * @return the time, in seconds since epoch, the credentials will expire; UINT64_MAX for credentials + * without a specific expiration time + */ +AWS_AUTH_API +uint64_t aws_credentials_get_expiration_timepoint_seconds(const struct aws_credentials *credentials); + +/** + * Get the elliptic curve key associated with this set of credentials + * @param credentials credentials to get the the elliptic curve key for + * @return the elliptic curve key associated with the credentials, or NULL if no key is associated with + * these credentials + */ +AWS_AUTH_API +struct aws_ecc_key_pair *aws_credentials_get_ecc_key_pair(const struct aws_credentials *credentials); + +/** + * If credentials are anonymous, then the signing process is skipped. + * + * @param credentials credentials to check + * + * @return true if the credentials are anonymous; false otherwise. + */ +AWS_AUTH_API +bool aws_credentials_is_anonymous(const struct aws_credentials *credentials); + +/** + * Derives an ecc key pair (based on the nist P256 curve) from the access key id and secret access key components + * of a set of AWS credentials using an internal key derivation specification. Used to perform sigv4a signing in + * the hybrid mode based on AWS credentials. + * + * @param allocator memory allocator to use for all memory allocation + * @param credentials AWS credentials to derive the ECC key from using the AWS sigv4a key derivation specification + * @return a new ecc key pair or NULL on failure + */ +AWS_AUTH_API +struct aws_ecc_key_pair *aws_ecc_key_pair_new_ecdsa_p256_key_from_aws_credentials( + struct aws_allocator *allocator, + const struct aws_credentials *credentials); + +/* + * Credentials provider APIs + */ + +/** + * Release a reference to a credentials provider + * + * @param provider provider to decrement the ref count on + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_release(struct aws_credentials_provider *provider); + +/* + * Add a reference to a credentials provider + * + * @param provider provider to increment the ref count on + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_acquire(struct aws_credentials_provider *provider); + +/* + * Async function for retrieving credentials from a provider + * + * @param provider credentials provider to source from + * @param callback completion callback to invoke when the fetch has completed or failed + * @param user_data user data to pass to the completion callback + * + * @return AWS_OP_SUCCESS if the fetch was successfully started, AWS_OP_ERR otherwise. The completion + * callback will only be invoked if-and-only-if the return value was AWS_OP_SUCCESS. + * + */ +AWS_AUTH_API +int aws_credentials_provider_get_credentials( + struct aws_credentials_provider *provider, + aws_on_get_credentials_callback_fn callback, + void *user_data); + +/* + * Credentials provider variant creation + */ + +/** + * Creates a simple provider that just returns a fixed set of credentials + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_static( + struct aws_allocator *allocator, + const struct aws_credentials_provider_static_options *options); + +/** + * Creates a simple anonymous credentials provider + * + * @param allocator memory allocator to use for all memory allocation + * @param shutdown_options an optional shutdown callback that gets + * invoked when the resources used by the provider are no longer in use. + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_anonymous( + struct aws_allocator *allocator, + const struct aws_credentials_provider_shutdown_options *shutdown_options); + +/** + * Creates a provider that returns credentials sourced from the environment variables: + * + * AWS_ACCESS_KEY_ID + * AWS_SECRET_ACCESS_KEY + * AWS_SESSION_TOKEN + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_environment( + struct aws_allocator *allocator, + const struct aws_credentials_provider_environment_options *options); + +/** + * Creates a provider that functions as a caching decorating of another provider. + * + * For example, the default chain is implemented as: + * + * CachedProvider -> ProviderChain(EnvironmentProvider -> ProfileProvider -> ECS/EC2IMD etc...) + * + * A reference is taken on the target provider + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_cached( + struct aws_allocator *allocator, + const struct aws_credentials_provider_cached_options *options); + +/** + * Creates a provider that sources credentials from key-value profiles loaded from the aws credentials + * file ("~/.aws/credentials" by default) and the aws config file ("~/.aws/config" by + * default) + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_profile( + struct aws_allocator *allocator, + const struct aws_credentials_provider_profile_options *options); + +/** + * Creates a provider that assumes an IAM role via. STS AssumeRole() API. This provider will fetch new credentials + * upon each call to aws_credentials_provider_get_credentials(). + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_sts( + struct aws_allocator *allocator, + const struct aws_credentials_provider_sts_options *options); + +/** + * Creates a provider that sources credentials from an ordered sequence of providers, with the overall result + * being from the first provider to return a valid set of credentials + * + * References are taken on all supplied providers + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_chain( + struct aws_allocator *allocator, + const struct aws_credentials_provider_chain_options *options); + +/** + * Creates a provider that sources credentials from the ec2 instance metadata service + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_imds( + struct aws_allocator *allocator, + const struct aws_credentials_provider_imds_options *options); + +/** + * Creates a provider that sources credentials from the ecs role credentials service and reads the required params from + * environment variables + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_ecs_from_environment( + struct aws_allocator *allocator, + const struct aws_credentials_provider_ecs_environment_options *options); + +/** + * Creates a provider that sources credentials from the ecs role credentials service + * This function doesn't read anything from the environment and requires everything to be explicitly passed in. + * If you need to read properties from the environment, use the `aws_credentials_provider_new_ecs_from_environment`. + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_ecs( + struct aws_allocator *allocator, + const struct aws_credentials_provider_ecs_options *options); + +/** + * Creates a provider that sources credentials from IoT Core + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_x509( + struct aws_allocator *allocator, + const struct aws_credentials_provider_x509_options *options); + +/** + * Creates a provider that sources credentials from STS using AssumeRoleWithWebIdentity + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_sts_web_identity( + struct aws_allocator *allocator, + const struct aws_credentials_provider_sts_web_identity_options *options); + +/** + * Creates a provider that sources credentials from SSO using a SSOToken. + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_sso( + struct aws_allocator *allocator, + const struct aws_credentials_provider_sso_options *options); + +/* + * Creates a provider that sources credentials from running an external command or process + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_process( + struct aws_allocator *allocator, + const struct aws_credentials_provider_process_options *options); + +/** + * Create a credentials provider depends on provided vtable to fetch the credentials. + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_delegate( + struct aws_allocator *allocator, + const struct aws_credentials_provider_delegate_options *options); + +/** + * Creates a provider that sources credentials from the Cognito-Identity service via an + * invocation of the GetCredentialsForIdentity API call. + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_cognito( + struct aws_allocator *allocator, + const struct aws_credentials_provider_cognito_options *options); + +/** + * Creates a cognito-based provider that has a caching layer wrapped around it + * + * @param allocator memory allocator to use for all memory allocation + * @param options cognito-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_cognito_caching( + struct aws_allocator *allocator, + const struct aws_credentials_provider_cognito_options *options); + +/** + * Creates the default provider chain used by most AWS SDKs. + * + * Generally: + * + * (1) Environment + * (2) Profile + * - STSCredentialsProvider + * - ProcessCredentialsProvider + * - ProfileCredentialsProvider + * (3) STS web identity + * (4) (conditional, off by default) ECS + * (5) (conditional, on by default) EC2 Instance Metadata + * + * Support for environmental control of the default provider chain is not yet + * implemented. + * + * @param allocator memory allocator to use for all memory allocation + * @param options provider-specific configuration options + * + * @return the newly-constructed credentials provider, or NULL if an error occurred. + */ +AWS_AUTH_API +struct aws_credentials_provider *aws_credentials_provider_new_chain_default( + struct aws_allocator *allocator, + const struct aws_credentials_provider_chain_default_options *options); + +AWS_AUTH_API extern const struct aws_auth_http_system_vtable *g_aws_credentials_provider_http_function_table; + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_AUTH_CREDENTIALS_H */ diff --git a/include/aws/auth/exports.h b/include/aws/auth/exports.h new file mode 100644 index 0000000000000000000000000000000000000000..9f8fe013fcfa52347bbe5bb35e63a6f689cf3b61 --- /dev/null +++ b/include/aws/auth/exports.h @@ -0,0 +1,29 @@ +#ifndef AWS_AUTH_EXPORTS_H +#define AWS_AUTH_EXPORTS_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#if defined(USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32) +# ifdef AWS_AUTH_USE_IMPORT_EXPORT +# ifdef AWS_AUTH_EXPORTS +# define AWS_AUTH_API __declspec(dllexport) +# else +# define AWS_AUTH_API __declspec(dllimport) +# endif /* AWS_AUTH_EXPORTS */ +# else +# define AWS_AUTH_API +# endif /*USE_IMPORT_EXPORT */ + +#else +# if ((__GNUC__ >= 4) || defined(__clang__)) && defined(AWS_AUTH_USE_IMPORT_EXPORT) && defined(AWS_AUTH_EXPORTS) +# define AWS_AUTH_API __attribute__((visibility("default"))) +# else +# define AWS_AUTH_API +# endif /* __GNUC__ >= 4 || defined(__clang__) */ + +#endif /* defined(USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32) */ + +#endif /* AWS_AUTH_EXPORTS_H */ diff --git a/include/aws/auth/signable.h b/include/aws/auth/signable.h new file mode 100644 index 0000000000000000000000000000000000000000..86c32de69b045427fa1910e4f106e411e80cb46b --- /dev/null +++ b/include/aws/auth/signable.h @@ -0,0 +1,237 @@ +#ifndef AWS_AUTH_SIGNABLE_H +#define AWS_AUTH_SIGNABLE_H + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_http_message; +struct aws_http_headers; +struct aws_input_stream; +struct aws_signable; +struct aws_string; + +/* + * While not referenced directly in this file, this is the structure expected to be in the property lists + */ +struct aws_signable_property_list_pair { + struct aws_byte_cursor name; + struct aws_byte_cursor value; +}; + +typedef int(aws_signable_get_property_fn)( + const struct aws_signable *signable, + const struct aws_string *name, + struct aws_byte_cursor *out_value); + +typedef int(aws_signable_get_property_list_fn)( + const struct aws_signable *signable, + const struct aws_string *name, + struct aws_array_list **out_list); + +typedef int(aws_signable_get_payload_stream_fn)( + const struct aws_signable *signable, + struct aws_input_stream **out_input_stream); + +typedef void(aws_signable_destroy_fn)(struct aws_signable *signable); + +struct aws_signable_vtable { + aws_signable_get_property_fn *get_property; + aws_signable_get_property_list_fn *get_property_list; + aws_signable_get_payload_stream_fn *get_payload_stream; + aws_signable_destroy_fn *destroy; +}; + +/** + * Signable is a generic interface for any kind of object that can be cryptographically signed. + * + * Like signing_result, the signable interface presents + * + * (1) Properties - A set of key-value pairs + * (2) Property Lists - A set of named key-value pair lists + * + * as well as + * + * (3) A message payload modeled as a stream + * + * When creating a signable "subclass" the query interface should map to retrieving + * the properties of the underlying object needed by signing algorithms that can operate on it. + * + * As an example, if a signable implementation wrapped an http request, you would query + * request elements like method and uri from the property interface, headers would be queried + * via the property list interface, and the request body would map to the payload stream. + * + * String constants that map to agreed on keys for particular signable types + * ("METHOD", "URI", "HEADERS", etc...) are exposed in appropriate header files. + */ +struct aws_signable { + struct aws_allocator *allocator; + void *impl; + struct aws_signable_vtable *vtable; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Cleans up and frees all resources associated with a signable instance + * + * @param signable signable object to destroy + */ +AWS_AUTH_API +void aws_signable_destroy(struct aws_signable *signable); + +/** + * Retrieves a property (key-value pair) from a signable. Global property name constants are + * included below. + * + * @param signable signable object to retrieve a property from + * @param name name of the property to query + * @param out_value output parameter for the property's value + * + * @return AWS_OP_SUCCESS if the property was successfully fetched, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_signable_get_property( + const struct aws_signable *signable, + const struct aws_string *name, + struct aws_byte_cursor *out_value); + +/** + * Retrieves a named property list (list of key-value pairs) from a signable. Global property list name + * constants are included below. + * + * @param signable signable object to retrieve a property list from + * @param name name of the property list to fetch + * @param out_property_list output parameter for the fetched property list + * + * @return AWS_OP_SUCCESS if the property list was successfully fetched, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_signable_get_property_list( + const struct aws_signable *signable, + const struct aws_string *name, + struct aws_array_list **out_property_list); + +/** + * Retrieves the signable's message payload as a stream. + * + * @param signable signable to get the payload of + * @param out_input_stream output parameter for the payload stream + * + * @return AWS_OP_SUCCESS if successful, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_signable_get_payload_stream(const struct aws_signable *signable, struct aws_input_stream **out_input_stream); + +/* + * Some global property and property-list name constants + */ + +/** + * Name of the property list that wraps the headers of an http request + */ +AWS_AUTH_API extern const struct aws_string *g_aws_http_headers_property_list_name; + +/** + * Name of the property list that wraps the query params of an http request. Only used by signing_result. + * For input to a http signing algorithm, query params are assumed to be part of the uri. + */ +AWS_AUTH_API extern const struct aws_string *g_aws_http_query_params_property_list_name; + +/** + * Name of the property that holds the method of an http request + */ +AWS_AUTH_API extern const struct aws_string *g_aws_http_method_property_name; + +/** + * Name of the property that holds the URI of an http request + */ +AWS_AUTH_API extern const struct aws_string *g_aws_http_uri_property_name; + +/** + * Name of the property that holds the signature value. This is always added to signing results. + * Depending on the requested signature type, the signature may be padded or encoded differently: + * (1) Header - hex encoding of the binary signature value + * (2) QueryParam - hex encoding of the binary signature value + * (3) Chunk/Sigv4 - hex encoding of the binary signature value + * (4) Chunk/Sigv4a - fixed-size-rhs-padded (with AWS_SIGV4A_SIGNATURE_PADDING_BYTE) hex encoding of the + * binary signature value + * (5) Event - binary signature value (NYI) + */ +AWS_AUTH_API extern const struct aws_string *g_aws_signature_property_name; + +/** + * Name of the property that holds the (hex-encoded) signature value of the signing event that preceded this one. + * This property must appear on signables that represent chunks or events. + */ +AWS_AUTH_API extern const struct aws_string *g_aws_previous_signature_property_name; + +/** + * Name of the property that holds the canonical request associated with this signable. + * This property must appear on signables that represent an http request's canonical request. + */ +AWS_AUTH_API extern const struct aws_string *g_aws_canonical_request_property_name; + +/* + * Common signable constructors + */ + +/** + * Creates a signable wrapper around an http request. + * + * @param allocator memory allocator to use to create the signable + * @param request http request to create a signable for + * + * @return the new signable object, or NULL if failure + */ +AWS_AUTH_API +struct aws_signable *aws_signable_new_http_request(struct aws_allocator *allocator, struct aws_http_message *request); + +/** + * Creates a signable that represents a unit of chunked encoding within an http request. + * This can also be used for Transcribe event signing with encoded payload as chunk_data. + * + * @param allocator memory allocator use to create the signable + * @param chunk_data stream representing the data in the chunk; it should be in its final, encoded form + * @param previous_signature the signature computed in the most recent signing that preceded this one. It can be + * found by copying the "signature" property from the signing_result of that most recent signing. + * + * @return the new signable object, or NULL if failure + */ +AWS_AUTH_API +struct aws_signable *aws_signable_new_chunk( + struct aws_allocator *allocator, + struct aws_input_stream *chunk_data, + struct aws_byte_cursor previous_signature); + +/** + * Creates a signable wrapper around a set of headers. + * + * @param allocator memory allocator use to create the signable + * @param trailing_headers http headers to create a signable for + * @param previous_signature the signature computed in the most recent signing that preceded this one. It can be + * found by copying the "signature" property from the signing_result of that most recent signing. + * + * @return the new signable object, or NULL if failure + */ +AWS_AUTH_API +struct aws_signable *aws_signable_new_trailing_headers( + struct aws_allocator *allocator, + struct aws_http_headers *trailing_headers, + struct aws_byte_cursor previous_signature); + +/** + * Creates a signable that represents a pre-computed canonical request from an http request + * @param allocator memory allocator use to create the signable + * @param canonical_request text of the canonical request + * @return the new signable object, or NULL if failure + */ +AWS_AUTH_API +struct aws_signable *aws_signable_new_canonical_request( + struct aws_allocator *allocator, + struct aws_byte_cursor canonical_request); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_AUTH_SIGNABLE_H */ diff --git a/include/aws/auth/signing.h b/include/aws/auth/signing.h new file mode 100644 index 0000000000000000000000000000000000000000..fe481c6898148c33dc0f873f4481caa53e4e2e69 --- /dev/null +++ b/include/aws/auth/signing.h @@ -0,0 +1,138 @@ +#ifndef AWS_AUTH_SIGNER_H +#define AWS_AUTH_SIGNER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_ecc_key_pair; +struct aws_signable; +struct aws_signing_result; + +/** + * Gets called by the signing function when the signing is complete. + * + * Note that result will be destroyed after this function returns, so either copy it, + * or do all necessary adjustments inside the callback. + * + * When performing event or chunk signing, you will need to copy out the signature value in order + * to correctly configure the signable that wraps the event or chunk you want signed next. The signature is + * found in the "signature" property on the signing result. This value must be added as the + * "previous-signature" property on the next signable. + */ +typedef void(aws_signing_complete_fn)(struct aws_signing_result *result, int error_code, void *userdata); + +AWS_EXTERN_C_BEGIN + +/* + * Takes a signable object and a configuration struct and computes the changes to the signable necessary + * for compliance with the signer's signing algorithm. + * + * This signing function currently supports only the sigv4 algorithm. + * + * When using this signing function to sign AWS http requests: + * + * (1) Do not add the following headers to requests before signing: + * x-amz-content-sha256, + * X-Amz-Date, + * Authorization + * + * (2) Do not add the following query params to requests before signing: + * X-Amz-Signature, + * X-Amz-Date, + * X-Amz-Credential, + * X-Amz-Algorithm, + * X-Amz-SignedHeaders + * + * The signing result will tell exactly what header and/or query params to add to the request + * to become a fully-signed AWS http request. + * + * + * When using this signing function to sign chunks: + * + * (1) Use aws_signable_new_chunk() to create the signable object representing the chunk + * + * The signing result will include the chunk's signature as the "signature" property. + * + * + */ + +/** + * (Asynchronous) entry point to sign something (a request, a chunk, an event) with an AWS signing process. + * Depending on the configuration, the signing process may or may not complete synchronously. + * + * @param allocator memory allocator to use throughout the signing process + * @param signable the thing to be signed. See signable.h for common constructors for signables that + * wrap different types. + * @param base_config pointer to a signing configuration, currently this must be of type aws_signing_config_aws + * @param on_complete completion callback to be invoked when signing has finished + * @param user_data opaque user data that will be passed to the completion callback + * + * @return AWS_OP_SUCCESS if the signing attempt was *initiated* successfully, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_sign_request_aws( + struct aws_allocator *allocator, + const struct aws_signable *signable, + const struct aws_signing_config_base *base_config, + aws_signing_complete_fn *on_complete, + void *userdata); + +/** + * Test-only API used for cross-library signing verification tests + * + * Verifies: + * (1) The canonical request generated during sigv4a signing of the request matches what is passed in + * (2) The signature passed in is a valid ECDSA signature of the hashed string-to-sign derived from the + * canonical request + * + * @param allocator memory allocator to use throughout the signing verification process + * @param signable the thing to be signed. See signable.h for common constructors for signables that + * wrap different types. + * @param base_config pointer to a signing configuration, currently this must be of type aws_signing_config_aws + * @param expected_canonical_request_cursor expected result when building the canonical request + * @param signature_cursor the actual signature computed from a previous signing of the signable + * @param ecc_key_pub_x the x coordinate of the public part of the ecc key to verify the signature + * @param ecc_key_pub_y the y coordinate of the public part of the ecc key to verify the signature + * + * @return AWS_OP_SUCCESS if the signing attempt was *initiated* successfully, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_verify_sigv4a_signing( + struct aws_allocator *allocator, + const struct aws_signable *signable, + const struct aws_signing_config_base *base_config, + struct aws_byte_cursor expected_canonical_request_cursor, + struct aws_byte_cursor signature_cursor, + struct aws_byte_cursor ecc_key_pub_x, + struct aws_byte_cursor ecc_key_pub_y); + +/** + * Another helper function to check a computed sigv4a signature. + */ +AWS_AUTH_API +int aws_validate_v4a_authorization_value( + struct aws_allocator *allocator, + struct aws_ecc_key_pair *ecc_key, + struct aws_byte_cursor string_to_sign_cursor, + struct aws_byte_cursor signature_value_cursor); + +/** + * Removes any padding added to the end of a sigv4a signature. Signature must be hex-encoded. + * @param signature signature to remove padding from + * @return cursor that ranges over only the valid hex encoding of the sigv4a signature + */ +AWS_AUTH_API +struct aws_byte_cursor aws_trim_padded_sigv4a_signature(struct aws_byte_cursor signature); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_AUTH_SIGNER_H */ diff --git a/include/aws/auth/signing_config.h b/include/aws/auth/signing_config.h new file mode 100644 index 0000000000000000000000000000000000000000..fa63fbee4508e29490e8d9cf8a2db6a0c6878936 --- /dev/null +++ b/include/aws/auth/signing_config.h @@ -0,0 +1,314 @@ +#ifndef AWS_AUTH_SIGNING_CONFIG_H +#define AWS_AUTH_SIGNING_CONFIG_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_credentials; + +typedef bool(aws_should_sign_header_fn)(const struct aws_byte_cursor *name, void *userdata); + +/** + * A primitive RTTI indicator for signing configuration structs + * + * There must be one entry per config structure type and it's a fatal error + * to put the wrong value in the "config_type" member of your config structure. + */ +enum aws_signing_config_type { AWS_SIGNING_CONFIG_AWS = 1 }; + +/** + * All signing configuration structs must match this by having + * the config_type member as the first member. + */ +struct aws_signing_config_base { + enum aws_signing_config_type config_type; +}; + +/** + * What version of the AWS signing process should we use. + */ +enum aws_signing_algorithm { + AWS_SIGNING_ALGORITHM_V4, + AWS_SIGNING_ALGORITHM_V4_ASYMMETRIC, + AWS_SIGNING_ALGORITHM_V4_S3EXPRESS, +}; + +/** + * What sort of signature should be computed from the signable? + */ +enum aws_signature_type { + /** + * A signature for a full http request should be computed, with header updates applied to the signing result. + */ + AWS_ST_HTTP_REQUEST_HEADERS, + + /** + * A signature for a full http request should be computed, with query param updates applied to the signing result. + */ + AWS_ST_HTTP_REQUEST_QUERY_PARAMS, + + /** + * Compute a signature for a payload chunk. The signable's input stream should be the chunk data and the + * signable should contain the most recent signature value (either the original http request or the most recent + * chunk) in the "previous-signature" property. + */ + AWS_ST_HTTP_REQUEST_CHUNK, + + /** + * Compute a signature for an event stream event. The signable's input stream should be the encoded event-stream + * message (headers + payload), the signable should contain the most recent signature value (either the original + * http request or the most recent event) in the "previous-signature" property. + * + * This option is only supported for Sigv4 for now. + */ + AWS_ST_HTTP_REQUEST_EVENT, + + /** + * Compute a signature for an http request via it's already-computed canonical request. Only the authorization + * signature header is added to the signing result. + */ + AWS_ST_CANONICAL_REQUEST_HEADERS, + + /** + * Compute a signature for an http request via it's already-computed canonical request. Only the authorization + * signature query param is added to the signing result. + */ + AWS_ST_CANONICAL_REQUEST_QUERY_PARAMS, + + /** + * Compute a signature for the trailing headers. + * the signable should contain the most recent signature value (either the original http request or the most recent + * chunk) in the "previous-signature" property. + */ + AWS_ST_HTTP_REQUEST_TRAILING_HEADERS +}; + +/** + * The SHA-256 of an empty string: + * 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' + * For use with `aws_signing_config_aws.signed_body_value`. + */ +AWS_AUTH_API extern const struct aws_byte_cursor g_aws_signed_body_value_empty_sha256; + +/** + * 'UNSIGNED-PAYLOAD' + * For use with `aws_signing_config_aws.signed_body_value`. + */ +AWS_AUTH_API extern const struct aws_byte_cursor g_aws_signed_body_value_unsigned_payload; + +/** + * 'STREAMING-UNSIGNED-PAYLOAD-TRAILER' + * For use with `aws_signing_config_aws.signed_body_value`. + */ +AWS_AUTH_API extern const struct aws_byte_cursor g_aws_signed_body_value_streaming_unsigned_payload_trailer; + +/** + * 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD' + * For use with `aws_signing_config_aws.signed_body_value`. + */ +AWS_AUTH_API extern const struct aws_byte_cursor g_aws_signed_body_value_streaming_aws4_hmac_sha256_payload; + +/** + * 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD-TRAILER' + * For use with `aws_signing_config_aws.signed_body_value`. + */ +AWS_AUTH_API extern const struct aws_byte_cursor g_aws_signed_body_value_streaming_aws4_hmac_sha256_payload_trailer; + +/** + * 'STREAMING-AWS4-ECDSA-P256-SHA256-PAYLOAD' + * For use with `aws_signing_config_aws.signed_body_value`. + */ +AWS_AUTH_API extern const struct aws_byte_cursor g_aws_signed_body_value_streaming_aws4_ecdsa_p256_sha256_payload; + +/** + * 'STREAMING-AWS4-ECDSA-P256-SHA256-PAYLOAD-TRAILER' + * For use with `aws_signing_config_aws.signed_body_value`. + */ +AWS_AUTH_API extern const struct aws_byte_cursor + g_aws_signed_body_value_streaming_aws4_ecdsa_p256_sha256_payload_trailer; + +/** + * 'STREAMING-AWS4-HMAC-SHA256-EVENTS' + * For use with `aws_signing_config_aws.signed_body_value`. + * + * Event signing is only supported for Sigv4 for now. + */ +AWS_AUTH_API extern const struct aws_byte_cursor g_aws_signed_body_value_streaming_aws4_hmac_sha256_events; + +/** + * Controls if signing adds a header containing the canonical request's body value + */ +enum aws_signed_body_header_type { + /** + * Do not add a header + */ + AWS_SBHT_NONE, + + /** + * Add the "x-amz-content-sha256" header with the canonical request's body value + */ + AWS_SBHT_X_AMZ_CONTENT_SHA256, +}; + +/** + * A configuration structure for use in AWS-related signing. Currently covers sigv4 only, but is not required to. + */ +struct aws_signing_config_aws { + + /** + * What kind of config structure is this? + */ + enum aws_signing_config_type config_type; + + /** + * What signing algorithm to use. + */ + enum aws_signing_algorithm algorithm; + + /** + * What sort of signature should be computed? + */ + enum aws_signature_type signature_type; + + /* + * Region-related configuration + * (1) If Sigv4, the region to sign against + * (2) If Sigv4a, the value of the X-amzn-region-set header (added in signing) + */ + struct aws_byte_cursor region; + + /** + * name of service to sign a request for + */ + struct aws_byte_cursor service; + + /** + * Raw date to use during the signing process. + */ + struct aws_date_time date; + + /** + * Optional function to control which headers are a part of the canonical request. + * Skipping auth-required headers will result in an unusable signature. Headers injected by the signing process + * are not skippable. + * + * This function does not override the internal check function (x-amzn-trace-id, user-agent), but rather + * supplements it. In particular, a header will get signed if and only if it returns true to both + * the internal check (skips x-amzn-trace-id, user-agent) and this function (if defined). + */ + aws_should_sign_header_fn *should_sign_header; + void *should_sign_header_ud; + + /* + * Put all flags in here at the end. If this grows, stay aware of bit-space overflow and ABI compatibility. + */ + struct { + /** + * We assume the uri will be encoded once in preparation for transmission. Certain services + * do not decode before checking signature, requiring us to actually double-encode the uri in the canonical + * request in order to pass a signature check. + */ + uint32_t use_double_uri_encode : 1; + + /** + * Controls whether or not the uri paths should be normalized when building the canonical request + */ + uint32_t should_normalize_uri_path : 1; + + /** + * Controls whether "X-Amz-Security-Token" is omitted from the canonical request. + * "X-Amz-Security-Token" is added during signing, as a header or + * query param, when credentials have a session token. + * If false (the default), this parameter is included in the canonical request. + * If true, this parameter is still added, but omitted from the canonical request. + */ + uint32_t omit_session_token : 1; + } flags; + + /** + * Optional string to use as the canonical request's body value. + * If string is empty, a value will be calculated from the payload during signing. + * Typically, this is the SHA-256 of the (request/chunk/event) payload, written as lowercase hex. + * If this has been precalculated, it can be set here. Special values used by certain services can also be set + * (e.g. "UNSIGNED-PAYLOAD" "STREAMING-AWS4-HMAC-SHA256-PAYLOAD" "STREAMING-AWS4-HMAC-SHA256-EVENTS"). + */ + struct aws_byte_cursor signed_body_value; + + /** + * Controls what body "hash" header, if any, should be added to the canonical request and the signed request: + * AWS_SBHT_NONE - no header should be added + * AWS_SBHT_X_AMZ_CONTENT_SHA256 - the body "hash" should be added in the X-Amz-Content-Sha256 header + */ + enum aws_signed_body_header_type signed_body_header; + + /* + * Signing key control: + * + * If "credentials" is valid: + * use it + * Else if "credentials_provider" is valid + * query credentials from the provider + * If sigv4a is being used + * use the ecc-based credentials derived from the query result + * Else + * use the query result + * Else + * fail + * + */ + + /* + * AWS Credentials to sign with. If Sigv4a is the algorithm and the credentials supplied are not ecc-based, + * a temporary ecc-based credentials object will be built and used instead. + */ + const struct aws_credentials *credentials; + + /* + * AWS credentials provider to fetch credentials from. If the signing algorithm is asymmetric sigv4, then the + * ecc-based credentials will be derived from the fetched credentials. + */ + struct aws_credentials_provider *credentials_provider; + + /** + * If non-zero and the signing transform is query param, then signing will add X-Amz-Expires to the query + * string, equal to the value specified here. If this value is zero or if header signing is being used then + * this parameter has no effect. + */ + uint64_t expiration_in_seconds; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Returns a c-string that describes the supplied signing algorithm + * + * @param algorithm signing algorithm to get a friendly string name for + * + * @return friendly string name of the supplied algorithm, or "Unknown" if the algorithm is not recognized + */ +AWS_AUTH_API +const char *aws_signing_algorithm_to_string(enum aws_signing_algorithm algorithm); + +/** + * Checks a signing configuration for invalid settings combinations. + * + * @param config signing configuration to validate + * + * @return - AWS_OP_SUCCESS if the configuration is valid, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_validate_aws_signing_config_aws(const struct aws_signing_config_aws *config); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_AUTH_SIGNING_CONFIG_H */ diff --git a/include/aws/auth/signing_result.h b/include/aws/auth/signing_result.h new file mode 100644 index 0000000000000000000000000000000000000000..309665adc19a3f3881f906e930e0948fd126d549 --- /dev/null +++ b/include/aws/auth/signing_result.h @@ -0,0 +1,169 @@ +#ifndef AWS_AUTH_SIGNING_RESULT_H +#define AWS_AUTH_SIGNING_RESULT_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_array_list; +struct aws_byte_cursor; +struct aws_http_message; +struct aws_string; + +struct aws_signing_result_property { + struct aws_string *name; + struct aws_string *value; +}; + +/** + * A structure for tracking all the signer-requested changes to a signable. Interpreting + * these changes is signing-algorithm specific. + * + * A signing result consists of + * + * (1) Properties - A set of key-value pairs + * (2) Property Lists - A set of named key-value pair lists + * + * The hope is that these two generic structures are enough to model the changes required + * by any generic message-signing algorithm. + * + * Note that the key-value pairs of a signing_result are different types (but same intent) as + * the key-value pairs in the signable interface. This is because the signing result stands alone + * and owns its own copies of all values, whereas a signable can wrap an existing object and thus + * use non-owning references (like byte cursors) if appropriate to its implementation. + */ +struct aws_signing_result { + struct aws_allocator *allocator; + struct aws_hash_table properties; + struct aws_hash_table property_lists; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initialize a signing result to its starting state + * + * @param result signing result to initialize + * @param allocator allocator to use for all memory allocation + * + * @return AWS_OP_SUCCESS if initialization was successful, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_signing_result_init(struct aws_signing_result *result, struct aws_allocator *allocator); + +/** + * Clean up all resources held by the signing result + * + * @param result signing result to clean up resources for + */ +AWS_AUTH_API +void aws_signing_result_clean_up(struct aws_signing_result *result); + +/** + * Sets the value of a property on a signing result + * + * @param result signing result to modify + * @param property_name name of the property to set + * @param property_value value that the property should assume + * + * @return AWS_OP_SUCCESS if the set was successful, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_signing_result_set_property( + struct aws_signing_result *result, + const struct aws_string *property_name, + const struct aws_byte_cursor *property_value); + +/** + * Gets the value of a property on a signing result + * + * @param result signing result to query from + * @param property_name name of the property to query the value of + * @param out_property_value output parameter for the property value + * + * @return AWS_OP_SUCCESS if the get was successful, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_signing_result_get_property( + const struct aws_signing_result *result, + const struct aws_string *property_name, + struct aws_string **out_property_value); + +/** + * Adds a key-value pair to a named property list. If the named list does not yet exist, it will be created as + * an empty list before the pair is added. No uniqueness checks are made against existing pairs. + * + * @param result signing result to modify + * @param list_name name of the list to add the property key-value pair to + * @param property_name key value of the key-value pair to append + * @param property_value property value of the key-value pair to append + * + * @return AWS_OP_SUCCESS if the operation was successful, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_signing_result_append_property_list( + struct aws_signing_result *result, + const struct aws_string *list_name, + const struct aws_byte_cursor *property_name, + const struct aws_byte_cursor *property_value); + +/** + * Gets a named property list on the signing result. If the list does not exist, *out_list will be set to null + * + * @param result signing result to query + * @param list_name name of the list of key-value pairs to get + * @param out_list output parameter for the list of key-value pairs + * + */ +AWS_AUTH_API +void aws_signing_result_get_property_list( + const struct aws_signing_result *result, + const struct aws_string *list_name, + struct aws_array_list **out_list); + +/** + * Looks for a property within a named property list on the signing result. If the list does not exist, or the property + * does not exist within the list, *out_value will be set to NULL. + * + * @param result signing result to query + * @param list_name name of the list of key-value pairs to search through for the property + * @param property_name name of the property to search for within the list + * @param out_value output parameter for the property value, if found + * + */ +AWS_AUTH_API +void aws_signing_result_get_property_value_in_property_list( + const struct aws_signing_result *result, + const struct aws_string *list_name, + const struct aws_string *property_name, + struct aws_string **out_value); + +/* + * Specific implementation that applies a signing result to a mutable http request + * + * @param request http request to apply the signing result to + * @param allocator memory allocator to use for all memory allocation + * @param result signing result to apply to the request + * + * @return AWS_OP_SUCCESS if the application operation was successful, AWS_OP_ERR otherwise + */ +AWS_AUTH_API +int aws_apply_signing_result_to_http_request( + struct aws_http_message *request, + struct aws_allocator *allocator, + const struct aws_signing_result *result); + +AWS_AUTH_API extern const struct aws_string *g_aws_signing_authorization_header_name; +AWS_AUTH_API extern const struct aws_string *g_aws_signing_authorization_query_param_name; + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_AUTH_SIGNING_RESULT_H */ diff --git a/include/aws/cal/cal.h b/include/aws/cal/cal.h new file mode 100644 index 0000000000000000000000000000000000000000..df2f1a9bdb2ed37238333e474ac7ee33545e0899 --- /dev/null +++ b/include/aws/cal/cal.h @@ -0,0 +1,61 @@ +#ifndef AWS_CAL_CAL_H +#define AWS_CAL_CAL_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_allocator; + +#define AWS_C_CAL_PACKAGE_ID 7 + +enum aws_cal_errors { + AWS_ERROR_CAL_SIGNATURE_VALIDATION_FAILED = AWS_ERROR_ENUM_BEGIN_RANGE(AWS_C_CAL_PACKAGE_ID), + AWS_ERROR_CAL_MISSING_REQUIRED_KEY_COMPONENT, + AWS_ERROR_CAL_INVALID_KEY_LENGTH_FOR_ALGORITHM, + AWS_ERROR_CAL_UNKNOWN_OBJECT_IDENTIFIER, + AWS_ERROR_CAL_MALFORMED_ASN1_ENCOUNTERED, + AWS_ERROR_CAL_MISMATCHED_DER_TYPE, + AWS_ERROR_CAL_UNSUPPORTED_ALGORITHM, + AWS_ERROR_CAL_BUFFER_TOO_LARGE_FOR_ALGORITHM, + AWS_ERROR_CAL_INVALID_CIPHER_MATERIAL_SIZE_FOR_ALGORITHM, + AWS_ERROR_CAL_DER_UNSUPPORTED_NEGATIVE_INT, + AWS_ERROR_CAL_UNSUPPORTED_KEY_FORMAT, + AWS_ERROR_CAL_CRYPTO_OPERATION_FAILED, + AWS_ERROR_CAL_END_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_CAL_PACKAGE_ID) +}; + +enum aws_cal_log_subject { + AWS_LS_CAL_GENERAL = AWS_LOG_SUBJECT_BEGIN_RANGE(AWS_C_CAL_PACKAGE_ID), + AWS_LS_CAL_ECC, + AWS_LS_CAL_HASH, + AWS_LS_CAL_HMAC, + AWS_LS_CAL_DER, + AWS_LS_CAL_LIBCRYPTO_RESOLVE, + AWS_LS_CAL_RSA, + AWS_LS_CAL_ED25519, + + AWS_LS_CAL_LAST = AWS_LOG_SUBJECT_END_RANGE(AWS_C_CAL_PACKAGE_ID) +}; + +AWS_EXTERN_C_BEGIN + +AWS_CAL_API void aws_cal_library_init(struct aws_allocator *allocator); +AWS_CAL_API void aws_cal_library_clean_up(void); + +/* + * Every CRT thread that might invoke aws-lc functionality should call this as part of the thread at_exit process + */ +AWS_CAL_API void aws_cal_thread_clean_up(void); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_CAL_CAL_H */ diff --git a/include/aws/cal/ecc.h b/include/aws/cal/ecc.h new file mode 100644 index 0000000000000000000000000000000000000000..4941fa93e92eb4c360efc6ec65e0db5139d997b8 --- /dev/null +++ b/include/aws/cal/ecc.h @@ -0,0 +1,185 @@ +#ifndef AWS_CAL_ECC_H +#define AWS_CAL_ECC_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum aws_ecc_curve_name { + AWS_CAL_ECDSA_P256, + AWS_CAL_ECDSA_P384, +}; + +struct aws_ecc_key_pair; + +typedef void aws_ecc_key_pair_destroy_fn(struct aws_ecc_key_pair *key_pair); +typedef int aws_ecc_key_pair_sign_message_fn( + const struct aws_ecc_key_pair *key_pair, + const struct aws_byte_cursor *message, + struct aws_byte_buf *signature_output); +typedef int aws_ecc_key_pair_derive_public_key_fn(struct aws_ecc_key_pair *key_pair); +typedef int aws_ecc_key_pair_verify_signature_fn( + const struct aws_ecc_key_pair *signer, + const struct aws_byte_cursor *message, + const struct aws_byte_cursor *signature); +typedef size_t aws_ecc_key_pair_signature_length_fn(const struct aws_ecc_key_pair *signer); + +struct aws_ecc_key_pair_vtable { + aws_ecc_key_pair_destroy_fn *destroy; + aws_ecc_key_pair_derive_public_key_fn *derive_pub_key; + aws_ecc_key_pair_sign_message_fn *sign_message; + aws_ecc_key_pair_verify_signature_fn *verify_signature; + aws_ecc_key_pair_signature_length_fn *signature_length; +}; + +struct aws_ecc_key_pair { + struct aws_allocator *allocator; + struct aws_atomic_var ref_count; + enum aws_ecc_curve_name curve_name; + struct aws_byte_buf key_buf; + struct aws_byte_buf pub_x; + struct aws_byte_buf pub_y; + struct aws_byte_buf priv_d; + struct aws_ecc_key_pair_vtable *vtable; + void *impl; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Adds one to an ecc key pair's ref count. + */ +AWS_CAL_API void aws_ecc_key_pair_acquire(struct aws_ecc_key_pair *key_pair); + +/** + * Subtracts one from an ecc key pair's ref count. If ref count reaches zero, the key pair is destroyed. + */ +AWS_CAL_API void aws_ecc_key_pair_release(struct aws_ecc_key_pair *key_pair); + +/** + * Creates an Elliptic Curve private key that can be used for signing. + * Returns a new instance of aws_ecc_key_pair if the key was successfully built. + * Otherwise returns NULL. Note: priv_key::len must match the appropriate length + * for the selected curve_name. + */ +AWS_CAL_API struct aws_ecc_key_pair *aws_ecc_key_pair_new_from_private_key( + struct aws_allocator *allocator, + enum aws_ecc_curve_name curve_name, + const struct aws_byte_cursor *priv_key); + +#if !defined(AWS_OS_IOS) +/** + * Creates an Elliptic Curve public/private key pair that can be used for signing and verifying. + * Returns a new instance of aws_ecc_key_pair if the key was successfully built. + * Otherwise returns NULL. + * Note: On Apple platforms this function is only supported on MacOS. This is + * due to usage of SecItemExport, which is only available on MacOS 10.7+ + * (yes, MacOS only and no other Apple platforms). There are alternatives for + * ios and other platforms, but they are ugly to use. Hence for now it only + * supports this call on MacOS. + */ +AWS_CAL_API struct aws_ecc_key_pair *aws_ecc_key_pair_new_generate_random( + struct aws_allocator *allocator, + enum aws_ecc_curve_name curve_name); +#endif /* !AWS_OS_IOS */ + +/** + * Creates an Elliptic Curve public key that can be used for verifying. + * Returns a new instance of aws_ecc_key_pair if the key was successfully built. + * Otherwise returns NULL. Note: public_key_x::len and public_key_y::len must + * match the appropriate length for the selected curve_name. + */ +AWS_CAL_API struct aws_ecc_key_pair *aws_ecc_key_pair_new_from_public_key( + struct aws_allocator *allocator, + enum aws_ecc_curve_name curve_name, + const struct aws_byte_cursor *public_key_x, + const struct aws_byte_cursor *public_key_y); + +/** + * Creates an Elliptic Curve public/private key pair from a DER encoded key pair. + * Returns a new instance of aws_ecc_key_pair if the key was successfully built. + * Otherwise returns NULL. Whether or not signing or verification can be perform depends + * on if encoded_keys is a public/private pair or a public key. + */ +AWS_CAL_API struct aws_ecc_key_pair *aws_ecc_key_pair_new_from_asn1( + struct aws_allocator *allocator, + const struct aws_byte_cursor *encoded_keys); + +/** + * Creates an Elliptic curve public key from x and y coordinates encoded as hex strings + * Returns a new instance of aws_ecc_key_pair if the key was successfully built. + * Otherwise returns NULL. + */ +AWS_CAL_API struct aws_ecc_key_pair *aws_ecc_key_new_from_hex_coordinates( + struct aws_allocator *allocator, + enum aws_ecc_curve_name curve_name, + struct aws_byte_cursor pub_x_hex_cursor, + struct aws_byte_cursor pub_y_hex_cursor); + +/** + * Derives a public key from the private key if supported by this operating system (not supported on OSX). + * key_pair::pub_x and key_pair::pub_y will be set with the raw key buffers. + */ +AWS_CAL_API int aws_ecc_key_pair_derive_public_key(struct aws_ecc_key_pair *key_pair); + +/** + * Get the curve name from the oid. OID here is the payload of the DER encoded ASN.1 part (doesn't include + * type specifier or length. On success, the value of curve_name will be set. + */ +AWS_CAL_API int aws_ecc_curve_name_from_oid(struct aws_byte_cursor *oid, enum aws_ecc_curve_name *curve_name); + +/** + * Get the DER encoded OID from the curve_name. The OID in this case will not contain the type or the length specifier. + */ +AWS_CAL_API int aws_ecc_oid_from_curve_name(enum aws_ecc_curve_name curve_name, struct aws_byte_cursor *oid); + +/** + * Uses the key_pair's private key to sign message. The output will be in signature. Signature must be large enough + * to hold the signature. Check aws_ecc_key_pair_signature_length() for the appropriate size. Signature will be DER + * encoded. + * + * It is the callers job to make sure message is the appropriate cryptographic digest for this operation. It's usually + * something like a SHA256. + */ +AWS_CAL_API int aws_ecc_key_pair_sign_message( + const struct aws_ecc_key_pair *key_pair, + const struct aws_byte_cursor *message, + struct aws_byte_buf *signature); + +/** + * Uses the key_pair's public key to verify signature of message. Signature should be DER + * encoded. + * + * It is the callers job to make sure message is the appropriate cryptographic digest for this operation. It's usually + * something like a SHA256. + * + * returns AWS_OP_SUCCESS if the signature is valid. + */ +AWS_CAL_API int aws_ecc_key_pair_verify_signature( + const struct aws_ecc_key_pair *key_pair, + const struct aws_byte_cursor *message, + const struct aws_byte_cursor *signature); +AWS_CAL_API size_t aws_ecc_key_pair_signature_length(const struct aws_ecc_key_pair *key_pair); + +AWS_CAL_API void aws_ecc_key_pair_get_public_key( + const struct aws_ecc_key_pair *key_pair, + struct aws_byte_cursor *pub_x, + struct aws_byte_cursor *pub_y); + +AWS_CAL_API void aws_ecc_key_pair_get_private_key( + const struct aws_ecc_key_pair *key_pair, + struct aws_byte_cursor *private_d); + +AWS_CAL_API size_t aws_ecc_key_coordinate_byte_size_from_curve_name(enum aws_ecc_curve_name curve_name); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_CAL_ECC_H */ diff --git a/include/aws/cal/ed25519.h b/include/aws/cal/ed25519.h new file mode 100644 index 0000000000000000000000000000000000000000..4d54848fa4f9fc447d2fe50dacdfc16e60b51f0a --- /dev/null +++ b/include/aws/cal/ed25519.h @@ -0,0 +1,88 @@ +#ifndef AWS_CAL_ED25519_H +#define AWS_CAL_ED25519_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_ed25519_key_pair; + +AWS_EXTERN_C_BEGIN + +/** + * Generate new Ed25519 key. + * Returns a new instance of aws_ed25519_key_pair if the key was successfully generated. + * Otherwise returns NULL. + * Note: keygen is not supported on all platforms and will return NULL for the key + * and raise AWS_ERROR_CAL_UNSUPPORTED_ALGORITHM. + * Examples of unsupported cases: + * - openssl pre 1.1.1 (Note: aws-lc and boringssl both expose the needed functions) + * - win/mac builds without special flag that forces linking to libcrypto to support this + */ +AWS_CAL_API struct aws_ed25519_key_pair *aws_ed25519_key_pair_new_generate(struct aws_allocator *allocator); + +/** + * Adds one to an Ed25519 key pair's ref count. + * Returns key_pair pointer. + */ +AWS_CAL_API struct aws_ed25519_key_pair *aws_ed25519_key_pair_acquire(struct aws_ed25519_key_pair *key_pair); + +/** + * Subtracts one from an Ed25519 key pair's ref count. If ref count reaches zero, the key pair is destroyed. + * Always returns NULL. + */ +AWS_CAL_API struct aws_ed25519_key_pair *aws_ed25519_key_pair_release(struct aws_ed25519_key_pair *key_pair); + +enum aws_ed25519_key_export_format { + /* Export the key as raw bytes */ + AWS_CAL_ED25519_KEY_EXPORT_RAW, + + /** + * Export the key to openssh format. + * This will only export the key block, framing (i.e. pem) is left as exercise for the caller. + * b64 encoding is done as convenience since common framing formats require it. + */ + AWS_CAL_ED25519_KEY_EXPORT_OPENSSH_B64, +}; + +/* + * Get public key for the key pair. + * Key in specified format is appended to the buffer. + * The buffer must be initialized before this call, with sufficient capacity to hold the result. + * Use aws_ed25519_key_pair_get_public_key_size to figure out how much capacity buffer needs for a given format. + */ +AWS_CAL_API int aws_ed25519_key_pair_get_public_key( + const struct aws_ed25519_key_pair *key_pair, + enum aws_ed25519_key_export_format format, + struct aws_byte_buf *out); + +/** + * Gets the size of the exported public key. + */ +AWS_CAL_API size_t aws_ed25519_key_pair_get_public_key_size(enum aws_ed25519_key_export_format format); + +/* + * Get private key for the key pair. + * Key in specified format is appended to the buffer. + * The buffer must be initialized before this call, with sufficient capacity to hold the result. + * Use aws_ed25519_key_pair_get_private_key_size to figure out how much capacity buffer needs for a given format. + */ +AWS_CAL_API int aws_ed25519_key_pair_get_private_key( + const struct aws_ed25519_key_pair *key_pair, + enum aws_ed25519_key_export_format format, + struct aws_byte_buf *out); + +/** + * Gets the size of the exported private key. + */ +AWS_CAL_API size_t aws_ed25519_key_pair_get_private_key_size(enum aws_ed25519_key_export_format format); + +AWS_EXTERN_C_END + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_CAL_ED25519_H */ diff --git a/include/aws/cal/exports.h b/include/aws/cal/exports.h new file mode 100644 index 0000000000000000000000000000000000000000..a0074e540c913b8bc3a91d59dea0f6ed3e1e1078 --- /dev/null +++ b/include/aws/cal/exports.h @@ -0,0 +1,28 @@ +#ifndef AWS_CAL_EXPORTS_H +#define AWS_CAL_EXPORTS_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#if defined(AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined(_WIN32) +# ifdef AWS_CAL_USE_IMPORT_EXPORT +# ifdef AWS_CAL_EXPORTS +# define AWS_CAL_API __declspec(dllexport) +# else +# define AWS_CAL_API __declspec(dllimport) +# endif /* AWS_CAL_EXPORTS */ +# else +# define AWS_CAL_API +# endif /* AWS_CAL_USE_IMPORT_EXPORT */ + +#else /* defined (AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) */ + +# if defined(AWS_CAL_USE_IMPORT_EXPORT) && defined(AWS_CAL_EXPORTS) +# define AWS_CAL_API __attribute__((visibility("default"))) +# else +# define AWS_CAL_API +# endif + +#endif /* defined (AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) */ + +#endif /* AWS_CAL_EXPORTS_H */ diff --git a/include/aws/cal/hash.h b/include/aws/cal/hash.h new file mode 100644 index 0000000000000000000000000000000000000000..97d6e3c3a2cbc82f2c9b85304221dd4163b3e671 --- /dev/null +++ b/include/aws/cal/hash.h @@ -0,0 +1,139 @@ +#ifndef AWS_CAL_HASH_H_ +#define AWS_CAL_HASH_H_ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_SHA256_LEN 32 +#define AWS_SHA1_LEN 20 +#define AWS_MD5_LEN 16 + +struct aws_hash; + +struct aws_hash_vtable { + const char *alg_name; + const char *provider; + void (*destroy)(struct aws_hash *hash); + int (*update)(struct aws_hash *hash, const struct aws_byte_cursor *buf); + int (*finalize)(struct aws_hash *hash, struct aws_byte_buf *out); +}; + +struct aws_hash { + struct aws_allocator *allocator; + struct aws_hash_vtable *vtable; + size_t digest_size; + bool good; + void *impl; +}; + +typedef struct aws_hash *(aws_hash_new_fn)(struct aws_allocator *allocator); + +AWS_EXTERN_C_BEGIN +/** + * Allocates and initializes a sha256 hash instance. + */ +AWS_CAL_API struct aws_hash *aws_sha256_new(struct aws_allocator *allocator); +/** + * Allocates and initializes a sha1 hash instance. + */ +AWS_CAL_API struct aws_hash *aws_sha1_new(struct aws_allocator *allocator); +/** + * Allocates and initializes an md5 hash instance. + */ +AWS_CAL_API struct aws_hash *aws_md5_new(struct aws_allocator *allocator); + +/** + * Cleans up and deallocates hash. + */ +AWS_CAL_API void aws_hash_destroy(struct aws_hash *hash); +/** + * Updates the running hash with to_hash. this can be called multiple times. + */ +AWS_CAL_API int aws_hash_update(struct aws_hash *hash, const struct aws_byte_cursor *to_hash); +/** + * Completes the hash computation and writes the final digest to output. + * Allocation of output is the caller's responsibility. If you specify + * truncate_to to something other than 0, the output will be truncated to that + * number of bytes. For example, if you want a SHA256 digest as the first 16 + * bytes, set truncate_to to 16. If you want the full digest size, just set this + * to 0. + */ +AWS_CAL_API int aws_hash_finalize(struct aws_hash *hash, struct aws_byte_buf *output, size_t truncate_to); + +/** + * Computes the md5 hash over input and writes the digest output to 'output'. + * Use this if you don't need to stream the data you're hashing and you can load + * the entire input to hash into memory. + */ +AWS_CAL_API int aws_md5_compute( + struct aws_allocator *allocator, + const struct aws_byte_cursor *input, + struct aws_byte_buf *output, + size_t truncate_to); + +/** + * Computes the sha256 hash over input and writes the digest output to 'output'. + * Use this if you don't need to stream the data you're hashing and you can load + * the entire input to hash into memory. If you specify truncate_to to something + * other than 0, the output will be truncated to that number of bytes. For + * example, if you want a SHA256 digest as the first 16 bytes, set truncate_to + * to 16. If you want the full digest size, just set this to 0. + */ +AWS_CAL_API int aws_sha256_compute( + struct aws_allocator *allocator, + const struct aws_byte_cursor *input, + struct aws_byte_buf *output, + size_t truncate_to); + +/** + * Computes the sha1 hash over input and writes the digest output to 'output'. + * Use this if you don't need to stream the data you're hashing and you can load + * the entire input to hash into memory. If you specify truncate_to to something + * other than 0, the output will be truncated to that number of bytes. For + * example, if you want a SHA1 digest as the first 16 bytes, set truncate_to + * to 16. If you want the full digest size, just set this to 0. + */ +AWS_CAL_API int aws_sha1_compute( + struct aws_allocator *allocator, + const struct aws_byte_cursor *input, + struct aws_byte_buf *output, + size_t truncate_to); + +/** + * Set the implementation of md5 to use. If you compiled without BYO_CRYPTO, + * you do not need to call this. However, if use this, we will honor it, + * regardless of compile options. This may be useful for testing purposes. If + * you did set BYO_CRYPTO, and you do not call this function you will + * segfault. + */ +AWS_CAL_API void aws_set_md5_new_fn(aws_hash_new_fn *fn); + +/** + * Set the implementation of sha256 to use. If you compiled without + * BYO_CRYPTO, you do not need to call this. However, if use this, we will + * honor it, regardless of compile options. This may be useful for testing + * purposes. If you did set BYO_CRYPTO, and you do not call this function + * you will segfault. + */ +AWS_CAL_API void aws_set_sha256_new_fn(aws_hash_new_fn *fn); + +/** + * Set the implementation of sha1 to use. If you compiled without + * BYO_CRYPTO, you do not need to call this. However, if use this, we will + * honor it, regardless of compile options. This may be useful for testing + * purposes. If you did set BYO_CRYPTO, and you do not call this function + * you will segfault. + */ +AWS_CAL_API void aws_set_sha1_new_fn(aws_hash_new_fn *fn); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_CAL_HASH_H_ */ diff --git a/include/aws/cal/hmac.h b/include/aws/cal/hmac.h new file mode 100644 index 0000000000000000000000000000000000000000..d02d7013978916db9b433e14b06b93fe091e0a66 --- /dev/null +++ b/include/aws/cal/hmac.h @@ -0,0 +1,87 @@ +#ifndef AWS_CAL_HMAC_H_ +#define AWS_CAL_HMAC_H_ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_SHA256_HMAC_LEN 32 + +struct aws_hmac; + +struct aws_hmac_vtable { + const char *alg_name; + const char *provider; + void (*destroy)(struct aws_hmac *hmac); + int (*update)(struct aws_hmac *hmac, const struct aws_byte_cursor *buf); + int (*finalize)(struct aws_hmac *hmac, struct aws_byte_buf *out); +}; + +struct aws_hmac { + struct aws_allocator *allocator; + struct aws_hmac_vtable *vtable; + size_t digest_size; + bool good; + void *impl; +}; + +typedef struct aws_hmac *(aws_hmac_new_fn)(struct aws_allocator *allocator, const struct aws_byte_cursor *secret); + +AWS_EXTERN_C_BEGIN +/** + * Allocates and initializes a sha256 hmac instance. Secret is the key to be + * used for the hmac process. + */ +AWS_CAL_API struct aws_hmac *aws_sha256_hmac_new(struct aws_allocator *allocator, const struct aws_byte_cursor *secret); + +/** + * Cleans up and deallocates hmac. + */ +AWS_CAL_API void aws_hmac_destroy(struct aws_hmac *hmac); + +/** + * Updates the running hmac with to_hash. this can be called multiple times. + */ +AWS_CAL_API int aws_hmac_update(struct aws_hmac *hmac, const struct aws_byte_cursor *to_hmac); +/** + * Completes the hmac computation and writes the final digest to output. + * Allocation of output is the caller's responsibility. If you specify + * truncate_to to something other than 0, the output will be truncated to that + * number of bytes. For example if you want a SHA256 digest as the first 16 + * bytes, set truncate_to to 16. If you want the full digest size, just set this + * to 0. + */ +AWS_CAL_API int aws_hmac_finalize(struct aws_hmac *hmac, struct aws_byte_buf *output, size_t truncate_to); +/** + * Computes the sha256 hmac over input and writes the digest output to 'output'. + * Use this if you don't need to stream the data you're hashing and you can load + * the entire input to hash into memory. If you specify truncate_to to something + * other than 0, the output will be truncated to that number of bytes. For + * example if you want a SHA256 HMAC digest as the first 16 bytes, set + * truncate_to to 16. If you want the full digest size, just set this to 0. + */ +AWS_CAL_API int aws_sha256_hmac_compute( + struct aws_allocator *allocator, + const struct aws_byte_cursor *secret, + const struct aws_byte_cursor *to_hmac, + struct aws_byte_buf *output, + size_t truncate_to); +/** + * Set the implementation of sha256 hmac to use. If you compiled without + * BYO_CRYPTO, you do not need to call this. However, if use this, we will + * honor it, regardless of compile options. This may be useful for testing + * purposes. If you did set BYO_CRYPTO, and you do not call this function + * you will segfault. + */ +AWS_CAL_API void aws_set_sha256_hmac_new_fn(aws_hmac_new_fn *fn); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_CAL_HASH_H_ */ diff --git a/include/aws/cal/rsa.h b/include/aws/cal/rsa.h new file mode 100644 index 0000000000000000000000000000000000000000..8a640b3fe42cdfb45da727f597284f5d427b2ee2 --- /dev/null +++ b/include/aws/cal/rsa.h @@ -0,0 +1,175 @@ +#ifndef AWS_CAL_RSA_H +#define AWS_CAL_RSA_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_rsa_key_pair; + +enum aws_rsa_encryption_algorithm { + AWS_CAL_RSA_ENCRYPTION_PKCS1_5, + AWS_CAL_RSA_ENCRYPTION_OAEP_SHA256, + AWS_CAL_RSA_ENCRYPTION_OAEP_SHA512, +}; + +enum aws_rsa_signature_algorithm { + AWS_CAL_RSA_SIGNATURE_PKCS1_5_SHA256, + AWS_CAL_RSA_SIGNATURE_PKCS1_5_SHA1, + AWS_CAL_RSA_SIGNATURE_PSS_SHA256, +}; + +/* + * Note: prefer using standard key sizes - 1024, 2048, 4096. + * Other key sizes will work, but which key sizes are supported may vary by + * platform. Typically, multiples of 64 should work on all platforms. + */ +enum { + AWS_CAL_RSA_MIN_SUPPORTED_KEY_SIZE_IN_BITS = 1024, + AWS_CAL_RSA_MAX_SUPPORTED_KEY_SIZE_IN_BITS = 4096, +}; + +AWS_EXTERN_C_BEGIN + +/** + * Creates an RSA public key from RSAPublicKey as defined in rfc 8017 (aka PKCS1). + * Returns a new instance of aws_rsa_key_pair if the key was successfully built. + * Otherwise returns NULL. + */ +AWS_CAL_API struct aws_rsa_key_pair *aws_rsa_key_pair_new_from_public_key_pkcs1( + struct aws_allocator *allocator, + struct aws_byte_cursor key); + +/** + * Creates an RSA private key from RSAPrivateKey as defined in rfc 8017 (aka PKCS1). + * Returns a new instance of aws_rsa_key_pair if the key was successfully built. + * Otherwise returns NULL. + */ +AWS_CAL_API struct aws_rsa_key_pair *aws_rsa_key_pair_new_from_private_key_pkcs1( + struct aws_allocator *allocator, + struct aws_byte_cursor key); + +/** + * Creates an RSA private key from PrivateKeyInfo as defined in rfc 5208 (aka PKCS8). + * Returns a new instance of aws_rsa_key_pair if the key was successfully built. + * Otherwise returns NULL. + */ +AWS_CAL_API struct aws_rsa_key_pair *aws_rsa_key_pair_new_from_private_key_pkcs8( + struct aws_allocator *allocator, + struct aws_byte_cursor key); + +/** + * Adds one to an RSA key pair's ref count. + * Returns key_pair pointer. + */ +AWS_CAL_API struct aws_rsa_key_pair *aws_rsa_key_pair_acquire(struct aws_rsa_key_pair *key_pair); + +/** + * Subtracts one from an RSA key pair's ref count. If ref count reaches zero, the key pair is destroyed. + * Always returns NULL. + */ +AWS_CAL_API struct aws_rsa_key_pair *aws_rsa_key_pair_release(struct aws_rsa_key_pair *key_pair); + +/** + * Max plaintext size that can be encrypted by the key (i.e. max data size + * supported by the key - bytes needed for padding). + */ +AWS_CAL_API size_t aws_rsa_key_pair_max_encrypt_plaintext_size( + const struct aws_rsa_key_pair *key_pair, + enum aws_rsa_encryption_algorithm algorithm); + +/* + * Uses the key_pair's private key to encrypt the plaintext. The output will be + * in out. out must be large enough to to hold the ciphertext. Check + * aws_rsa_key_pair_block_length() for output upper bound. + */ +AWS_CAL_API int aws_rsa_key_pair_encrypt( + const struct aws_rsa_key_pair *key_pair, + enum aws_rsa_encryption_algorithm algorithm, + struct aws_byte_cursor plaintext, + struct aws_byte_buf *out); + +/* + * Uses the key_pair's private key to decrypt the ciphertext. The output will be + * in out. out must be large enough to to hold the ciphertext. Check + * aws_rsa_key_pair_block_length() for output upper bound. + */ +AWS_CAL_API int aws_rsa_key_pair_decrypt( + const struct aws_rsa_key_pair *key_pair, + enum aws_rsa_encryption_algorithm algorithm, + struct aws_byte_cursor ciphertext, + struct aws_byte_buf *out); + +/* + * Max size for a block supported by a given key pair. + */ +AWS_CAL_API size_t aws_rsa_key_pair_block_length(const struct aws_rsa_key_pair *key_pair); + +/** + * Uses the key_pair's private key to sign message. The output will be in out. out must be large enough + * to hold the signature. Check aws_rsa_key_pair_signature_length() for the appropriate size. + * + * It is the callers job to make sure message is the appropriate cryptographic digest for this operation. It's usually + * something like a SHA256. + */ +AWS_CAL_API int aws_rsa_key_pair_sign_message( + const struct aws_rsa_key_pair *key_pair, + enum aws_rsa_signature_algorithm algorithm, + struct aws_byte_cursor digest, + struct aws_byte_buf *out); + +/** + * Uses the key_pair's public key to verify signature of message. + * + * It is the callers job to make sure message is the appropriate cryptographic digest for this operation. It's usually + * something like a SHA256. + * + * returns AWS_OP_SUCCESS if the signature is valid. + * raises AWS_ERROR_CAL_SIGNATURE_VALIDATION_FAILED if signature validation failed + */ +AWS_CAL_API int aws_rsa_key_pair_verify_signature( + const struct aws_rsa_key_pair *key_pair, + enum aws_rsa_signature_algorithm algorithm, + struct aws_byte_cursor digest, + struct aws_byte_cursor signature); + +/* + * Max size for a signature supported by a given key pair. + */ +AWS_CAL_API size_t aws_rsa_key_pair_signature_length(const struct aws_rsa_key_pair *key_pair); + +enum aws_rsa_key_export_format { + AWS_CAL_RSA_KEY_EXPORT_PKCS1, +}; + +/* + * Get public key for the key pair. + * Inits out to a copy of key. + * Any encoding on top of that (ex. b64) is left up to user. + * Note: this function is currently not supported on windows for generated keys. + */ +AWS_CAL_API int aws_rsa_key_pair_get_public_key( + const struct aws_rsa_key_pair *key_pair, + enum aws_rsa_key_export_format format, + struct aws_byte_buf *out); + +/* + * Get private key for the key pair. + * Inits out to a copy of key. + * Any encoding on top of that (ex. b64) is left up to user. + * Note: this function is currently not supported on Windows for generated keys. + */ +AWS_CAL_API int aws_rsa_key_pair_get_private_key( + const struct aws_rsa_key_pair *key_pair, + enum aws_rsa_key_export_format format, + struct aws_byte_buf *out); + +AWS_EXTERN_C_END + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_CAL_RSA_H */ diff --git a/include/aws/cal/symmetric_cipher.h b/include/aws/cal/symmetric_cipher.h new file mode 100644 index 0000000000000000000000000000000000000000..df2a11da412bccb10f2fd0084ac8afb03ece3fd2 --- /dev/null +++ b/include/aws/cal/symmetric_cipher.h @@ -0,0 +1,259 @@ +#ifndef AWS_CAL_SYMMETRIC_CIPHER_H +#define AWS_CAL_SYMMETRIC_CIPHER_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_AES_256_CIPHER_BLOCK_SIZE 16 +#define AWS_AES_256_KEY_BIT_LEN 256 +#define AWS_AES_256_KEY_BYTE_LEN (AWS_AES_256_KEY_BIT_LEN / 8) + +struct aws_symmetric_cipher; + +typedef struct aws_symmetric_cipher *(aws_aes_cbc_256_new_fn)(struct aws_allocator *allocator, + const struct aws_byte_cursor *key, + const struct aws_byte_cursor *iv); + +typedef struct aws_symmetric_cipher *(aws_aes_ctr_256_new_fn)(struct aws_allocator *allocator, + const struct aws_byte_cursor *key, + const struct aws_byte_cursor *iv); + +typedef struct aws_symmetric_cipher *(aws_aes_gcm_256_new_fn)(struct aws_allocator *allocator, + const struct aws_byte_cursor *key, + const struct aws_byte_cursor *iv, + const struct aws_byte_cursor *aad); + +typedef struct aws_symmetric_cipher *(aws_aes_keywrap_256_new_fn)(struct aws_allocator *allocator, + const struct aws_byte_cursor *key); + +enum aws_symmetric_cipher_state { + AWS_SYMMETRIC_CIPHER_READY, + AWS_SYMMETRIC_CIPHER_FINALIZED, + AWS_SYMMETRIC_CIPHER_ERROR, +}; + +AWS_EXTERN_C_BEGIN + +/** + * Creates an instance of AES CBC with 256-bit key. + * If key and iv are NULL, they will be generated internally. + * You can get the generated key and iv back by calling: + * + * aws_symmetric_cipher_get_key() and + * aws_symmetric_cipher_get_initialization_vector() + * + * respectively. + * + * If they are set, that key and iv will be copied internally and used by the cipher. + * + * Returns NULL on failure. You can check aws_last_error() to get the error code indicating the failure cause. + */ +AWS_CAL_API struct aws_symmetric_cipher *aws_aes_cbc_256_new( + struct aws_allocator *allocator, + const struct aws_byte_cursor *key, + const struct aws_byte_cursor *iv); + +/** + * Creates an instance of AES CTR with 256-bit key. + * If key and iv are NULL, they will be generated internally. + * You can get the generated key and iv back by calling: + * + * aws_symmetric_cipher_get_key() and + * aws_symmetric_cipher_get_initialization_vector() + * + * respectively. + * + * If they are set, that key and iv will be copied internally and used by the cipher. + * + * Returns NULL on failure. You can check aws_last_error() to get the error code indicating the failure cause. + */ +AWS_CAL_API struct aws_symmetric_cipher *aws_aes_ctr_256_new( + struct aws_allocator *allocator, + const struct aws_byte_cursor *key, + const struct aws_byte_cursor *iv); + +/** + * Creates an instance of AES GCM with 256-bit key. + * If key, iv are NULL, they will be generated internally. + * You can get the generated key and iv back by calling: + * + * aws_symmetric_cipher_get_key() and + * aws_symmetric_cipher_get_initialization_vector() + * + * respectively. + * + * If aad is set it will be copied and applied to the cipher. + * + * If they are set, that key and iv will be copied internally and used by the cipher. + * + * For decryption purposes tag can be provided via aws_symmetric_cipher_set_tag method. + * Note: for decrypt operations, tag must be provided before first decrypt is called. + * (this is a windows bcrypt limitations, but for consistency sake same limitation is extended to other platforms) + * Tag generated during encryption can be retrieved using aws_symmetric_cipher_get_tag method + * after finalize is called. + * + * Returns NULL on failure. You can check aws_last_error() to get the error code indicating the failure cause. + */ +AWS_CAL_API struct aws_symmetric_cipher *aws_aes_gcm_256_new( + struct aws_allocator *allocator, + const struct aws_byte_cursor *key, + const struct aws_byte_cursor *iv, + const struct aws_byte_cursor *aad); + +/** + * Creates an instance of AES Keywrap with 256-bit key. + * If key is NULL, it will be generated internally. + * You can get the generated key back by calling: + * + * aws_symmetric_cipher_get_key() + * + * If key is set, that key will be copied internally and used by the cipher. + * + * Returns NULL on failure. You can check aws_last_error() to get the error code indicating the failure cause. + */ +AWS_CAL_API struct aws_symmetric_cipher *aws_aes_keywrap_256_new( + struct aws_allocator *allocator, + const struct aws_byte_cursor *key); + +/** + * Cleans up internal resources and state for cipher and then deallocates it. + */ +AWS_CAL_API void aws_symmetric_cipher_destroy(struct aws_symmetric_cipher *cipher); + +/** + * Encrypts the value in to_encrypt and writes the encrypted data into out. + * If out is dynamic it will be expanded. If it is not, and out is not large enough to handle + * the encrypted output, the call will fail. If you're trying to optimize to use a stack based array + * or something, make sure it's at least as large as the size of to_encrypt + an extra BLOCK to account for + * padding etc... + * + * returns AWS_OP_SUCCESS on success. Call aws_last_error() to determine the failure cause if it returns + * AWS_OP_ERR; + */ +AWS_CAL_API int aws_symmetric_cipher_encrypt( + struct aws_symmetric_cipher *cipher, + struct aws_byte_cursor to_encrypt, + struct aws_byte_buf *out); + +/** + * Decrypts the value in to_decrypt and writes the decrypted data into out. + * If out is dynamic it will be expanded. If it is not, and out is not large enough to handle + * the decrypted output, the call will fail. If you're trying to optimize to use a stack based array + * or something, make sure it's at least as large as the size of to_decrypt + an extra BLOCK to account for + * padding etc... + * + * returns AWS_OP_SUCCESS on success. Call aws_last_error() to determine the failure cause if it returns + * AWS_OP_ERR; + */ +AWS_CAL_API int aws_symmetric_cipher_decrypt( + struct aws_symmetric_cipher *cipher, + struct aws_byte_cursor to_decrypt, + struct aws_byte_buf *out); + +/** + * Encrypts any remaining data that was reserved for final padding, loads GMACs etc... and if there is any + * writes any remaining encrypted data to out. If out is dynamic it will be expanded. If it is not, and + * out is not large enough to handle the decrypted output, the call will fail. If you're trying to optimize + * to use a stack based array or something, make sure it's at least as large as the size of 2 BLOCKs to account for + * padding etc... + * + * After invoking this function, you MUST call aws_symmetric_cipher_reset() before invoking any encrypt/decrypt + * operations on this cipher again. + * + * returns AWS_OP_SUCCESS on success. Call aws_last_error() to determine the failure cause if it returns + * AWS_OP_ERR; + */ +AWS_CAL_API int aws_symmetric_cipher_finalize_encryption(struct aws_symmetric_cipher *cipher, struct aws_byte_buf *out); + +/** + * Decrypts any remaining data that was reserved for final padding, loads GMACs etc... and if there is any + * writes any remaining decrypted data to out. If out is dynamic it will be expanded. If it is not, and + * out is not large enough to handle the decrypted output, the call will fail. If you're trying to optimize + * to use a stack based array or something, make sure it's at least as large as the size of 2 BLOCKs to account for + * padding etc... + * + * After invoking this function, you MUST call aws_symmetric_cipher_reset() before invoking any encrypt/decrypt + * operations on this cipher again. + * + * returns AWS_OP_SUCCESS on success. Call aws_last_error() to determine the failure cause if it returns + * AWS_OP_ERR; + */ +AWS_CAL_API int aws_symmetric_cipher_finalize_decryption(struct aws_symmetric_cipher *cipher, struct aws_byte_buf *out); + +/** + * Resets the cipher state for starting a new encrypt or decrypt operation. Note encrypt/decrypt cannot be mixed on the + * same cipher without a call to reset in between them. However, this leaves the key, iv etc... materials setup for + * immediate reuse. + * Note: GCM tag is not preserved between operations. If you intend to do encrypt followed directly by decrypt, make + * sure to make a copy of tag before reseting the cipher and pass that copy for decryption. + * + * Warning: In most cases it's a really bad idea to reset a cipher and perform another operation using that cipher. + * Key and IV should not be reused for different operations. Instead of reseting the cipher, destroy the cipher + * and create new one with a new key/iv pair. Use reset at your own risk, and only after careful consideration. + * + * returns AWS_OP_SUCCESS on success. Call aws_last_error() to determine the failure cause if it returns + * AWS_OP_ERR; + */ +AWS_CAL_API int aws_symmetric_cipher_reset(struct aws_symmetric_cipher *cipher); + +/** + * Gets the current GMAC tag. If not AES GCM, this function will just return an empty cursor. + * The memory in this cursor is unsafe as it refers to the internal buffer. + * This was done because the use case doesn't require fetching these during an + * encryption or decryption operation and it dramatically simplifies the API. + * Only use this function between other calls to this API as any function call can alter the value of this tag. + * + * If you need to access it in a different pattern, copy the values to your own buffer first. + */ +AWS_CAL_API struct aws_byte_cursor aws_symmetric_cipher_get_tag(const struct aws_symmetric_cipher *cipher); + +/** + * Sets the GMAC tag on the cipher. Does nothing for ciphers that do not support tag. + */ +AWS_CAL_API void aws_symmetric_cipher_set_tag(struct aws_symmetric_cipher *cipher, struct aws_byte_cursor tag); + +/** + * Gets the original initialization vector as a cursor. + * The memory in this cursor is unsafe as it refers to the internal buffer. + * This was done because the use case doesn't require fetching these during an + * encryption or decryption operation and it dramatically simplifies the API. + * + * Unlike some other fields, this value does not change after the inital construction of the cipher. + * + * For some algorithms, such as AES Keywrap, this will return an empty cursor. + */ +AWS_CAL_API struct aws_byte_cursor aws_symmetric_cipher_get_initialization_vector( + const struct aws_symmetric_cipher *cipher); + +/** + * Gets the original key. + * + * The memory in this cursor is unsafe as it refers to the internal buffer. + * This was done because the use case doesn't require fetching these during an + * encryption or decryption operation and it dramatically simplifies the API. + * + * Unlike some other fields, this value does not change after the inital construction of the cipher. + */ +AWS_CAL_API struct aws_byte_cursor aws_symmetric_cipher_get_key(const struct aws_symmetric_cipher *cipher); + +/** + * Returns true if the state of the cipher is good, and otherwise returns false. + * Most operations, other than aws_symmetric_cipher_reset() will fail if this function is returning false. + * aws_symmetric_cipher_reset() will reset the state to a good state if possible. + */ +AWS_CAL_API bool aws_symmetric_cipher_is_good(const struct aws_symmetric_cipher *cipher); + +/** + * Retuns the current state of the cipher. Ther state of the cipher can be ready for use, finalized, or has encountered + * an error. if the cipher is in a finished or error state, it must be reset before further use. + */ +AWS_CAL_API enum aws_symmetric_cipher_state aws_symmetric_cipher_get_state(const struct aws_symmetric_cipher *cipher); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL +#endif /* AWS_CAL_SYMMETRIC_CIPHER_H */ diff --git a/include/aws/common/allocator.h b/include/aws/common/allocator.h new file mode 100644 index 0000000000000000000000000000000000000000..8d092055faa03422e3b6895f54f4eff05fbc303a --- /dev/null +++ b/include/aws/common/allocator.h @@ -0,0 +1,234 @@ +#ifndef AWS_COMMON_ALLOCATOR_H +#define AWS_COMMON_ALLOCATOR_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/* + * Quick guide to allocators: + * CRT offers several flavours of allocators: + * - default: basic allocator that invokes system one directly. + * - aligned: basic allocator that aligns small allocations on 8 byte + * boundary and big buffers on 32/64 byte (system dependent) boundary. + * Aligned mem can improve perf on some operations, like memcpy or hashes. + * Depending on a system, can result in higher peak memory count in heavy + * acquire/free scenarios (ex. s3), due to memory fragmentation related to how + * aligned allocators work (over allocate, find aligned offset, release extra memory) + * - wrapped_cf: wraps MacOS's Security Framework allocator. + * - mem_tracer: wraps any allocator and provides tracing functionality to allocations + * - small_block_allocator: pools smaller allocations into preallocated buckets. + * Not actively maintained. Avoid if possible. + */ + +/* Allocator structure. An instance of this will be passed around for anything needing memory allocation */ +struct aws_allocator { + void *(*mem_acquire)(struct aws_allocator *allocator, size_t size); + void (*mem_release)(struct aws_allocator *allocator, void *ptr); + /* Optional method; if not supported, this pointer must be NULL */ + void *(*mem_realloc)(struct aws_allocator *allocator, void *oldptr, size_t oldsize, size_t newsize); + /* Optional method; if not supported, this pointer must be NULL */ + void *(*mem_calloc)(struct aws_allocator *allocator, size_t num, size_t size); + void *impl; +}; + +/** + * Inexpensive (constant time) check of data-structure invariants. + */ +AWS_COMMON_API +bool aws_allocator_is_valid(const struct aws_allocator *alloc); + +AWS_COMMON_API +struct aws_allocator *aws_default_allocator(void); + +/* + * Allocator that align small allocations on 8 byte boundary and big allocations + * on 32/64 byte boundary. + */ +AWS_COMMON_API +struct aws_allocator *aws_aligned_allocator(void); + +#ifdef __MACH__ +/* Avoid pulling in CoreFoundation headers in a header file. */ +struct __CFAllocator; /* NOLINT(bugprone-reserved-identifier) */ +typedef const struct __CFAllocator *CFAllocatorRef; + +/** + * Wraps a CFAllocator around aws_allocator. For Mac only. Use this anytime you need a CFAllocatorRef for interacting + * with Apple Frameworks. Unfortunately, it allocates memory so we can't make it static file scope, be sure to call + * aws_wrapped_cf_allocator_destroy when finished. + */ +AWS_COMMON_API +CFAllocatorRef aws_wrapped_cf_allocator_new(struct aws_allocator *allocator); + +/** + * Cleans up any resources alloced in aws_wrapped_cf_allocator_new. + */ +AWS_COMMON_API +void aws_wrapped_cf_allocator_destroy(CFAllocatorRef allocator); +#endif + +/** + * Returns at least `size` of memory ready for usage. In versions v0.6.8 and prior, this function was allowed to return + * NULL. In later versions, if allocator->mem_acquire() returns NULL, this function will assert and exit. To handle + * conditions where OOM is not a fatal error, allocator->mem_acquire() is responsible for finding/reclaiming/running a + * GC etc...before returning. + */ +AWS_COMMON_API +void *aws_mem_acquire(struct aws_allocator *allocator, size_t size); + +/** + * Allocates a block of memory for an array of num elements, each of them size bytes long, and initializes all its bits + * to zero. In versions v0.6.8 and prior, this function was allowed to return NULL. + * In later versions, if allocator->mem_calloc() returns NULL, this function will assert and exit. To handle + * conditions where OOM is not a fatal error, allocator->mem_calloc() is responsible for finding/reclaiming/running a + * GC etc...before returning. + */ +AWS_COMMON_API +void *aws_mem_calloc(struct aws_allocator *allocator, size_t num, size_t size); + +/** + * Allocates many chunks of bytes into a single block. Expects to be called with alternating void ** (dest), size_t + * (size). The first void ** will be set to the root of the allocation. Alignment is assumed to be sizeof(intmax_t). + * + * This is useful for allocating structs using the pimpl pattern, as you may allocate the public object and impl object + * in the same contiguous block of memory. + * + * Returns a pointer to the allocation. + * + * In versions v0.6.8 and prior, this function was allowed to return + * NULL. In later versions, if allocator->mem_acquire() returns NULL, this function will assert and exit. To handle + * conditions where OOM is not a fatal error, allocator->mem_acquire() is responsible for finding/reclaiming/running a + * GC etc...before returning. + */ +AWS_COMMON_API +void *aws_mem_acquire_many(struct aws_allocator *allocator, size_t count, ...); + +/** + * Releases ptr back to whatever allocated it. + * Nothing happens if ptr is NULL. + */ +AWS_COMMON_API +void aws_mem_release(struct aws_allocator *allocator, void *ptr); + +/** + * Attempts to adjust the size of the pointed-to memory buffer from oldsize to + * newsize. The pointer (*ptr) may be changed if the memory needs to be + * reallocated. + * + * In versions v0.6.8 and prior, this function was allowed to return + * NULL. In later versions, if allocator->mem_realloc() returns NULL, this function will assert and exit. To handle + * conditions where OOM is not a fatal error, allocator->mem_realloc() is responsible for finding/reclaiming/running a + * GC etc...before returning. + */ +AWS_COMMON_API +int aws_mem_realloc(struct aws_allocator *allocator, void **ptr, size_t oldsize, size_t newsize); +/* + * Maintainer note: The above function doesn't return the pointer (as with + * standard C realloc) as this pattern becomes error-prone when OOMs occur. + * In particular, we want to avoid losing the old pointer when an OOM condition + * occurs, so we prefer to take the old pointer as an in/out reference argument + * that we can leave unchanged on failure. + */ + +enum aws_mem_trace_level { + AWS_MEMTRACE_NONE = 0, /* no tracing */ + AWS_MEMTRACE_BYTES = 1, /* just track allocation sizes and total allocated */ + AWS_MEMTRACE_STACKS = 2, /* capture callstacks for each allocation */ +}; + +/* + * Wraps an allocator and tracks all external allocations. If aws_mem_trace_dump() is called + * and there are still allocations active, they will be reported to the aws_logger at TRACE level. + * allocator - The allocator to wrap + * deprecated - Deprecated arg, ignored. + * level - The level to track allocations at + * frames_per_stack is how many frames to store per callstack if AWS_MEMTRACE_STACKS is in use, + * otherwise it is ignored. 8 tends to be a pretty good number balancing storage space vs useful stacks. + * Returns the tracer allocator, which should be used for all allocations that should be tracked. + */ +AWS_COMMON_API +struct aws_allocator *aws_mem_tracer_new( + struct aws_allocator *allocator, + struct aws_allocator *deprecated, + enum aws_mem_trace_level level, + size_t frames_per_stack); + +/* + * Unwraps the traced allocator and cleans up the tracer. + * Returns the original allocator + */ +AWS_COMMON_API +struct aws_allocator *aws_mem_tracer_destroy(struct aws_allocator *trace_allocator); + +/* + * If there are outstanding allocations, dumps them to log, along with any information gathered + * based on the trace level set when aws_mem_trace() was called. + * Should be passed the tracer allocator returned from aws_mem_trace(). + */ +AWS_COMMON_API +void aws_mem_tracer_dump(struct aws_allocator *trace_allocator); + +/* + * Returns the current number of bytes in outstanding allocations + */ +AWS_COMMON_API +size_t aws_mem_tracer_bytes(struct aws_allocator *trace_allocator); + +/* + * Returns the current number of outstanding allocations + */ +AWS_COMMON_API +size_t aws_mem_tracer_count(struct aws_allocator *trace_allocator); + +/* + * Creates a new Small Block Allocator which fronts the supplied parent allocator. The SBA will intercept + * and handle small allocs, and will forward anything larger to the parent allocator. + * If multi_threaded is true, the internal allocator will protect its internal data structures with a mutex + */ +AWS_COMMON_API +struct aws_allocator *aws_small_block_allocator_new(struct aws_allocator *allocator, bool multi_threaded); + +/* + * Destroys a Small Block Allocator instance and frees its memory to the parent allocator. The parent + * allocator will otherwise be unaffected. + */ +AWS_COMMON_API +void aws_small_block_allocator_destroy(struct aws_allocator *sba_allocator); + +/* + * Returns the number of bytes currently active in the SBA + */ +AWS_COMMON_API +size_t aws_small_block_allocator_bytes_active(struct aws_allocator *sba_allocator); + +/* + * Returns the number of bytes reserved in pages/bins inside the SBA, e.g. the + * current system memory used by the SBA + */ +AWS_COMMON_API +size_t aws_small_block_allocator_bytes_reserved(struct aws_allocator *sba_allocator); + +/* + * Returns the page size that the SBA is using + */ +AWS_COMMON_API +size_t aws_small_block_allocator_page_size(struct aws_allocator *sba_allocator); + +/* + * Returns the amount of memory in each page available to user allocations + */ +AWS_COMMON_API +size_t aws_small_block_allocator_page_size_available(struct aws_allocator *sba_allocator); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_ALLOCATOR_H */ diff --git a/include/aws/common/array_list.h b/include/aws/common/array_list.h new file mode 100644 index 0000000000000000000000000000000000000000..4cd05bb7d1178b48c97d782d3449e8a666f79eeb --- /dev/null +++ b/include/aws/common/array_list.h @@ -0,0 +1,241 @@ +#ifndef AWS_COMMON_ARRAY_LIST_H +#define AWS_COMMON_ARRAY_LIST_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum { AWS_ARRAY_LIST_DEBUG_FILL = 0xDD }; + +struct aws_array_list { + struct aws_allocator *alloc; + size_t current_size; + size_t length; + size_t item_size; + void *data; +}; + +/** + * Prototype for a comparator function for sorting elements. + * + * a and b should be cast to pointers to the element type held in the list + * before being dereferenced. The function should compare the elements and + * return a positive number if a > b, zero if a = b, and a negative number + * if a < b. + */ +typedef int(aws_array_list_comparator_fn)(const void *a, const void *b); + +AWS_EXTERN_C_BEGIN + +/** + * Initializes an array list with an array of size initial_item_allocation * item_size. In this mode, the array size + * will grow by a factor of 2 upon insertion if space is not available. initial_item_allocation is the number of + * elements you want space allocated for. item_size is the size of each element in bytes. Mixing items types is not + * supported by this API. + */ +AWS_STATIC_IMPL +int aws_array_list_init_dynamic( + struct aws_array_list *AWS_RESTRICT list, + struct aws_allocator *alloc, + size_t initial_item_allocation, + size_t item_size); + +/** + * Initializes an array list with a preallocated array of void *. item_count is the number of elements in the array, + * and item_size is the size in bytes of each element. Mixing items types is not supported + * by this API. Once this list is full, new items will be rejected. + */ +AWS_STATIC_IMPL +void aws_array_list_init_static( + struct aws_array_list *AWS_RESTRICT list, + void *raw_array, + size_t item_count, + size_t item_size); + +/** + * Initializes an array list with a preallocated array of *already-initialized* elements. item_count is the number of + * elements in the array, and item_size is the size in bytes of each element. + * + * Once initialized, nothing further can be added to the list, since it will be full and cannot resize. + * + * Primary use case is to treat an already-initialized C array as an array list. + */ +AWS_STATIC_IMPL +void aws_array_list_init_static_from_initialized( + struct aws_array_list *AWS_RESTRICT list, + void *raw_array, + size_t item_count, + size_t item_size); + +/** + * Set of properties of a valid aws_array_list. + */ +AWS_STATIC_IMPL +bool aws_array_list_is_valid(const struct aws_array_list *AWS_RESTRICT list); + +/** + * Deallocates any memory that was allocated for this list, and resets list for reuse or deletion. + */ +AWS_STATIC_IMPL +void aws_array_list_clean_up(struct aws_array_list *AWS_RESTRICT list); + +/** + * Erases and then deallocates any memory that was allocated for this list, and resets list for reuse or deletion. + */ +AWS_STATIC_IMPL +void aws_array_list_clean_up_secure(struct aws_array_list *AWS_RESTRICT list); + +/** + * Pushes the memory pointed to by val onto the end of internal list + */ +AWS_STATIC_IMPL +int aws_array_list_push_back(struct aws_array_list *AWS_RESTRICT list, const void *val); + +/** + * Copies the element at the front of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised + */ +AWS_STATIC_IMPL +int aws_array_list_front(const struct aws_array_list *AWS_RESTRICT list, void *val); + +/** + * Pushes the memory pointed to by val onto the front of internal list. + * This call results in shifting all of the elements in the list. Avoid this call unless that + * is intended behavior. + */ +AWS_STATIC_IMPL +int aws_array_list_push_front(struct aws_array_list *AWS_RESTRICT list, const void *val); + +/** + * Deletes the element at the front of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised. + * This call results in shifting all of the elements at the end of the array to the front. Avoid this call unless that + * is intended behavior. + */ +AWS_STATIC_IMPL +int aws_array_list_pop_front(struct aws_array_list *AWS_RESTRICT list); + +/** + * Delete N elements from the front of the list. + * Remaining elements are shifted to the front of the list. + * If the list has less than N elements, the list is cleared. + * This call is more efficient than calling aws_array_list_pop_front() N times. + */ +AWS_STATIC_IMPL +void aws_array_list_pop_front_n(struct aws_array_list *AWS_RESTRICT list, size_t n); + +/** + * Deletes the element this index in the list if it exists. + * If element does not exist, AWS_ERROR_INVALID_INDEX will be raised. + * This call results in shifting all remaining elements towards the front. + * Avoid this call unless that is intended behavior. + */ +AWS_STATIC_IMPL +int aws_array_list_erase(struct aws_array_list *AWS_RESTRICT list, size_t index); + +/** + * Copies the element at the end of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised. + */ +AWS_STATIC_IMPL +int aws_array_list_back(const struct aws_array_list *AWS_RESTRICT list, void *val); + +/** + * Deletes the element at the end of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised. + */ +AWS_STATIC_IMPL +int aws_array_list_pop_back(struct aws_array_list *AWS_RESTRICT list); + +/** + * Clears all elements in the array and resets length to zero. Size does not change in this operation. + */ +AWS_STATIC_IMPL +void aws_array_list_clear(struct aws_array_list *AWS_RESTRICT list); + +/** + * If in dynamic mode, shrinks the allocated array size to the minimum amount necessary to store its elements. + */ +AWS_COMMON_API +int aws_array_list_shrink_to_fit(struct aws_array_list *AWS_RESTRICT list); + +/** + * Copies the elements from from to to. If to is in static mode, it must at least be the same length as from. Any data + * in to will be overwritten in this copy. + */ +AWS_COMMON_API +int aws_array_list_copy(const struct aws_array_list *AWS_RESTRICT from, struct aws_array_list *AWS_RESTRICT to); + +/** + * Swap contents between two dynamic lists. Both lists must use the same allocator. + */ +AWS_STATIC_IMPL +void aws_array_list_swap_contents( + struct aws_array_list *AWS_RESTRICT list_a, + struct aws_array_list *AWS_RESTRICT list_b); + +/** + * Returns the number of elements that can fit in the internal array. If list is initialized in dynamic mode, + * the capacity changes over time. + */ +AWS_STATIC_IMPL +size_t aws_array_list_capacity(const struct aws_array_list *AWS_RESTRICT list); + +/** + * Returns the number of elements in the internal array. + */ +AWS_STATIC_IMPL +size_t aws_array_list_length(const struct aws_array_list *AWS_RESTRICT list); + +/** + * Copies the memory at index to val. If element does not exist, AWS_ERROR_INVALID_INDEX will be raised. + */ +AWS_STATIC_IMPL +int aws_array_list_get_at(const struct aws_array_list *AWS_RESTRICT list, void *val, size_t index); + +/** + * Copies the memory address of the element at index to *val. If element does not exist, AWS_ERROR_INVALID_INDEX will be + * raised. + */ +AWS_STATIC_IMPL +int aws_array_list_get_at_ptr(const struct aws_array_list *AWS_RESTRICT list, void **val, size_t index); + +/** + * Ensures that the array list has enough capacity to store a value at the specified index. If there is not already + * enough capacity, and the list is in dynamic mode, this function will attempt to allocate more memory, expanding the + * list. In static mode, if 'index' is beyond the maximum index, AWS_ERROR_INVALID_INDEX will be raised. + */ +AWS_COMMON_API +int aws_array_list_ensure_capacity(struct aws_array_list *AWS_RESTRICT list, size_t index); + +/** + * Copies the the memory pointed to by val into the array at index. If in dynamic mode, the size will grow by a factor + * of two when the array is full. In static mode, AWS_ERROR_INVALID_INDEX will be raised if the index is past the bounds + * of the array. + */ +AWS_STATIC_IMPL +int aws_array_list_set_at(struct aws_array_list *AWS_RESTRICT list, const void *val, size_t index); + +/** + * Swap elements at the specified indices, which must be within the bounds of the array. + */ +AWS_COMMON_API +void aws_array_list_swap(struct aws_array_list *AWS_RESTRICT list, size_t a, size_t b); + +/** + * Sort elements in the list in-place according to the comparator function. + */ +AWS_COMMON_API +void aws_array_list_sort(struct aws_array_list *AWS_RESTRICT list, aws_array_list_comparator_fn *compare_fn); + +AWS_EXTERN_C_END +#ifndef AWS_NO_STATIC_IMPL +# include +#endif /* AWS_NO_STATIC_IMPL */ + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_ARRAY_LIST_H */ diff --git a/include/aws/common/array_list.inl b/include/aws/common/array_list.inl new file mode 100644 index 0000000000000000000000000000000000000000..5472104c67636d1baf758cae508df656c0da8609 --- /dev/null +++ b/include/aws/common/array_list.inl @@ -0,0 +1,410 @@ +#ifndef AWS_COMMON_ARRAY_LIST_INL +#define AWS_COMMON_ARRAY_LIST_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* This is implicitly included, but helps with editor highlighting */ +#include +/* + * Do not add system headers here; add them to array_list.h. This file is included under extern "C" guards, + * which might break system headers. + */ +AWS_EXTERN_C_BEGIN + +AWS_STATIC_IMPL +int aws_array_list_init_dynamic( + struct aws_array_list *AWS_RESTRICT list, + struct aws_allocator *alloc, + size_t initial_item_allocation, + size_t item_size) { + + AWS_FATAL_PRECONDITION(list != NULL); + AWS_FATAL_PRECONDITION(alloc != NULL); + AWS_FATAL_PRECONDITION(item_size > 0); + + AWS_ZERO_STRUCT(*list); + + size_t allocation_size = 0; + if (aws_mul_size_checked(initial_item_allocation, item_size, &allocation_size)) { + goto error; + } + + if (allocation_size > 0) { + list->data = aws_mem_acquire(alloc, allocation_size); + if (!list->data) { + goto error; + } +#ifdef DEBUG_BUILD + memset(list->data, AWS_ARRAY_LIST_DEBUG_FILL, allocation_size); + +#endif + list->current_size = allocation_size; + } + list->item_size = item_size; + list->alloc = alloc; + + AWS_FATAL_POSTCONDITION(list->current_size == 0 || list->data); + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; + +error: + AWS_POSTCONDITION(AWS_IS_ZEROED(*list)); + return AWS_OP_ERR; +} + +AWS_STATIC_IMPL +void aws_array_list_init_static( + struct aws_array_list *AWS_RESTRICT list, + void *raw_array, + size_t item_count, + size_t item_size) { + + AWS_FATAL_PRECONDITION(list != NULL); + AWS_FATAL_PRECONDITION(raw_array != NULL); + AWS_FATAL_PRECONDITION(item_count > 0); + AWS_FATAL_PRECONDITION(item_size > 0); + + AWS_ZERO_STRUCT(*list); + list->alloc = NULL; + + size_t current_size = 0; + int no_overflow = !aws_mul_size_checked(item_count, item_size, ¤t_size); + AWS_FATAL_PRECONDITION(no_overflow); + list->current_size = current_size; + + list->item_size = item_size; + list->length = 0; + list->data = raw_array; + AWS_POSTCONDITION(aws_array_list_is_valid(list)); +} + +AWS_STATIC_IMPL +void aws_array_list_init_static_from_initialized( + struct aws_array_list *AWS_RESTRICT list, + void *raw_array, + size_t item_count, + size_t item_size) { + + aws_array_list_init_static(list, raw_array, item_count, item_size); + list->length = item_count; + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); +} + +AWS_STATIC_IMPL +bool aws_array_list_is_valid(const struct aws_array_list *AWS_RESTRICT list) { + if (!list) { + return false; + } + size_t required_size = 0; + bool required_size_is_valid = + (aws_mul_size_checked(list->length, list->item_size, &required_size) == AWS_OP_SUCCESS); + bool current_size_is_valid = (list->current_size >= required_size); + bool data_is_valid = AWS_IMPLIES(list->current_size == 0, list->data == NULL) && + AWS_IMPLIES(list->current_size != 0, AWS_MEM_IS_WRITABLE(list->data, list->current_size)); + bool item_size_is_valid = (list->item_size != 0); + return required_size_is_valid && current_size_is_valid && data_is_valid && item_size_is_valid; +} + +AWS_STATIC_IMPL +void aws_array_list_clean_up(struct aws_array_list *AWS_RESTRICT list) { + AWS_PRECONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list)); + if (list->alloc && list->data) { + aws_mem_release(list->alloc, list->data); + } + + AWS_ZERO_STRUCT(*list); +} + +AWS_STATIC_IMPL +void aws_array_list_clean_up_secure(struct aws_array_list *AWS_RESTRICT list) { + AWS_PRECONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list)); + if (list->alloc && list->data) { + aws_secure_zero(list->data, list->current_size); + aws_mem_release(list->alloc, list->data); + } + + AWS_ZERO_STRUCT(*list); +} + +AWS_STATIC_IMPL +int aws_array_list_push_back(struct aws_array_list *AWS_RESTRICT list, const void *val) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + AWS_PRECONDITION( + val && AWS_MEM_IS_READABLE(val, list->item_size), + "Input pointer [val] must point writable memory of [list->item_size] bytes."); + + int err_code = aws_array_list_set_at(list, val, aws_array_list_length(list)); + + if (err_code && aws_last_error() == AWS_ERROR_INVALID_INDEX && !list->alloc) { + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_LIST_EXCEEDS_MAX_SIZE); + } + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return err_code; +} + +AWS_STATIC_IMPL +int aws_array_list_front(const struct aws_array_list *AWS_RESTRICT list, void *val) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + AWS_PRECONDITION( + val && AWS_MEM_IS_WRITABLE(val, list->item_size), + "Input pointer [val] must point writable memory of [list->item_size] bytes."); + if (aws_array_list_length(list) > 0) { + memcpy(val, list->data, list->item_size); + AWS_POSTCONDITION(AWS_BYTES_EQ(val, list->data, list->item_size)); + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; + } + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_LIST_EMPTY); +} + +AWS_STATIC_IMPL +int aws_array_list_push_front(struct aws_array_list *AWS_RESTRICT list, const void *val) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + AWS_PRECONDITION( + val && AWS_MEM_IS_READABLE(val, list->item_size), + "Input pointer [val] must point writable memory of [list->item_size] bytes."); + size_t orig_len = aws_array_list_length(list); + int err_code = aws_array_list_ensure_capacity(list, orig_len); + + if (err_code && aws_last_error() == AWS_ERROR_INVALID_INDEX && !list->alloc) { + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_LIST_EXCEEDS_MAX_SIZE); + } else if (err_code) { + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return err_code; + } + if (orig_len) { + memmove((uint8_t *)list->data + list->item_size, list->data, orig_len * list->item_size); + } + ++list->length; + memcpy(list->data, val, list->item_size); + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return err_code; +} + +AWS_STATIC_IMPL +int aws_array_list_pop_front(struct aws_array_list *AWS_RESTRICT list) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + if (aws_array_list_length(list) > 0) { + aws_array_list_pop_front_n(list, 1); + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; + } + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_LIST_EMPTY); +} + +AWS_STATIC_IMPL +void aws_array_list_pop_front_n(struct aws_array_list *AWS_RESTRICT list, size_t n) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + if (n >= aws_array_list_length(list)) { + aws_array_list_clear(list); + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return; + } + + if (n > 0) { + size_t popping_bytes = list->item_size * n; + size_t remaining_items = aws_array_list_length(list) - n; + size_t remaining_bytes = remaining_items * list->item_size; + memmove(list->data, (uint8_t *)list->data + popping_bytes, remaining_bytes); + list->length = remaining_items; +#ifdef DEBUG_BUILD + memset((uint8_t *)list->data + remaining_bytes, AWS_ARRAY_LIST_DEBUG_FILL, popping_bytes); +#endif + } + AWS_POSTCONDITION(aws_array_list_is_valid(list)); +} + +int aws_array_list_erase(struct aws_array_list *AWS_RESTRICT list, size_t index) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + + const size_t length = aws_array_list_length(list); + + if (index >= length) { + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_INVALID_INDEX); + } + + if (index == 0) { + /* Removing front element */ + aws_array_list_pop_front(list); + } else if (index == (length - 1)) { + /* Removing back element */ + aws_array_list_pop_back(list); + } else { + /* Removing middle element */ + uint8_t *item_ptr = (uint8_t *)list->data + (index * list->item_size); + uint8_t *next_item_ptr = item_ptr + list->item_size; + size_t trailing_items = (length - index) - 1; + size_t trailing_bytes = trailing_items * list->item_size; + memmove(item_ptr, next_item_ptr, trailing_bytes); + + aws_array_list_pop_back(list); + } + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; +} + +AWS_STATIC_IMPL +int aws_array_list_back(const struct aws_array_list *AWS_RESTRICT list, void *val) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + AWS_PRECONDITION( + val && AWS_MEM_IS_WRITABLE(val, list->item_size), + "Input pointer [val] must point writable memory of [list->item_size] bytes."); + if (aws_array_list_length(list) > 0) { + size_t last_item_offset = list->item_size * (aws_array_list_length(list) - 1); + + memcpy(val, (void *)((uint8_t *)list->data + last_item_offset), list->item_size); + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; + } + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_LIST_EMPTY); +} + +AWS_STATIC_IMPL +int aws_array_list_pop_back(struct aws_array_list *AWS_RESTRICT list) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + if (aws_array_list_length(list) > 0) { + + AWS_FATAL_PRECONDITION(list->data); + + size_t last_item_offset = list->item_size * (aws_array_list_length(list) - 1); + + memset((void *)((uint8_t *)list->data + last_item_offset), 0, list->item_size); + list->length--; + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; + } + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_LIST_EMPTY); +} + +AWS_STATIC_IMPL +void aws_array_list_clear(struct aws_array_list *AWS_RESTRICT list) { + AWS_PRECONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list)); + if (list->data) { +#ifdef DEBUG_BUILD + memset(list->data, AWS_ARRAY_LIST_DEBUG_FILL, list->current_size); +#endif + list->length = 0; + } + AWS_POSTCONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list)); +} + +AWS_STATIC_IMPL +void aws_array_list_swap_contents( + struct aws_array_list *AWS_RESTRICT list_a, + struct aws_array_list *AWS_RESTRICT list_b) { + AWS_FATAL_PRECONDITION(list_a->alloc); + AWS_FATAL_PRECONDITION(list_a->alloc == list_b->alloc); + AWS_FATAL_PRECONDITION(list_a->item_size == list_b->item_size); + AWS_FATAL_PRECONDITION(list_a != list_b); + AWS_PRECONDITION(aws_array_list_is_valid(list_a)); + AWS_PRECONDITION(aws_array_list_is_valid(list_b)); + + struct aws_array_list tmp = *list_a; + *list_a = *list_b; + *list_b = tmp; + AWS_POSTCONDITION(aws_array_list_is_valid(list_a)); + AWS_POSTCONDITION(aws_array_list_is_valid(list_b)); +} + +AWS_STATIC_IMPL +size_t aws_array_list_capacity(const struct aws_array_list *AWS_RESTRICT list) { + AWS_FATAL_PRECONDITION(list->item_size); + AWS_PRECONDITION(aws_array_list_is_valid(list)); + size_t capacity = list->current_size / list->item_size; + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return capacity; +} + +AWS_STATIC_IMPL +size_t aws_array_list_length(const struct aws_array_list *AWS_RESTRICT list) { + /* + * This assert teaches clang-tidy and friends that list->data cannot be null in a non-empty + * list. + */ + AWS_FATAL_PRECONDITION(!list->length || list->data); + AWS_PRECONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list)); + size_t len = list->length; + AWS_POSTCONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list)); + return len; +} + +AWS_STATIC_IMPL +int aws_array_list_get_at(const struct aws_array_list *AWS_RESTRICT list, void *val, size_t index) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + AWS_PRECONDITION( + val && AWS_MEM_IS_WRITABLE(val, list->item_size), + "Input pointer [val] must point writable memory of [list->item_size] bytes."); + if (aws_array_list_length(list) > index) { + memcpy(val, (void *)((uint8_t *)list->data + (list->item_size * index)), list->item_size); + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; + } + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_INVALID_INDEX); +} + +AWS_STATIC_IMPL +int aws_array_list_get_at_ptr(const struct aws_array_list *AWS_RESTRICT list, void **val, size_t index) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + AWS_PRECONDITION(val != NULL); + if (aws_array_list_length(list) > index) { + *val = (void *)((uint8_t *)list->data + (list->item_size * index)); + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; + } + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return aws_raise_error(AWS_ERROR_INVALID_INDEX); +} + +AWS_STATIC_IMPL +int aws_array_list_set_at(struct aws_array_list *AWS_RESTRICT list, const void *val, size_t index) { + AWS_PRECONDITION(aws_array_list_is_valid(list)); + AWS_PRECONDITION( + val && AWS_MEM_IS_READABLE(val, list->item_size), + "Input pointer [val] must point readable memory of [list->item_size] bytes."); + + if (aws_array_list_ensure_capacity(list, index)) { + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_ERR; + } + + AWS_FATAL_PRECONDITION(list->data); + + memcpy((void *)((uint8_t *)list->data + (list->item_size * index)), val, list->item_size); + + /* + * This isn't perfect, but its the best I can come up with for detecting + * length changes. + */ + if (index >= aws_array_list_length(list)) { + if (aws_add_size_checked(index, 1, &list->length)) { + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_ERR; + } + } + + AWS_POSTCONDITION(aws_array_list_is_valid(list)); + return AWS_OP_SUCCESS; +} + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_ARRAY_LIST_INL */ diff --git a/include/aws/common/atomics.h b/include/aws/common/atomics.h new file mode 100644 index 0000000000000000000000000000000000000000..a4fa72e38593fed2e7a22cb83a60401cd325e1ef --- /dev/null +++ b/include/aws/common/atomics.h @@ -0,0 +1,329 @@ +#ifndef AWS_COMMON_ATOMICS_H +#define AWS_COMMON_ATOMICS_H + +#include + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +AWS_PUSH_SANE_WARNING_LEVEL + +/** + * struct aws_atomic_var represents an atomic variable - a value which can hold an integer or pointer + * that can be manipulated atomically. struct aws_atomic_vars should normally only be manipulated + * with atomics methods defined in this header. + */ +struct aws_atomic_var { + void *value; +}; +/* Helpers for extracting the integer and pointer values from aws_atomic_var. */ +#define AWS_ATOMIC_VAR_PTRVAL(var) ((var)->value) +#define AWS_ATOMIC_VAR_INTVAL(var) (*(aws_atomic_impl_int_t *)(var)) + +/* + * This enumeration specifies the memory ordering properties requested for a particular + * atomic operation. The atomic operation may provide stricter ordering than requested. + * Note that, within a single thread, all operations are still sequenced (that is, a thread + * sees its own atomic writes and reads happening in program order, but other threads may + * disagree on this ordering). + * + * The behavior of these memory orderings are the same as in the C11 atomics API; however, + * we only implement a subset that can be portably implemented on the compilers we target. + */ + +enum aws_memory_order { + /** + * No particular ordering constraints are guaranteed relative to other + * operations at all; we merely ensure that the operation itself is atomic. + */ + aws_memory_order_relaxed = 0, + /* aws_memory_order_consume - not currently implemented */ + + /** + * Specifies acquire ordering. No reads or writes on the current thread can be + * reordered to happen before this operation. This is typically paired with a release + * ordering; any writes that happened on the releasing operation will be visible + * after the paired acquire operation. + * + * Acquire ordering is only meaningful on load or load-store operations. + */ + aws_memory_order_acquire = 2, /* leave a spot for consume if we ever add it */ + + /** + * Specifies release order. No reads or writes can be reordered to come after this + * operation. Typically paired with an acquire operation. + * + * Release ordering is only meaningful on store or load-store operations. + */ + aws_memory_order_release, + + /** + * Specifies acquire-release order; if this operation acts as a load, it acts as an + * acquire operation; if it acts as a store, it acts as a release operation; if it's + * a load-store, it does both. + */ + aws_memory_order_acq_rel, + + /* + * Specifies sequentially consistent order. This behaves as acq_rel, but in addition, + * all seq_cst operations appear to occur in some globally consistent order. + * + * TODO: Figure out how to correctly implement this in MSVC. It appears that interlocked + * functions provide only acq_rel ordering. + */ + aws_memory_order_seq_cst +}; + +/** + * Statically initializes an aws_atomic_var to a given size_t value. + */ +#define AWS_ATOMIC_INIT_INT(x) {.value = (void *)(uintptr_t)(x)} + +/** + * Statically initializes an aws_atomic_var to a given void * value. + */ +#define AWS_ATOMIC_INIT_PTR(x) {.value = (void *)(x)} + +AWS_EXTERN_C_BEGIN + +/* + * Note: We do not use the C11 atomics API; this is because we want to make sure the representation + * (and behavior) of atomic values is consistent, regardless of what --std= flag you pass to your compiler. + * Since C11 atomics can silently introduce locks, we run the risk of creating such ABI inconsistencies + * if we decide based on compiler features which atomics API to use, and in practice we expect to have + * either the GNU or MSVC atomics anyway. + * + * As future work, we could test to see if the C11 atomics API on this platform behaves consistently + * with the other APIs and use it if it does. + */ + +/** + * Initializes an atomic variable with an integer value. This operation should be done before any + * other operations on this atomic variable, and must be done before attempting any parallel operations. + * + * This operation does not imply a barrier. Ensure that you use an acquire-release barrier (or stronger) + * when communicating the fact that initialization is complete to the other thread. Launching the thread + * implies a sufficiently strong barrier. + */ +AWS_STATIC_IMPL +void aws_atomic_init_int(volatile struct aws_atomic_var *var, size_t n); + +/** + * Initializes an atomic variable with a pointer value. This operation should be done before any + * other operations on this atomic variable, and must be done before attempting any parallel operations. + * + * This operation does not imply a barrier. Ensure that you use an acquire-release barrier (or stronger) + * when communicating the fact that initialization is complete to the other thread. Launching the thread + * implies a sufficiently strong barrier. + */ +AWS_STATIC_IMPL +void aws_atomic_init_ptr(volatile struct aws_atomic_var *var, void *p); + +/** + * Reads an atomic var as an integer, using the specified ordering, and returns the result. + */ +AWS_STATIC_IMPL +size_t aws_atomic_load_int_explicit(volatile const struct aws_atomic_var *var, enum aws_memory_order memory_order); + +/** + * Reads an atomic var as an integer, using sequentially consistent ordering, and returns the result. + */ +AWS_STATIC_IMPL +size_t aws_atomic_load_int(volatile const struct aws_atomic_var *var); +/** + * Reads an atomic var as a pointer, using the specified ordering, and returns the result. + */ +AWS_STATIC_IMPL +void *aws_atomic_load_ptr_explicit(volatile const struct aws_atomic_var *var, enum aws_memory_order memory_order); + +/** + * Reads an atomic var as a pointer, using sequentially consistent ordering, and returns the result. + */ +AWS_STATIC_IMPL +void *aws_atomic_load_ptr(volatile const struct aws_atomic_var *var); + +/** + * Stores an integer into an atomic var, using the specified ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_int_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order memory_order); + +/** + * Stores an integer into an atomic var, using sequentially consistent ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_int(volatile struct aws_atomic_var *var, size_t n); + +/** + * Stores a pointer into an atomic var, using the specified ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_ptr_explicit(volatile struct aws_atomic_var *var, void *p, enum aws_memory_order memory_order); + +/** + * Stores a pointer into an atomic var, using sequentially consistent ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_ptr(volatile struct aws_atomic_var *var, void *p); + +/** + * Exchanges an integer with the value in an atomic_var, using the specified ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_exchange_int_explicit( + volatile struct aws_atomic_var *var, + size_t n, + enum aws_memory_order memory_order); + +/** + * Exchanges an integer with the value in an atomic_var, using sequentially consistent ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_exchange_int(volatile struct aws_atomic_var *var, size_t n); + +/** + * Exchanges a pointer with the value in an atomic_var, using the specified ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +void *aws_atomic_exchange_ptr_explicit( + volatile struct aws_atomic_var *var, + void *p, + enum aws_memory_order memory_order); + +/** + * Exchanges an integer with the value in an atomic_var, using sequentially consistent ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +void *aws_atomic_exchange_ptr(volatile struct aws_atomic_var *var, void *p); + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. On success, the memory ordering used was order_success; otherwise, it was order_failure. + * order_failure must be no stronger than order_success, and must not be release or acq_rel. + * Returns true if the compare was successful and the variable updated to desired. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_int_explicit( + volatile struct aws_atomic_var *var, + size_t *expected, + size_t desired, + enum aws_memory_order order_success, + enum aws_memory_order order_failure); + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. Uses sequentially consistent memory ordering, regardless of success or failure. + * Returns true if the compare was successful and the variable updated to desired. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_int(volatile struct aws_atomic_var *var, size_t *expected, size_t desired); + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. On success, the memory ordering used was order_success; otherwise, it was order_failure. + * order_failure must be no stronger than order_success, and must not be release or acq_rel. + * Returns true if the compare was successful and the variable updated to desired. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_ptr_explicit( + volatile struct aws_atomic_var *var, + void **expected, + void *desired, + enum aws_memory_order order_success, + enum aws_memory_order order_failure); + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. Uses sequentially consistent memory ordering, regardless of success or failure. + * Returns true if the compare was successful and the variable updated to desired. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_ptr(volatile struct aws_atomic_var *var, void **expected, void *desired); + +/** + * Atomically adds n to *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_add_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order); + +/** + * Atomically subtracts n from *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_sub_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order); + +/** + * Atomically ORs n with *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_or_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order); + +/** + * Atomically ANDs n with *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_and_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order); + +/** + * Atomically XORs n with *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_xor_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order); + +/** + * Atomically adds n to *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_add(volatile struct aws_atomic_var *var, size_t n); + +/** + * Atomically subtracts n from *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_sub(volatile struct aws_atomic_var *var, size_t n); + +/** + * Atomically ands n into *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_and(volatile struct aws_atomic_var *var, size_t n); + +/** + * Atomically ors n into *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_or(volatile struct aws_atomic_var *var, size_t n); + +/** + * Atomically xors n into *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_xor(volatile struct aws_atomic_var *var, size_t n); + +/** + * Provides the same reordering guarantees as an atomic operation with the specified memory order, without + * needing to actually perform an atomic operation. + */ +AWS_STATIC_IMPL +void aws_atomic_thread_fence(enum aws_memory_order order); + +AWS_EXTERN_C_END + +#ifndef AWS_NO_STATIC_IMPL +# include +#endif /* AWS_NO_STATIC_IMPL */ + +AWS_POP_SANE_WARNING_LEVEL + +#endif diff --git a/include/aws/common/atomics.inl b/include/aws/common/atomics.inl new file mode 100644 index 0000000000000000000000000000000000000000..306504fb17653dd0d1836ee8561277e24d89c0ce --- /dev/null +++ b/include/aws/common/atomics.inl @@ -0,0 +1,147 @@ +#ifndef AWS_COMMON_ATOMICS_INL +#define AWS_COMMON_ATOMICS_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_EXTERN_C_BEGIN + +/** + * Reads an atomic var as an integer, using sequentially consistent ordering, and returns the result. + */ +AWS_STATIC_IMPL +size_t aws_atomic_load_int(volatile const struct aws_atomic_var *var) { + return aws_atomic_load_int_explicit(var, aws_memory_order_seq_cst); +} + +/** + * Reads an atomic var as a pointer, using sequentially consistent ordering, and returns the result. + */ +AWS_STATIC_IMPL +void *aws_atomic_load_ptr(volatile const struct aws_atomic_var *var) { + return aws_atomic_load_ptr_explicit(var, aws_memory_order_seq_cst); +} + +/** + * Stores an integer into an atomic var, using sequentially consistent ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_int(volatile struct aws_atomic_var *var, size_t n) { + aws_atomic_store_int_explicit(var, n, aws_memory_order_seq_cst); +} + +/** + * Stores a pointer into an atomic var, using sequentially consistent ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_ptr(volatile struct aws_atomic_var *var, void *p) { + aws_atomic_store_ptr_explicit(var, p, aws_memory_order_seq_cst); +} + +/** + * Exchanges an integer with the value in an atomic_var, using sequentially consistent ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_exchange_int(volatile struct aws_atomic_var *var, size_t n) { + return aws_atomic_exchange_int_explicit(var, n, aws_memory_order_seq_cst); +} + +/** + * Exchanges an integer with the value in an atomic_var, using sequentially consistent ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +void *aws_atomic_exchange_ptr(volatile struct aws_atomic_var *var, void *p) { + return aws_atomic_exchange_ptr_explicit(var, p, aws_memory_order_seq_cst); +} + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. Uses sequentially consistent memory ordering, regardless of success or failure. + * Returns true if the compare was successful and the variable updated to desired. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_int(volatile struct aws_atomic_var *var, size_t *expected, size_t desired) { + return aws_atomic_compare_exchange_int_explicit( + var, expected, desired, aws_memory_order_seq_cst, aws_memory_order_seq_cst); +} + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. Uses sequentially consistent memory ordering, regardless of success or failure. + * Returns true if the compare was successful and the variable updated to desired. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_ptr(volatile struct aws_atomic_var *var, void **expected, void *desired) { + return aws_atomic_compare_exchange_ptr_explicit( + var, expected, desired, aws_memory_order_seq_cst, aws_memory_order_seq_cst); +} + +/** + * Atomically adds n to *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_add(volatile struct aws_atomic_var *var, size_t n) { + return aws_atomic_fetch_add_explicit(var, n, aws_memory_order_seq_cst); +} + +/** + * Atomically subtracts n from *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_sub(volatile struct aws_atomic_var *var, size_t n) { + return aws_atomic_fetch_sub_explicit(var, n, aws_memory_order_seq_cst); +} + +/** + * Atomically ands n into *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_and(volatile struct aws_atomic_var *var, size_t n) { + return aws_atomic_fetch_and_explicit(var, n, aws_memory_order_seq_cst); +} + +/** + * Atomically ors n into *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_or(volatile struct aws_atomic_var *var, size_t n) { + return aws_atomic_fetch_or_explicit(var, n, aws_memory_order_seq_cst); +} + +/** + * Atomically xors n into *var, and returns the previous value of *var. + * Uses sequentially consistent ordering. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_xor(volatile struct aws_atomic_var *var, size_t n) { + return aws_atomic_fetch_xor_explicit(var, n, aws_memory_order_seq_cst); +} +AWS_EXTERN_C_END + +/* Include the backend implementation now, because we'll use its typedefs and #defines below */ +#if defined(__GNUC__) || defined(__clang__) +# if defined(__ATOMIC_RELAXED) +# include +# else +# include +# endif /* __ATOMIC_RELAXED */ +#elif defined(_MSC_VER) +# include +#else +# error No atomics implementation for your compiler is available +#endif + +#include + +#endif /* AWS_COMMON_ATOMICS_INL */ diff --git a/include/aws/common/atomics_gnu.inl b/include/aws/common/atomics_gnu.inl new file mode 100644 index 0000000000000000000000000000000000000000..711b7795d64f7285095c8161dda810e1a6103816 --- /dev/null +++ b/include/aws/common/atomics_gnu.inl @@ -0,0 +1,218 @@ +#ifndef AWS_COMMON_ATOMICS_GNU_INL +#define AWS_COMMON_ATOMICS_GNU_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* These are implicitly included, but help with editor highlighting */ +#include +#include + +#include +#include + +AWS_EXTERN_C_BEGIN + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wc11-extensions" +#else +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +#endif + +typedef size_t aws_atomic_impl_int_t; + +static inline int aws_atomic_priv_xlate_order(enum aws_memory_order order) { + switch (order) { + case aws_memory_order_relaxed: + return __ATOMIC_RELAXED; + case aws_memory_order_acquire: + return __ATOMIC_ACQUIRE; + case aws_memory_order_release: + return __ATOMIC_RELEASE; + case aws_memory_order_acq_rel: + return __ATOMIC_ACQ_REL; + case aws_memory_order_seq_cst: + return __ATOMIC_SEQ_CST; + default: /* Unknown memory order */ + abort(); + } +} + +/** + * Initializes an atomic variable with an integer value. This operation should be done before any + * other operations on this atomic variable, and must be done before attempting any parallel operations. + */ +AWS_STATIC_IMPL +void aws_atomic_init_int(volatile struct aws_atomic_var *var, size_t n) { + AWS_ATOMIC_VAR_INTVAL(var) = n; +} + +/** + * Initializes an atomic variable with a pointer value. This operation should be done before any + * other operations on this atomic variable, and must be done before attempting any parallel operations. + */ +AWS_STATIC_IMPL +void aws_atomic_init_ptr(volatile struct aws_atomic_var *var, void *p) { + AWS_ATOMIC_VAR_PTRVAL(var) = p; +} + +/** + * Reads an atomic var as an integer, using the specified ordering, and returns the result. + */ +AWS_STATIC_IMPL +size_t aws_atomic_load_int_explicit(volatile const struct aws_atomic_var *var, enum aws_memory_order memory_order) { + return __atomic_load_n(&AWS_ATOMIC_VAR_INTVAL(var), aws_atomic_priv_xlate_order(memory_order)); +} + +/** + * Reads an atomic var as a pointer, using the specified ordering, and returns the result. + */ +AWS_STATIC_IMPL +void *aws_atomic_load_ptr_explicit(volatile const struct aws_atomic_var *var, enum aws_memory_order memory_order) { + return __atomic_load_n(&AWS_ATOMIC_VAR_PTRVAL(var), aws_atomic_priv_xlate_order(memory_order)); +} + +/** + * Stores an integer into an atomic var, using the specified ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_int_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order memory_order) { + __atomic_store_n(&AWS_ATOMIC_VAR_INTVAL(var), n, aws_atomic_priv_xlate_order(memory_order)); +} + +/** + * Stores an pointer into an atomic var, using the specified ordering. + */ +AWS_STATIC_IMPL +void aws_atomic_store_ptr_explicit(volatile struct aws_atomic_var *var, void *p, enum aws_memory_order memory_order) { + __atomic_store_n(&AWS_ATOMIC_VAR_PTRVAL(var), p, aws_atomic_priv_xlate_order(memory_order)); +} + +/** + * Exchanges an integer with the value in an atomic_var, using the specified ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_exchange_int_explicit( + volatile struct aws_atomic_var *var, + size_t n, + enum aws_memory_order memory_order) { + return __atomic_exchange_n(&AWS_ATOMIC_VAR_INTVAL(var), n, aws_atomic_priv_xlate_order(memory_order)); +} + +/** + * Exchanges a pointer with the value in an atomic_var, using the specified ordering. + * Returns the value that was previously in the atomic_var. + */ +AWS_STATIC_IMPL +void *aws_atomic_exchange_ptr_explicit( + volatile struct aws_atomic_var *var, + void *p, + enum aws_memory_order memory_order) { + return __atomic_exchange_n(&AWS_ATOMIC_VAR_PTRVAL(var), p, aws_atomic_priv_xlate_order(memory_order)); +} + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. On success, the memory ordering used was order_success; otherwise, it was order_failure. + * order_failure must be no stronger than order_success, and must not be release or acq_rel. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_int_explicit( + volatile struct aws_atomic_var *var, + size_t *expected, + size_t desired, + enum aws_memory_order order_success, + enum aws_memory_order order_failure) { + return __atomic_compare_exchange_n( + &AWS_ATOMIC_VAR_INTVAL(var), + expected, + desired, + false, + aws_atomic_priv_xlate_order(order_success), + aws_atomic_priv_xlate_order(order_failure)); +} + +/** + * Atomically compares *var to *expected; if they are equal, atomically sets *var = desired. Otherwise, *expected is set + * to the value in *var. On success, the memory ordering used was order_success; otherwise, it was order_failure. + * order_failure must be no stronger than order_success, and must not be release or acq_rel. + */ +AWS_STATIC_IMPL +bool aws_atomic_compare_exchange_ptr_explicit( + volatile struct aws_atomic_var *var, + void **expected, + void *desired, + enum aws_memory_order order_success, + enum aws_memory_order order_failure) { + return __atomic_compare_exchange_n( + &AWS_ATOMIC_VAR_PTRVAL(var), + expected, + desired, + false, + aws_atomic_priv_xlate_order(order_success), + aws_atomic_priv_xlate_order(order_failure)); +} + +/** + * Atomically adds n to *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_add_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order) { + return __atomic_fetch_add(&AWS_ATOMIC_VAR_INTVAL(var), n, aws_atomic_priv_xlate_order(order)); +} + +/** + * Atomically subtracts n from *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_sub_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order) { + return __atomic_fetch_sub(&AWS_ATOMIC_VAR_INTVAL(var), n, aws_atomic_priv_xlate_order(order)); +} + +/** + * Atomically ORs n with *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_or_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order) { + return __atomic_fetch_or(&AWS_ATOMIC_VAR_INTVAL(var), n, aws_atomic_priv_xlate_order(order)); +} + +/** + * Atomically ANDs n with *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_and_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order) { + return __atomic_fetch_and(&AWS_ATOMIC_VAR_INTVAL(var), n, aws_atomic_priv_xlate_order(order)); +} + +/** + * Atomically XORs n with *var, and returns the previous value of *var. + */ +AWS_STATIC_IMPL +size_t aws_atomic_fetch_xor_explicit(volatile struct aws_atomic_var *var, size_t n, enum aws_memory_order order) { + return __atomic_fetch_xor(&AWS_ATOMIC_VAR_INTVAL(var), n, aws_atomic_priv_xlate_order(order)); +} + +/** + * Provides the same reordering guarantees as an atomic operation with the specified memory order, without + * needing to actually perform an atomic operation. + */ +AWS_STATIC_IMPL +void aws_atomic_thread_fence(enum aws_memory_order order) { + __atomic_thread_fence(order); +} + +#ifdef __clang__ +# pragma clang diagnostic pop +#else +# pragma GCC diagnostic pop +#endif + +#define AWS_ATOMICS_HAVE_THREAD_FENCE +AWS_EXTERN_C_END +#endif /* AWS_COMMON_ATOMICS_GNU_INL */ diff --git a/include/aws/common/byte_order.h b/include/aws/common/byte_order.h new file mode 100644 index 0000000000000000000000000000000000000000..c2bd0d1b5692c055016cc6bc5aaa62073db74e84 --- /dev/null +++ b/include/aws/common/byte_order.h @@ -0,0 +1,76 @@ +#ifndef AWS_COMMON_BYTE_ORDER_H +#define AWS_COMMON_BYTE_ORDER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/** + * Returns 1 if machine is big endian, 0 if little endian. + * If you compile with even -O1 optimization, this check is completely optimized + * out at compile time and code which calls "if (aws_is_big_endian())" will do + * the right thing without branching. + */ +AWS_STATIC_IMPL int aws_is_big_endian(void); +/** + * Convert 64 bit integer from host to network byte order. + */ +AWS_STATIC_IMPL uint64_t aws_hton64(uint64_t x); +/** + * Convert 64 bit integer from network to host byte order. + */ +AWS_STATIC_IMPL uint64_t aws_ntoh64(uint64_t x); + +/** + * Convert 32 bit integer from host to network byte order. + */ +AWS_STATIC_IMPL uint32_t aws_hton32(uint32_t x); + +/** + * Convert 32 bit float from host to network byte order. + */ +AWS_STATIC_IMPL float aws_htonf32(float x); + +/** + * Convert 64 bit double from host to network byte order. + */ +AWS_STATIC_IMPL double aws_htonf64(double x); + +/** + * Convert 32 bit integer from network to host byte order. + */ +AWS_STATIC_IMPL uint32_t aws_ntoh32(uint32_t x); + +/** + * Convert 32 bit float from network to host byte order. + */ +AWS_STATIC_IMPL float aws_ntohf32(float x); +/** + * Convert 32 bit float from network to host byte order. + */ +AWS_STATIC_IMPL double aws_ntohf64(double x); + +/** + * Convert 16 bit integer from host to network byte order. + */ +AWS_STATIC_IMPL uint16_t aws_hton16(uint16_t x); + +/** + * Convert 16 bit integer from network to host byte order. + */ +AWS_STATIC_IMPL uint16_t aws_ntoh16(uint16_t x); + +AWS_EXTERN_C_END +#ifndef AWS_NO_STATIC_IMPL +# include +#endif /* AWS_NO_STATIC_IMPL */ + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_BYTE_ORDER_H */ diff --git a/include/aws/common/cache.h b/include/aws/common/cache.h new file mode 100644 index 0000000000000000000000000000000000000000..dfac0de6dd3be1fe0cf72c97ae84058f7b6d3d22 --- /dev/null +++ b/include/aws/common/cache.h @@ -0,0 +1,87 @@ +#ifndef AWS_COMMON_CACHE_H +#define AWS_COMMON_CACHE_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_cache; + +struct aws_cache_vtable { + void (*destroy)(struct aws_cache *cache); + int (*find)(struct aws_cache *cache, const void *key, void **p_value); + int (*put)(struct aws_cache *cache, const void *key, void *p_value); + int (*remove)(struct aws_cache *cache, const void *key); + void (*clear)(struct aws_cache *cache); + size_t (*get_element_count)(const struct aws_cache *cache); +}; + +/** + * Base stucture for caches, used the linked hash table implementation. + */ +struct aws_cache { + struct aws_allocator *allocator; + const struct aws_cache_vtable *vtable; + struct aws_linked_hash_table table; + size_t max_items; + + void *impl; +}; + +/* Default implementations */ +void aws_cache_base_default_destroy(struct aws_cache *cache); +int aws_cache_base_default_find(struct aws_cache *cache, const void *key, void **p_value); +int aws_cache_base_default_remove(struct aws_cache *cache, const void *key); +void aws_cache_base_default_clear(struct aws_cache *cache); +size_t aws_cache_base_default_get_element_count(const struct aws_cache *cache); + +AWS_EXTERN_C_BEGIN +/** + * Cleans up the cache. Elements in the cache will be evicted and cleanup + * callbacks will be invoked. + */ +AWS_COMMON_API +void aws_cache_destroy(struct aws_cache *cache); + +/** + * Finds element in the cache by key. If found, *p_value will hold the stored value, and AWS_OP_SUCCESS will be + * returned. If not found, AWS_OP_SUCCESS will be returned and *p_value will be NULL. + * + * If any errors occur AWS_OP_ERR will be returned. + */ +AWS_COMMON_API +int aws_cache_find(struct aws_cache *cache, const void *key, void **p_value); + +/** + * Puts `p_value` at `key`. If an element is already stored at `key` it will be replaced. If the cache is already full, + * an item will be removed based on the cache policy. + */ +AWS_COMMON_API +int aws_cache_put(struct aws_cache *cache, const void *key, void *p_value); + +/** + * Removes item at `key` from the cache. + */ +AWS_COMMON_API +int aws_cache_remove(struct aws_cache *cache, const void *key); + +/** + * Clears all items from the cache. + */ +AWS_COMMON_API +void aws_cache_clear(struct aws_cache *cache); + +/** + * Returns the number of elements in the cache. + */ +AWS_COMMON_API +size_t aws_cache_get_element_count(const struct aws_cache *cache); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_CACHE_H */ diff --git a/include/aws/common/cbor.h b/include/aws/common/cbor.h new file mode 100644 index 0000000000000000000000000000000000000000..a7369fc6ff3471b63fe97d44f5054e35d121da98 --- /dev/null +++ b/include/aws/common/cbor.h @@ -0,0 +1,460 @@ +#ifndef AWS_COMMON_CBOR_H +#define AWS_COMMON_CBOR_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/** + * The types use by APIs, not 1:1 with major type. + * It's an extension for cbor major type in RFC8949 section 3.1 + * Major type 0 - AWS_CBOR_TYPE_UINT + * Major type 1 - AWS_CBOR_TYPE_NEGINT + * Major type 2 - AWS_CBOR_TYPE_BYTES/AWS_CBOR_TYPE_INDEF_BYTES_START + * Major type 3 - AWS_CBOR_TYPE_TEXT/AWS_CBOR_TYPE_INDEF_TEXT_START + * Major type 4 - AWS_CBOR_TYPE_ARRAY_START/AWS_CBOR_TYPE_INDEF_ARRAY_START + * Major type 5 - AWS_CBOR_TYPE_MAP_START/AWS_CBOR_TYPE_INDEF_MAP_START + * Major type 6 - AWS_CBOR_TYPE_TAG + * Major type 7 + * - 20/21 - AWS_CBOR_TYPE_BOOL + * - 22 - AWS_CBOR_TYPE_NULL + * - 23 - AWS_CBOR_TYPE_UNDEFINED + * - 25/26/27 - AWS_CBOR_TYPE_FLOAT + * - 31 - AWS_CBOR_TYPE_BREAK + * - rest of value are not supported. + */ +enum aws_cbor_type { + AWS_CBOR_TYPE_UNKNOWN = 0, + + AWS_CBOR_TYPE_UINT, + AWS_CBOR_TYPE_NEGINT, + AWS_CBOR_TYPE_FLOAT, + AWS_CBOR_TYPE_BYTES, + AWS_CBOR_TYPE_TEXT, + + AWS_CBOR_TYPE_ARRAY_START, + AWS_CBOR_TYPE_MAP_START, + + AWS_CBOR_TYPE_TAG, + + AWS_CBOR_TYPE_BOOL, + AWS_CBOR_TYPE_NULL, + AWS_CBOR_TYPE_UNDEFINED, + AWS_CBOR_TYPE_BREAK, + + AWS_CBOR_TYPE_INDEF_BYTES_START, + AWS_CBOR_TYPE_INDEF_TEXT_START, + AWS_CBOR_TYPE_INDEF_ARRAY_START, + AWS_CBOR_TYPE_INDEF_MAP_START, +}; + +/** + * The common tags, refer to RFC8949 section 3.4 + * Expected value type followed by the tag: + * AWS_CBOR_TAG_STANDARD_TIME - AWS_CBOR_TYPE_TEXT + * AWS_CBOR_TAG_EPOCH_TIME - AWS_CBOR_TYPE_UINT/AWS_CBOR_TYPE_NEGINT/AWS_CBOR_TYPE_FLOAT + * AWS_CBOR_TAG_UNSIGNED_BIGNUM - AWS_CBOR_TYPE_BYTES + * AWS_CBOR_TAG_NEGATIVE_BIGNUM - AWS_CBOR_TYPE_BYTES + * AWS_CBOR_TAG_DECIMAL_FRACTION - AWS_CBOR_TYPE_ARRAY_START/AWS_CBOR_TYPE_INDEF_ARRAY_START + **/ +#define AWS_CBOR_TAG_STANDARD_TIME 0 +#define AWS_CBOR_TAG_EPOCH_TIME 1 +#define AWS_CBOR_TAG_UNSIGNED_BIGNUM 2 +#define AWS_CBOR_TAG_NEGATIVE_BIGNUM 3 +#define AWS_CBOR_TAG_DECIMAL_FRACTION 4 + +struct aws_cbor_encoder; +struct aws_cbor_decoder; + +/******************************************************************************* + * ENCODE + ******************************************************************************/ + +/* Return c-string for aws_cbor_type */ +AWS_COMMON_API +const char *aws_cbor_type_cstr(enum aws_cbor_type type); + +/** + * @brief Create a new cbor encoder. Creating a encoder with a temporay buffer. + * Every aws_cbor_encoder_write_* will encode directly into the buffer to follow the encoded data. + * + * @param allocator + * @return aws_cbor_encoder + */ +AWS_COMMON_API +struct aws_cbor_encoder *aws_cbor_encoder_new(struct aws_allocator *allocator); + +AWS_COMMON_API +struct aws_cbor_encoder *aws_cbor_encoder_destroy(struct aws_cbor_encoder *encoder); + +/** + * @brief Get the current encoded data from encoder. The encoded data has the same lifetime as the encoder, and once + * any other function call invoked for the encoder, the encoded data is no longer valid. + * + * @param encoder + * @return struct aws_byte_cursor from the encoder buffer. + */ +AWS_COMMON_API +struct aws_byte_cursor aws_cbor_encoder_get_encoded_data(const struct aws_cbor_encoder *encoder); + +/** + * @brief Clear the current encoded buffer from encoder. + * + * @param encoder + */ +AWS_COMMON_API +void aws_cbor_encoder_reset(struct aws_cbor_encoder *encoder); + +/** + * @brief Encode a AWS_CBOR_TYPE_UINT value to "smallest possible" in encoder's buffer. + * Referring to RFC8949 section 4.2.1 + * + * TODO: maybe add a width of the encoded value. + * + * @param encoder + * @param value value to encode. + */ +AWS_COMMON_API +void aws_cbor_encoder_write_uint(struct aws_cbor_encoder *encoder, uint64_t value); + +/** + * @brief Encode a AWS_CBOR_TYPE_NEGINT value to "smallest possible" in encoder's buffer. + * It represents (-1 - value). + * Referring to RFC8949 section 4.2.1 + * + * + * @param encoder + * @param value The argument to encode to negative integer, which is (-1 - expected_val) + */ +AWS_COMMON_API +void aws_cbor_encoder_write_negint(struct aws_cbor_encoder *encoder, uint64_t value); + +/** + * @brief Encode a AWS_CBOR_TYPE_FLOAT value to "smallest possible", but will not be encoded into half-precision float, + * as it's not well supported cross languages. + * + * To be more specific, it will be encoded into integer/negative/float + * (Order with priority) when the conversation will not cause precision loss. + * + * @param encoder + * @param value value to encode. + */ +AWS_COMMON_API +void aws_cbor_encoder_write_float(struct aws_cbor_encoder *encoder, double value); + +/** + * @brief Encode a AWS_CBOR_TYPE_BYTES value to "smallest possible" in encoder's buffer. + * Referring to RFC8949 section 4.2.1, the length of "from" will be encoded first and then the value of "from" will + * be followed. + * + * @param encoder + * @param from value to encode. + */ +AWS_COMMON_API +void aws_cbor_encoder_write_bytes(struct aws_cbor_encoder *encoder, struct aws_byte_cursor from); + +/** + * @brief Encode a AWS_CBOR_TYPE_TEXT value to "smallest possible" in encoder's buffer. + * Referring to RFC8949 section 4.2.1, the length of "from" will be encoded first and then the value of "from" will + * be followed. + * + * @param encoder + * @param from value to encode. + */ +AWS_COMMON_API +void aws_cbor_encoder_write_text(struct aws_cbor_encoder *encoder, struct aws_byte_cursor from); + +/** + * @brief Encode a AWS_CBOR_TYPE_ARRAY_START value to "smallest possible" in encoder's buffer. + * Referring to RFC8949 section 4.2.1 + * The "number_entries" is the cbor data items should be followed as the content of the array. + * Notes: it's user's responsibility to keep the integrity of the array to be encoded. + * + * @param encoder + * @param number_entries The number of data item in array. + */ +AWS_COMMON_API +void aws_cbor_encoder_write_array_start(struct aws_cbor_encoder *encoder, size_t number_entries); + +/** + * @brief Encode a AWS_CBOR_TYPE_MAP_START value to "smallest possible" in encoder's buffer. + * Referring to RFC8949 section 4.2.1 + * The "number_entries" is the number of pair of cbor data items as key and value should be followed as the content of + * the map. + * + * Notes: it's user's responsibility to keep the integrity of the map to be encoded. + * + * @param encoder + * @param number_entries The number of data item in map. + */ +AWS_COMMON_API +void aws_cbor_encoder_write_map_start(struct aws_cbor_encoder *encoder, size_t number_entries); + +/** + * @brief Encode a AWS_CBOR_TYPE_TAG value to "smallest possible" in encoder's buffer. + * Referring to RFC8949 section 4.2.1 + * The following cbor data item will be the content of the tagged value. + * Notes: it's user's responsibility to keep the integrity of the tagged value to follow the RFC8949 section 3.4 + * + * @param encoder + * @param tag_number The tag value to encode. + */ +AWS_COMMON_API +void aws_cbor_encoder_write_tag(struct aws_cbor_encoder *encoder, uint64_t tag_number); + +/** + * @brief Encode a simple value AWS_CBOR_TYPE_NULL + * + * @param encoder + */ +AWS_COMMON_API +void aws_cbor_encoder_write_null(struct aws_cbor_encoder *encoder); + +/** + * @brief Encode a simple value AWS_CBOR_TYPE_UNDEFINED + * + * @param encoder + */ +AWS_COMMON_API +void aws_cbor_encoder_write_undefined(struct aws_cbor_encoder *encoder); + +/** + * @brief Encode a simple value AWS_CBOR_TYPE_BOOL + * + * @param encoder + */ +AWS_COMMON_API +void aws_cbor_encoder_write_bool(struct aws_cbor_encoder *encoder, bool value); + +/** + * @brief Encode a simple value AWS_CBOR_TYPE_BREAK + * + * Notes: no error checking, it's user's responsibility to track the break + * to close the corresponding indef_start + */ +AWS_COMMON_API +void aws_cbor_encoder_write_break(struct aws_cbor_encoder *encoder); + +/** + * @brief Encode a AWS_CBOR_TYPE_INDEF_BYTES_START + * + * Notes: no error checking, it's user's responsibility to add corresponding data and the break + * to close the indef_start + */ +AWS_COMMON_API +void aws_cbor_encoder_write_indef_bytes_start(struct aws_cbor_encoder *encoder); +/** + * @brief Encode a AWS_CBOR_TYPE_INDEF_TEXT_START + * + * Notes: no error checking, it's user's responsibility to add corresponding data + * and the break to close the indef_start + */ +AWS_COMMON_API +void aws_cbor_encoder_write_indef_text_start(struct aws_cbor_encoder *encoder); +/** + * @brief Encode a AWS_CBOR_TYPE_INDEF_ARRAY_START + * + * Notes: no error checking, it's user's responsibility to add corresponding data + * and the break to close the indef_start + */ +AWS_COMMON_API +void aws_cbor_encoder_write_indef_array_start(struct aws_cbor_encoder *encoder); +/** + * @brief Encode a AWS_CBOR_TYPE_INDEF_MAP_START + * + * Notes: no error checking, it's user's responsibility to add corresponding data + * and the break to close the indef_start + */ +AWS_COMMON_API +void aws_cbor_encoder_write_indef_map_start(struct aws_cbor_encoder *encoder); + +/******************************************************************************* + * DECODE + ******************************************************************************/ + +/** + * @brief Create a cbor decoder to take src to decode. + * The typical usage of decoder will be: + * - If the next element type only accept what expected, `aws_cbor_decoder_pop_next_*` + * - If the next element type accept different type, invoke `aws_cbor_decoder_peek_type` first, then based on the type + * to invoke corresponding `aws_cbor_decoder_pop_next_*` + * - If the next element type doesn't have corrsponding value, specifically: AWS_CBOR_TYPE_NULL, + * AWS_CBOR_TYPE_UNDEFINED, AWS_CBOR_TYPE_INF_*_START, AWS_CBOR_TYPE_BREAK, call + * `aws_cbor_decoder_consume_next_single_element` to consume it and continues for further decoding. + * - To ignore the next data item (the element and the content of it), `aws_cbor_decoder_consume_next_whole_data_item` + * + * Note: it's caller's responsibilty to keep the src outlive the decoder. + * + * @param allocator + * @param src The src data to decode from. + * @return decoder + */ +AWS_COMMON_API +struct aws_cbor_decoder *aws_cbor_decoder_new(struct aws_allocator *allocator, struct aws_byte_cursor src); + +AWS_COMMON_API +struct aws_cbor_decoder *aws_cbor_decoder_destroy(struct aws_cbor_decoder *decoder); + +/** + * @brief Get the length of the remaining bytes of the source. Once the source was decoded, it will be consumed, + * and result in decrease of the remaining length of bytes. + * + * @param decoder + * @return The length of bytes remaining of the decoder source. + */ +AWS_COMMON_API +size_t aws_cbor_decoder_get_remaining_length(const struct aws_cbor_decoder *decoder); + +/** + * @brief Reset the decoder source to a new src. + * The previous src will be discarded regardless of the unconsumed bytes. + * The decoder will clear its cache if any. + * + * @param decoder + * @param src The src data to decode from.. + */ +AWS_COMMON_API +void aws_cbor_decoder_reset_src(struct aws_cbor_decoder *decoder, struct aws_byte_cursor src); + +/** + * @brief Decode the next element and store it in the decoder cache if there was no element cached. + * If there was element cached, just return the type of the cached element. + * + * @param decoder + * @param out_type + * @return AWS_OP_SUCCESS if succeed, AWS_OP_ERR for any decoding error and corresponding error code will be raised. + */ +AWS_COMMON_API +int aws_cbor_decoder_peek_type(struct aws_cbor_decoder *decoder, enum aws_cbor_type *out_type); + +/** + * @brief Consume the next data item, includes all the content within the data item. + * + * As an example for the following cbor, this function will consume all the data + * as it's only one cbor data item, an indefinite map with 2 pair: + * 0xbf6346756ef563416d7421ff + * BF -- Start indefinite-length map + * 63 -- First key, UTF-8 string length 3 + * 46756e -- "Fun" + * F5 -- First value, true + * 63 -- Second key, UTF-8 string length 3 + * 416d74 -- "Amt" + * 21 -- Second value, -2 + * FF -- "break" + * + * Notes: this function will not ensure the data item is well-formed. + * + * @param src The src to parse data from + * @return AWS_OP_SUCCESS successfully consumed the next data item, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_cbor_decoder_consume_next_whole_data_item(struct aws_cbor_decoder *decoder); + +/** + * @brief Consume the next single element, without the content followed by the element. + * + * As an example for the following cbor, this function will only consume the + * 0xBF, "Start indefinite-length map", not any content of the map represented. + * The next element to decode will start from 0x63 + * 0xbf6346756ef563416d7421ff + * BF -- Start indefinite-length map + * 63 -- First key, UTF-8 string length 3 + * 46756e -- "Fun" + * F5 -- First value, true + * 63 -- Second key, UTF-8 string length 3 + * 416d74 -- "Amt" + * 21 -- Second value, -2 + * FF -- "break" + * + * @param decoder The decoder to parse data from + * @return AWS_OP_SUCCESS successfully consumed the next element, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_cbor_decoder_consume_next_single_element(struct aws_cbor_decoder *decoder); + +/** + * @brief Get the next element based on the type. If the next element doesn't match the expected type. Error will be + * raised. If the next element already been cached, it will consume the cached item when no error was returned. + * Specifically: + * AWS_CBOR_TYPE_UINT - aws_cbor_decoder_pop_next_unsigned_int_val + * AWS_CBOR_TYPE_NEGINT - aws_cbor_decoder_pop_next_negative_int_val, it represents (-1 - *out) + * AWS_CBOR_TYPE_FLOAT - aws_cbor_decoder_pop_next_float_val + * AWS_CBOR_TYPE_BYTES - aws_cbor_decoder_pop_next_bytes_val + * AWS_CBOR_TYPE_TEXT - aws_cbor_decoder_pop_next_text_val + * + * @param decoder + * @param out + * @return AWS_OP_SUCCESS successfully consumed the next element and get the result, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_cbor_decoder_pop_next_unsigned_int_val(struct aws_cbor_decoder *decoder, uint64_t *out); +AWS_COMMON_API +int aws_cbor_decoder_pop_next_negative_int_val(struct aws_cbor_decoder *decoder, uint64_t *out); +AWS_COMMON_API +int aws_cbor_decoder_pop_next_float_val(struct aws_cbor_decoder *decoder, double *out); +AWS_COMMON_API +int aws_cbor_decoder_pop_next_boolean_val(struct aws_cbor_decoder *decoder, bool *out); +AWS_COMMON_API +int aws_cbor_decoder_pop_next_bytes_val(struct aws_cbor_decoder *decoder, struct aws_byte_cursor *out); +AWS_COMMON_API +int aws_cbor_decoder_pop_next_text_val(struct aws_cbor_decoder *decoder, struct aws_byte_cursor *out); + +/** + * @brief Get the next AWS_CBOR_TYPE_ARRAY_START element. Only consume the AWS_CBOR_TYPE_ARRAY_START element and set the + * size of array to *out_size, not the content of the array. The next *out_size cbor data items will be the content of + * the array for a valid cbor data, + * + * Notes: For indefinite-length, this function will fail with "AWS_ERROR_CBOR_UNEXPECTED_TYPE". The designed way to + * handle indefinite-length is: + * - Get AWS_CBOR_TYPE_INDEF_ARRAY_START from _peek_type + * - call `aws_cbor_decoder_consume_next_single_element` to pop the indefinite-length start. + * - Decode the next data item until AWS_CBOR_TYPE_BREAK read. + * + * @param decoder + * @param out_size store the size of array if succeed. + * @return AWS_OP_SUCCESS successfully consumed the next element and get the result, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_cbor_decoder_pop_next_array_start(struct aws_cbor_decoder *decoder, uint64_t *out_size); + +/** + * @brief Get the next AWS_CBOR_TYPE_MAP_START element. + * Only consume the AWS_CBOR_TYPE_MAP_START element and set the size of array to *out_size, not the content of the map. + * The next *out_size pair of cbor data items as key and value will be the content of the array for a valid cbor data, + * + * Notes: For indefinite-length, this function will fail with "AWS_ERROR_CBOR_UNEXPECTED_TYPE". The designed way to + * handle indefinite-length is: + * - Get AWS_CBOR_TYPE_INDEF_MAP_START from _peek_type + * - call `aws_cbor_decoder_consume_next_single_element` to pop the indefinite-length start. + * - Decode the next data item until AWS_CBOR_TYPE_BREAK read. + * + * @param decoder + * @param out_size store the size of map if succeed. + * @return AWS_OP_SUCCESS successfully consumed the next element and get the result, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_cbor_decoder_pop_next_map_start(struct aws_cbor_decoder *decoder, uint64_t *out_size); + +/** + * @brief Get the next AWS_CBOR_TYPE_TAG element. + * Only consume the AWS_CBOR_TYPE_TAG element and set the tag ID value to *out_tag_val, not the content of the tagged. + * The next cbor data item will be the content of the tagged value for a valid cbor data. + * + * @param decoder + * @param out_tag_val store the value of tag ID. + * @return AWS_OP_SUCCESS successfully consumed the next element and get the result, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_cbor_decoder_pop_next_tag_val(struct aws_cbor_decoder *decoder, uint64_t *out_tag_val); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif // AWS_COMMON_CBOR_H diff --git a/include/aws/common/common.h b/include/aws/common/common.h new file mode 100644 index 0000000000000000000000000000000000000000..b378a4f902165afea49f4d176df9535c4c395aa3 --- /dev/null +++ b/include/aws/common/common.h @@ -0,0 +1,48 @@ +#ifndef AWS_COMMON_COMMON_H +#define AWS_COMMON_COMMON_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* for abort() */ +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/** + * Initializes internal data structures used by aws-c-common. + * Must be called before using any functionality in aws-c-common. + */ +AWS_COMMON_API +void aws_common_library_init(struct aws_allocator *allocator); + +/** + * Shuts down the internal data structures used by aws-c-common. + */ +AWS_COMMON_API +void aws_common_library_clean_up(void); + +AWS_COMMON_API +void aws_common_fatal_assert_library_initialized(void); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_COMMON_H */ diff --git a/include/aws/common/condition_variable.h b/include/aws/common/condition_variable.h new file mode 100644 index 0000000000000000000000000000000000000000..a4eb1bdfe31cc92a5e31756ee8e9a7c176be20e6 --- /dev/null +++ b/include/aws/common/condition_variable.h @@ -0,0 +1,118 @@ +#ifndef AWS_COMMON_CONDITION_VARIABLE_H +#define AWS_COMMON_CONDITION_VARIABLE_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#ifndef _WIN32 +# include +#endif + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_mutex; + +struct aws_condition_variable; + +typedef bool(aws_condition_predicate_fn)(void *); + +struct aws_condition_variable { +#ifdef _WIN32 + void *condition_handle; +#else + pthread_cond_t condition_handle; +#endif + bool initialized; +}; + +/** + * Static initializer for condition variable. + * You can do something like struct aws_condition_variable var = + * AWS_CONDITION_VARIABLE_INIT; + * + * If on Windows and you get an error about AWS_CONDITION_VARIABLE_INIT being undefined, please include windows.h to get + * CONDITION_VARIABLE_INIT. + */ +#ifdef _WIN32 +# define AWS_CONDITION_VARIABLE_INIT {.condition_handle = NULL, .initialized = true} +#else +# define AWS_CONDITION_VARIABLE_INIT {.condition_handle = PTHREAD_COND_INITIALIZER, .initialized = true} +#endif + +AWS_EXTERN_C_BEGIN + +/** + * Initializes a condition variable. + */ +AWS_COMMON_API +int aws_condition_variable_init(struct aws_condition_variable *condition_variable); + +/** + * Cleans up a condition variable. + */ +AWS_COMMON_API +void aws_condition_variable_clean_up(struct aws_condition_variable *condition_variable); + +/** + * Notifies/Wakes one waiting thread + */ +AWS_COMMON_API +int aws_condition_variable_notify_one(struct aws_condition_variable *condition_variable); + +/** + * Notifies/Wakes all waiting threads. + */ +AWS_COMMON_API +int aws_condition_variable_notify_all(struct aws_condition_variable *condition_variable); + +/** + * Waits the calling thread on a notification from another thread. This function must be called with the mutex locked + * by the calling thread otherwise the behavior is undefined. Spurious wakeups can occur and to avoid this causing + * any problems use the _pred version of this function. + */ +AWS_COMMON_API +int aws_condition_variable_wait(struct aws_condition_variable *condition_variable, struct aws_mutex *mutex); + +/** + * Waits the calling thread on a notification from another thread. If predicate returns false, the wait is reentered, + * otherwise control returns to the caller. This function must be called with the mutex locked by the calling thread + * otherwise the behavior is undefined. + */ +AWS_COMMON_API +int aws_condition_variable_wait_pred( + struct aws_condition_variable *condition_variable, + struct aws_mutex *mutex, + aws_condition_predicate_fn *pred, + void *pred_ctx); + +/** + * Waits the calling thread on a notification from another thread. Times out after time_to_wait. time_to_wait is in + * nanoseconds. This function must be called with the mutex locked by the calling thread otherwise the behavior is + * undefined. Spurious wakeups can occur and to avoid this causing any problems use the _pred version of this function. + */ +AWS_COMMON_API +int aws_condition_variable_wait_for( + struct aws_condition_variable *condition_variable, + struct aws_mutex *mutex, + int64_t time_to_wait); + +/** + * Waits the calling thread on a notification from another thread. Times out after time_to_wait. time_to_wait is in + * nanoseconds. If predicate returns false, the wait is reentered, otherwise control returns to the caller. This + * function must be called with the mutex locked by the calling thread otherwise the behavior is undefined. + */ +AWS_COMMON_API +int aws_condition_variable_wait_for_pred( + struct aws_condition_variable *condition_variable, + struct aws_mutex *mutex, + int64_t time_to_wait, + aws_condition_predicate_fn *pred, + void *pred_ctx); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_CONDITION_VARIABLE_H */ diff --git a/include/aws/common/config.h b/include/aws/common/config.h new file mode 100644 index 0000000000000000000000000000000000000000..45c522bbaaa17dd4555525c25381d4fbf2f1a59d --- /dev/null +++ b/include/aws/common/config.h @@ -0,0 +1,33 @@ +#ifndef AWS_COMMON_CONFIG_H +#define AWS_COMMON_CONFIG_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* + * This header exposes compiler feature test results determined during cmake + * configure time to inline function implementations. The macros defined here + * should be considered to be an implementation detail, and can change at any + * time. + */ +#define AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS +#define AWS_HAVE_GCC_INLINE_ASM +/* #undef AWS_HAVE_MSVC_INTRINSICS_X64 */ +#define AWS_HAVE_POSIX_LARGE_FILE_SUPPORT +#define AWS_HAVE_EXECINFO +/* #undef AWS_HAVE_WINAPI_DESKTOP */ +#define AWS_HAVE_LINUX_IF_LINK_H +#define AWS_HAVE_AVX2_INTRINSICS +#define AWS_HAVE_AVX512_INTRINSICS +#define AWS_HAVE_MM256_EXTRACT_EPI64 +#define AWS_HAVE_CLMUL +/* #undef AWS_HAVE_ARM32_CRC */ +/* #undef AWS_HAVE_ARMv8_1 */ +/* #undef AWS_ARCH_ARM64 */ +#define AWS_ARCH_INTEL +#define AWS_ARCH_INTEL_X64 +#define AWS_USE_CPU_EXTENSIONS + +#endif diff --git a/include/aws/common/cpuid.h b/include/aws/common/cpuid.h new file mode 100644 index 0000000000000000000000000000000000000000..9ab7d505931ed11f1237a95abad42000314e591a --- /dev/null +++ b/include/aws/common/cpuid.h @@ -0,0 +1,36 @@ +#ifndef AWS_COMMON_CPUID_H +#define AWS_COMMON_CPUID_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum aws_cpu_feature_name { + AWS_CPU_FEATURE_CLMUL, + AWS_CPU_FEATURE_SSE_4_1, + AWS_CPU_FEATURE_SSE_4_2, + AWS_CPU_FEATURE_AVX2, + AWS_CPU_FEATURE_AVX512, + AWS_CPU_FEATURE_ARM_CRC, + AWS_CPU_FEATURE_BMI2, + AWS_CPU_FEATURE_VPCLMULQDQ, + AWS_CPU_FEATURE_ARM_PMULL, + AWS_CPU_FEATURE_ARM_CRYPTO, + AWS_CPU_FEATURE_COUNT, +}; + +AWS_EXTERN_C_BEGIN + +/** + * Returns true if a cpu feature is supported, false otherwise. + */ +AWS_COMMON_API bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_CPUID_H */ diff --git a/include/aws/common/cross_process_lock.h b/include/aws/common/cross_process_lock.h new file mode 100644 index 0000000000000000000000000000000000000000..99ecc5cb6b128425d4f31f56a13072f5b2eb69b0 --- /dev/null +++ b/include/aws/common/cross_process_lock.h @@ -0,0 +1,35 @@ +#ifndef AWS_COMMON_CROSS_PROCESS_LOCK_H +#define AWS_COMMON_CROSS_PROCESS_LOCK_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +struct aws_cross_process_lock; +AWS_EXTERN_C_BEGIN + +/** + * Attempts to acquire a system-wide (not per process or per user) lock scoped by instance_nonce. + * For any given unique nonce, a lock will be returned by the first caller. Subsequent calls will + * return NULL and raise AWS_ERROR_MUTEX_CALLER_NOT_OWNER + * until the either the process owning the lock exits or the program owning the lock + * calls aws_cross_process_lock_release() explicitly. + * + * If the process exits before the lock is released, the kernel will unlock it for the next consumer. + */ +AWS_COMMON_API +struct aws_cross_process_lock *aws_cross_process_lock_try_acquire( + struct aws_allocator *allocator, + struct aws_byte_cursor instance_nonce); + +/** + * Releases the lock so the next caller (may be another process) can get an instance of the lock. + */ +AWS_COMMON_API +void aws_cross_process_lock_release(struct aws_cross_process_lock *instance_lock); + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_CROSS_PROCESS_LOCK_H */ diff --git a/include/aws/common/date_time.h b/include/aws/common/date_time.h new file mode 100644 index 0000000000000000000000000000000000000000..72ca09a86beb4c83f056191cf076661f041e991c --- /dev/null +++ b/include/aws/common/date_time.h @@ -0,0 +1,167 @@ +#ifndef AWS_COMMON_DATE_TIME_H +#define AWS_COMMON_DATE_TIME_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum { + AWS_DATE_TIME_STR_MAX_LEN = 100, + AWS_DATE_TIME_STR_MAX_BASIC_LEN = 20, +}; + +struct aws_byte_buf; +struct aws_byte_cursor; + +enum aws_date_format { + AWS_DATE_FORMAT_RFC822, + AWS_DATE_FORMAT_ISO_8601, + AWS_DATE_FORMAT_ISO_8601_BASIC, + AWS_DATE_FORMAT_AUTO_DETECT, +}; + +enum aws_date_month { + AWS_DATE_MONTH_JANUARY = 0, + AWS_DATE_MONTH_FEBRUARY, + AWS_DATE_MONTH_MARCH, + AWS_DATE_MONTH_APRIL, + AWS_DATE_MONTH_MAY, + AWS_DATE_MONTH_JUNE, + AWS_DATE_MONTH_JULY, + AWS_DATE_MONTH_AUGUST, + AWS_DATE_MONTH_SEPTEMBER, + AWS_DATE_MONTH_OCTOBER, + AWS_DATE_MONTH_NOVEMBER, + AWS_DATE_MONTH_DECEMBER, +}; + +enum aws_date_day_of_week { + AWS_DATE_DAY_OF_WEEK_SUNDAY = 0, + AWS_DATE_DAY_OF_WEEK_MONDAY, + AWS_DATE_DAY_OF_WEEK_TUESDAY, + AWS_DATE_DAY_OF_WEEK_WEDNESDAY, + AWS_DATE_DAY_OF_WEEK_THURSDAY, + AWS_DATE_DAY_OF_WEEK_FRIDAY, + AWS_DATE_DAY_OF_WEEK_SATURDAY, +}; + +struct aws_date_time { + time_t timestamp; + uint16_t milliseconds; + char tz[6]; + struct tm gmt_time; + struct tm local_time; + bool utc_assumed; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes dt to be the current system time. + */ +AWS_COMMON_API void aws_date_time_init_now(struct aws_date_time *dt); + +/** + * Initializes dt to be the time represented in milliseconds since unix epoch. + */ +AWS_COMMON_API void aws_date_time_init_epoch_millis(struct aws_date_time *dt, uint64_t ms_since_epoch); + +/** + * Initializes dt to be the time represented in seconds.millis since unix epoch. + */ +AWS_COMMON_API void aws_date_time_init_epoch_secs(struct aws_date_time *dt, double sec_ms); + +/** + * Initializes dt to be the time represented by date_str in format 'fmt'. Returns AWS_OP_SUCCESS if the + * string was successfully parsed, returns AWS_OP_ERR if parsing failed. + * + * The parser is lenient regarding AWS_DATE_FORMAT_ISO_8601 vs AWS_DATE_FORMAT_ISO_8601_BASIC. + * Regardless of which you pass in, both "2002-10-02T08:05:09Z" and "20021002T080509Z" would be accepted. + * + * Notes for AWS_DATE_FORMAT_RFC822: + * If no time zone information is provided, it is assumed to be local time (please don't do this). + * + * Only time zones indicating Universal Time (e.g. Z, UT, UTC, or GMT), + * or offsets from UTC (e.g. +0100, -0700), are accepted. + * + * Really, it's just better if you always use Universal Time. + */ +AWS_COMMON_API int aws_date_time_init_from_str( + struct aws_date_time *dt, + const struct aws_byte_buf *date_str, + enum aws_date_format fmt); + +/** + * aws_date_time_init variant that takes a byte_cursor rather than a byte_buf + */ +AWS_COMMON_API int aws_date_time_init_from_str_cursor( + struct aws_date_time *dt, + const struct aws_byte_cursor *date_str_cursor, + enum aws_date_format fmt); + +/** + * Copies the current time as a formatted date string in local time into output_buf. If buffer is too small, it will + * return AWS_OP_ERR. A good size suggestion is AWS_DATE_TIME_STR_MAX_LEN bytes. AWS_DATE_FORMAT_AUTO_DETECT is not + * allowed. + */ +AWS_COMMON_API int aws_date_time_to_local_time_str( + const struct aws_date_time *dt, + enum aws_date_format fmt, + struct aws_byte_buf *output_buf); + +/** + * Copies the current time as a formatted date string in utc time into output_buf. If buffer is too small, it will + * return AWS_OP_ERR. A good size suggestion is AWS_DATE_TIME_STR_MAX_LEN bytes. AWS_DATE_FORMAT_AUTO_DETECT is not + * allowed. + */ +AWS_COMMON_API int aws_date_time_to_utc_time_str( + const struct aws_date_time *dt, + enum aws_date_format fmt, + struct aws_byte_buf *output_buf); + +/** + * Copies the current time as a formatted short date string in local time into output_buf. If buffer is too small, it + * will return AWS_OP_ERR. A good size suggestion is AWS_DATE_TIME_STR_MAX_LEN bytes. AWS_DATE_FORMAT_AUTO_DETECT is not + * allowed. + */ +AWS_COMMON_API int aws_date_time_to_local_time_short_str( + const struct aws_date_time *dt, + enum aws_date_format fmt, + struct aws_byte_buf *output_buf); + +/** + * Copies the current time as a formatted short date string in utc time into output_buf. If buffer is too small, it will + * return AWS_OP_ERR. A good size suggestion is AWS_DATE_TIME_STR_MAX_LEN bytes. AWS_DATE_FORMAT_AUTO_DETECT is not + * allowed. + */ +AWS_COMMON_API int aws_date_time_to_utc_time_short_str( + const struct aws_date_time *dt, + enum aws_date_format fmt, + struct aws_byte_buf *output_buf); + +AWS_COMMON_API double aws_date_time_as_epoch_secs(const struct aws_date_time *dt); +AWS_COMMON_API uint64_t aws_date_time_as_nanos(const struct aws_date_time *dt); +AWS_COMMON_API uint64_t aws_date_time_as_millis(const struct aws_date_time *dt); +AWS_COMMON_API uint16_t aws_date_time_year(const struct aws_date_time *dt, bool local_time); +AWS_COMMON_API enum aws_date_month aws_date_time_month(const struct aws_date_time *dt, bool local_time); +AWS_COMMON_API uint8_t aws_date_time_month_day(const struct aws_date_time *dt, bool local_time); +AWS_COMMON_API enum aws_date_day_of_week aws_date_time_day_of_week(const struct aws_date_time *dt, bool local_time); +AWS_COMMON_API uint8_t aws_date_time_hour(const struct aws_date_time *dt, bool local_time); +AWS_COMMON_API uint8_t aws_date_time_minute(const struct aws_date_time *dt, bool local_time); +AWS_COMMON_API uint8_t aws_date_time_second(const struct aws_date_time *dt, bool local_time); +AWS_COMMON_API bool aws_date_time_dst(const struct aws_date_time *dt, bool local_time); + +/** + * returns the difference of a and b (a - b) in seconds. + */ +AWS_COMMON_API time_t aws_date_time_diff(const struct aws_date_time *a, const struct aws_date_time *b); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_DATE_TIME_H */ diff --git a/include/aws/common/device_random.h b/include/aws/common/device_random.h new file mode 100644 index 0000000000000000000000000000000000000000..6336f635d2f205e623cecf1970ae82c8ce13b0dc --- /dev/null +++ b/include/aws/common/device_random.h @@ -0,0 +1,50 @@ +#ifndef AWS_COMMON_DEVICE_RANDOM_H +#define AWS_COMMON_DEVICE_RANDOM_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_byte_buf; + +AWS_EXTERN_C_BEGIN + +/** + * Get an unpredictably random 64bit number, suitable for cryptographic use. + */ +AWS_COMMON_API int aws_device_random_u64(uint64_t *output); + +/** + * Get an unpredictably random 32bit number, suitable for cryptographic use. + */ +AWS_COMMON_API int aws_device_random_u32(uint32_t *output); + +/** + * Get an unpredictably random 16bit number, suitable for cryptographic use. + */ +AWS_COMMON_API int aws_device_random_u16(uint16_t *output); + +/** + * Get an unpredictably random 8bit number, suitable for cryptographic use. + */ +AWS_COMMON_API int aws_device_random_u8(uint8_t *output); + +/** + * Fill the rest of a buffer with unpredictably random bytes, suitable for cryptographic use. + */ +AWS_COMMON_API int aws_device_random_buffer(struct aws_byte_buf *output); + +/** + * Write N unpredictably random bytes to a buffer, suitable for cryptographic use. + * If there is insufficient space in the buffer, AWS_ERROR_SHORT_BUFFER is raised + * and the buffer will be unchanged. + */ +AWS_COMMON_API int aws_device_random_buffer_append(struct aws_byte_buf *output, size_t n); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_DEVICE_RANDOM_H */ diff --git a/include/aws/common/encoding.h b/include/aws/common/encoding.h new file mode 100644 index 0000000000000000000000000000000000000000..fef3de71dbacd9e1241c62e7e635cb765fa56d13 --- /dev/null +++ b/include/aws/common/encoding.h @@ -0,0 +1,235 @@ +#ifndef AWS_COMMON_ENCODING_H +#define AWS_COMMON_ENCODING_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/* + * computes the length necessary to store the result of aws_hex_encode(). + * returns -1 on failure, and 0 on success. encoded_length will be set on + * success. + */ +AWS_COMMON_API +int aws_hex_compute_encoded_len(size_t to_encode_len, size_t *encoded_length); + +/* + * Base 16 (hex) encodes the contents of to_encode and stores the result in + * output. Assumes the buffer is empty and does not resize on + * insufficient capacity. + */ +AWS_COMMON_API +int aws_hex_encode(const struct aws_byte_cursor *AWS_RESTRICT to_encode, struct aws_byte_buf *AWS_RESTRICT output); + +/* + * Base 16 (hex) encodes the contents of to_encode and appends the result in + * output. Grows the destination buffer dynamically if necessary. + */ +AWS_COMMON_API +int aws_hex_encode_append_dynamic( + const struct aws_byte_cursor *AWS_RESTRICT to_encode, + struct aws_byte_buf *AWS_RESTRICT output); + +/* + * computes the length necessary to store the result of aws_hex_decode(). + * returns -1 on failure, and 0 on success. decoded_len will be set on success. + */ +AWS_COMMON_API +int aws_hex_compute_decoded_len(size_t to_decode_len, size_t *decoded_len); + +/* + * Base 16 (hex) decodes the contents of to_decode and stores the result in + * output. If output is NULL, output_size will be set to what the output_size + * should be. + */ +AWS_COMMON_API +int aws_hex_decode(const struct aws_byte_cursor *AWS_RESTRICT to_decode, struct aws_byte_buf *AWS_RESTRICT output); + +/* + * Computes the length necessary to store the output of aws_base64_encode call. + * returns -1 on failure, and 0 on success. encoded_length will be set on + * success. + */ +AWS_COMMON_API +int aws_base64_compute_encoded_len(size_t to_encode_len, size_t *encoded_len); + +/* + * Base 64 encodes the contents of to_encode and stores the result in output. + */ +AWS_COMMON_API +int aws_base64_encode(const struct aws_byte_cursor *AWS_RESTRICT to_encode, struct aws_byte_buf *AWS_RESTRICT output); + +/* + * Computes the length necessary to store the output of aws_base64_decode call. + * returns -1 on failure, and 0 on success. decoded_len will be set on success. + */ +AWS_COMMON_API +int aws_base64_compute_decoded_len(const struct aws_byte_cursor *AWS_RESTRICT to_decode, size_t *decoded_len); + +/* + * Base 64 decodes the contents of to_decode and stores the result in output. + */ +AWS_COMMON_API +int aws_base64_decode(const struct aws_byte_cursor *AWS_RESTRICT to_decode, struct aws_byte_buf *AWS_RESTRICT output); + +/* Add a 64 bit unsigned integer to the buffer, ensuring network - byte order + * Assumes the buffer size is at least 8 bytes. + */ +AWS_STATIC_IMPL void aws_write_u64(uint64_t value, uint8_t *buffer); + +/* + * Extracts a 64 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes buffer size is at least 8 + * bytes. + */ +AWS_STATIC_IMPL uint64_t aws_read_u64(const uint8_t *buffer); + +/* Add a 32 bit unsigned integer to the buffer, ensuring network - byte order + * Assumes the buffer size is at least 4 bytes. + */ +AWS_STATIC_IMPL void aws_write_u32(uint32_t value, uint8_t *buffer); + +/* + * Extracts a 32 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes the buffer size is at least 4 + * bytes. + */ +AWS_STATIC_IMPL uint32_t aws_read_u32(const uint8_t *buffer); + +/* Add a 24 bit unsigned integer to the buffer, ensuring network - byte order + * return the new position in the buffer for the next operation. + * Note, since this uses uint32_t for storage, the 3 least significant bytes + * will be used. Assumes buffer is at least 3 bytes long. + */ +AWS_STATIC_IMPL void aws_write_u24(uint32_t value, uint8_t *buffer); +/* + * Extracts a 24 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes buffer is at least 3 bytes + * long. + */ +AWS_STATIC_IMPL uint32_t aws_read_u24(const uint8_t *buffer); + +/* Add a 16 bit unsigned integer to the buffer, ensuring network-byte order + * return the new position in the buffer for the next operation. + * Assumes buffer is at least 2 bytes long. + */ +AWS_STATIC_IMPL void aws_write_u16(uint16_t value, uint8_t *buffer); +/* + * Extracts a 16 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes buffer is at least 2 bytes + * long. + */ +AWS_STATIC_IMPL uint16_t aws_read_u16(const uint8_t *buffer); + +enum aws_text_encoding { + AWS_TEXT_UNKNOWN, + AWS_TEXT_UTF8, + AWS_TEXT_UTF16, + AWS_TEXT_UTF32, + AWS_TEXT_ASCII, +}; + +/* Checks the BOM in the buffer to see if encoding can be determined. If there is no BOM or + * it is unrecognizable, then AWS_TEXT_UNKNOWN will be returned. + */ +AWS_STATIC_IMPL enum aws_text_encoding aws_text_detect_encoding(const uint8_t *bytes, size_t size); + +/* + * Returns true if aws_text_detect_encoding() determines the text is UTF8 or ASCII. + * Note that this immediately returns true if the UTF8 BOM is seen. + * To fully validate every byte, use aws_decode_utf8(). + */ +AWS_STATIC_IMPL bool aws_text_is_utf8(const uint8_t *bytes, size_t size); + +struct aws_utf8_decoder_options { + /** + * Optional. + * Callback invoked for each Unicode codepoint. + * Use this callback to store codepoints as they're decoded, + * or to perform additional validation. RFC-3629 is already enforced, + * which forbids codepoints between U+D800 and U+DFFF, + * but you may whish to forbid codepoints like U+0000. + * + * @return AWS_OP_SUCCESS to continue processing the string, otherwise + * return AWS_OP_ERROR and raise an error (i.e. AWS_ERROR_INVALID_UTF8) + * to stop processing the string and report failure. + */ + int (*on_codepoint)(uint32_t codepoint, void *user_data); + + /* Optional. Pointer passed to on_codepoint callback. */ + void *user_data; +}; + +/** + * Decode a complete string of UTF8/ASCII text. + * Text is always validated according to RFC-3629 (you may perform additional + * validation in the on_codepoint callback). + * The text does not need to begin with a UTF8 BOM. + * If you need to decode text incrementally as you receive it, use aws_utf8_decoder_new() instead. + * + * @param bytes Text to decode. + * @param options Options for decoding. If NULL is passed, the text is simply validated. + * + * @return AWS_OP_SUCCESS if successful. + * An error is raised if the text is not valid, or the on_codepoint callback raises an error. + */ +AWS_COMMON_API int aws_decode_utf8(struct aws_byte_cursor bytes, const struct aws_utf8_decoder_options *options); + +struct aws_utf8_decoder; + +/** + * Create a UTF8/ASCII decoder, which can process text incrementally as you receive it. + * Text is always validated according to RFC-3629 (you may perform additional + * validation in the on_codepoint callback). + * The text does not need to begin with a UTF8 BOM. + * To decode text all at once, simply use aws_decode_utf8(). + * + * Feed bytes into the decoder with aws_utf8_decoder_update(), + * and call aws_utf8_decoder_finalize() when the text is complete. + * + * @param allocator Allocator + * @param options Options for decoder. If NULL is passed, the text is simply validated. + */ +AWS_COMMON_API struct aws_utf8_decoder *aws_utf8_decoder_new( + struct aws_allocator *allocator, + const struct aws_utf8_decoder_options *options); + +AWS_COMMON_API void aws_utf8_decoder_destroy(struct aws_utf8_decoder *decoder); +AWS_COMMON_API void aws_utf8_decoder_reset(struct aws_utf8_decoder *decoder); + +/** + * Update the decoder with more bytes of text. + * The on_codepoint callback will be invoked for each codepoint encountered. + * Raises an error if invalid UTF8 is encountered or the on_codepoint callback reports an error. + * + * Note: You must call aws_utf8_decoder_finalize() when the text is 100% complete, + * to ensure the input was completely valid. + */ +AWS_COMMON_API int aws_utf8_decoder_update(struct aws_utf8_decoder *decoder, struct aws_byte_cursor bytes); + +/** + * Tell the decoder that you've reached the end of your text. + * Raises AWS_ERROR_INVALID_UTF8 if the text did not end with a complete UTF8 codepoint. + * This also resets the decoder. + */ +AWS_COMMON_API int aws_utf8_decoder_finalize(struct aws_utf8_decoder *decoder); + +AWS_EXTERN_C_END + +#ifndef AWS_NO_STATIC_IMPL +# include +#endif /* AWS_NO_STATIC_IMPL */ + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_ENCODING_H */ diff --git a/include/aws/common/encoding.inl b/include/aws/common/encoding.inl new file mode 100644 index 0000000000000000000000000000000000000000..6f3e2fef07426784b17a2d910b3f133723939554 --- /dev/null +++ b/include/aws/common/encoding.inl @@ -0,0 +1,142 @@ +#ifndef AWS_COMMON_ENCODING_INL +#define AWS_COMMON_ENCODING_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include +#include + +AWS_EXTERN_C_BEGIN + +/* Add a 64 bit unsigned integer to the buffer, ensuring network - byte order + * Assumes the buffer size is at least 8 bytes. + */ +AWS_STATIC_IMPL void aws_write_u64(uint64_t value, uint8_t *buffer) { + value = aws_hton64(value); + + memcpy((void *)buffer, &value, sizeof(value)); +} + +/* + * Extracts a 64 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes buffer size is at least 8 + * bytes. + */ +AWS_STATIC_IMPL uint64_t aws_read_u64(const uint8_t *buffer) { + uint64_t value = 0; + memcpy((void *)&value, (void *)buffer, sizeof(value)); + + return aws_ntoh64(value); +} + +/* Add a 32 bit unsigned integer to the buffer, ensuring network - byte order + * Assumes the buffer size is at least 4 bytes. + */ +AWS_STATIC_IMPL void aws_write_u32(uint32_t value, uint8_t *buffer) { + value = aws_hton32(value); + + memcpy((void *)buffer, (void *)&value, sizeof(value)); +} + +/* + * Extracts a 32 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes the buffer size is at least 4 + * bytes. + */ +AWS_STATIC_IMPL uint32_t aws_read_u32(const uint8_t *buffer) { + uint32_t value = 0; + memcpy((void *)&value, (void *)buffer, sizeof(value)); + + return aws_ntoh32(value); +} + +/* Add a 24 bit unsigned integer to the buffer, ensuring network - byte order + * return the new position in the buffer for the next operation. + * Note, since this uses uint32_t for storage, the 3 least significant bytes + * will be used. Assumes buffer is at least 3 bytes long. + */ +AWS_STATIC_IMPL void aws_write_u24(uint32_t value, uint8_t *buffer) { + value = aws_hton32(value); + memcpy((void *)buffer, (void *)((uint8_t *)&value + 1), sizeof(value) - 1); +} + +/* + * Extracts a 24 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes buffer is at least 3 bytes + * long. + */ +AWS_STATIC_IMPL uint32_t aws_read_u24(const uint8_t *buffer) { + uint32_t value = 0; + memcpy((void *)((uint8_t *)&value + 1), (void *)buffer, sizeof(value) - 1); + + return aws_ntoh32(value); +} + +/* Add a 16 bit unsigned integer to the buffer, ensuring network-byte order + * return the new position in the buffer for the next operation. + * Assumes buffer is at least 2 bytes long. + */ +AWS_STATIC_IMPL void aws_write_u16(uint16_t value, uint8_t *buffer) { + value = aws_hton16(value); + + memcpy((void *)buffer, (void *)&value, sizeof(value)); +} + +/* + * Extracts a 16 bit unsigned integer from buffer. Ensures conversion from + * network byte order to host byte order. Assumes buffer is at least 2 bytes + * long. + */ +AWS_STATIC_IMPL uint16_t aws_read_u16(const uint8_t *buffer) { + uint16_t value = 0; + memcpy((void *)&value, (void *)buffer, sizeof(value)); + + return aws_ntoh16(value); +} + +/* Reference: https://unicodebook.readthedocs.io/guess_encoding.html */ +AWS_STATIC_IMPL enum aws_text_encoding aws_text_detect_encoding(const uint8_t *bytes, size_t size) { + static const char *UTF_8_BOM = "\xEF\xBB\xBF"; + static const char *UTF_16_BE_BOM = "\xFE\xFF"; + static const char *UTF_16_LE_BOM = "\xFF\xFE"; + static const char *UTF_32_BE_BOM = "\x00\x00\xFE\xFF"; + static const char *UTF_32_LE_BOM = "\xFF\xFE\x00\x00"; + + if (size >= 3) { + if (memcmp(bytes, UTF_8_BOM, 3) == 0) + return AWS_TEXT_UTF8; + } + if (size >= 4) { + if (memcmp(bytes, UTF_32_LE_BOM, 4) == 0) + return AWS_TEXT_UTF32; + if (memcmp(bytes, UTF_32_BE_BOM, 4) == 0) + return AWS_TEXT_UTF32; + } + if (size >= 2) { + if (memcmp(bytes, UTF_16_LE_BOM, 2) == 0) + return AWS_TEXT_UTF16; + if (memcmp(bytes, UTF_16_BE_BOM, 2) == 0) + return AWS_TEXT_UTF16; + } + size_t idx = 0; + for (; idx < size; ++idx) { + if (bytes[idx] & 0x80) { + return AWS_TEXT_UNKNOWN; + } + } + return AWS_TEXT_ASCII; +} + +AWS_STATIC_IMPL bool aws_text_is_utf8(const uint8_t *bytes, size_t size) { + enum aws_text_encoding encoding = aws_text_detect_encoding(bytes, size); + return encoding == AWS_TEXT_UTF8 || encoding == AWS_TEXT_ASCII; +} + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_ENCODING_INL */ diff --git a/include/aws/common/environment.h b/include/aws/common/environment.h new file mode 100644 index 0000000000000000000000000000000000000000..2958e515438f38690ae7f7de1a5e995c4f71a738 --- /dev/null +++ b/include/aws/common/environment.h @@ -0,0 +1,65 @@ +#ifndef AWS_COMMON_ENVIRONMENT_H +#define AWS_COMMON_ENVIRONMENT_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_string; + +/* + * Simple shims to the appropriate platform calls for environment variable manipulation. + * + * Not thread safe to use set/unset unsynced with get. Set/unset only used in unit tests. + */ +AWS_EXTERN_C_BEGIN + +/* + * Get the value of an environment variable. If the variable is not set, the output string will be set to NULL. + * Not thread-safe + */ +AWS_COMMON_API +struct aws_string *aws_get_env(struct aws_allocator *allocator, const char *name); + +/* + * Get the value of an environment variable. If the variable is not set or is empty, the output string will be set to + * NULL. Not thread-safe + */ +AWS_COMMON_API +struct aws_string *aws_get_env_nonempty(struct aws_allocator *allocator, const char *name); + +/* + * *DEPRECATED* + * Please use the `aws_get_env` or `aws_get_env_nonempty` instead. + * Get the value of an environment variable. If the variable is not set, the output string will be set to NULL. + * Not thread-safe + */ +AWS_COMMON_API +int aws_get_environment_value( + struct aws_allocator *allocator, + const struct aws_string *variable_name, + struct aws_string **value_out); + +/* + * Set the value of an environment variable. On Windows, setting a variable to the empty string will actually unset it. + * Not thread-safe + */ +AWS_COMMON_API +int aws_set_environment_value(const struct aws_string *variable_name, const struct aws_string *value); + +/* + * Unset an environment variable. + * Not thread-safe + */ +AWS_COMMON_API +int aws_unset_environment_value(const struct aws_string *variable_name); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_ENVIRONMENT_H */ diff --git a/include/aws/common/error.h b/include/aws/common/error.h new file mode 100644 index 0000000000000000000000000000000000000000..b8ecdc88b8e8fa1460abc4d76bca6abbe8c8d57f --- /dev/null +++ b/include/aws/common/error.h @@ -0,0 +1,225 @@ +#ifndef AWS_COMMON_ERROR_H +#define AWS_COMMON_ERROR_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_OP_SUCCESS (0) +#define AWS_OP_ERR (-1) + +/* Each library gets space for 2^^10 error entries */ +#define AWS_ERROR_ENUM_STRIDE_BITS 10 +#define AWS_ERROR_ENUM_STRIDE (1U << AWS_ERROR_ENUM_STRIDE_BITS) +#define AWS_ERROR_ENUM_BEGIN_RANGE(x) ((x) * AWS_ERROR_ENUM_STRIDE) +#define AWS_ERROR_ENUM_END_RANGE(x) (((x) + 1) * AWS_ERROR_ENUM_STRIDE - 1) + +struct aws_error_info { + int error_code; + const char *literal_name; + const char *error_str; + const char *lib_name; + const char *formatted_name; +}; + +struct aws_error_info_list { + const struct aws_error_info *error_list; + uint16_t count; +}; + +#define AWS_DEFINE_ERROR_INFO(C, ES, LN) \ + { \ + .literal_name = #C, \ + .error_code = (C), \ + .error_str = (ES), \ + .lib_name = (LN), \ + .formatted_name = LN ": " #C ", " ES, \ + } + +typedef void(aws_error_handler_fn)(int err, void *ctx); + +AWS_EXTERN_C_BEGIN + +/* + * Returns the latest error code on the current thread, or 0 if none have + * occurred. + */ +AWS_COMMON_API +int aws_last_error(void); + +/* + * Returns the error str corresponding to `err`. + */ +AWS_COMMON_API +const char *aws_error_str(int err); + +/* + * Returns the enum name corresponding to `err`. + */ +AWS_COMMON_API +const char *aws_error_name(int err); + +/* + * Returns the error lib name corresponding to `err`. + */ +AWS_COMMON_API +const char *aws_error_lib_name(int err); + +/* + * Returns libname concatenated with error string. + */ +AWS_COMMON_API +const char *aws_error_debug_str(int err); + +/* + * Internal implementation detail. + */ +AWS_COMMON_API +void aws_raise_error_private(int err); + +/* + * Raises `err` to the installed callbacks, and sets the thread's error. + */ +AWS_STATIC_IMPL +int aws_raise_error(int err); + +/* + * Resets the `err` back to defaults + */ +AWS_COMMON_API +void aws_reset_error(void); +/* + * Sets `err` to the latest error. Does not invoke callbacks. + */ +AWS_COMMON_API +void aws_restore_error(int err); + +/* + * Sets an application wide error handler function. This will be overridden by + * the thread local handler. The previous handler is returned, this can be used + * for restoring an error handler if it needs to be overridden temporarily. + * Setting this to NULL will turn off this error callback after it has been + * enabled. + */ +AWS_COMMON_API +aws_error_handler_fn *aws_set_global_error_handler_fn(aws_error_handler_fn *handler, void *ctx); + +/* + * Sets a thread-local error handler function. This will override the global + * handler. The previous handler is returned, this can be used for restoring an + * error handler if it needs to be overridden temporarily. Setting this to NULL + * will turn off this error callback after it has been enabled. + */ +AWS_COMMON_API +aws_error_handler_fn *aws_set_thread_local_error_handler_fn(aws_error_handler_fn *handler, void *ctx); + +/** TODO: this needs to be a private function (wait till we have the cmake story + * better before moving it though). It should be external for the purpose of + * other libs we own, but customers should not be able to hit it without going + * out of their way to do so. + */ +AWS_COMMON_API +void aws_register_error_info(const struct aws_error_info_list *error_info); + +AWS_COMMON_API +void aws_unregister_error_info(const struct aws_error_info_list *error_info); + +/** + * Convert a c library io error into an aws error, and raise it. + * If no conversion is found, fallback_aws_error_code is raised. + * Always returns AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_translate_and_raise_io_error_or(int error_no, int fallback_aws_error_code); + +/** + * Convert a c library io error into an aws error, and raise it. + * If no conversion is found, AWS_ERROR_SYS_CALL_FAILURE is raised. + * Always returns AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_translate_and_raise_io_error(int error_no); + +AWS_EXTERN_C_END +#ifndef AWS_NO_STATIC_IMPL +# include +#endif /* AWS_NO_STATIC_IMPL */ + +enum aws_common_error { + AWS_ERROR_SUCCESS = AWS_ERROR_ENUM_BEGIN_RANGE(AWS_C_COMMON_PACKAGE_ID), + AWS_ERROR_OOM, + AWS_ERROR_NO_SPACE, + AWS_ERROR_UNKNOWN, + AWS_ERROR_SHORT_BUFFER, + AWS_ERROR_OVERFLOW_DETECTED, + AWS_ERROR_UNSUPPORTED_OPERATION, + AWS_ERROR_INVALID_BUFFER_SIZE, + AWS_ERROR_INVALID_HEX_STR, + AWS_ERROR_INVALID_BASE64_STR, + AWS_ERROR_INVALID_INDEX, + AWS_ERROR_THREAD_INVALID_SETTINGS, + AWS_ERROR_THREAD_INSUFFICIENT_RESOURCE, + AWS_ERROR_THREAD_NO_PERMISSIONS, + AWS_ERROR_THREAD_NOT_JOINABLE, + AWS_ERROR_THREAD_NO_SUCH_THREAD_ID, + AWS_ERROR_THREAD_DEADLOCK_DETECTED, + AWS_ERROR_MUTEX_NOT_INIT, + AWS_ERROR_MUTEX_TIMEOUT, + AWS_ERROR_MUTEX_CALLER_NOT_OWNER, + AWS_ERROR_MUTEX_FAILED, + AWS_ERROR_COND_VARIABLE_INIT_FAILED, + AWS_ERROR_COND_VARIABLE_TIMED_OUT, + AWS_ERROR_COND_VARIABLE_ERROR_UNKNOWN, + AWS_ERROR_CLOCK_FAILURE, + AWS_ERROR_LIST_EMPTY, + AWS_ERROR_DEST_COPY_TOO_SMALL, + AWS_ERROR_LIST_EXCEEDS_MAX_SIZE, + AWS_ERROR_LIST_STATIC_MODE_CANT_SHRINK, + AWS_ERROR_PRIORITY_QUEUE_FULL, + AWS_ERROR_PRIORITY_QUEUE_EMPTY, + AWS_ERROR_PRIORITY_QUEUE_BAD_NODE, + AWS_ERROR_HASHTBL_ITEM_NOT_FOUND, + AWS_ERROR_INVALID_DATE_STR, + AWS_ERROR_INVALID_ARGUMENT, + AWS_ERROR_RANDOM_GEN_FAILED, + AWS_ERROR_MALFORMED_INPUT_STRING, + AWS_ERROR_UNIMPLEMENTED, + AWS_ERROR_INVALID_STATE, + AWS_ERROR_ENVIRONMENT_GET, + AWS_ERROR_ENVIRONMENT_SET, + AWS_ERROR_ENVIRONMENT_UNSET, + AWS_ERROR_STREAM_UNSEEKABLE, + AWS_ERROR_NO_PERMISSION, + AWS_ERROR_FILE_INVALID_PATH, + AWS_ERROR_MAX_FDS_EXCEEDED, + AWS_ERROR_SYS_CALL_FAILURE, + AWS_ERROR_C_STRING_BUFFER_NOT_NULL_TERMINATED, + AWS_ERROR_STRING_MATCH_NOT_FOUND, + AWS_ERROR_DIVIDE_BY_ZERO, + AWS_ERROR_INVALID_FILE_HANDLE, + AWS_ERROR_OPERATION_INTERUPTED, + AWS_ERROR_DIRECTORY_NOT_EMPTY, + AWS_ERROR_PLATFORM_NOT_SUPPORTED, + AWS_ERROR_INVALID_UTF8, + AWS_ERROR_GET_HOME_DIRECTORY_FAILED, + AWS_ERROR_INVALID_XML, + AWS_ERROR_FILE_OPEN_FAILURE, + AWS_ERROR_FILE_READ_FAILURE, + AWS_ERROR_FILE_WRITE_FAILURE, + AWS_ERROR_INVALID_CBOR, + AWS_ERROR_CBOR_UNEXPECTED_TYPE, + AWS_ERROR_END_COMMON_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_COMMON_PACKAGE_ID) +}; + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_ERROR_H */ diff --git a/include/aws/common/exports.h b/include/aws/common/exports.h new file mode 100644 index 0000000000000000000000000000000000000000..90f7f174c235ec4323f0d08666b77b9fa0489be2 --- /dev/null +++ b/include/aws/common/exports.h @@ -0,0 +1,40 @@ +#ifndef AWS_COMMON_EXPORTS_H +#define AWS_COMMON_EXPORTS_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#if defined(AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined(_WIN32) +# ifdef AWS_COMMON_USE_IMPORT_EXPORT +# ifdef AWS_COMMON_EXPORTS +# define AWS_COMMON_API __declspec(dllexport) +# else +# define AWS_COMMON_API __declspec(dllimport) +# endif /* AWS_COMMON_EXPORTS */ +# else +# define AWS_COMMON_API +# endif /* AWS_COMMON_USE_IMPORT_EXPORT */ + +#else /* defined (AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) */ + +# if defined(AWS_COMMON_USE_IMPORT_EXPORT) && defined(AWS_COMMON_EXPORTS) +# define AWS_COMMON_API __attribute__((visibility("default"))) +# else +# define AWS_COMMON_API +# endif + +#endif /* defined (AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) */ + +#ifdef AWS_NO_STATIC_IMPL +# define AWS_STATIC_IMPL AWS_COMMON_API +#endif + +#ifndef AWS_STATIC_IMPL +/* + * In order to allow us to export our inlinable methods in a DLL/.so, we have a designated .c + * file where this AWS_STATIC_IMPL macro will be redefined to be non-static. + */ +# define AWS_STATIC_IMPL static inline +#endif + +#endif /* AWS_COMMON_EXPORTS_H */ diff --git a/include/aws/common/fifo_cache.h b/include/aws/common/fifo_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..44127aa652e5689992a608ba899ca42632721b2c --- /dev/null +++ b/include/aws/common/fifo_cache.h @@ -0,0 +1,31 @@ +#ifndef AWS_COMMON_FIFO_CACHE_H +#define AWS_COMMON_FIFO_CACHE_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/** + * Initializes the first-in-first-out cache. Sets up the underlying linked hash table. + * Once `max_items` elements have been added, the oldest(first-in) item will + * be removed. For the other parameters, see aws/common/hash_table.h. Hash table + * semantics of these arguments are preserved. + */ +AWS_COMMON_API +struct aws_cache *aws_cache_new_fifo( + struct aws_allocator *allocator, + aws_hash_fn *hash_fn, + aws_hash_callback_eq_fn *equals_fn, + aws_hash_callback_destroy_fn *destroy_key_fn, + aws_hash_callback_destroy_fn *destroy_value_fn, + size_t max_items); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_FIFO_CACHE_H */ diff --git a/include/aws/common/file.h b/include/aws/common/file.h new file mode 100644 index 0000000000000000000000000000000000000000..23937e866ad4df1264cda0707b32a465637c12a2 --- /dev/null +++ b/include/aws/common/file.h @@ -0,0 +1,213 @@ +#ifndef AWS_COMMON_FILE_H +#define AWS_COMMON_FILE_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#ifdef AWS_OS_WINDOWS +# define AWS_PATH_DELIM '\\' +# define AWS_PATH_DELIM_STR "\\" +#else +# define AWS_PATH_DELIM '/' +# define AWS_PATH_DELIM_STR "/" +#endif + +struct aws_string; +struct aws_directory_iterator; + +enum aws_file_type { + AWS_FILE_TYPE_FILE = 1, + AWS_FILE_TYPE_SYM_LINK = 2, + AWS_FILE_TYPE_DIRECTORY = 4, +}; + +struct aws_directory_entry { + /** + * Absolute path to the entry from the current process root. + */ + struct aws_byte_cursor path; + /** + * Path to the entry relative to the current working directory. + */ + struct aws_byte_cursor relative_path; + /** + * Bit-field of enum aws_file_type + */ + int file_type; + /** + * Size of the file on disk. + */ + int64_t file_size; +}; + +/** + * Invoked during calls to aws_directory_traverse() as an entry is encountered. entry will contain + * the parsed directory entry info. + * + * Return true to continue the traversal, or alternatively, if you have a reason to abort the traversal, return false. + */ +typedef bool(aws_on_directory_entry)(const struct aws_directory_entry *entry, void *user_data); + +AWS_EXTERN_C_BEGIN + +/** + * Deprecated - Use aws_fopen_safe() instead, avoid const char * in public APIs. + * Opens file at file_path using mode. Returns the FILE pointer if successful. + * Otherwise, aws_last_error() will contain the error that occurred + */ +AWS_COMMON_API FILE *aws_fopen(const char *file_path, const char *mode); + +/** + * Opens file at file_path using mode. Returns the FILE pointer if successful. + * Otherwise, aws_last_error() will contain the error that occurred + */ +AWS_COMMON_API FILE *aws_fopen_safe(const struct aws_string *file_path, const struct aws_string *mode); + +/** + * Creates a directory if it doesn't currently exist. If the directory already exists, it's ignored and assumed + * successful. + * + * Returns AWS_OP_SUCCESS on success. Otherwise, check aws_last_error(). + */ +AWS_COMMON_API int aws_directory_create(const struct aws_string *dir_path); +/** + * Returns true if the directory currently exists. Otherwise, it returns false. + */ +AWS_COMMON_API bool aws_directory_exists(const struct aws_string *dir_path); +/** + * Deletes a directory. If the directory is not empty, this will fail unless the recursive parameter is set to true. + * If recursive is true then the entire directory and all of its contents will be deleted. If it is set to false, + * the directory will be deleted only if it is empty. Returns AWS_OP_SUCCESS if the operation was successful. Otherwise, + * aws_last_error() will contain the error that occurred. If the directory doesn't exist, AWS_OP_SUCCESS is still + * returned. + */ +AWS_COMMON_API int aws_directory_delete(const struct aws_string *dir_path, bool recursive); +/** + * Deletes a file. Returns AWS_OP_SUCCESS if the operation was successful. Otherwise, + * aws_last_error() will contain the error that occurred. If the file doesn't exist, AWS_OP_SUCCESS is still returned. + */ +AWS_COMMON_API int aws_file_delete(const struct aws_string *file_path); + +/** + * Moves directory at from to to. + * Returns AWS_OP_SUCCESS if the operation was successful. Otherwise, + * aws_last_error() will contain the error that occurred. + */ +AWS_COMMON_API int aws_directory_or_file_move(const struct aws_string *from, const struct aws_string *to); + +/** + * Traverse a directory starting at path. + * + * If you want the traversal to recurse the entire directory, pass recursive as true. Passing false for this parameter + * will only iterate the contents of the directory, but will not descend into any directories it encounters. + * + * If recursive is set to true, the traversal is performed post-order, depth-first + * (for practical reasons such as deleting a directory that contains subdirectories or files). + * + * returns AWS_OP_SUCCESS(0) on success. + */ +AWS_COMMON_API int aws_directory_traverse( + struct aws_allocator *allocator, + const struct aws_string *path, + bool recursive, + aws_on_directory_entry *on_entry, + void *user_data); + +/** + * Creates a read-only iterator of a directory starting at path. If path is invalid or there's any other error + * condition, NULL will be returned. Call aws_last_error() for the exact error in that case. + */ +AWS_COMMON_API struct aws_directory_iterator *aws_directory_entry_iterator_new( + struct aws_allocator *allocator, + const struct aws_string *path); + +/** + * Moves the iterator to the next entry. Returns AWS_OP_SUCCESS if another entry is available, or AWS_OP_ERR with + * AWS_ERROR_LIST_EMPTY as the value for aws_last_error() if no more entries are available. + */ +AWS_COMMON_API int aws_directory_entry_iterator_next(struct aws_directory_iterator *iterator); + +/** + * Moves the iterator to the previous entry. Returns AWS_OP_SUCCESS if another entry is available, or AWS_OP_ERR with + * AWS_ERROR_LIST_EMPTY as the value for aws_last_error() if no more entries are available. + */ +AWS_COMMON_API int aws_directory_entry_iterator_previous(struct aws_directory_iterator *iterator); + +/** + * Cleanup and deallocate iterator + */ +AWS_COMMON_API void aws_directory_entry_iterator_destroy(struct aws_directory_iterator *iterator); + +/** + * Gets the aws_directory_entry value for iterator at the current position. Returns NULL if the iterator contains no + * entries. + */ +AWS_COMMON_API const struct aws_directory_entry *aws_directory_entry_iterator_get_value( + const struct aws_directory_iterator *iterator); + +/** + * Returns true iff the character is a directory separator on ANY supported platform. + */ +AWS_COMMON_API +bool aws_is_any_directory_separator(char value); + +/** + * Returns the directory separator used by the local platform + */ +AWS_COMMON_API +char aws_get_platform_directory_separator(void); + +/** + * Normalizes the path by replacing any directory separator with the local platform's directory separator. + * @param path path to normalize. Must be writeable. + */ +AWS_COMMON_API +void aws_normalize_directory_separator(struct aws_byte_buf *path); + +/** + * Returns the current user's home directory. + */ +AWS_COMMON_API +struct aws_string *aws_get_home_directory(struct aws_allocator *allocator); + +/** + * Returns true if a file or path exists, otherwise, false. + */ +AWS_COMMON_API +bool aws_path_exists(const struct aws_string *path); + +/* + * Wrapper for highest-resolution platform-dependent seek implementation. + * Maps to: + * + * _fseeki64() on windows + * fseeko() on linux + * + * whence can either be SEEK_SET or SEEK_END + * + * Returns AWS_OP_SUCCESS, or AWS_OP_ERR (after an error has been raised). + */ +AWS_COMMON_API +int aws_fseek(FILE *file, int64_t offset, int whence); + +/* + * Wrapper for os-specific file length query. We can't use fseek(END, 0) + * because support for it is not technically required. + * + * Unix flavors call fstat, while Windows variants use GetFileSize on a + * HANDLE queried from the libc FILE pointer. + */ +AWS_COMMON_API +int aws_file_get_length(FILE *file, int64_t *length); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_FILE_H */ diff --git a/include/aws/common/hash_table.h b/include/aws/common/hash_table.h new file mode 100644 index 0000000000000000000000000000000000000000..c2cfadd77800013dd72083b7b91b2e778571dd27 --- /dev/null +++ b/include/aws/common/hash_table.h @@ -0,0 +1,454 @@ +#ifndef AWS_COMMON_HASH_TABLE_H +#define AWS_COMMON_HASH_TABLE_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum { + AWS_COMMON_HASH_TABLE_ITER_CONTINUE = (1 << 0), + AWS_COMMON_HASH_TABLE_ITER_DELETE = (1 << 1), + AWS_COMMON_HASH_TABLE_ITER_ERROR = (1 << 2), +}; + +/** + * Hash table data structure. This module provides an automatically resizing + * hash table implementation for general purpose use. The hash table stores a + * mapping between void * keys and values; it is expected that in most cases, + * these will point to a structure elsewhere in the heap, instead of inlining a + * key or value into the hash table element itself. + * + * Currently, this hash table implements a variant of robin hood hashing, but + * we do not guarantee that this won't change in the future. + * + * Associated with each hash function are four callbacks: + * + * hash_fn - A hash function from the keys to a uint64_t. It is critical that + * the hash function for a key does not change while the key is in the hash + * table; violating this results in undefined behavior. Collisions are + * tolerated, though naturally with reduced performance. + * + * equals_fn - An equality comparison function. This function must be + * reflexive and consistent with hash_fn. + * + * destroy_key_fn, destroy_value_fn - Optional callbacks invoked when the + * table is cleared or cleaned up and at the caller's option when an element + * is removed from the table. Either or both may be set to NULL, which + * has the same effect as a no-op destroy function. + * + * This datastructure can be safely moved between threads, subject to the + * requirements of the underlying allocator. It is also safe to invoke + * non-mutating operations on the hash table from multiple threads. A suitable + * memory barrier must be used when transitioning from single-threaded mutating + * usage to multithreaded usage. + */ +struct hash_table_state; /* Opaque pointer */ +struct aws_hash_table { + struct hash_table_state *p_impl; +}; + +/** + * Represents an element in the hash table. Various operations on the hash + * table may provide pointers to elements stored within the hash table; + * generally, calling code may alter value, but must not alter key (or any + * information used to compute key's hash code). + * + * Pointers to elements within the hash are invalidated whenever an operation + * which may change the number of elements in the hash is invoked (i.e. put, + * delete, clear, and clean_up), regardless of whether the number of elements + * actually changes. + */ +struct aws_hash_element { + const void *key; + void *value; +}; + +enum aws_hash_iter_status { + AWS_HASH_ITER_STATUS_DONE, + AWS_HASH_ITER_STATUS_DELETE_CALLED, + AWS_HASH_ITER_STATUS_READY_FOR_USE, +}; + +struct aws_hash_iter { + const struct aws_hash_table *map; + struct aws_hash_element element; + size_t slot; + size_t limit; + enum aws_hash_iter_status status; + /* + * Reserving extra fields for binary compatibility with future expansion of + * iterator in case hash table implementation changes. + */ + int unused_0; + void *unused_1; + void *unused_2; +}; + +/** + * Prototype for a key hashing function pointer. + */ +typedef uint64_t(aws_hash_fn)(const void *key); + +/** + * Prototype for a hash table equality check function pointer. + * + * This type is usually used for a function that compares two hash table + * keys, but note that the same type is used for a function that compares + * two hash table values in aws_hash_table_eq. + * + * Equality functions used in a hash table must be be reflexive (a == a), + * symmetric (a == b => b == a), transitive (a == b, b == c => a == c) + * and consistent (result does not change with time). + */ +typedef bool(aws_hash_callback_eq_fn)(const void *a, const void *b); + +/** + * Prototype for a hash table key or value destructor function pointer. + * + * This function is used to destroy elements in the hash table when the + * table is cleared or cleaned up. + * + * Note that functions which remove individual elements from the hash + * table provide options of whether or not to invoke the destructors + * on the key and value of a removed element. + */ +typedef void(aws_hash_callback_destroy_fn)(void *key_or_value); + +AWS_EXTERN_C_BEGIN + +/** + * Initializes a hash map with initial capacity for 'size' elements + * without resizing. Uses hash_fn to compute the hash of each element. + * equals_fn to compute equality of two keys. Whenever an element is + * removed without being returned, destroy_key_fn is run on the pointer + * to the key and destroy_value_fn is run on the pointer to the value. + * Either or both may be NULL if a callback is not desired in this case. + */ +AWS_COMMON_API +int aws_hash_table_init( + struct aws_hash_table *map, + struct aws_allocator *alloc, + size_t size, + aws_hash_fn *hash_fn, + aws_hash_callback_eq_fn *equals_fn, + aws_hash_callback_destroy_fn *destroy_key_fn, + aws_hash_callback_destroy_fn *destroy_value_fn); + +/** + * Deletes every element from map and frees all associated memory. + * destroy_fn will be called for each element. aws_hash_table_init + * must be called before reusing the hash table. + * + * This method is idempotent. + */ +AWS_COMMON_API +void aws_hash_table_clean_up(struct aws_hash_table *map); + +/** + * Safely swaps two hash tables. Note that we swap the entirety of the hash + * table, including which allocator is associated. + * + * Neither hash table is required to be initialized; if one or both is + * uninitialized, then the uninitialized state is also swapped. + */ +AWS_COMMON_API +void aws_hash_table_swap(struct aws_hash_table *AWS_RESTRICT a, struct aws_hash_table *AWS_RESTRICT b); + +/** + * Moves the hash table in 'from' to 'to'. After this move, 'from' will + * be identical to the state of the original 'to' hash table, and 'to' + * will be in the same state as if it had been passed to aws_hash_table_clean_up + * (that is, it will have no memory allocated, and it will be safe to + * either discard it or call aws_hash_table_clean_up again). + * + * Note that 'to' will not be cleaned up. You should make sure that 'to' + * is either uninitialized or cleaned up before moving a hashtable into + * it. + */ +AWS_COMMON_API +void aws_hash_table_move(struct aws_hash_table *AWS_RESTRICT to, struct aws_hash_table *AWS_RESTRICT from); + +/** + * Returns the current number of entries in the table. + */ +AWS_COMMON_API +size_t aws_hash_table_get_entry_count(const struct aws_hash_table *map); + +/** + * Returns an iterator to be used for iterating through a hash table. + * Iterator will already point to the first element of the table it finds, + * which can be accessed as iter.element. + * + * This function cannot fail, but if there are no elements in the table, + * the returned iterator will return true for aws_hash_iter_done(&iter). + */ +AWS_COMMON_API +struct aws_hash_iter aws_hash_iter_begin(const struct aws_hash_table *map); + +/** + * Returns true if iterator is done iterating through table, false otherwise. + * If this is true, the iterator will not include an element of the table. + */ +AWS_COMMON_API +bool aws_hash_iter_done(const struct aws_hash_iter *iter); + +/** + * Updates iterator so that it points to next element of hash table. + * + * This and the two previous functions are designed to be used together with + * the following idiom: + * + * for (struct aws_hash_iter iter = aws_hash_iter_begin(&map); + * !aws_hash_iter_done(&iter); aws_hash_iter_next(&iter)) { + * const key_type key = *(const key_type *)iter.element.key; + * value_type value = *(value_type *)iter.element.value; + * // etc. + * } + * + * Note that calling this on an iter which is "done" is idempotent: + * i.e. it will return another iter which is "done". + */ +AWS_COMMON_API +void aws_hash_iter_next(struct aws_hash_iter *iter); + +/** + * Deletes the element currently pointed-to by the hash iterator. + * After calling this method, the element member of the iterator + * should not be accessed until the next call to aws_hash_iter_next. + * + * @param destroy_contents If true, the destructors for the key and value + * will be called. + */ +AWS_COMMON_API +void aws_hash_iter_delete(struct aws_hash_iter *iter, bool destroy_contents); + +/** + * Attempts to locate an element at key. If the element is found, a + * pointer to the value is placed in *p_elem; if it is not found, + * *pElem is set to NULL. Either way, AWS_OP_SUCCESS is returned. + * + * This method does not change the state of the hash table. Therefore, it + * is safe to call _find from multiple threads on the same hash table, + * provided no mutating operations happen in parallel. + * + * Calling code may update the value in the hash table by modifying **pElem + * after a successful find. However, this pointer is not guaranteed to + * remain usable after a subsequent call to _put, _delete, _clear, or + * _clean_up. + */ + +AWS_COMMON_API +int aws_hash_table_find(const struct aws_hash_table *map, const void *key, struct aws_hash_element **p_elem); + +/** + * Attempts to locate an element at key. If no such element was found, + * creates a new element, with value initialized to NULL. In either case, a + * pointer to the element is placed in *p_elem. + * + * If was_created is non-NULL, *was_created is set to 0 if an existing + * element was found, or 1 is a new element was created. + * + * Returns AWS_OP_SUCCESS if an item was found or created. + * Raises AWS_ERROR_OOM if hash table expansion was required and memory + * allocation failed. + */ +AWS_COMMON_API +int aws_hash_table_create( + struct aws_hash_table *map, + const void *key, + struct aws_hash_element **p_elem, + int *was_created); + +/** + * Inserts a new element at key, with the given value. If another element + * exists at that key, the old element will be overwritten; both old key and + * value objects will be destroyed. + * + * If was_created is non-NULL, *was_created is set to 0 if an existing + * element was found, or 1 is a new element was created. + * + * Returns AWS_OP_SUCCESS if an item was found or created. + * Raises AWS_ERROR_OOM if hash table expansion was required and memory + * allocation failed. + */ +AWS_COMMON_API +int aws_hash_table_put(struct aws_hash_table *map, const void *key, void *value, int *was_created); + +/** + * Removes element at key. Always returns AWS_OP_SUCCESS. + * + * If pValue is non-NULL, the existing value (if any) is moved into + * (*value) before removing from the table, and destroy_fn is _not_ + * invoked. If pValue is NULL, then (if the element existed) destroy_fn + * will be invoked on the element being removed. + * + * If was_present is non-NULL, it is set to 0 if the element was + * not present, or 1 if it was present (and is now removed). + */ +AWS_COMMON_API +int aws_hash_table_remove( + struct aws_hash_table *map, + const void *key, + struct aws_hash_element *p_value, + int *was_present); + +/** + * Removes element already known (typically by find()). + * + * p_value should point to a valid element returned by create() or find(). + * + * NOTE: DO NOT call this method from inside of a aws_hash_table_foreach callback, return + * AWS_COMMON_HASH_TABLE_ITER_DELETE instead. + */ +AWS_COMMON_API +int aws_hash_table_remove_element(struct aws_hash_table *map, struct aws_hash_element *p_value); + +/** + * Iterates through every element in the map and invokes the callback on + * that item. Iteration is performed in an arbitrary, implementation-defined + * order, and is not guaranteed to be consistent across invocations. + * + * The callback may change the value associated with the key by overwriting + * the value pointed-to by value. In this case, the on_element_removed + * callback will not be invoked, unless the callback invokes + * AWS_COMMON_HASH_TABLE_ITER_DELETE (in which case the on_element_removed + * is given the updated value). + * + * The callback must return a bitmask of zero or more of the following values + * ORed together: + * + * # AWS_COMMON_HASH_TABLE_ITER_CONTINUE - Continues iteration to the next + * element (if not set, iteration stops) + * # AWS_COMMON_HASH_TABLE_ITER_DELETE - Deletes the current value and + * continues iteration. destroy_fn will NOT be invoked. + * # AWS_COMMON_HASH_TABLE_ITER_ERROR - Stop iteration with error. + * No action will be taken for the current value and the value before this. + * No rolling back. The deleted value before will NOT be back. + * aws_hash_table_foreach returns AWS_OP_ERR after stropping the iteration. + * + * Invoking any method which may change the contents of the hashtable + * during iteration results in undefined behavior. However, you may safely + * invoke non-mutating operations during an iteration. + * + * This operation is mutating only if AWS_COMMON_HASH_TABLE_ITER_DELETE + * is returned at some point during iteration. Otherwise, it is non-mutating + * and is safe to invoke in parallel with other non-mutating operations. + */ + +AWS_COMMON_API +int aws_hash_table_foreach( + struct aws_hash_table *map, + int (*callback)(void *context, struct aws_hash_element *p_element), + void *context); + +/** + * Compares two hash tables for equality. Both hash tables must have equivalent + * key comparators; values will be compared using the comparator passed into this + * function. The key hash function does not need to be equivalent between the + * two hash tables. + */ +AWS_COMMON_API +bool aws_hash_table_eq( + const struct aws_hash_table *a, + const struct aws_hash_table *b, + aws_hash_callback_eq_fn *value_eq); + +/** + * Removes every element from the hash map. destroy_fn will be called for + * each element. + */ +AWS_COMMON_API +void aws_hash_table_clear(struct aws_hash_table *map); + +/** + * Convenience hash function for NULL-terminated C-strings + */ +AWS_COMMON_API +uint64_t aws_hash_c_string(const void *item); + +/** + * Convenience hash function for struct aws_strings. + * Hash is same as used on the string bytes by aws_hash_c_string. + */ +AWS_COMMON_API +uint64_t aws_hash_string(const void *item); + +/** + * Convenience hash function for struct aws_byte_cursor. + * Hash is same as used on the string bytes by aws_hash_c_string. + */ +AWS_COMMON_API +uint64_t aws_hash_byte_cursor_ptr(const void *item); + +/** + * Convenience hash function which hashes the pointer value directly, + * without dereferencing. This can be used in cases where pointer identity + * is desired, or where a uintptr_t is encoded into a const void *. + */ +AWS_COMMON_API +uint64_t aws_hash_ptr(const void *item); + +AWS_COMMON_API +uint64_t aws_hash_combine(uint64_t item1, uint64_t item2); + +/** + * Convenience eq callback for NULL-terminated C-strings + */ +AWS_COMMON_API +bool aws_hash_callback_c_str_eq(const void *a, const void *b); + +/** + * Convenience eq callback for AWS strings + */ +AWS_COMMON_API +bool aws_hash_callback_string_eq(const void *a, const void *b); + +/** + * Convenience destroy callback for AWS strings + */ +AWS_COMMON_API +void aws_hash_callback_string_destroy(void *a); + +/** + * Equality function which compares pointer equality. + */ +AWS_COMMON_API +bool aws_ptr_eq(const void *a, const void *b); + +/** + * Best-effort check of hash_table_state data-structure invariants + */ +AWS_COMMON_API +bool aws_hash_table_is_valid(const struct aws_hash_table *map); + +/** + * Given a pointer to a hash_iter, checks that it is well-formed, with all data-structure invariants. + */ +AWS_COMMON_API +bool aws_hash_iter_is_valid(const struct aws_hash_iter *iter); + +/** + * Helper function to hash keys that are uint64_t values. + * + * The function is not a strong hash function in any sense; it merely reflects + * the uint64 value back. Do not use this function as a hash if you need + * the properties of a strong hash function. + */ +AWS_COMMON_API uint64_t aws_hash_uint64_t_by_identity(const void *item); + +/** + * Helper function to compare hash keys that are uint64_t values. + */ +AWS_COMMON_API bool aws_hash_compare_uint64_t_eq(const void *a, const void *b); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_HASH_TABLE_H */ diff --git a/include/aws/common/host_utils.h b/include/aws/common/host_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..0b8285d7a50243464c063f2b5641e2192901beff --- /dev/null +++ b/include/aws/common/host_utils.h @@ -0,0 +1,28 @@ +#ifndef AWS_COMMON_HOST_UTILS_H +#define AWS_COMMON_HOST_UTILS_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +struct aws_byte_cursor; + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/* + * Determine whether host cursor is IPv4 string. + */ +AWS_COMMON_API bool aws_host_utils_is_ipv4(struct aws_byte_cursor host); + +/* + * Determine whether host cursor is IPv6 string. + * Supports checking for uri encoded strings and scoped literals. + */ +AWS_COMMON_API bool aws_host_utils_is_ipv6(struct aws_byte_cursor host, bool is_uri_encoded); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_HOST_UTILS_H */ diff --git a/include/aws/common/json.h b/include/aws/common/json.h new file mode 100644 index 0000000000000000000000000000000000000000..cfda4cf18aaa5e413ad8a0214cf786dd56f5cb59 --- /dev/null +++ b/include/aws/common/json.h @@ -0,0 +1,489 @@ +#ifndef AWS_COMMON_JSON_H +#define AWS_COMMON_JSON_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_json_value; + +AWS_EXTERN_C_BEGIN + +// ==================== +// Create and pass type + +/** + * Creates a new string aws_json_value with the given string and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * Note: might be slower than c_str version due to internal copy + * @param string A byte cursor you want to store in the aws_json_value + * @param allocator The allocator to use when creating the value + * @return A new string aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_string(struct aws_allocator *allocator, struct aws_byte_cursor string); + +/** + * Creates a new string aws_json_value with the given string and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * @param string c string pointer you want to store in the aws_json_value + * @param allocator The allocator to use when creating the value + * @return A new string aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_string_from_c_str(struct aws_allocator *allocator, const char *string); + +/** + * Creates a new number aws_json_value with the given number and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * @param number The number you want to store in the aws_json_value + * @param allocator The allocator to use when creating the value + * @return A new number aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_number(struct aws_allocator *allocator, double number); + +/** + * Creates a new array aws_json_value and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * Deleting this array will also destroy any aws_json_values it contains. + * @param allocator The allocator to use when creating the value + * @return A new array aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_array(struct aws_allocator *allocator); + +/** + * Creates a new boolean aws_json_value with the given boolean and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * @param boolean The boolean you want to store in the aws_json_value + * @param allocator The allocator to use when creating the value + * @return A new boolean aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_boolean(struct aws_allocator *allocator, bool boolean); + +/** + * Creates a new null aws_json_value and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * @param allocator The allocator to use when creating the value + * @return A new null aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_null(struct aws_allocator *allocator); + +/** + * Creates a new object aws_json_value and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * Deleting this object will also destroy any aws_json_values it contains. + * @param allocator The allocator to use when creating the value + * @return A new object aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_object(struct aws_allocator *allocator); +// ==================== + +// ==================== +// Value getters + +/** + * Gets the string of a string aws_json_value. + * @param value The string aws_json_value. + * @param output The string + * @return AWS_OP_SUCCESS if the value is a string, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_json_value_get_string(const struct aws_json_value *value, struct aws_byte_cursor *output); + +/** + * Gets the number of a number aws_json_value. + * @param value The number aws_json_value. + * @param output The number + * @return AWS_OP_SUCCESS if the value is a number, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_json_value_get_number(const struct aws_json_value *value, double *output); + +/** + * Gets the boolean of a boolean aws_json_value. + * @param value The boolean aws_json_value. + * @param output The boolean + * @return AWS_OP_SUCCESS if the value is a boolean, otherwise AWS_OP_ERR. + */ +AWS_COMMON_API +int aws_json_value_get_boolean(const struct aws_json_value *value, bool *output); +// ==================== + +// ==================== +// Object API + +/** + * Adds a aws_json_value to a object aws_json_value. + * + * Note that the aws_json_value will be destroyed when the aws_json_value object is destroyed + * by calling "aws_json_destroy()" + * Note: might be slower than c_str version due to internal copy + * @param object The object aws_json_value you want to add a value to. + * @param key The key to add the aws_json_value at. + * @param value The aws_json_value you want to add. + * @return AWS_OP_SUCCESS if adding was successful. + * Will return AWS_OP_ERROR if the object passed is invalid or if the passed key + * is already in use in the object. + */ +AWS_COMMON_API +int aws_json_value_add_to_object( + struct aws_json_value *object, + struct aws_byte_cursor key, + struct aws_json_value *value); + +/** + * Adds a aws_json_value to a object aws_json_value. + * + * Note that the aws_json_value will be destroyed when the aws_json_value object is destroyed + * by calling "aws_json_destroy()" + * @param object The object aws_json_value you want to add a value to. + * @param key The key to add the aws_json_value at. + * @param value The aws_json_value you want to add. + * @return AWS_OP_SUCCESS if adding was successful. + * Will return AWS_OP_ERROR if the object passed is invalid or if the passed key + * is already in use in the object. + */ +AWS_COMMON_API +int aws_json_value_add_to_object_c_str(struct aws_json_value *object, const char *key, struct aws_json_value *value); + +/** + * Returns the aws_json_value at the given key. + * Note: might be slower than c_str version due to internal copy + * @param object The object aws_json_value you want to get the value from. + * @param key The key that the aws_json_value is at. Is case sensitive. + * @return The aws_json_value at the given key, otherwise NULL. + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_get_from_object(const struct aws_json_value *object, struct aws_byte_cursor key); + +/** + * Returns the aws_json_value at the given key. + * Note: same as aws_json_value_get_from_object but with key as const char *. + * Prefer this method is you have a key thats already a valid char * as it is likely to be faster. + * @param object The object aws_json_value you want to get the value from. + * @param key The key that the aws_json_value is at. Is case sensitive. + * @return The aws_json_value at the given key, otherwise NULL. + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_get_from_object_c_str(const struct aws_json_value *object, const char *key); + +/** + * Checks if there is a aws_json_value at the given key. + * Note: might be slower than c_str version due to internal copy + * @param object The value aws_json_value you want to check a key in. + * @param key The key that you want to check. Is case sensitive. + * @return True if a aws_json_value is found. + */ +AWS_COMMON_API +bool aws_json_value_has_key(const struct aws_json_value *object, struct aws_byte_cursor key); + +/** + * Checks if there is a aws_json_value at the given key. + * Note: same as aws_json_value_has_key but with key as const char *. + * Prefer this method is you have a key thats already a valid char * as it is likely to be faster. + * @param object The value aws_json_value you want to check a key in. + * @param key The key that you want to check. Is case sensitive. + * @return True if a aws_json_value is found. + */ +AWS_COMMON_API +bool aws_json_value_has_key_c_str(const struct aws_json_value *object, const char *key); + +/** + * Removes the aws_json_value at the given key. + * Note: might be slower than c_str version due to internal copy + * @param object The object aws_json_value you want to remove a aws_json_value in. + * @param key The key that the aws_json_value is at. Is case sensitive. + * @return AWS_OP_SUCCESS if the aws_json_value was removed. + * Will return AWS_OP_ERR if the object passed is invalid or if the value + * at the key cannot be found. + */ +AWS_COMMON_API +int aws_json_value_remove_from_object(struct aws_json_value *object, struct aws_byte_cursor key); + +/** + * Removes the aws_json_value at the given key. + * Note: same as aws_json_value_remove_from_object but with key as const char *. + * Prefer this method is you have a key thats already a valid char * as it is likely to be faster. + * @param object The object aws_json_value you want to remove a aws_json_value in. + * @param key The key that the aws_json_value is at. Is case sensitive. + * @return AWS_OP_SUCCESS if the aws_json_value was removed. + * Will return AWS_OP_ERR if the object passed is invalid or if the value + * at the key cannot be found. + */ +AWS_COMMON_API +int aws_json_value_remove_from_object_c_str(struct aws_json_value *object, const char *key); + +/** + * @brief callback for iterating members of an object + * Iteration can be controlled as follows: + * - return AWS_OP_SUCCESS and out_should_continue is set to true (default value) - + * continue iteration without error + * - return AWS_OP_SUCCESS and out_continue is set to false - + * stop iteration without error + * - return AWS_OP_ERR - stop iteration with error + */ +typedef int(aws_json_on_member_encountered_const_fn)( + const struct aws_byte_cursor *key, + const struct aws_json_value *value, + bool *out_should_continue, + void *user_data); + +/** + * @brief iterates through members of the object. + * iteration is sequential in order fields were initially parsed. + * @param object object to iterate over. + * @param on_member callback for when member is encountered. + * @param user_data user data to pass back in callback. + * @return AWS_OP_SUCCESS when iteration finishes completely or exits early, + * AWS_OP_ERR if value is not an object. + */ +AWS_COMMON_API +int aws_json_const_iterate_object( + const struct aws_json_value *object, + aws_json_on_member_encountered_const_fn *on_member, + void *user_data); + +// ==================== + +// ==================== +// Array API + +/** + * Adds a aws_json_value to the given array aws_json_value. + * + * Note that the aws_json_value will be destroyed when the aws_json_value array is destroyed + * by calling "aws_json_destroy()" + * @param array The array aws_json_value you want to add an aws_json_value to. + * @param value The aws_json_value you want to add. + * @return AWS_OP_SUCCESS if adding the aws_json_value was successful. + * Will return AWS_OP_ERR if the array passed is invalid. + */ +AWS_COMMON_API +int aws_json_value_add_array_element(struct aws_json_value *array, const struct aws_json_value *value); + +/** + * Returns the aws_json_value at the given index in the array aws_json_value. + * @param array The array aws_json_value. + * @param index The index of the aws_json_value you want to access. + * @return A pointer to the aws_json_value at the given index in the array, otherwise NULL. + */ +AWS_COMMON_API +struct aws_json_value *aws_json_get_array_element(const struct aws_json_value *array, size_t index); + +/** + * Returns the number of items in the array aws_json_value. + * @param array The array aws_json_value. + * @return The number of items in the array_json_value. + */ +AWS_COMMON_API +size_t aws_json_get_array_size(const struct aws_json_value *array); + +/** + * Removes the aws_json_value at the given index in the array aws_json_value. + * @param array The array aws_json_value. + * @param index The index containing the aws_json_value you want to remove. + * @return AWS_OP_SUCCESS if the aws_json_value at the index was removed. + * Will return AWS_OP_ERR if the array passed is invalid or if the index + * passed is out of range. + */ +AWS_COMMON_API +int aws_json_value_remove_array_element(struct aws_json_value *array, size_t index); + +/** + * @brief callback for iterating values of an array. + * Iteration can be controlled as follows: + * - return AWS_OP_SUCCESS and out_should_continue is set to true (default value) - + * continue iteration without error + * - return AWS_OP_SUCCESS and out_continue is set to false - + * stop iteration without error + * - return AWS_OP_ERR - stop iteration with error + */ +typedef int(aws_json_on_value_encountered_const_fn)( + size_t index, + const struct aws_json_value *value, + bool *out_should_continue, + void *user_data); + +/** + * @brief iterates through values of an array. + * iteration is sequential starting with 0th element. + * @param array array to iterate over. + * @param on_value callback for when value is encountered. + * @param user_data user data to pass back in callback. + * @return AWS_OP_SUCCESS when iteration finishes completely or exits early, + * AWS_OP_ERR if value is not an array. + */ +AWS_COMMON_API +int aws_json_const_iterate_array( + const struct aws_json_value *array, + aws_json_on_value_encountered_const_fn *on_value, + void *user_data); + +// ==================== + +// ==================== +// Checks + +/** + * Checks whether two json values are equivalent. + * @param a first value to compare. + * @param b second value to compare. + * @param is_case_sensitive case sensitive compare or not. + * @return True is values are equal, false otherwise + */ +AWS_COMMON_API +bool aws_json_value_compare(const struct aws_json_value *a, const struct aws_json_value *b, bool is_case_sensitive); + +/** + * Duplicates json value. + * @param value first value to compare. + * @return duplicated value. NULL and last error set if value cannot be duplicated. + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_duplicate(const struct aws_json_value *value); + +/** + * Checks if the aws_json_value is a string. + * @param value The aws_json_value to check. + * @return True if the aws_json_value is a string aws_json_value, otherwise false. + */ +AWS_COMMON_API +bool aws_json_value_is_string(const struct aws_json_value *value); + +/** + * Checks if the aws_json_value is a number. + * @param value The aws_json_value to check. + * @return True if the aws_json_value is a number aws_json_value, otherwise false. + */ +AWS_COMMON_API +bool aws_json_value_is_number(const struct aws_json_value *value); + +/** + * Checks if the aws_json_value is a array. + * @param value The aws_json_value to check. + * @return True if the aws_json_value is a array aws_json_value, otherwise false. + */ +AWS_COMMON_API +bool aws_json_value_is_array(const struct aws_json_value *value); + +/** + * Checks if the aws_json_value is a boolean. + * @param value The aws_json_value to check. + * @return True if the aws_json_value is a boolean aws_json_value, otherwise false. + */ +AWS_COMMON_API +bool aws_json_value_is_boolean(const struct aws_json_value *value); + +/** + * Checks if the aws_json_value is a null aws_json_value. + * @param value The aws_json_value to check. + * @return True if the aws_json_value is a null aws_json_value, otherwise false. + */ +AWS_COMMON_API +bool aws_json_value_is_null(const struct aws_json_value *value); + +/** + * Checks if the aws_json_value is a object aws_json_value. + * @param value The aws_json_value to check. + * @return True if the aws_json_value is a object aws_json_value, otherwise false. + */ +AWS_COMMON_API +bool aws_json_value_is_object(const struct aws_json_value *value); +// ==================== + +// ==================== +// Memory Management + +/** + * Removes the aws_json_value from memory. If the aws_json_value is a object or array, it will also destroy + * attached aws_json_values as well. + * + * For example, if you called "aws_json_array_add(b, a)" to add an object "a" to an array "b", if you call + * "aws_json_destroy(b)" then it will also free "a" automatically. All children/attached aws_json_values are freed + * when the parent/root aws_json_value is destroyed. + * @param value The aws_json_value to destroy. + */ +AWS_COMMON_API +void aws_json_value_destroy(struct aws_json_value *value); +// ==================== + +// ==================== +// Utility + +/** + * Appends a unformatted JSON string representation of the aws_json_value into the passed byte buffer. + * The byte buffer is expected to be already initialized so the function can append the JSON into it. + * + * Note: The byte buffer will automatically have its size extended if the JSON string is over the byte + * buffer capacity AND the byte buffer has an allocator associated with it. If the byte buffer does not + * have an allocator associated and the JSON string is over capacity, AWS_OP_ERR will be returned. + * + * Note: When you are finished with the aws_byte_buf, you must call "aws_byte_buf_clean_up_secure" to free + * the memory used, as it will NOT be called automatically. + * @param value The aws_json_value to format. + * @param output The destination for the JSON string + * @return AWS_OP_SUCCESS if the JSON string was allocated to output without any errors + * Will return AWS_OP_ERR if the value passed is not an aws_json_value or if there + * was an error appending the JSON into the byte buffer. + */ +AWS_COMMON_API +int aws_byte_buf_append_json_string(const struct aws_json_value *value, struct aws_byte_buf *output); + +/** + * Appends a formatted JSON string representation of the aws_json_value into the passed byte buffer. + * The byte buffer is expected to already be initialized so the function can append the JSON into it. + * + * Note: The byte buffer will automatically have its size extended if the JSON string is over the byte + * buffer capacity AND the byte buffer has an allocator associated with it. If the byte buffer does not + * have an allocator associated and the JSON string is over capacity, AWS_OP_ERR will be returned. + * + * Note: When you are finished with the aws_byte_buf, you must call "aws_byte_buf_clean_up_secure" to free + * the memory used, as it will NOT be called automatically. + * @param value The aws_json_value to format. + * @param output The destination for the JSON string + * @return AWS_OP_SUCCESS if the JSON string was allocated to output without any errors + * Will return AWS_OP_ERR if the value passed is not an aws_json_value or if there + * aws an error appending the JSON into the byte buffer. + */ +AWS_COMMON_API +int aws_byte_buf_append_json_string_formatted(const struct aws_json_value *value, struct aws_byte_buf *output); + +/** + * Parses the JSON string and returns a aws_json_value containing the root of the JSON. + * @param allocator The allocator used to create the value + * @param string The string containing the JSON. + * @return The root aws_json_value of the JSON. + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_from_string(struct aws_allocator *allocator, struct aws_byte_cursor string); +// ==================== + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif // AWS_COMMON_JSON_H diff --git a/include/aws/common/lifo_cache.h b/include/aws/common/lifo_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..cd547fed79f6dd03366b7477204cd82203c90c80 --- /dev/null +++ b/include/aws/common/lifo_cache.h @@ -0,0 +1,31 @@ +#ifndef AWS_COMMON_LIFO_CACHE_H +#define AWS_COMMON_LIFO_CACHE_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/** + * Initializes the last-in-first-out cache. Sets up the underlying linked hash table. + * Once `max_items` elements have been added, the latest(last-in) item will + * be removed. For the other parameters, see aws/common/hash_table.h. Hash table + * semantics of these arguments are preserved. + */ +AWS_COMMON_API +struct aws_cache *aws_cache_new_lifo( + struct aws_allocator *allocator, + aws_hash_fn *hash_fn, + aws_hash_callback_eq_fn *equals_fn, + aws_hash_callback_destroy_fn *destroy_key_fn, + aws_hash_callback_destroy_fn *destroy_value_fn, + size_t max_items); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LIFO_CACHE_H */ diff --git a/include/aws/common/linked_hash_table.h b/include/aws/common/linked_hash_table.h new file mode 100644 index 0000000000000000000000000000000000000000..d7fd3c88b7e6b8fb13c13812355cf900ef1f5d47 --- /dev/null +++ b/include/aws/common/linked_hash_table.h @@ -0,0 +1,125 @@ +#ifndef AWS_COMMON_LINKED_HASH_TABLE_H +#define AWS_COMMON_LINKED_HASH_TABLE_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +/** + * Simple linked hash table. Preserves insertion order, and can be iterated in insertion order. + * + * You can also change the order safely without altering the shape of the underlying hash table. + */ +struct aws_linked_hash_table { + struct aws_allocator *allocator; + struct aws_linked_list list; + struct aws_hash_table table; + aws_hash_callback_destroy_fn *user_on_value_destroy; + aws_hash_callback_destroy_fn *user_on_key_destroy; +}; + +/** + * Linked-List node stored in the table. This is the node type that will be returned in + * aws_linked_hash_table_get_iteration_list(). + */ +struct aws_linked_hash_table_node { + struct aws_linked_list_node node; + struct aws_linked_hash_table *table; + const void *key; + void *value; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes the table. Sets up the underlying hash table and linked list. + * For the other parameters, see aws/common/hash_table.h. Hash table + * semantics of these arguments are preserved. + */ +AWS_COMMON_API +int aws_linked_hash_table_init( + struct aws_linked_hash_table *table, + struct aws_allocator *allocator, + aws_hash_fn *hash_fn, + aws_hash_callback_eq_fn *equals_fn, + aws_hash_callback_destroy_fn *destroy_key_fn, + aws_hash_callback_destroy_fn *destroy_value_fn, + size_t initial_item_count); + +/** + * Cleans up the table. Elements in the table will be evicted and cleanup + * callbacks will be invoked. + */ +AWS_COMMON_API +void aws_linked_hash_table_clean_up(struct aws_linked_hash_table *table); + +/** + * Finds element in the table by key. If found, AWS_OP_SUCCESS will be + * returned. If not found, AWS_OP_SUCCESS will be returned and *p_value will be + * NULL. + * + * If any errors occur AWS_OP_ERR will be returned. + */ +AWS_COMMON_API +int aws_linked_hash_table_find(struct aws_linked_hash_table *table, const void *key, void **p_value); + +/** + * Finds element in the table by key. If found, AWS_OP_SUCCESS will be returned and the item will be moved to the back + * of the list. + * If not found, AWS_OP_SUCCESS will be returned and *p_value will be NULL. + * + * Note: this will change the order of elements + */ +AWS_COMMON_API +int aws_linked_hash_table_find_and_move_to_back(struct aws_linked_hash_table *table, const void *key, void **p_value); + +/** + * Puts `p_value` at `key`. If an element is already stored at `key` it will be replaced. + */ +AWS_COMMON_API +int aws_linked_hash_table_put(struct aws_linked_hash_table *table, const void *key, void *p_value); + +/** + * Removes item at `key` from the table. + */ +AWS_COMMON_API +int aws_linked_hash_table_remove(struct aws_linked_hash_table *table, const void *key); + +/** + * Clears all items from the table. + */ +AWS_COMMON_API +void aws_linked_hash_table_clear(struct aws_linked_hash_table *table); + +/** + * returns number of elements in the table. + */ +AWS_COMMON_API +size_t aws_linked_hash_table_get_element_count(const struct aws_linked_hash_table *table); + +/** + * Move the aws_linked_hash_table_node to the end of the list. + * + * Note: this will change the order of elements + */ +AWS_COMMON_API +void aws_linked_hash_table_move_node_to_end_of_list( + struct aws_linked_hash_table *table, + struct aws_linked_hash_table_node *node); + +/** + * returns the underlying linked list for iteration. + * + * The returned list has nodes of the type: aws_linked_hash_table_node. Use AWS_CONTAINER_OF for access to the element. + */ +AWS_COMMON_API +const struct aws_linked_list *aws_linked_hash_table_get_iteration_list(const struct aws_linked_hash_table *table); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LINKED_HASH_TABLE_H */ diff --git a/include/aws/common/linked_list.h b/include/aws/common/linked_list.h new file mode 100644 index 0000000000000000000000000000000000000000..bd2e5d891a53257894f7f4c742a50ebcb1add1e9 --- /dev/null +++ b/include/aws/common/linked_list.h @@ -0,0 +1,196 @@ +#ifndef AWS_COMMON_LINKED_LIST_H +#define AWS_COMMON_LINKED_LIST_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_linked_list_node { + struct aws_linked_list_node *next; + struct aws_linked_list_node *prev; +}; + +struct aws_linked_list { + struct aws_linked_list_node head; + struct aws_linked_list_node tail; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Set node's next and prev pointers to NULL. + */ +AWS_STATIC_IMPL void aws_linked_list_node_reset(struct aws_linked_list_node *node); + +/** + * These functions need to be defined first as they are used in pre + * and post conditions. + */ + +/** + * Tests if the list is empty. + */ +AWS_STATIC_IMPL bool aws_linked_list_empty(const struct aws_linked_list *list); + +/** + * Checks that a linked list is valid. + */ +AWS_STATIC_IMPL bool aws_linked_list_is_valid(const struct aws_linked_list *list); +/** + * Checks that the prev of the next pointer of a node points to the + * node. As this checks whether the [next] connection of a node is + * bidirectional, it returns false if used for the list tail. + */ +AWS_STATIC_IMPL bool aws_linked_list_node_next_is_valid(const struct aws_linked_list_node *node); + +/** + * Checks that the next of the prev pointer of a node points to the + * node. Similarly to the above, this returns false if used for the + * head of a list. + */ +AWS_STATIC_IMPL bool aws_linked_list_node_prev_is_valid(const struct aws_linked_list_node *node); +/** + * Checks that a linked list satisfies double linked list connectivity + * constraints. This check is O(n) as it traverses the whole linked + * list to ensure that tail is reachable from head (and vice versa) + * and that every connection is bidirectional. + * + * Note: This check *cannot* go into an infinite loop, because we + * ensure that the connection to the next node is + * bidirectional. Therefore, if a node's [a] a.next is a previous node + * [b] in the list, b.prev != &a and so this check would fail, thus + * terminating the loop. + */ +AWS_STATIC_IMPL bool aws_linked_list_is_valid_deep(const struct aws_linked_list *list); + +/** + * Initializes the list. List will be empty after this call. + */ +AWS_STATIC_IMPL void aws_linked_list_init(struct aws_linked_list *list); + +/** + * Returns an iteration pointer for the first element in the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_begin(const struct aws_linked_list *list); + +/** + * Returns an iteration pointer for one past the last element in the list. + */ +AWS_STATIC_IMPL const struct aws_linked_list_node *aws_linked_list_end(const struct aws_linked_list *list); + +/** + * Returns a pointer for the last element in the list. + * Used to begin iterating the list in reverse. Ex: + * for (i = aws_linked_list_rbegin(list); i != aws_linked_list_rend(list); i = aws_linked_list_prev(i)) {...} + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_rbegin(const struct aws_linked_list *list); + +/** + * Returns the pointer to one before the first element in the list. + * Used to end iterating the list in reverse. + */ +AWS_STATIC_IMPL const struct aws_linked_list_node *aws_linked_list_rend(const struct aws_linked_list *list); + +/** + * Returns the next element in the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_next(const struct aws_linked_list_node *node); + +/** + * Returns the previous element in the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_prev(const struct aws_linked_list_node *node); + +/** + * Inserts to_add immediately after after. + */ +AWS_STATIC_IMPL void aws_linked_list_insert_after( + struct aws_linked_list_node *after, + struct aws_linked_list_node *to_add); +/** + * Swaps the order two nodes in the linked list. + */ +AWS_STATIC_IMPL void aws_linked_list_swap_nodes(struct aws_linked_list_node *a, struct aws_linked_list_node *b); + +/** + * Inserts to_add immediately before before. + */ +AWS_STATIC_IMPL void aws_linked_list_insert_before( + struct aws_linked_list_node *before, + struct aws_linked_list_node *to_add); + +/** + * Removes the specified node from the list (prev/next point to each other) and + * returns the next node in the list. + */ +AWS_STATIC_IMPL void aws_linked_list_remove(struct aws_linked_list_node *node); + +/** + * Append new_node. + */ +AWS_STATIC_IMPL void aws_linked_list_push_back(struct aws_linked_list *list, struct aws_linked_list_node *node); + +/** + * Returns the element in the back of the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_back(const struct aws_linked_list *list); + +/** + * Returns the element in the back of the list and removes it + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_pop_back(struct aws_linked_list *list); + +/** + * Prepend new_node. + */ +AWS_STATIC_IMPL void aws_linked_list_push_front(struct aws_linked_list *list, struct aws_linked_list_node *node); +/** + * Returns the element in the front of the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_front(const struct aws_linked_list *list); +/** + * Returns the element in the front of the list and removes it + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_pop_front(struct aws_linked_list *list); + +AWS_STATIC_IMPL void aws_linked_list_swap_contents( + struct aws_linked_list *AWS_RESTRICT a, + struct aws_linked_list *AWS_RESTRICT b); + +/** + * Remove all nodes from one list, and add them to the back of another. + * + * Example: if dst={1,2} and src={3,4}, they become dst={1,2,3,4} and src={} + */ +AWS_STATIC_IMPL void aws_linked_list_move_all_back( + struct aws_linked_list *AWS_RESTRICT dst, + struct aws_linked_list *AWS_RESTRICT src); + +/** + * Remove all nodes from one list, and add them to the front of another. + * + * Example: if dst={2,1} and src={4,3}, they become dst={4,3,2,1} and src={} + */ +AWS_STATIC_IMPL void aws_linked_list_move_all_front( + struct aws_linked_list *AWS_RESTRICT dst, + struct aws_linked_list *AWS_RESTRICT src); + +/** + * Returns true if the node is currently in a list, false otherwise. + */ +AWS_STATIC_IMPL bool aws_linked_list_node_is_in_list(struct aws_linked_list_node *node); +AWS_EXTERN_C_END + +#ifndef AWS_NO_STATIC_IMPL +# include +#endif /* AWS_NO_STATIC_IMPL */ +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LINKED_LIST_H */ diff --git a/include/aws/common/linked_list.inl b/include/aws/common/linked_list.inl new file mode 100644 index 0000000000000000000000000000000000000000..4d7e54dd0663a4c72b90e00bab8b5a5aff20447a --- /dev/null +++ b/include/aws/common/linked_list.inl @@ -0,0 +1,440 @@ +#ifndef AWS_COMMON_LINKED_LIST_INL +#define AWS_COMMON_LINKED_LIST_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include + +AWS_EXTERN_C_BEGIN + +/** + * Set node's next and prev pointers to NULL. + */ +AWS_STATIC_IMPL void aws_linked_list_node_reset(struct aws_linked_list_node *node) { + AWS_PRECONDITION(node != NULL); + AWS_ZERO_STRUCT(*node); + AWS_POSTCONDITION(AWS_IS_ZEROED(*node)); +} + +/** + * These functions need to be defined first as they are used in pre + * and post conditions. + */ + +/** + * Tests if the list is empty. + */ +AWS_STATIC_IMPL bool aws_linked_list_empty(const struct aws_linked_list *list) { + AWS_PRECONDITION(list); + return list->head.next == &list->tail; +} + +/** + * Checks that a linked list is valid. + */ +AWS_STATIC_IMPL bool aws_linked_list_is_valid(const struct aws_linked_list *list) { + if (list && list->head.next && list->head.prev == NULL && list->tail.prev && list->tail.next == NULL) { +#if defined(AWS_DEEP_CHECKS) && (AWS_DEEP_CHECKS == 1) + return aws_linked_list_is_valid_deep(list); +#else + return true; +#endif + } + return false; +} + +/** + * Checks that the prev of the next pointer of a node points to the + * node. As this checks whether the [next] connection of a node is + * bidirectional, it returns false if used for the list tail. + */ +AWS_STATIC_IMPL bool aws_linked_list_node_next_is_valid(const struct aws_linked_list_node *node) { + return node && node->next && node->next->prev == node; +} + +/** + * Checks that the next of the prev pointer of a node points to the + * node. Similarly to the above, this returns false if used for the + * head of a list. + */ +AWS_STATIC_IMPL bool aws_linked_list_node_prev_is_valid(const struct aws_linked_list_node *node) { + return node && node->prev && node->prev->next == node; +} + +/** + * Checks that a linked list satisfies double linked list connectivity + * constraints. This check is O(n) as it traverses the whole linked + * list to ensure that tail is reachable from head (and vice versa) + * and that every connection is bidirectional. + * + * Note: This check *cannot* go into an infinite loop, because we + * ensure that the connection to the next node is + * bidirectional. Therefore, if a node's [a] a.next is a previous node + * [b] in the list, b.prev != &a and so this check would fail, thus + * terminating the loop. + */ +AWS_STATIC_IMPL bool aws_linked_list_is_valid_deep(const struct aws_linked_list *list) { + if (!list) { + return false; + } + /* This could go into an infinite loop for a circular list */ + const struct aws_linked_list_node *temp = &list->head; + /* Head must reach tail by following next pointers */ + bool head_reaches_tail = false; + /* By satisfying the above and that edges are bidirectional, we + * also guarantee that tail reaches head by following prev + * pointers */ + while (temp) { + if (temp == &list->tail) { + head_reaches_tail = true; + break; + } else if (!aws_linked_list_node_next_is_valid(temp)) { + /* Next and prev pointers should connect the same nodes */ + return false; + } + temp = temp->next; + } + return head_reaches_tail; +} + +/** + * Initializes the list. List will be empty after this call. + */ +AWS_STATIC_IMPL void aws_linked_list_init(struct aws_linked_list *list) { + AWS_PRECONDITION(list); + list->head.next = &list->tail; + list->head.prev = NULL; + list->tail.prev = &list->head; + list->tail.next = NULL; + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(aws_linked_list_empty(list)); +} + +/** + * Returns an iteration pointer for the first element in the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_begin(const struct aws_linked_list *list) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + struct aws_linked_list_node *rval = list->head.next; + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(rval == list->head.next); + return rval; +} + +/** + * Returns an iteration pointer for one past the last element in the list. + */ +AWS_STATIC_IMPL const struct aws_linked_list_node *aws_linked_list_end(const struct aws_linked_list *list) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + const struct aws_linked_list_node *rval = &list->tail; + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(rval == &list->tail); + return rval; +} + +/** + * Returns a pointer for the last element in the list. + * Used to begin iterating the list in reverse. Ex: + * for (i = aws_linked_list_rbegin(list); i != aws_linked_list_rend(list); i = aws_linked_list_prev(i)) {...} + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_rbegin(const struct aws_linked_list *list) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + struct aws_linked_list_node *rval = list->tail.prev; + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(rval == list->tail.prev); + return rval; +} + +/** + * Returns the pointer to one before the first element in the list. + * Used to end iterating the list in reverse. + */ +AWS_STATIC_IMPL const struct aws_linked_list_node *aws_linked_list_rend(const struct aws_linked_list *list) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + const struct aws_linked_list_node *rval = &list->head; + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(rval == &list->head); + return rval; +} + +/** + * Returns the next element in the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_next(const struct aws_linked_list_node *node) { + AWS_PRECONDITION(aws_linked_list_node_next_is_valid(node)); + struct aws_linked_list_node *rval = node->next; + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(node)); + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(rval)); + AWS_POSTCONDITION(rval == node->next); + return rval; +} + +/** + * Returns the previous element in the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_prev(const struct aws_linked_list_node *node) { + AWS_PRECONDITION(aws_linked_list_node_prev_is_valid(node)); + struct aws_linked_list_node *rval = node->prev; + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(node)); + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(rval)); + AWS_POSTCONDITION(rval == node->prev); + return rval; +} + +/** + * Inserts to_add immediately after after. + */ +AWS_STATIC_IMPL void aws_linked_list_insert_after( + struct aws_linked_list_node *after, + struct aws_linked_list_node *to_add) { + AWS_PRECONDITION(aws_linked_list_node_next_is_valid(after)); + AWS_PRECONDITION(to_add != NULL); + to_add->prev = after; + to_add->next = after->next; + after->next->prev = to_add; + after->next = to_add; + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(after)); + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(to_add)); + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(to_add)); + AWS_POSTCONDITION(after->next == to_add); +} + +/** + * Swaps the order two nodes in the linked list. + */ +AWS_STATIC_IMPL void aws_linked_list_swap_nodes(struct aws_linked_list_node *a, struct aws_linked_list_node *b) { + AWS_PRECONDITION(aws_linked_list_node_prev_is_valid(a)); + AWS_PRECONDITION(aws_linked_list_node_next_is_valid(a)); + AWS_PRECONDITION(aws_linked_list_node_prev_is_valid(b)); + AWS_PRECONDITION(aws_linked_list_node_next_is_valid(b)); + + if (a == b) { + return; + } + + /* snapshot b's value to avoid clobbering its next/prev pointers if a/b are adjacent */ + struct aws_linked_list_node tmp = *b; + a->prev->next = b; + a->next->prev = b; + + tmp.prev->next = a; + tmp.next->prev = a; + + tmp = *a; + *a = *b; + *b = tmp; + + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(a)); + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(a)); + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(b)); + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(b)); +} + +/** + * Inserts to_add immediately before before. + */ +AWS_STATIC_IMPL void aws_linked_list_insert_before( + struct aws_linked_list_node *before, + struct aws_linked_list_node *to_add) { + AWS_PRECONDITION(aws_linked_list_node_prev_is_valid(before)); + AWS_PRECONDITION(to_add != NULL); + to_add->next = before; + to_add->prev = before->prev; + before->prev->next = to_add; + before->prev = to_add; + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(before)); + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(to_add)); + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(to_add)); + AWS_POSTCONDITION(before->prev == to_add); +} + +/** + * Removes the specified node from the list (prev/next point to each other) and + * returns the next node in the list. + */ +AWS_STATIC_IMPL void aws_linked_list_remove(struct aws_linked_list_node *node) { + AWS_PRECONDITION(aws_linked_list_node_prev_is_valid(node)); + AWS_PRECONDITION(aws_linked_list_node_next_is_valid(node)); + node->prev->next = node->next; + node->next->prev = node->prev; + aws_linked_list_node_reset(node); + AWS_POSTCONDITION(node->next == NULL && node->prev == NULL); +} + +/** + * Append new_node. + */ +AWS_STATIC_IMPL void aws_linked_list_push_back(struct aws_linked_list *list, struct aws_linked_list_node *node) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + AWS_PRECONDITION(node != NULL); + aws_linked_list_insert_before(&list->tail, node); + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(list->tail.prev == node, "[node] is the new last element of [list]"); +} + +/** + * Returns the element in the back of the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_back(const struct aws_linked_list *list) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + AWS_PRECONDITION(!aws_linked_list_empty(list)); + struct aws_linked_list_node *rval = list->tail.prev; + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(rval)); + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(rval)); + return rval; +} + +/** + * Returns the element in the back of the list and removes it + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_pop_back(struct aws_linked_list *list) { + AWS_PRECONDITION(!aws_linked_list_empty(list)); + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + struct aws_linked_list_node *back = aws_linked_list_back(list); + aws_linked_list_remove(back); + AWS_POSTCONDITION(back->next == NULL && back->prev == NULL); + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + return back; +} + +/** + * Prepend new_node. + */ +AWS_STATIC_IMPL void aws_linked_list_push_front(struct aws_linked_list *list, struct aws_linked_list_node *node) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + AWS_PRECONDITION(node != NULL); + aws_linked_list_insert_before(list->head.next, node); + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(list->head.next == node, "[node] is the new first element of [list]"); +} + +/** + * Returns the element in the front of the list. + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_front(const struct aws_linked_list *list) { + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + AWS_PRECONDITION(!aws_linked_list_empty(list)); + struct aws_linked_list_node *rval = list->head.next; + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + AWS_POSTCONDITION(aws_linked_list_node_prev_is_valid(rval)); + AWS_POSTCONDITION(aws_linked_list_node_next_is_valid(rval)); + return rval; +} + +/** + * Returns the element in the front of the list and removes it + */ +AWS_STATIC_IMPL struct aws_linked_list_node *aws_linked_list_pop_front(struct aws_linked_list *list) { + AWS_PRECONDITION(!aws_linked_list_empty(list)); + AWS_PRECONDITION(aws_linked_list_is_valid(list)); + struct aws_linked_list_node *front = aws_linked_list_front(list); + aws_linked_list_remove(front); + AWS_POSTCONDITION(front->next == NULL && front->prev == NULL); + AWS_POSTCONDITION(aws_linked_list_is_valid(list)); + return front; +} + +AWS_STATIC_IMPL void aws_linked_list_swap_contents( + struct aws_linked_list *AWS_RESTRICT a, + struct aws_linked_list *AWS_RESTRICT b) { + + AWS_PRECONDITION(aws_linked_list_is_valid(a)); + AWS_PRECONDITION(aws_linked_list_is_valid(b)); + AWS_PRECONDITION(a != b); + struct aws_linked_list_node *a_first = a->head.next; + struct aws_linked_list_node *a_last = a->tail.prev; + + /* Move B's contents into A */ + if (aws_linked_list_empty(b)) { + aws_linked_list_init(a); + } else { + a->head.next = b->head.next; + a->head.next->prev = &a->head; + a->tail.prev = b->tail.prev; + a->tail.prev->next = &a->tail; + } + + /* Move A's old contents into B */ + if (a_first == &a->tail) { + aws_linked_list_init(b); + } else { + b->head.next = a_first; + b->head.next->prev = &b->head; + b->tail.prev = a_last; + b->tail.prev->next = &b->tail; + } + AWS_POSTCONDITION(aws_linked_list_is_valid(a)); + AWS_POSTCONDITION(aws_linked_list_is_valid(b)); +} + +AWS_STATIC_IMPL void aws_linked_list_move_all_back( + struct aws_linked_list *AWS_RESTRICT dst, + struct aws_linked_list *AWS_RESTRICT src) { + + AWS_PRECONDITION(aws_linked_list_is_valid(src)); + AWS_PRECONDITION(aws_linked_list_is_valid(dst)); + AWS_PRECONDITION(dst != src); + + if (!aws_linked_list_empty(src)) { + /* splice src nodes into dst, between the back and tail nodes */ + struct aws_linked_list_node *dst_back = dst->tail.prev; + struct aws_linked_list_node *src_front = src->head.next; + struct aws_linked_list_node *src_back = src->tail.prev; + + dst_back->next = src_front; + src_front->prev = dst_back; + + dst->tail.prev = src_back; + src_back->next = &dst->tail; + + /* reset src */ + src->head.next = &src->tail; + src->tail.prev = &src->head; + } + + AWS_POSTCONDITION(aws_linked_list_is_valid(src)); + AWS_POSTCONDITION(aws_linked_list_is_valid(dst)); +} + +AWS_STATIC_IMPL void aws_linked_list_move_all_front( + struct aws_linked_list *AWS_RESTRICT dst, + struct aws_linked_list *AWS_RESTRICT src) { + + AWS_PRECONDITION(aws_linked_list_is_valid(src)); + AWS_PRECONDITION(aws_linked_list_is_valid(dst)); + AWS_PRECONDITION(dst != src); + + if (!aws_linked_list_empty(src)) { + /* splice src nodes into dst, between the head and front nodes */ + struct aws_linked_list_node *dst_front = dst->head.next; + struct aws_linked_list_node *src_front = src->head.next; + struct aws_linked_list_node *src_back = src->tail.prev; + + dst->head.next = src_front; + src_front->prev = &dst->head; + + src_back->next = dst_front; + dst_front->prev = src_back; + + /* reset src */ + src->head.next = &src->tail; + src->tail.prev = &src->head; + } + + AWS_POSTCONDITION(aws_linked_list_is_valid(src)); + AWS_POSTCONDITION(aws_linked_list_is_valid(dst)); +} + +AWS_STATIC_IMPL bool aws_linked_list_node_is_in_list(struct aws_linked_list_node *node) { + return aws_linked_list_node_prev_is_valid(node) && aws_linked_list_node_next_is_valid(node); +} + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_LINKED_LIST_INL */ diff --git a/include/aws/common/log_channel.h b/include/aws/common/log_channel.h new file mode 100644 index 0000000000000000000000000000000000000000..b6e1f0fc358dd0e7db57a5cd0f92e30067ceaccd --- /dev/null +++ b/include/aws/common/log_channel.h @@ -0,0 +1,75 @@ + +#ifndef AWS_COMMON_LOG_CHANNEL_H +#define AWS_COMMON_LOG_CHANNEL_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_string; +struct aws_log_writer; + +/* + * Log channel interface and default implementations + * + * A log channel is an abstraction for the transfer of formatted log data between a source (formatter) + * and a sink (writer). + */ +struct aws_log_channel; + +typedef int(aws_log_channel_send_fn)(struct aws_log_channel *channel, struct aws_string *output); +typedef void(aws_log_channel_clean_up_fn)(struct aws_log_channel *channel); + +struct aws_log_channel_vtable { + aws_log_channel_send_fn *send; + aws_log_channel_clean_up_fn *clean_up; +}; + +struct aws_log_channel { + struct aws_log_channel_vtable *vtable; + struct aws_allocator *allocator; + struct aws_log_writer *writer; + void *impl; +}; + +AWS_EXTERN_C_BEGIN + +/* + * Simple channel that results in log lines being written in the same thread they were generated in. + * + * The passed in log writer is not an ownership transfer. The log channel does not clean up the writer. + */ +AWS_COMMON_API +int aws_log_channel_init_foreground( + struct aws_log_channel *channel, + struct aws_allocator *allocator, + struct aws_log_writer *writer); + +/* + * Simple channel that sends log lines to a background thread. + * + * The passed in log writer is not an ownership transfer. The log channel does not clean up the writer. + */ +AWS_COMMON_API +int aws_log_channel_init_background( + struct aws_log_channel *channel, + struct aws_allocator *allocator, + struct aws_log_writer *writer); + +/* + * Channel cleanup function + */ +AWS_COMMON_API +void aws_log_channel_clean_up(struct aws_log_channel *channel); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LOG_CHANNEL_H */ diff --git a/include/aws/common/log_formatter.h b/include/aws/common/log_formatter.h new file mode 100644 index 0000000000000000000000000000000000000000..f7604556299ee8e06eddcd74df4ca0b51a74129a --- /dev/null +++ b/include/aws/common/log_formatter.h @@ -0,0 +1,98 @@ + +#ifndef AWS_COMMON_LOG_FORMATTER_H +#define AWS_COMMON_LOG_FORMATTER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_allocator; +struct aws_string; + +/* + * Log formatter interface and default implementation + * + * Log formatters are invoked by the LOGF_* macros to transform a set of arguments into + * one or more lines of text to be output to a logging sink (writer). + */ +struct aws_log_formatter; + +typedef int(aws_log_formatter_format_fn)( + struct aws_log_formatter *formatter, + struct aws_string **formatted_output, + enum aws_log_level level, + aws_log_subject_t subject, + const char *format, + va_list args); + +typedef void(aws_log_formatter_clean_up_fn)(struct aws_log_formatter *logger); + +struct aws_log_formatter_vtable { + aws_log_formatter_format_fn *format; + aws_log_formatter_clean_up_fn *clean_up; +}; + +struct aws_log_formatter { + struct aws_log_formatter_vtable *vtable; + struct aws_allocator *allocator; + void *impl; +}; + +struct aws_log_formatter_standard_options { + enum aws_date_format date_format; +}; + +struct aws_logging_standard_formatting_data { + char *log_line_buffer; + size_t total_length; + enum aws_log_level level; + const char *subject_name; + const char *format; + enum aws_date_format date_format; + struct aws_allocator *allocator; /* not used, just there to make byte_bufs valid */ + + size_t amount_written; +}; + +AWS_EXTERN_C_BEGIN + +/* + * Initializes the default log formatter which outputs lines in the format: + * + * [] [] [] - \n + */ +AWS_COMMON_API +int aws_log_formatter_init_default( + struct aws_log_formatter *formatter, + struct aws_allocator *allocator, + struct aws_log_formatter_standard_options *options); + +/* + * Cleans up a log formatter (minus the base structure memory) by calling the formatter's clean_up function + * via the vtable. + */ +AWS_COMMON_API +void aws_log_formatter_clean_up(struct aws_log_formatter *formatter); + +/* + * Formats a single log line based on the input + the var args list. Output is written to a fixed-size + * buffer supplied in the data struct. + */ +AWS_COMMON_API +int aws_format_standard_log_line(struct aws_logging_standard_formatting_data *formatting_data, va_list args); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LOG_FORMATTER_H */ diff --git a/include/aws/common/log_writer.h b/include/aws/common/log_writer.h new file mode 100644 index 0000000000000000000000000000000000000000..54fb98358432d43dd89fe18aaede4c3c38bebef1 --- /dev/null +++ b/include/aws/common/log_writer.h @@ -0,0 +1,76 @@ + +#ifndef AWS_COMMON_LOG_WRITER_H +#define AWS_COMMON_LOG_WRITER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_allocator; +struct aws_string; + +/* + * Log writer interface and default implementation(s) + * + * A log writer functions as a sink for formatted log lines. We provide + * default implementations that go to stdout, stderr, and a specified file. + */ +struct aws_log_writer; + +typedef int(aws_log_writer_write_fn)(struct aws_log_writer *writer, const struct aws_string *output); +typedef void(aws_log_writer_clean_up_fn)(struct aws_log_writer *writer); + +struct aws_log_writer_vtable { + aws_log_writer_write_fn *write; + aws_log_writer_clean_up_fn *clean_up; +}; + +struct aws_log_writer { + struct aws_log_writer_vtable *vtable; + struct aws_allocator *allocator; + void *impl; +}; + +struct aws_log_writer_file_options { + const char *filename; + FILE *file; +}; + +AWS_EXTERN_C_BEGIN + +/* + * Initialize a log writer that sends log lines to stdout. Uses C library IO. + */ +AWS_COMMON_API +int aws_log_writer_init_stdout(struct aws_log_writer *writer, struct aws_allocator *allocator); + +/* + * Initialize a log writer that sends log lines to stderr. Uses C library IO. + */ +AWS_COMMON_API +int aws_log_writer_init_stderr(struct aws_log_writer *writer, struct aws_allocator *allocator); + +/* + * Initialize a log writer that sends log lines to a file. Uses C library IO. + */ +AWS_COMMON_API +int aws_log_writer_init_file( + struct aws_log_writer *writer, + struct aws_allocator *allocator, + struct aws_log_writer_file_options *options); + +/* + * Frees all resources used by a log writer with the exception of the base structure memory + */ +AWS_COMMON_API +void aws_log_writer_clean_up(struct aws_log_writer *writer); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LOG_WRITER_H */ diff --git a/include/aws/common/logging.h b/include/aws/common/logging.h new file mode 100644 index 0000000000000000000000000000000000000000..444465aa11066d2e7e8155315ee8b56ecc730e7e --- /dev/null +++ b/include/aws/common/logging.h @@ -0,0 +1,360 @@ +#ifndef AWS_COMMON_LOGGING_H +#define AWS_COMMON_LOGGING_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_LOG_LEVEL_NONE 0 +#define AWS_LOG_LEVEL_FATAL 1 +#define AWS_LOG_LEVEL_ERROR 2 +#define AWS_LOG_LEVEL_WARN 3 +#define AWS_LOG_LEVEL_INFO 4 +#define AWS_LOG_LEVEL_DEBUG 5 +#define AWS_LOG_LEVEL_TRACE 6 + +/** + * Controls what log calls pass through the logger and what log calls get filtered out. + * If a log level has a value of X, then all log calls using a level <= X will appear, while + * those using a value > X will not occur. + * + * You can filter both dynamically (by setting the log level on the logger object) or statically + * (by defining AWS_STATIC_LOG_LEVEL to be an appropriate integer module-wide). Statically filtered + * log calls will be completely compiled out but require a rebuild if you want to get more detail + * about what's happening. + */ +enum aws_log_level { + AWS_LL_NONE = AWS_LOG_LEVEL_NONE, + AWS_LL_FATAL = AWS_LOG_LEVEL_FATAL, + AWS_LL_ERROR = AWS_LOG_LEVEL_ERROR, + AWS_LL_WARN = AWS_LOG_LEVEL_WARN, + AWS_LL_INFO = AWS_LOG_LEVEL_INFO, + AWS_LL_DEBUG = AWS_LOG_LEVEL_DEBUG, + AWS_LL_TRACE = AWS_LOG_LEVEL_TRACE, + + AWS_LL_COUNT +}; + +/** + * Log subject is a way of designating the topic of logging. + * + * The general idea is to support a finer-grained approach to log level control. The primary use case + * is for situations that require more detailed logging within a specific domain, where enabling that detail + * globally leads to an untenable flood of information. + * + * For example, enable TRACE logging for tls-related log statements (handshake binary payloads), but + * only WARN logging everywhere else (because http payloads would blow up the log files). + * + * Log subject is an enum similar to aws error: each library has its own value-space and someone is + * responsible for registering the value <-> string connections. + */ +typedef uint32_t aws_log_subject_t; + +/* Each library gets space for 2^^10 log subject entries */ +enum { + AWS_LOG_SUBJECT_STRIDE_BITS = 10, +}; +#define AWS_LOG_SUBJECT_STRIDE (1U << AWS_LOG_SUBJECT_STRIDE_BITS) +#define AWS_LOG_SUBJECT_BEGIN_RANGE(x) ((x) * AWS_LOG_SUBJECT_STRIDE) +#define AWS_LOG_SUBJECT_END_RANGE(x) (((x) + 1) * AWS_LOG_SUBJECT_STRIDE - 1) + +struct aws_log_subject_info { + aws_log_subject_t subject_id; + const char *subject_name; + const char *subject_description; +}; + +#define DEFINE_LOG_SUBJECT_INFO(id, name, desc) \ + {.subject_id = (id), .subject_name = (name), .subject_description = (desc)} + +struct aws_log_subject_info_list { + struct aws_log_subject_info *subject_list; + size_t count; +}; + +enum aws_common_log_subject { + AWS_LS_COMMON_GENERAL = AWS_LOG_SUBJECT_BEGIN_RANGE(AWS_C_COMMON_PACKAGE_ID), + AWS_LS_COMMON_TASK_SCHEDULER, + AWS_LS_COMMON_THREAD, + AWS_LS_COMMON_MEMTRACE, + AWS_LS_COMMON_XML_PARSER, + AWS_LS_COMMON_IO, + AWS_LS_COMMON_BUS, + AWS_LS_COMMON_TEST, + AWS_LS_COMMON_JSON_PARSER, + AWS_LS_COMMON_CBOR, + + AWS_LS_COMMON_LAST = AWS_LOG_SUBJECT_END_RANGE(AWS_C_COMMON_PACKAGE_ID) +}; + +struct aws_logger; +struct aws_log_formatter; +struct aws_log_channel; +struct aws_log_writer; + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable : 4623) /* default constructor was implicitly defined as deleted */ +# pragma warning(disable : 4626) /* assignment operator was implicitly defined as deleted */ +# pragma warning(disable : 5027) /* move assignment operator was implicitly defined as deleted */ +#endif + +/** + * We separate the log level function from the log call itself so that we can do the filter check in the macros (see + * below) + * + * By doing so, we make it so that the variadic format arguments are not even evaluated if the filter check does not + * succeed. + */ +struct aws_logger_vtable { + int (*const log)( + struct aws_logger *logger, + enum aws_log_level log_level, + aws_log_subject_t subject, + const char *format, + ...) +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + __attribute__((format(printf, 4, 5))) +#endif /* non-ms compilers: TODO - find out what versions format support was added in */ + ; + enum aws_log_level (*const get_log_level)(struct aws_logger *logger, aws_log_subject_t subject); + void (*const clean_up)(struct aws_logger *logger); + int (*set_log_level)(struct aws_logger *logger, enum aws_log_level); +}; + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +struct aws_logger { + struct aws_logger_vtable *vtable; + struct aws_allocator *allocator; + void *p_impl; +}; + +/** + * The base formatted logging macro that all other formatted logging macros resolve to. + * Checks for a logger and filters based on log level. + */ +#define AWS_LOGF(log_level, subject, ...) \ + do { \ + AWS_ASSERT(log_level > 0); \ + struct aws_logger *logger = aws_logger_get(); \ + if (logger != NULL && logger->vtable->get_log_level(logger, (subject)) >= (log_level)) { \ + logger->vtable->log(logger, log_level, subject, __VA_ARGS__); \ + } \ + } while (0) +/** + * Unconditional logging macro that takes a logger and does not do a level check or a null check. Intended for + * situations when you need to log many things and do a single manual level check before beginning. + */ +#define AWS_LOGUF(logger, log_level, subject, ...) \ + { logger->vtable->log(logger, log_level, subject, __VA_ARGS__); } + +/** + * LOGF_ variants for each level. These are what should be used directly to do all logging. + * + * i.e. + * + * LOGF_FATAL("Device \"%s\" not found", device->name); + * + * + * Later we will likely expose Subject-aware variants + */ +#if !defined(AWS_STATIC_LOG_LEVEL) || (AWS_STATIC_LOG_LEVEL >= AWS_LOG_LEVEL_FATAL) +# define AWS_LOGF_FATAL(subject, ...) AWS_LOGF(AWS_LL_FATAL, subject, __VA_ARGS__) +#else +# define AWS_LOGF_FATAL(subject, ...) +#endif + +#if !defined(AWS_STATIC_LOG_LEVEL) || (AWS_STATIC_LOG_LEVEL >= AWS_LOG_LEVEL_ERROR) +# define AWS_LOGF_ERROR(subject, ...) AWS_LOGF(AWS_LL_ERROR, subject, __VA_ARGS__) +#else +# define AWS_LOGF_ERROR(subject, ...) +#endif + +#if !defined(AWS_STATIC_LOG_LEVEL) || (AWS_STATIC_LOG_LEVEL >= AWS_LOG_LEVEL_WARN) +# define AWS_LOGF_WARN(subject, ...) AWS_LOGF(AWS_LL_WARN, subject, __VA_ARGS__) +#else +# define AWS_LOGF_WARN(subject, ...) +#endif + +#if !defined(AWS_STATIC_LOG_LEVEL) || (AWS_STATIC_LOG_LEVEL >= AWS_LOG_LEVEL_INFO) +# define AWS_LOGF_INFO(subject, ...) AWS_LOGF(AWS_LL_INFO, subject, __VA_ARGS__) +#else +# define AWS_LOGF_INFO(subject, ...) +#endif + +#if !defined(AWS_STATIC_LOG_LEVEL) || (AWS_STATIC_LOG_LEVEL >= AWS_LOG_LEVEL_DEBUG) +# define AWS_LOGF_DEBUG(subject, ...) AWS_LOGF(AWS_LL_DEBUG, subject, __VA_ARGS__) +#else +# define AWS_LOGF_DEBUG(subject, ...) +#endif + +#if !defined(AWS_STATIC_LOG_LEVEL) || (AWS_STATIC_LOG_LEVEL >= AWS_LOG_LEVEL_TRACE) +# define AWS_LOGF_TRACE(subject, ...) AWS_LOGF(AWS_LL_TRACE, subject, __VA_ARGS__) +#else +# define AWS_LOGF_TRACE(subject, ...) +#endif + +/* + * Standard logger implementation composing three sub-components: + * + * The formatter takes var args input from the user and produces a formatted log line + * The writer takes a formatted log line and outputs it somewhere + * The channel is the transport between the two + */ +struct aws_logger_pipeline { + struct aws_log_formatter *formatter; + struct aws_log_channel *channel; + struct aws_log_writer *writer; + struct aws_allocator *allocator; + struct aws_atomic_var level; +}; + +/** + * Options for aws_logger_init_standard(). + * Set `filename` to open a file for logging and close it when the logger cleans up. + * Set `file` to use a file that is already open, such as `stderr` or `stdout`. + */ +struct aws_logger_standard_options { + enum aws_log_level level; + const char *filename; + FILE *file; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Sets the aws logger used globally across the process. Not thread-safe. Must only be called once. + */ +AWS_COMMON_API +void aws_logger_set(struct aws_logger *logger); + +/** + * Gets the aws logger used globally across the process. + */ +AWS_COMMON_API +struct aws_logger *aws_logger_get(void); + +/** + * Gets the aws logger used globally across the process if the logging level is at least the inputted level. + * + * @param subject log subject to perform the level check versus, not currently used + * @param level logging level to check against in order to return the logger + * @return the current logger if the current logging level is at or more detailed then the supplied logging level + */ +AWS_COMMON_API +struct aws_logger *aws_logger_get_conditional(aws_log_subject_t subject, enum aws_log_level level); + +/** + * Cleans up all resources used by the logger; simply invokes the clean_up v-function + */ +AWS_COMMON_API +void aws_logger_clean_up(struct aws_logger *logger); + +/** + * Sets the current logging level for the logger. Loggers are not require to support this. + * @param logger logger to set the log level for + * @param level new log level for the logger + * @return AWS_OP_SUCCESS if the level was successfully set, AWS_OP_ERR otherwise + */ +AWS_COMMON_API +int aws_logger_set_log_level(struct aws_logger *logger, enum aws_log_level level); + +/** + * Converts a log level to a c-string constant. Intended primarily to support building log lines that + * include the level in them, i.e. + * + * [ERROR] 10:34:54.642 01-31-19 - Json parse error.... + */ +AWS_COMMON_API +int aws_log_level_to_string(enum aws_log_level log_level, const char **level_string); + +/** + * Converts a c-string constant to a log level value. Uses case-insensitive comparison + * and simply iterates all possibilities until a match or nothing remains. If no match + * is found, AWS_OP_ERR is returned. + */ +AWS_COMMON_API +int aws_string_to_log_level(const char *level_string, enum aws_log_level *log_level); + +/** + * Converts an aws_thread_id_t to a c-string. For portability, aws_thread_id_t + * must not be printed directly. Intended primarily to support building log + * lines that include the thread id in them. The parameter `buffer` must + * point-to a char buffer of length `bufsz == AWS_THREAD_ID_T_REPR_BUFSZ`. The + * thread id representation is returned in `buffer`. + */ +AWS_COMMON_API +int aws_thread_id_t_to_string(aws_thread_id_t thread_id, char *buffer, size_t bufsz); + +/** + * Get subject name from log subject. + */ +AWS_COMMON_API +const char *aws_log_subject_name(aws_log_subject_t subject); + +/** + * Connects log subject strings with log subject integer values + */ +AWS_COMMON_API +void aws_register_log_subject_info_list(struct aws_log_subject_info_list *log_subject_list); + +/** + * Disconnects log subject strings with log subject integer values + */ +AWS_COMMON_API +void aws_unregister_log_subject_info_list(struct aws_log_subject_info_list *log_subject_list); + +/* + * Initializes a pipeline logger that is built from the default formatter, a background thread-based channel, and + * a file writer. The default logger in almost all circumstances. + */ +AWS_COMMON_API +int aws_logger_init_standard( + struct aws_logger *logger, + struct aws_allocator *allocator, + struct aws_logger_standard_options *options); + +/* + * Initializes a pipeline logger from components that have already been initialized. This is not an ownership transfer. + * After the pipeline logger is cleaned up, the components will have to manually be cleaned up by the user. + */ +AWS_COMMON_API +int aws_logger_init_from_external( + struct aws_logger *logger, + struct aws_allocator *allocator, + struct aws_log_formatter *formatter, + struct aws_log_channel *channel, + struct aws_log_writer *writer, + enum aws_log_level level); + +/* + * Pipeline logger vtable for custom configurations + */ +AWS_COMMON_API +extern struct aws_logger_vtable g_pipeline_logger_owned_vtable; + +/* + * Initializes a logger that does not perform any allocation during logging. Log lines larger than the internal + * constant are truncated. Formatting matches the standard logger. Used for memory tracing logging. + * If no file or filename is set in the aws_logger_standard_options, then it will use stderr. + */ +AWS_COMMON_API +int aws_logger_init_noalloc( + struct aws_logger *logger, + struct aws_allocator *allocator, + struct aws_logger_standard_options *options); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LOGGING_H */ diff --git a/include/aws/common/lru_cache.h b/include/aws/common/lru_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..b99551a79b250a16711e487cd752e8856b6d3348 --- /dev/null +++ b/include/aws/common/lru_cache.h @@ -0,0 +1,44 @@ +#ifndef AWS_COMMON_LRU_CACHE_H +#define AWS_COMMON_LRU_CACHE_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/** + * Initializes the Least-recently-used cache. Sets up the underlying linked hash table. + * Once `max_items` elements have been added, the least recently used item will be removed. For the other parameters, + * see aws/common/hash_table.h. Hash table semantics of these arguments are preserved.(Yes the one that was the answer + * to that interview question that one time). + */ +AWS_COMMON_API +struct aws_cache *aws_cache_new_lru( + struct aws_allocator *allocator, + aws_hash_fn *hash_fn, + aws_hash_callback_eq_fn *equals_fn, + aws_hash_callback_destroy_fn *destroy_key_fn, + aws_hash_callback_destroy_fn *destroy_value_fn, + size_t max_items); + +/** + * Accesses the least-recently-used element, sets it to most-recently-used + * element, and returns the value. + */ +AWS_COMMON_API +void *aws_lru_cache_use_lru_element(struct aws_cache *cache); + +/** + * Accesses the most-recently-used element and returns its value. + */ +AWS_COMMON_API +void *aws_lru_cache_get_mru_element(const struct aws_cache *cache); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_LRU_CACHE_H */ diff --git a/include/aws/common/macros.h b/include/aws/common/macros.h new file mode 100644 index 0000000000000000000000000000000000000000..03e50a218627b3364017fa166fca8246a39a7f2e --- /dev/null +++ b/include/aws/common/macros.h @@ -0,0 +1,183 @@ +#ifndef AWS_COMMON_MACROS_H +#define AWS_COMMON_MACROS_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* clang-format off */ + +/* Use these macros in public header files to suppress unreasonable compiler + * warnings. Public header files are included by external applications, + * which may set their warning levels pedantically high. + * + * Developers of AWS libraries should hesitate before adding more warnings to this macro. + * Prefer disabling the warning within a .c file, or in the library's CFLAGS, + * or push/pop the warning around a single problematic declaration. */ +#if defined(_MSC_VER) +# define AWS_PUSH_SANE_WARNING_LEVEL \ + __pragma(warning(push)) \ + __pragma(warning(disable : 4820)) /* padding added to struct */ \ + __pragma(warning(disable : 4514)) /* unreferenced inline function has been removed */ \ + __pragma(warning(disable : 5039)) /* reference to potentially throwing function passed to extern C function */ +# define AWS_POP_SANE_WARNING_LEVEL __pragma(warning(pop)) +#else +# define AWS_PUSH_SANE_WARNING_LEVEL +# define AWS_POP_SANE_WARNING_LEVEL +#endif +/* clang-format on */ + +#ifdef __cplusplus +# define AWS_EXTERN_C_BEGIN extern "C" { +# define AWS_EXTERN_C_END } +#else +# define AWS_EXTERN_C_BEGIN +# define AWS_EXTERN_C_END +#endif /* __cplusplus */ + +#define AWS_CONCAT(A, B) A##B +#define AWS_STATIC_ASSERT0(cond, msg) typedef char AWS_CONCAT(static_assertion_, msg)[(!!(cond)) * 2 - 1] +#define AWS_STATIC_ASSERT1(cond, line) AWS_STATIC_ASSERT0(cond, AWS_CONCAT(at_line_, line)) +#define AWS_STATIC_ASSERT(cond) AWS_STATIC_ASSERT1(cond, __LINE__) + +/* https://stackoverflow.com/questions/9183993/msvc-variadic-macro-expansion */ +#define GLUE(x, y) x y + +#define RETURN_ARG_COUNT(_1_, _2_, _3_, _4_, _5_, count, ...) count +#define EXPAND_ARGS(args) RETURN_ARG_COUNT args +#define COUNT_ARGS_MAX5(...) EXPAND_ARGS((__VA_ARGS__, 5, 4, 3, 2, 1, 0)) + +#define OVERLOAD_MACRO2(name, count) name##count +#define OVERLOAD_MACRO1(name, count) OVERLOAD_MACRO2(name, count) +#define OVERLOAD_MACRO(name, count) OVERLOAD_MACRO1(name, count) + +#define CALL_OVERLOAD(name, ...) GLUE(OVERLOAD_MACRO(name, COUNT_ARGS_MAX5(__VA_ARGS__)), (__VA_ARGS__)) + +#define CALL_OVERLOAD_TEST1(x) x +#define CALL_OVERLOAD_TEST2(x, y) y +#define CALL_OVERLOAD_TEST3(x, y, z) z +#define CALL_OVERLOAD_TEST(...) CALL_OVERLOAD(CALL_OVERLOAD_TEST, __VA_ARGS__) +AWS_STATIC_ASSERT(CALL_OVERLOAD_TEST(1) == 1); +AWS_STATIC_ASSERT(CALL_OVERLOAD_TEST(1, 2) == 2); +AWS_STATIC_ASSERT(CALL_OVERLOAD_TEST(1, 2, 3) == 3); + +enum { AWS_CACHE_LINE = 64 }; +/** + * Format macro for strings of a specified length. + * Allows non null-terminated strings to be used with the printf family of functions. + * Ex: printf("scheme is " PRInSTR, 4, "http://example.org"); // outputs: "scheme is http" + */ +#define PRInSTR "%.*s" + +#if defined(_MSC_VER) +# include +# define AWS_ALIGNED_TYPEDEF(from, to, alignment) typedef __declspec(align(alignment)) from to +# define AWS_LIKELY(x) x +# define AWS_UNLIKELY(x) x +# define AWS_FORCE_INLINE __forceinline +# define AWS_NO_INLINE __declspec(noinline) +# define AWS_VARIABLE_LENGTH_ARRAY(type, name, length) type *name = _alloca(sizeof(type) * (length)) +# define AWS_DECLSPEC_NORETURN __declspec(noreturn) +# define AWS_ATTRIBUTE_NORETURN +#else +# if defined(__GNUC__) || defined(__clang__) +# define AWS_ALIGNED_TYPEDEF(from, to, alignment) typedef from to __attribute__((aligned(alignment))) +# define AWS_TYPE_OF(a) __typeof__(a) +# define AWS_LIKELY(x) __builtin_expect(!!(x), 1) +# define AWS_UNLIKELY(x) __builtin_expect(!!(x), 0) +# define AWS_FORCE_INLINE __attribute__((always_inline)) +# define AWS_NO_INLINE __attribute__((noinline)) +# define AWS_DECLSPEC_NORETURN +# define AWS_ATTRIBUTE_NORETURN __attribute__((noreturn)) +# if defined(__cplusplus) +# define AWS_VARIABLE_LENGTH_ARRAY(type, name, length) type *name = alloca(sizeof(type) * (length)) +# else +# define AWS_VARIABLE_LENGTH_ARRAY(type, name, length) type name[length] +# endif /* defined(__cplusplus) */ +# endif /* defined(__GNUC__) || defined(__clang__) */ +#endif /* defined(_MSC_VER) */ + +#if defined(__has_feature) +# if __has_feature(address_sanitizer) +# define AWS_SUPPRESS_ASAN __attribute__((no_sanitize("address"))) +# endif +#elif defined(__SANITIZE_ADDRESS__) +# if defined(__GNUC__) +# define AWS_SUPPRESS_ASAN __attribute__((no_sanitize_address)) +# elif defined(_MSC_VER) +# define AWS_SUPPRESS_ASAN __declspec(no_sanitize_address) +# endif +#endif + +#if !defined(AWS_SUPPRESS_ASAN) +# define AWS_SUPPRESS_ASAN +#endif + +#if defined(__has_feature) +# if __has_feature(thread_sanitizer) +# define AWS_SUPPRESS_TSAN __attribute__((no_sanitize("thread"))) +# endif +#elif defined(__SANITIZE_THREAD__) +# if defined(__GNUC__) +# define AWS_SUPPRESS_TSAN __attribute__((no_sanitize_thread)) +# else +# define AWS_SUPPRESS_TSAN +# endif +#else +# define AWS_SUPPRESS_TSAN +#endif + +#if !defined(AWS_SUPPRESS_TSAN) +# define AWS_SUPPRESS_TSAN +#endif + +#if defined(__has_feature) +# if __has_feature(undefined_behavior_sanitizer) +# define AWS_SUPPRESS_UBSAN __attribute__((no_sanitize("undefined"))) +# endif +#elif defined(__SANITIZE_UNDEFINED__) +# if defined(__GNUC__) +# define AWS_SUPPRESS_UBSAN __attribute__((no_sanitize_undefined)) +# else +# define AWS_SUPPRESS_UBSAN +# endif +#else +# define AWS_SUPPRESS_UBSAN +#endif + +#if !defined(AWS_SUPPRESS_UBSAN) +# define AWS_SUPPRESS_UBSAN +#endif + +/* If this is C++, restrict isn't supported. If this is not at least C99 on gcc and clang, it isn't supported. + * If visual C++ building in C mode, the restrict definition is __restrict. + * This just figures all of that out based on who's including this header file. */ +#if defined(__cplusplus) +# define AWS_RESTRICT +#else +# if defined(_MSC_VER) +# define AWS_RESTRICT __restrict +# else +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +# define AWS_RESTRICT restrict +# else +# define AWS_RESTRICT +# endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */ +# endif /* defined(_MSC_VER) */ +#endif /* defined(__cplusplus) */ + +#if defined(_MSC_VER) +# define AWS_THREAD_LOCAL __declspec(thread) +#else +# define AWS_THREAD_LOCAL __thread +#endif + +#define AWS_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) +/** + * from a pointer and a type of the struct containing the node + * this will get you back to the pointer of the object. member is the name of + * the instance of struct aws_linked_list_node in your struct. + */ +#define AWS_CONTAINER_OF(ptr, type, member) ((type *)((uint8_t *)(ptr) - offsetof(type, member))) + +#endif /* AWS_COMMON_MACROS_H */ diff --git a/include/aws/common/math.cbmc.inl b/include/aws/common/math.cbmc.inl new file mode 100644 index 0000000000000000000000000000000000000000..e54b22b8b93d272b84632fad019e9d2abbbe8a6a --- /dev/null +++ b/include/aws/common/math.cbmc.inl @@ -0,0 +1,107 @@ +#ifndef AWS_COMMON_MATH_CBMC_INL +#define AWS_COMMON_MATH_CBMC_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* + * This header is already included, but include it again to make editor + * highlighting happier. + */ +#include + +AWS_EXTERN_C_BEGIN + +/* This header does safe operations. Supressing the checks within these functions + * avoids unnecessary CBMC assertions + */ +#pragma CPROVER check push +#pragma CPROVER check disable "unsigned-overflow" + +/** + * Multiplies a * b. If the result overflows, returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_mul_u64_saturating(uint64_t a, uint64_t b) { + if (__CPROVER_overflow_mult(a, b)) + return UINT64_MAX; + return a * b; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + if (__CPROVER_overflow_mult(a, b)) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a * b; + return AWS_OP_SUCCESS; +} + +/** + * Multiplies a * b. If the result overflows, returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_mul_u32_saturating(uint32_t a, uint32_t b) { + if (__CPROVER_overflow_mult(a, b)) + return UINT32_MAX; + return a * b; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + if (__CPROVER_overflow_mult(a, b)) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a * b; + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_add_u64_saturating(uint64_t a, uint64_t b) { + if (__CPROVER_overflow_plus(a, b)) + return UINT64_MAX; + return a + b; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + if (__CPROVER_overflow_plus(a, b)) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a + b; + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_add_u32_saturating(uint32_t a, uint32_t b) { + if (__CPROVER_overflow_plus(a, b)) + return UINT32_MAX; + return a + b; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + if (__CPROVER_overflow_plus(a, b)) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a + b; + return AWS_OP_SUCCESS; +} + +#pragma CPROVER check pop + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_MATH_CBMC_INL */ diff --git a/include/aws/common/math.fallback.inl b/include/aws/common/math.fallback.inl new file mode 100644 index 0000000000000000000000000000000000000000..f1adc49a652d145acbf7d37966227b8aa9139c41 --- /dev/null +++ b/include/aws/common/math.fallback.inl @@ -0,0 +1,199 @@ +#ifndef AWS_COMMON_MATH_FALLBACK_INL +#define AWS_COMMON_MATH_FALLBACK_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* + * This header is already included, but include it again to make editor + * highlighting happier. + */ +#include +#include + +AWS_EXTERN_C_BEGIN +/** + * Multiplies a * b. If the result overflows, returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_mul_u64_saturating(uint64_t a, uint64_t b) { + if (a > 0 && b > 0 && a > (UINT64_MAX / b)) + return UINT64_MAX; + return a * b; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + if (a > 0 && b > 0 && a > (UINT64_MAX / b)) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a * b; + return AWS_OP_SUCCESS; +} + +/** + * Multiplies a * b. If the result overflows, returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_mul_u32_saturating(uint32_t a, uint32_t b) { + if (a > 0 && b > 0 && a > (UINT32_MAX / b)) + return UINT32_MAX; + return a * b; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + if (a > 0 && b > 0 && a > (UINT32_MAX / b)) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a * b; + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_add_u64_saturating(uint64_t a, uint64_t b) { + if ((b > 0) && (a > (UINT64_MAX - b))) + return UINT64_MAX; + return a + b; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + if ((b > 0) && (a > (UINT64_MAX - b))) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a + b; + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_add_u32_saturating(uint32_t a, uint32_t b) { + if ((b > 0) && (a > (UINT32_MAX - b))) + return UINT32_MAX; + return a + b; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + if ((b > 0) && (a > (UINT32_MAX - b))) + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + *r = a + b; + return AWS_OP_SUCCESS; +} + +/** + * Search from the MSB to LSB, looking for a 1 + */ +AWS_STATIC_IMPL size_t aws_clz_u32(uint32_t n) { + return aws_clz_i32((int32_t)n); +} + +AWS_STATIC_IMPL size_t aws_clz_i32(int32_t n) { + size_t idx = 0; + if (n == 0) { + return sizeof(n) * 8; + } + /* sign bit is the first bit */ + if (n < 0) { + return 0; + } + while (n >= 0) { + ++idx; + n <<= 1; + } + return idx; +} + +AWS_STATIC_IMPL size_t aws_clz_u64(uint64_t n) { + return aws_clz_i64((int64_t)n); +} + +AWS_STATIC_IMPL size_t aws_clz_i64(int64_t n) { + size_t idx = 0; + if (n == 0) { + return sizeof(n) * 8; + } + /* sign bit is the first bit */ + if (n < 0) { + return 0; + } + while (n >= 0) { + ++idx; + n <<= 1; + } + return idx; +} + +AWS_STATIC_IMPL size_t aws_clz_size(size_t n) { +#if SIZE_BITS == 64 + return aws_clz_u64(n); +#else + return aws_clz_u32(n); +#endif +} + +/** + * Search from the LSB to MSB, looking for a 1 + */ +AWS_STATIC_IMPL size_t aws_ctz_u32(uint32_t n) { + return aws_ctz_i32((int32_t)n); +} + +AWS_STATIC_IMPL size_t aws_ctz_i32(int32_t n) { + int32_t idx = 0; + const int32_t max_bits = (int32_t)(SIZE_BITS / sizeof(uint8_t)); + if (n == 0) { + return sizeof(n) * 8; + } + while (idx < max_bits) { + if (n & (1 << idx)) { + break; + } + ++idx; + } + return (size_t)idx; +} + +AWS_STATIC_IMPL size_t aws_ctz_u64(uint64_t n) { + return aws_ctz_i64((int64_t)n); +} + +AWS_STATIC_IMPL size_t aws_ctz_i64(int64_t n) { + int64_t idx = 0; + const int64_t max_bits = (int64_t)(SIZE_BITS / sizeof(uint8_t)); + if (n == 0) { + return sizeof(n) * 8; + } + while (idx < max_bits) { + if (n & (1ULL << idx)) { + break; + } + ++idx; + } + return (size_t)idx; +} + +AWS_STATIC_IMPL size_t aws_ctz_size(size_t n) { +#if SIZE_BITS == 64 + return aws_ctz_u64(n); +#else + return aws_ctz_u32(n); +#endif +} + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_MATH_FALLBACK_INL */ diff --git a/include/aws/common/math.gcc_arm64_asm.inl b/include/aws/common/math.gcc_arm64_asm.inl new file mode 100644 index 0000000000000000000000000000000000000000..b068fff169b1ed1883648ceece242f232cab642b --- /dev/null +++ b/include/aws/common/math.gcc_arm64_asm.inl @@ -0,0 +1,184 @@ +#ifndef AWS_COMMON_MATH_GCC_ARM64_ASM_INL +#define AWS_COMMON_MATH_GCC_ARM64_ASM_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* + * This header is already included, but include it again to make editor + * highlighting happier. + */ +#include +#include + +/* clang-format off */ + +AWS_EXTERN_C_BEGIN + +/** + * Multiplies a * b. If the result overflows, returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_mul_u64_saturating(uint64_t a, uint64_t b) { + /* We can use inline assembly to do this efficiently on arm64 by doing + a high-mul and checking the upper 64 bits of a 64x64->128b multiply + are zero */ + uint64_t tmp = 0, res = 0; + __asm__("umulh %x[hmul], %x[arga], %x[argb]\n" + "mul %x[res], %x[arga], %x[argb]\n" + "cmp %x[hmul], #0\n" + "csinv %x[res], %x[res], xzr, eq\n" + : /* inout: hmul is upper 64b, r is the result */ [hmul] "+&r"(tmp), [res]"+&r"(res) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b) + : /* clobbers: cc (cmp clobbers condition codes) */ "cc"); + + return res; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + /* We can use inline assembly to do this efficiently on arm64 by doing + a high-mul and checking the upper 64 bits of a 64x64->128b multiply + are zero */ + + uint64_t tmp, res; + __asm__("umulh %x[hmul], %x[arga], %x[argb]\n" + "mul %x[res], %x[arga], %x[argb]\n" + : /* inout: hmul is upper 64b, r is the result */ [hmul] "=&r"(tmp), [res]"=&r"(res) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b)); + + *r = res; + if (tmp) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * Multiplies a * b. If the result overflows, returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_mul_u32_saturating(uint32_t a, uint32_t b) { + /* We can use inline assembly to do this efficiently on arm64 by doing + a high-mul and checking the upper 32 bits of a 32x32->64b multiply + are zero */ + + uint64_t res = 0; + __asm__("umull %x[res], %w[arga], %w[argb]\n" + "cmp xzr, %x[res], lsr #32\n" + "csinv %w[res], %w[res], wzr, eq\n" + : /* inout: res contains both lower/upper 32b */ [res]"+&r"(res) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b) + : /* clobbers: cc (cmp clobbers condition codes) */ "cc"); + + return res & 0xffffffff; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + /* We can use inline assembly to do this efficiently on arm64 by doing + a high-mul and checking the upper 32 bits of a 32x32->64b multiply + are zero */ + + uint64_t res; + __asm__("umull %x[res], %w[arga], %w[argb]\n" + : /* inout: res is both upper/lower 32b */ [res]"=r"(res) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b)); + + *r = res & 0xffffffff; + if (res >> 32) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + /* We can use inline assembly to do this efficiently on arm64 by doing a + * 64b + 64b add and checking the carry out */ + + uint64_t res, flag; + __asm__("adds %x[res], %x[arga], %x[argb]\n" + "csinv %x[flag], xzr, xzr, cc\n" + : /* inout: res is the result of addition; flag is -1 if carry happened */ + [res]"=&r"(res), [flag] "=r"(flag) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b) + : /* clobbers: cc (cmp clobbers condition codes) */ "cc"); + + *r = res; + if (flag) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows, returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_add_u64_saturating(uint64_t a, uint64_t b) { + /* We can use inline assembly to do this efficiently on arm64 by doing a + * 64b + 64b add and checking the carry out */ + + uint64_t res; + __asm__("adds %x[res], %x[arga], %x[argb]\n" + "csinv %x[res], %x[res], xzr, cc\n" + : /* inout: res is the result */ [res]"=&r"(res) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b) + : /* clobbers: cc (cmp clobbers condition codes) */ "cc"); + + return res; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + /* We can use inline assembly to do this efficiently on arm64 by doing a + * 32b + 32b add and checking the carry out */ + + uint32_t res, flag; + __asm__("adds %w[res], %w[arga], %w[argb]\n" + "csinv %w[flag], wzr, wzr, cc\n" + : /* inout: res is 32b result */ [res]"=&r"(res), [flag] "=r"(flag) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b) + : /* clobbers: cc (cmp clobbers condition codes) */ "cc"); + + *r = res; + if (flag) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows, returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_add_u32_saturating(uint32_t a, uint32_t b) { + /* We can use inline assembly to do this efficiently on arm64 by doing a + * 32b + 32b add and checking the carry out */ + + uint32_t res = 0; + __asm__("adds %w[res], %w[arga], %w[argb]\n" + "csinv %w[res], %w[res], wzr, cc\n" + : /* inout: res is the result */ [res]"+&r"(res) + : /* in: a and b */ [arga] "r"(a), [argb] "r"(b) + : /* clobbers: cc (cmp clobbers condition codes) */ "cc"); + + return res; +} + +AWS_EXTERN_C_END + +/* clang-format on */ + +#endif /* AWS_COMMON_MATH_GCC_ARM64_ASM_INL */ diff --git a/include/aws/common/math.gcc_overflow.inl b/include/aws/common/math.gcc_overflow.inl new file mode 100644 index 0000000000000000000000000000000000000000..24ce3f0e00fef650843885f384778d8366134218 --- /dev/null +++ b/include/aws/common/math.gcc_overflow.inl @@ -0,0 +1,115 @@ +#ifndef AWS_COMMON_MATH_GCC_OVERFLOW_INL +#define AWS_COMMON_MATH_GCC_OVERFLOW_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* + * This header is already included, but include it again to make editor + * highlighting happier. + */ +#include +#include + +AWS_EXTERN_C_BEGIN +/** + * Multiplies a * b. If the result overflows, returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_mul_u64_saturating(uint64_t a, uint64_t b) { + uint64_t res; + + if (__builtin_mul_overflow(a, b, &res)) { + res = UINT64_MAX; + } + + return res; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + if (__builtin_mul_overflow(a, b, r)) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * Multiplies a * b. If the result overflows, returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_mul_u32_saturating(uint32_t a, uint32_t b) { + uint32_t res; + + if (__builtin_mul_overflow(a, b, &res)) { + res = UINT32_MAX; + } + + return res; +} + +/** + * If a * b overflows, returns AWS_OP_ERR; otherwise multiplies + * a * b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_mul_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + if (__builtin_mul_overflow(a, b, r)) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u64_checked(uint64_t a, uint64_t b, uint64_t *r) { + if (__builtin_add_overflow(a, b, r)) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows, returns 2^64 - 1. + */ +AWS_STATIC_IMPL uint64_t aws_add_u64_saturating(uint64_t a, uint64_t b) { + uint64_t res; + + if (__builtin_add_overflow(a, b, &res)) { + res = UINT64_MAX; + } + + return res; +} + +/** + * If a + b overflows, returns AWS_OP_ERR; otherwise adds + * a + b, returns the result in *r, and returns AWS_OP_SUCCESS. + */ +AWS_STATIC_IMPL int aws_add_u32_checked(uint32_t a, uint32_t b, uint32_t *r) { + if (__builtin_add_overflow(a, b, r)) { + return aws_raise_error(AWS_ERROR_OVERFLOW_DETECTED); + } + return AWS_OP_SUCCESS; +} + +/** + * Adds a + b. If the result overflows, returns 2^32 - 1. + */ +AWS_STATIC_IMPL uint32_t aws_add_u32_saturating(uint32_t a, uint32_t b) { + uint32_t res; + + if (__builtin_add_overflow(a, b, &res)) { + res = UINT32_MAX; + } + + return res; +} + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_MATH_GCC_OVERFLOW_INL */ diff --git a/include/aws/common/package.h b/include/aws/common/package.h new file mode 100644 index 0000000000000000000000000000000000000000..c93fd5109ca44cb80f45050176b950b68161e23b --- /dev/null +++ b/include/aws/common/package.h @@ -0,0 +1,21 @@ +#ifndef AWS_COMMON_PACKAGE_H +#define AWS_COMMON_PACKAGE_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* + * Preliminary cap on the number of possible aws-c-libraries participating in shared enum ranges for + * errors, log subjects, and other cross-library enums. Expandable as needed + */ +#define AWS_PACKAGE_SLOTS 32 + +/* + * Each aws-c-* and aws-crt-* library has a unique package id starting from zero. These are used to macro-calculate + * correct ranges for the cross-library enumerations. + */ +#define AWS_C_COMMON_PACKAGE_ID 0 + +#endif /* AWS_COMMON_PACKAGE_H */ diff --git a/include/aws/common/priority_queue.h b/include/aws/common/priority_queue.h new file mode 100644 index 0000000000000000000000000000000000000000..26b35e9911ca0be02a02a28b18d0267e3a47a151 --- /dev/null +++ b/include/aws/common/priority_queue.h @@ -0,0 +1,205 @@ +#ifndef AWS_COMMON_PRIORITY_QUEUE_H +#define AWS_COMMON_PRIORITY_QUEUE_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +/* The comparator should return a positive value if the second argument has a + * higher priority than the first; Otherwise, it should return a negative value + * or zero. NOTE: priority_queue pops its highest priority element first. For + * example: int cmp(const void *a, const void *b) { return a < b; } would result + * in a max heap, while: int cmp(const void *a, const void *b) { return a > b; } + * would result in a min heap. + */ +typedef int(aws_priority_queue_compare_fn)(const void *a, const void *b); + +struct aws_priority_queue { + /** + * predicate that determines the priority of the elements in the queue. + */ + aws_priority_queue_compare_fn *pred; + + /** + * The underlying container storing the queue elements. + */ + struct aws_array_list container; + + /** + * An array of pointers to backpointer elements. This array is initialized when + * the first call to aws_priority_queue_push_bp is made, and is subsequently maintained + * through any heap node manipulations. + * + * Each element is a struct aws_priority_queue_node *, pointing to a backpointer field + * owned by the calling code, or a NULL. The backpointer field is continually updated + * with information needed to locate and remove a specific node later on. + */ + struct aws_array_list backpointers; +}; + +struct aws_priority_queue_node { + /** The current index of the node in question, or SIZE_MAX if the node has been removed. */ + size_t current_index; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes a priority queue struct for use. This mode will grow memory automatically (exponential model) + * Default size is the inital size of the queue + * item_size is the size of each element in bytes. Mixing items types is not supported by this API. + * pred is the function that will be used to determine priority. + */ +AWS_COMMON_API +int aws_priority_queue_init_dynamic( + struct aws_priority_queue *queue, + struct aws_allocator *alloc, + size_t default_size, + size_t item_size, + aws_priority_queue_compare_fn *pred); + +/** + * Initializes a priority queue struct for use. This mode will not allocate any additional memory. When the heap fills + * new enqueue operations will fail with AWS_ERROR_PRIORITY_QUEUE_FULL. + * + * Heaps initialized using this call do not support the aws_priority_queue_push_ref call with a non-NULL backpointer + * parameter. + * + * heap is the raw memory allocated for this priority_queue + * item_count is the maximum number of elements the raw heap can contain + * item_size is the size of each element in bytes. Mixing items types is not supported by this API. + * pred is the function that will be used to determine priority. + */ +AWS_COMMON_API +void aws_priority_queue_init_static( + struct aws_priority_queue *queue, + void *heap, + size_t item_count, + size_t item_size, + aws_priority_queue_compare_fn *pred); + +/** + * Checks that the backpointer at a specific index of the queue is + * NULL or points to a correctly allocated aws_priority_queue_node. + */ +bool aws_priority_queue_backpointer_index_valid(const struct aws_priority_queue *const queue, size_t index); + +/** + * Checks that the backpointers of the priority queue are either NULL + * or correctly allocated to point at aws_priority_queue_nodes. This + * check is O(n), as it accesses every backpointer in a loop, and thus + * shouldn't be used carelessly. + */ +bool aws_priority_queue_backpointers_valid_deep(const struct aws_priority_queue *const queue); + +/** + * Checks that the backpointers of the priority queue satisfy validity + * constraints. + */ +bool aws_priority_queue_backpointers_valid(const struct aws_priority_queue *const queue); + +/** + * Set of properties of a valid aws_priority_queue. + */ +AWS_COMMON_API +bool aws_priority_queue_is_valid(const struct aws_priority_queue *const queue); + +/** + * Cleans up any internally allocated memory and resets the struct for reuse or deletion. + */ +AWS_COMMON_API +void aws_priority_queue_clean_up(struct aws_priority_queue *queue); + +/** + * Copies item into the queue and places it in the proper priority order. Complexity: O(log(n)). + */ +AWS_COMMON_API +int aws_priority_queue_push(struct aws_priority_queue *queue, void *item); + +/** + * Copies item into the queue and places it in the proper priority order. Complexity: O(log(n)). + * + * If the backpointer parameter is non-null, the heap will continually update the pointed-to field + * with information needed to remove the node later on. *backpointer must remain valid until the node + * is removed from the heap, and may be updated on any mutating operation on the priority queue. + * + * If the node is removed, the backpointer will be set to a sentinel value that indicates that the + * node has already been removed. It is safe (and a no-op) to call aws_priority_queue_remove with + * such a sentinel value. + */ +AWS_COMMON_API +int aws_priority_queue_push_ref( + struct aws_priority_queue *queue, + void *item, + struct aws_priority_queue_node *backpointer); + +/** + * Copies the element of the highest priority, and removes it from the queue.. Complexity: O(log(n)). + * If queue is empty, AWS_ERROR_PRIORITY_QUEUE_EMPTY will be raised. + */ +AWS_COMMON_API +int aws_priority_queue_pop(struct aws_priority_queue *queue, void *item); + +/** + * Removes a specific node from the priority queue. Complexity: O(log(n)) + * After removing a node (using either _remove or _pop), the backpointer set at push_ref time is set + * to a sentinel value. If this sentinel value is passed to aws_priority_queue_remove, + * AWS_ERROR_PRIORITY_QUEUE_BAD_NODE will be raised. Note, however, that passing uninitialized + * aws_priority_queue_nodes, or ones from different priority queues, results in undefined behavior. + */ +AWS_COMMON_API +int aws_priority_queue_remove(struct aws_priority_queue *queue, void *item, const struct aws_priority_queue_node *node); + +/** + * Obtains a pointer to the element of the highest priority. Complexity: constant time. + * If queue is empty, AWS_ERROR_PRIORITY_QUEUE_EMPTY will be raised. + */ +AWS_COMMON_API +int aws_priority_queue_top(const struct aws_priority_queue *queue, void **item); + +/** + * Removes all elements from the queue, but does not free internal memory. + */ +AWS_COMMON_API +void aws_priority_queue_clear(struct aws_priority_queue *queue); + +/** + * Current number of elements in the queue + */ +AWS_COMMON_API +size_t aws_priority_queue_size(const struct aws_priority_queue *queue); + +/** + * Current allocated capacity for the queue, in dynamic mode this grows over time, in static mode, this will never + * change. + */ +AWS_COMMON_API +size_t aws_priority_queue_capacity(const struct aws_priority_queue *queue); + +/** + * Initializes a queue node to a default value that indicates the node is not in the queue. + * + * @param node priority queue node to initialize with a default value + */ +AWS_COMMON_API +void aws_priority_queue_node_init(struct aws_priority_queue_node *node); + +/** + * Checks if a priority queue node is currently in a priority queue. + * + * @param node priority queue node to check usage for + * + * @return true if the node is in a queue, false otherwise + */ +AWS_COMMON_API +bool aws_priority_queue_node_is_in_queue(const struct aws_priority_queue_node *node); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_PRIORITY_QUEUE_H */ diff --git a/include/aws/common/ref_count.h b/include/aws/common/ref_count.h new file mode 100644 index 0000000000000000000000000000000000000000..43fbde5e549f8b646dac447c33fb11b667c96684 --- /dev/null +++ b/include/aws/common/ref_count.h @@ -0,0 +1,56 @@ +#ifndef AWS_COMMON_REF_COUNT_H +#define AWS_COMMON_REF_COUNT_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +/* + * A utility type for making ref-counted types, reminiscent of std::shared_ptr in C++ + */ +struct aws_ref_count { + struct aws_atomic_var ref_count; + void *object; + aws_simple_completion_callback *on_zero_fn; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes a ref-counter structure. After initialization, the ref count will be 1. + * + * @param ref_count ref-counter to initialize + * @param object object being ref counted + * @param on_zero_fn function to invoke when the ref count reaches zero + */ +AWS_COMMON_API void aws_ref_count_init( + struct aws_ref_count *ref_count, + void *object, + aws_simple_completion_callback *on_zero_fn); + +/** + * Increments a ref-counter's ref count + * + * @param ref_count ref-counter to increment the count for + * @return the object being ref-counted + */ +AWS_COMMON_API void *aws_ref_count_acquire(struct aws_ref_count *ref_count); + +/** + * Decrements a ref-counter's ref count. Invokes the on_zero callback if the ref count drops to zero + * @param ref_count ref-counter to decrement the count for + * @return the value of the decremented ref count + */ +AWS_COMMON_API size_t aws_ref_count_release(struct aws_ref_count *ref_count); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_REF_COUNT_H */ diff --git a/include/aws/common/ring_buffer.h b/include/aws/common/ring_buffer.h new file mode 100644 index 0000000000000000000000000000000000000000..e798d5d1d2b84aaa0c73d5957f2f18f5942ba700 --- /dev/null +++ b/include/aws/common/ring_buffer.h @@ -0,0 +1,104 @@ +#ifndef AWS_COMMON_RING_BUFFER_H +#define AWS_COMMON_RING_BUFFER_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +/** + * Lockless ring buffer implementation that is thread safe assuming a single thread acquires and a single thread + * releases. For any other use case (other than the single-threaded use-case), you must manage thread-safety manually. + * + * Also, a very important note: release must happen in the same order as acquire. If you do not your application, and + * possibly computers within a thousand mile radius, may die terrible deaths, and the local drinking water will be + * poisoned for generations with fragments of what is left of your radioactive corrupted memory. + */ +struct aws_ring_buffer { + struct aws_allocator *allocator; + uint8_t *allocation; + struct aws_atomic_var head; + struct aws_atomic_var tail; + uint8_t *allocation_end; +}; + +struct aws_byte_buf; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes a ring buffer with an allocation of size `size`. Returns AWS_OP_SUCCESS on a successful initialization, + * AWS_OP_ERR otherwise. + */ +AWS_COMMON_API int aws_ring_buffer_init(struct aws_ring_buffer *ring_buf, struct aws_allocator *allocator, size_t size); + +/* + * Checks whether atomic_ptr correctly points to a memory location within the bounds of the aws_ring_buffer + */ +AWS_STATIC_IMPL bool aws_ring_buffer_check_atomic_ptr( + const struct aws_ring_buffer *ring_buf, + const uint8_t *atomic_ptr); +/** + * Checks whether the ring buffer is empty + */ +AWS_STATIC_IMPL bool aws_ring_buffer_is_empty(const struct aws_ring_buffer *ring_buf); + +/** + * Evaluates the set of properties that define the shape of all valid aws_ring_buffer structures. + * It is also a cheap check, in the sense it run in constant time (i.e., no loops or recursion). + */ +AWS_STATIC_IMPL bool aws_ring_buffer_is_valid(const struct aws_ring_buffer *ring_buf); + +/** + * Cleans up the ring buffer's resources. + */ +AWS_COMMON_API void aws_ring_buffer_clean_up(struct aws_ring_buffer *ring_buf); + +/** + * Attempts to acquire `requested_size` buffer and stores the result in `dest` if successful. Returns AWS_OP_SUCCESS if + * the requested size was available for use, AWS_OP_ERR otherwise. + */ +AWS_COMMON_API int aws_ring_buffer_acquire( + struct aws_ring_buffer *ring_buf, + size_t requested_size, + struct aws_byte_buf *dest); + +/** + * Attempts to acquire `requested_size` buffer and stores the result in `dest` if successful. If not available, it will + * attempt to acquire anywhere from 1 byte to `requested_size`. Returns AWS_OP_SUCCESS if some buffer space is available + * for use, AWS_OP_ERR otherwise. + */ +AWS_COMMON_API int aws_ring_buffer_acquire_up_to( + struct aws_ring_buffer *ring_buf, + size_t minimum_size, + size_t requested_size, + struct aws_byte_buf *dest); + +/** + * Releases `buf` back to the ring buffer for further use. RELEASE MUST HAPPEN in the SAME ORDER AS ACQUIRE. + * If you do not, your application, and possibly computers within a thousand mile radius, may die terrible deaths, + * and the local drinking water will be poisoned for generations + * with fragments of what is left of your radioactive corrupted memory. + */ +AWS_COMMON_API void aws_ring_buffer_release(struct aws_ring_buffer *ring_buffer, struct aws_byte_buf *buf); + +/** + * Returns true if the memory in `buf` was vended by this ring buffer, false otherwise. + * Make sure `buf->buffer` and `ring_buffer->allocation` refer to the same memory region. + */ +AWS_COMMON_API bool aws_ring_buffer_buf_belongs_to_pool( + const struct aws_ring_buffer *ring_buffer, + const struct aws_byte_buf *buf); + +AWS_EXTERN_C_END + +#ifndef AWS_NO_STATIC_IMPL +# include +#endif /* AWS_NO_STATIC_IMPL */ + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_RING_BUFFER_H */ diff --git a/include/aws/common/ring_buffer.inl b/include/aws/common/ring_buffer.inl new file mode 100644 index 0000000000000000000000000000000000000000..34e76a4a1390504cd5076ddab92351ecf875a30b --- /dev/null +++ b/include/aws/common/ring_buffer.inl @@ -0,0 +1,44 @@ +#ifndef AWS_COMMON_RING_BUFFER_INL +#define AWS_COMMON_RING_BUFFER_INL +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_EXTERN_C_BEGIN +/* + * Checks whether atomic_ptr correctly points to a memory location within the bounds of the aws_ring_buffer + */ +AWS_STATIC_IMPL bool aws_ring_buffer_check_atomic_ptr( + const struct aws_ring_buffer *ring_buf, + const uint8_t *atomic_ptr) { + return ((atomic_ptr != NULL) && (atomic_ptr >= ring_buf->allocation && atomic_ptr <= ring_buf->allocation_end)); +} + +/** + * Checks whether the ring buffer is empty + */ +AWS_STATIC_IMPL bool aws_ring_buffer_is_empty(const struct aws_ring_buffer *ring_buf) { + uint8_t *head = (uint8_t *)aws_atomic_load_ptr(&ring_buf->head); + uint8_t *tail = (uint8_t *)aws_atomic_load_ptr(&ring_buf->tail); + return head == tail; +} + +/** + * Evaluates the set of properties that define the shape of all valid aws_ring_buffer structures. + * It is also a cheap check, in the sense it run in constant time (i.e., no loops or recursion). + */ +AWS_STATIC_IMPL bool aws_ring_buffer_is_valid(const struct aws_ring_buffer *ring_buf) { + uint8_t *head = (uint8_t *)aws_atomic_load_ptr(&ring_buf->head); + uint8_t *tail = (uint8_t *)aws_atomic_load_ptr(&ring_buf->tail); + bool head_in_range = aws_ring_buffer_check_atomic_ptr(ring_buf, head); + bool tail_in_range = aws_ring_buffer_check_atomic_ptr(ring_buf, tail); + /* if head points-to the first element of the buffer then tail must too */ + bool valid_head_tail = (head != ring_buf->allocation) || (tail == ring_buf->allocation); + return ring_buf && (ring_buf->allocation != NULL) && head_in_range && tail_in_range && valid_head_tail && + (ring_buf->allocator != NULL); +} +AWS_EXTERN_C_END +#endif /* AWS_COMMON_RING_BUFFER_INL */ diff --git a/include/aws/common/rw_lock.h b/include/aws/common/rw_lock.h new file mode 100644 index 0000000000000000000000000000000000000000..3ee778537688d0c930ce578143070c750b1ca3e3 --- /dev/null +++ b/include/aws/common/rw_lock.h @@ -0,0 +1,71 @@ +#ifndef AWS_COMMON_RW_LOCK_H +#define AWS_COMMON_RW_LOCK_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#ifdef _WIN32 +/* NOTE: Do not use this macro before including windows.h */ +# define AWSSRW_TO_WINDOWS(pCV) (PSRWLOCK) pCV +#else +# include +#endif + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_rw_lock { +#ifdef _WIN32 + void *lock_handle; +#else + pthread_rwlock_t lock_handle; +#endif +}; + +#ifdef _WIN32 +# define AWS_RW_LOCK_INIT {.lock_handle = NULL} +#else +# define AWS_RW_LOCK_INIT {.lock_handle = PTHREAD_RWLOCK_INITIALIZER} +#endif + +AWS_EXTERN_C_BEGIN + +/** + * Initializes a new platform instance of mutex. + */ +AWS_COMMON_API int aws_rw_lock_init(struct aws_rw_lock *lock); + +/** + * Cleans up internal resources. + */ +AWS_COMMON_API void aws_rw_lock_clean_up(struct aws_rw_lock *lock); + +/** + * Blocks until it acquires the lock. While on some platforms such as Windows, + * this may behave as a reentrant mutex, you should not treat it like one. On + * platforms it is possible for it to be non-reentrant, it will be. + */ +AWS_COMMON_API int aws_rw_lock_rlock(struct aws_rw_lock *lock); +AWS_COMMON_API int aws_rw_lock_wlock(struct aws_rw_lock *lock); + +/** + * Attempts to acquire the lock but returns immediately if it can not. + * While on some platforms such as Windows, this may behave as a reentrant mutex, + * you should not treat it like one. On platforms it is possible for it to be non-reentrant, it will be. + * Note: For windows, minimum support server version is Windows Server 2008 R2 [desktop apps | UWP apps] + */ +AWS_COMMON_API int aws_rw_lock_try_rlock(struct aws_rw_lock *lock); +AWS_COMMON_API int aws_rw_lock_try_wlock(struct aws_rw_lock *lock); + +/** + * Releases the lock. + */ +AWS_COMMON_API int aws_rw_lock_runlock(struct aws_rw_lock *lock); +AWS_COMMON_API int aws_rw_lock_wunlock(struct aws_rw_lock *lock); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_RW_LOCK_H */ diff --git a/include/aws/common/statistics.h b/include/aws/common/statistics.h new file mode 100644 index 0000000000000000000000000000000000000000..efeed7228010cea76a6c5067da466ca5506aa1d6 --- /dev/null +++ b/include/aws/common/statistics.h @@ -0,0 +1,146 @@ +#ifndef AWS_COMMON_STATISTICS_H +#define AWS_COMMON_STATISTICS_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_array_list; + +typedef uint32_t aws_crt_statistics_category_t; + +/* Each library gets space for 2^^8 category entries */ +enum { + AWS_CRT_STATISTICS_CATEGORY_STRIDE_BITS = 8, +}; + +#define AWS_CRT_STATISTICS_CATEGORY_STRIDE (1U << AWS_CRT_STATISTICS_CATEGORY_STRIDE_BITS) +#define AWS_CRT_STATISTICS_CATEGORY_BEGIN_RANGE(x) ((x) * AWS_CRT_STATISTICS_CATEGORY_STRIDE) +#define AWS_CRT_STATISTICS_CATEGORY_END_RANGE(x) (((x) + 1) * AWS_CRT_STATISTICS_CATEGORY_STRIDE - 1) + +/** + * The common-specific range of the aws_crt_statistics_category cross-library enum. + * + * This enum functions as an RTTI value that lets statistics handler's interpret (via cast) a + * specific statistics structure if the RTTI value is understood. + * + * Common doesn't have any statistics structures presently, so its range is essentially empty. + * + */ +enum aws_crt_common_statistics_category { + AWSCRT_STAT_CAT_INVALID = AWS_CRT_STATISTICS_CATEGORY_BEGIN_RANGE(AWS_C_COMMON_PACKAGE_ID) +}; + +/** + * Pattern-struct that functions as a base "class" for all statistics structures. To conform + * to the pattern, a statistics structure must have its first member be the category. In that + * case it becomes "safe" to cast from aws_crt_statistics_base to the specific statistics structure + * based on the category value. + */ +struct aws_crt_statistics_base { + aws_crt_statistics_category_t category; +}; + +/** + * The start and end time, in milliseconds-since-epoch, that a set of statistics was gathered over. + */ +struct aws_crt_statistics_sample_interval { + uint64_t begin_time_ms; + uint64_t end_time_ms; +}; + +struct aws_crt_statistics_handler; + +/* + * Statistics intake function. The array_list is a list of pointers to aws_crt_statistics_base "derived" (via + * pattern) objects. The handler should iterate the list and downcast elements whose RTTI category it understands, + * while skipping those it does not understand. + */ +typedef void(aws_crt_statistics_handler_process_statistics_fn)( + struct aws_crt_statistics_handler *handler, + struct aws_crt_statistics_sample_interval *interval, + struct aws_array_list *stats, + void *context); + +/* + * Destroys a statistics handler implementation + */ +typedef void(aws_crt_statistics_handler_destroy_fn)(struct aws_crt_statistics_handler *handler); + +/* + * The period, in milliseconds, that the handler would like to be informed of statistics. Statistics generators are + * not required to honor this value, but should if able. + */ +typedef uint64_t(aws_crt_statistics_handler_get_report_interval_ms_fn)(struct aws_crt_statistics_handler *); + +/** + * Vtable for functions that all statistics handlers must implement + */ +struct aws_crt_statistics_handler_vtable { + aws_crt_statistics_handler_process_statistics_fn *process_statistics; + aws_crt_statistics_handler_destroy_fn *destroy; + aws_crt_statistics_handler_get_report_interval_ms_fn *get_report_interval_ms; +}; + +/** + * Base structure for all statistics handler implementations. + * + * A statistics handler is an object that listens to a stream of polymorphic (via the category RTTI enum) statistics + * structures emitted from some arbitrary source. In the initial implementation, statistics handlers are primarily + * attached to channels, where they monitor IO throughput and state data (from channel handlers) to determine a + * connection's health. + * + * Statistics handlers are a generalization of the timeout and bandwidth filters that are often associated with + * SDK network connections. Configurable, default implementations are defined at the protocol level (http, etc...) + * where they can be attached at connection (channel) creation time. + */ +struct aws_crt_statistics_handler { + struct aws_crt_statistics_handler_vtable *vtable; + struct aws_allocator *allocator; + void *impl; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Submits a list of statistics objects to a statistics handler for processing + * + * handler - the statistics handler that will process the statistics objects + * interval - time period over which the statistics were gathered + * stats - list of pointers to structures that can be case to aws_crt_statistics_base (i.e. have category as a first + * member) + * context - (optional) additional context specific to where the statistics handler has been attached + */ +AWS_COMMON_API +void aws_crt_statistics_handler_process_statistics( + struct aws_crt_statistics_handler *handler, + struct aws_crt_statistics_sample_interval *interval, + struct aws_array_list *stats, + void *context); + +/** + * Queries the frequency (via an interval in milliseconds) which a statistics handler would like to be informed + * of statistics. + */ +AWS_COMMON_API +uint64_t aws_crt_statistics_handler_get_report_interval_ms(struct aws_crt_statistics_handler *handler); + +/** + * completely destroys a statistics handler. The handler's cleanup function must clean up the impl portion completely + * (including its allocation, if done separately). + */ +AWS_COMMON_API +void aws_crt_statistics_handler_destroy(struct aws_crt_statistics_handler *handler); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_STATISTICS_H */ diff --git a/include/aws/common/stdbool.h b/include/aws/common/stdbool.h new file mode 100644 index 0000000000000000000000000000000000000000..f022bfe348f4a9f6a63f6ae327851a8166d654b8 --- /dev/null +++ b/include/aws/common/stdbool.h @@ -0,0 +1,30 @@ +/* clang-format off */ +/* clang-format gets confused by the #define bool line, and gives crazy indenting */ +#ifndef AWS_COMMON_STDBOOL_H +#define AWS_COMMON_STDBOOL_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#ifndef NO_STDBOOL +# include /* NOLINT(fuchsia-restrict-system-includes) */ +#else +# ifndef __cplusplus +# define bool _Bool +# define true 1 +# define false 0 +# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) +# define _Bool bool +# if __cplusplus < 201103L +/* For C++98, define bool, false, true as a GNU extension. */ +# define bool bool +# define false false +# define true true +# endif /* __cplusplus < 201103L */ +# endif /* __cplusplus */ +#endif /* NO_STDBOOL */ + +#endif /* AWS_COMMON_STDBOOL_H */ +/* clang-format on */ diff --git a/include/aws/common/system_info.h b/include/aws/common/system_info.h new file mode 100644 index 0000000000000000000000000000000000000000..91da41f9d8f607a46c082710166b19ed60319063 --- /dev/null +++ b/include/aws/common/system_info.h @@ -0,0 +1,155 @@ +#ifndef AWS_COMMON_SYSTEM_INFO_H +#define AWS_COMMON_SYSTEM_INFO_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum aws_platform_os { + AWS_PLATFORM_OS_WINDOWS, + AWS_PLATFORM_OS_MAC, + AWS_PLATFORM_OS_UNIX, +}; + +struct aws_cpu_info { + int32_t cpu_id; + bool suspected_hyper_thread; +}; + +struct aws_system_environment; + +AWS_EXTERN_C_BEGIN + +/** + * Allocates and initializes information about the system the current process is executing on. + * If successful returns an instance of aws_system_environment. If it fails, it will return NULL. + * + * Note: This api is used internally and is still early in its evolution. + * It may change in incompatible ways in the future. + */ +AWS_COMMON_API +struct aws_system_environment *aws_system_environment_load(struct aws_allocator *allocator); + +AWS_COMMON_API +struct aws_system_environment *aws_system_environment_acquire(struct aws_system_environment *env); + +AWS_COMMON_API +void aws_system_environment_release(struct aws_system_environment *env); + +/** + * Returns the virtualization vendor for the specified compute environment, e.g. "Xen, Amazon EC2, etc..." + * + * The return value may be empty and in that case no vendor was detected. + */ +AWS_COMMON_API +struct aws_byte_cursor aws_system_environment_get_virtualization_vendor(const struct aws_system_environment *env); + +/** + * Returns the product name for the specified compute environment. For example, the Amazon EC2 Instance type. + * + * The return value may be empty and in that case no vendor was detected. + */ +AWS_COMMON_API +struct aws_byte_cursor aws_system_environment_get_virtualization_product_name(const struct aws_system_environment *env); + +/** + * Returns the number of processors for the specified compute environment. + */ +AWS_COMMON_API +size_t aws_system_environment_get_processor_count(struct aws_system_environment *env); + +/** + * Returns the number of separate cpu groupings (multi-socket configurations or NUMA). + */ +AWS_COMMON_API +size_t aws_system_environment_get_cpu_group_count(const struct aws_system_environment *env); + +/* Returns the OS this was built under */ +AWS_COMMON_API +enum aws_platform_os aws_get_platform_build_os(void); + +/* Returns the number of online processors available for usage. */ +AWS_COMMON_API +size_t aws_system_info_processor_count(void); + +/** + * Returns the logical processor groupings on the system (such as multiple numa nodes). + */ +AWS_COMMON_API +uint16_t aws_get_cpu_group_count(void); + +/** + * For a group, returns the number of CPUs it contains. + */ +AWS_COMMON_API +size_t aws_get_cpu_count_for_group(uint16_t group_idx); + +/** + * Fills in cpu_ids_array with the cpu_id's for the group. To obtain the size to allocate for cpu_ids_array + * and the value for argument for cpu_ids_array_length, call aws_get_cpu_count_for_group(). + */ +AWS_COMMON_API +void aws_get_cpu_ids_for_group(uint16_t group_idx, struct aws_cpu_info *cpu_ids_array, size_t cpu_ids_array_length); + +/* Returns true if a debugger is currently attached to the process. */ +AWS_COMMON_API +bool aws_is_debugger_present(void); + +/* If a debugger is attached to the process, trip a breakpoint. */ +AWS_COMMON_API +void aws_debug_break(void); + +#if defined(AWS_HAVE_EXECINFO) || defined(_WIN32) || defined(__APPLE__) +# define AWS_BACKTRACE_STACKS_AVAILABLE +#endif + +/* + * Records a stack trace from the call site. + * Returns the number of stack entries/stack depth captured, or 0 if the operation + * is not supported on this platform + */ +AWS_COMMON_API +size_t aws_backtrace(void **stack_frames, size_t num_frames); + +/* + * Converts stack frame pointers to symbols, if symbols are available + * Returns an array up to stack_depth long, that needs to be free()ed. + * stack_depth should be the length of frames. + * Returns NULL if the platform does not support stack frame translation + * or an error occurs + */ +char **aws_backtrace_symbols(void *const *stack_frames, size_t stack_depth); + +/* + * Converts stack frame pointers to symbols, using all available system + * tools to try to produce a human readable result. This call will not be + * quick, as it shells out to addr2line or similar tools. + * On Windows, this is the same as aws_backtrace_symbols() + * Returns an array up to stack_depth long that needs to be free()ed. Missing + * frames will be NULL. + * Returns NULL if the platform does not support stack frame translation + * or an error occurs + */ +char **aws_backtrace_addr2line(void *const *stack_frames, size_t stack_depth); + +/** + * Print a backtrace from either the current stack, or (if provided) the current exception/signal + * call_site_data is siginfo_t* on POSIX, and LPEXCEPTION_POINTERS on Windows, and can be null + */ +AWS_COMMON_API +void aws_backtrace_print(FILE *fp, void *call_site_data); + +/* Log the callstack from the current stack to the currently configured aws_logger */ +AWS_COMMON_API +void aws_backtrace_log(int log_level); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_SYSTEM_INFO_H */ diff --git a/include/aws/common/system_resource_util.h b/include/aws/common/system_resource_util.h new file mode 100644 index 0000000000000000000000000000000000000000..ffe8d53e4fac6662213fb3f4c3c497e0af62302e --- /dev/null +++ b/include/aws/common/system_resource_util.h @@ -0,0 +1,30 @@ +#ifndef AWS_COMMON_SYSTEM_RESOURCE_UTIL_H +#define AWS_COMMON_SYSTEM_RESOURCE_UTIL_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +AWS_EXTERN_C_BEGIN + +struct aws_memory_usage_stats { + size_t maxrss; /* max resident set size in kilobytes since program start */ + size_t page_faults; /* num of page faults since program start */ + + size_t _reserved[8]; +}; + +/* + * Get memory usage for current process. + * Raises AWS_ERROR_SYS_CALL_FAILURE on failure. + */ +AWS_COMMON_API int aws_init_memory_usage_for_current_process(struct aws_memory_usage_stats *memory_usage); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_SYSTEM_RESOURCE_UTIL_H */ diff --git a/include/aws/common/task_scheduler.h b/include/aws/common/task_scheduler.h new file mode 100644 index 0000000000000000000000000000000000000000..a51d6e41e71506996a8332f0c5297553e67adce4 --- /dev/null +++ b/include/aws/common/task_scheduler.h @@ -0,0 +1,132 @@ +#ifndef AWS_COMMON_TASK_SCHEDULER_H +#define AWS_COMMON_TASK_SCHEDULER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_task; + +typedef enum aws_task_status { + AWS_TASK_STATUS_RUN_READY, + AWS_TASK_STATUS_CANCELED, +} aws_task_status; + +/** + * A scheduled function. + */ +typedef void(aws_task_fn)(struct aws_task *task, void *arg, enum aws_task_status); + +/* + * A task object. + * Once added to the scheduler, a task must remain in memory until its function is executed. + */ +struct aws_task { + aws_task_fn *fn; + void *arg; + uint64_t timestamp; + struct aws_linked_list_node node; + struct aws_priority_queue_node priority_queue_node; + const char *type_tag; + + /* honor the ABI compat */ + union { + bool scheduled; + size_t reserved; + } abi_extension; +}; + +struct aws_task_scheduler { + struct aws_allocator *alloc; + struct aws_priority_queue timed_queue; /* Tasks scheduled to run at specific times */ + struct aws_linked_list timed_list; /* If timed_queue runs out of memory, further timed tests are stored here */ + struct aws_linked_list asap_list; /* Tasks scheduled to run as soon as possible */ +}; + +AWS_EXTERN_C_BEGIN + +/** + * Init an aws_task + */ +AWS_COMMON_API +void aws_task_init(struct aws_task *task, aws_task_fn *fn, void *arg, const char *type_tag); + +/* + * Runs or cancels a task + */ +AWS_COMMON_API +void aws_task_run(struct aws_task *task, enum aws_task_status status); + +/** + * Initializes a task scheduler instance. + */ +AWS_COMMON_API +int aws_task_scheduler_init(struct aws_task_scheduler *scheduler, struct aws_allocator *alloc); + +/** + * Empties and executes all queued tasks, passing the AWS_TASK_STATUS_CANCELED status to the task function. + * Cleans up any memory allocated, and prepares the instance for reuse or deletion. + */ +AWS_COMMON_API +void aws_task_scheduler_clean_up(struct aws_task_scheduler *scheduler); + +AWS_COMMON_API +bool aws_task_scheduler_is_valid(const struct aws_task_scheduler *scheduler); + +/** + * Returns whether the scheduler has any scheduled tasks. + * next_task_time (optional) will be set to time of the next task, note that 0 will be set if tasks were + * added via aws_task_scheduler_schedule_now() and UINT64_MAX will be set if no tasks are scheduled at all. + */ +AWS_COMMON_API +bool aws_task_scheduler_has_tasks(const struct aws_task_scheduler *scheduler, uint64_t *next_task_time); + +/** + * Schedules a task to run immediately. + * The task should not be cleaned up or modified until its function is executed. + */ +AWS_COMMON_API +void aws_task_scheduler_schedule_now(struct aws_task_scheduler *scheduler, struct aws_task *task); + +/** + * Schedules a task to run at time_to_run. + * The task should not be cleaned up or modified until its function is executed. + */ +AWS_COMMON_API +void aws_task_scheduler_schedule_future( + struct aws_task_scheduler *scheduler, + struct aws_task *task, + uint64_t time_to_run); + +/** + * Removes task from the scheduler and invokes the task with the AWS_TASK_STATUS_CANCELED status. + */ +AWS_COMMON_API +void aws_task_scheduler_cancel_task(struct aws_task_scheduler *scheduler, struct aws_task *task); + +/** + * Sequentially execute all tasks scheduled to run at, or before current_time. + * AWS_TASK_STATUS_RUN_READY will be passed to the task function as the task status. + * + * If a task schedules another task, the new task will not be executed until the next call to this function. + */ +AWS_COMMON_API +void aws_task_scheduler_run_all(struct aws_task_scheduler *scheduler, uint64_t current_time); + +/** + * Convert a status value to a c-string suitable for logging + */ +AWS_COMMON_API +const char *aws_task_status_to_c_str(enum aws_task_status status); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_TASK_SCHEDULER_H */ diff --git a/include/aws/common/thread.h b/include/aws/common/thread.h new file mode 100644 index 0000000000000000000000000000000000000000..84180e69030c4c35e15607ccb2f04e967586d29b --- /dev/null +++ b/include/aws/common/thread.h @@ -0,0 +1,270 @@ +#ifndef AWS_COMMON_THREAD_H +#define AWS_COMMON_THREAD_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +#ifndef _WIN32 +# include +#endif + +AWS_PUSH_SANE_WARNING_LEVEL + +enum aws_thread_detach_state { + AWS_THREAD_NOT_CREATED = 1, + AWS_THREAD_JOINABLE, + AWS_THREAD_JOIN_COMPLETED, + AWS_THREAD_MANAGED, +}; + +/** + * Specifies the join strategy used on an aws_thread, which in turn controls whether or not a thread participates + * in the managed thread system. The managed thread system provides logic to guarantee a join on all participating + * threads at the cost of laziness (the user cannot control when joins happen). + * + * Manual - thread does not participate in the managed thread system; any joins must be done by the user. This + * is the default. The user must call aws_thread_clean_up(), but only after any desired join operation has completed. + * Not doing so will cause the windows handle to leak. + * + * Managed - the managed thread system will automatically perform a join some time after the thread's run function + * has completed. It is an error to call aws_thread_join on a thread configured with the managed join strategy. The + * managed thread system will call aws_thread_clean_up() on the thread after the background join has completed. + * + * Additionally, an API exists, aws_thread_join_all_managed(), which blocks and returns when all outstanding threads + * with the managed strategy have fully joined. This API is useful for tests (rather than waiting for many individual + * signals) and program shutdown or DLL unload. This API is automatically invoked by the common library clean up + * function. If the common library clean up is called from a managed thread, this will cause deadlock. + * + * Lazy thread joining is done only when threads finish their run function or when the user calls + * aws_thread_join_all_managed(). This means it may be a long time between thread function completion and the join + * being applied, but the queue of unjoined threads is always one or fewer so there is no critical resource + * backlog. + * + * Currently, only event loop group async cleanup and host resolver threads participate in the managed thread system. + * Additionally, event loop threads will increment and decrement the pending join count (they are manually joined + * internally) in order to have an accurate view of internal thread usage and also to prevent failure to release + * an event loop group fully from allowing aws_thread_join_all_managed() from running to completion when its + * intent is such that it should block instead. + */ +enum aws_thread_join_strategy { + AWS_TJS_MANUAL = 0, + AWS_TJS_MANAGED, +}; + +/** + * Thread names should be 15 characters or less. + * Longer names will not display on Linux. + * This length does not include a null terminator. + */ +#define AWS_THREAD_NAME_RECOMMENDED_STRLEN 15 + +struct aws_thread_options { + size_t stack_size; + /* default is -1. If you set this to anything >= 0, and the platform supports it, the thread will be pinned to + * that cpu. Also, we assume you're doing this for memory throughput purposes. On unix systems, + * If libnuma.so is available, upon the thread launching, the memory policy for that thread will be set to + * allocate on the numa node that cpu-core is on. + * + * On windows, this will cause the thread affinity to be set, but currently we don't do anything to tell the OS + * how to allocate memory on a node. + * + * On Apple and Android platforms, this setting doesn't do anything at all. + */ + int32_t cpu_id; + + enum aws_thread_join_strategy join_strategy; + + /** + * Thread name, for debugging purpose. + * The length should not exceed AWS_THREAD_NAME_RECOMMENDED_STRLEN(15) + * if you want it to display properly on all platforms. + */ + struct aws_byte_cursor name; +}; + +#ifdef _WIN32 +typedef union { + void *ptr; +} aws_thread_once; +# define AWS_THREAD_ONCE_STATIC_INIT {NULL} +typedef unsigned long aws_thread_id_t; +#else +typedef pthread_once_t aws_thread_once; +# define AWS_THREAD_ONCE_STATIC_INIT PTHREAD_ONCE_INIT +typedef pthread_t aws_thread_id_t; +#endif + +/* + * Buffer size needed to represent aws_thread_id_t as a string (2 hex chars per byte + * plus '\0' terminator). Needed for portable printing because pthread_t is + * opaque. + */ +#define AWS_THREAD_ID_T_REPR_BUFSZ (sizeof(aws_thread_id_t) * 2 + 1) + +struct aws_thread { + struct aws_allocator *allocator; + enum aws_thread_detach_state detach_state; +#ifdef _WIN32 + void *thread_handle; +#endif + aws_thread_id_t thread_id; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Returns an instance of system default thread options. + */ +AWS_COMMON_API +const struct aws_thread_options *aws_default_thread_options(void); + +AWS_COMMON_API void aws_thread_call_once(aws_thread_once *flag, void (*call_once)(void *), void *user_data); + +/** + * Initializes a new platform specific thread object struct (not the os-level + * thread itself). + */ +AWS_COMMON_API +int aws_thread_init(struct aws_thread *thread, struct aws_allocator *allocator); + +/** + * Creates an OS level thread and associates it with func. context will be passed to func when it is executed. + * options will be applied to the thread if they are applicable for the platform. + * + * After launch, you may join on the thread. A successfully launched thread must have clean_up called on it in order + * to avoid a handle leak. If you do not join before calling clean_up, the thread will become detached. + * + * Managed threads must not have join or clean_up called on them by external code. + */ +AWS_COMMON_API +int aws_thread_launch( + struct aws_thread *thread, + void (*func)(void *arg), + void *arg, + const struct aws_thread_options *options); + +/** + * Gets the id of thread + */ +AWS_COMMON_API +aws_thread_id_t aws_thread_get_id(struct aws_thread *thread); + +/** + * Gets the detach state of the thread. For example, is it safe to call join on + * this thread? Has it been detached()? + */ +AWS_COMMON_API +enum aws_thread_detach_state aws_thread_get_detach_state(struct aws_thread *thread); + +/** + * Joins the calling thread to a thread instance. Returns when thread is + * finished. Calling this from the associated OS thread will cause a deadlock. + */ +AWS_COMMON_API +int aws_thread_join(struct aws_thread *thread); + +/** + * Blocking call that waits for all managed threads to complete their join call. This can only be called + * from the main thread or a non-managed thread. + * + * This gets called automatically from library cleanup. + * + * By default the wait is unbounded, but that default can be overridden via aws_thread_set_managed_join_timeout_ns() + */ +AWS_COMMON_API +int aws_thread_join_all_managed(void); + +/** + * Overrides how long, in nanoseconds, that aws_thread_join_all_managed will wait for threads to complete. + * A value of zero will result in an unbounded wait. + */ +AWS_COMMON_API +void aws_thread_set_managed_join_timeout_ns(uint64_t timeout_in_ns); + +/** + * Cleans up the thread handle. Don't call this on a managed thread. If you wish to join the thread, you must join + * before calling this function. + */ +AWS_COMMON_API +void aws_thread_clean_up(struct aws_thread *thread); + +/** + * Returns the thread id of the calling thread. + */ +AWS_COMMON_API +aws_thread_id_t aws_thread_current_thread_id(void); + +/** + * Compare thread ids. + */ +AWS_COMMON_API +bool aws_thread_thread_id_equal(aws_thread_id_t t1, aws_thread_id_t t2); + +/** + * Sleeps the current thread by nanos. + */ +AWS_COMMON_API +void aws_thread_current_sleep(uint64_t nanos); + +typedef void(aws_thread_atexit_fn)(void *user_data); + +/** + * Adds a callback to the chain to be called when the current thread joins. + * Callbacks are called from the current thread, in the reverse order they + * were added, after the thread function returns. + * If not called from within an aws_thread, has no effect. + */ +AWS_COMMON_API +int aws_thread_current_at_exit(aws_thread_atexit_fn *callback, void *user_data); + +/** + * Increments the count of unjoined threads in the managed thread system. Used by managed threads and + * event loop threads. Additional usage requires the user to join corresponding threads themselves and + * correctly increment/decrement even in the face of launch/join errors. + * + * aws_thread_join_all_managed() will not return until this count has gone to zero. + */ +AWS_COMMON_API void aws_thread_increment_unjoined_count(void); + +/** + * Decrements the count of unjoined threads in the managed thread system. Used by managed threads and + * event loop threads. Additional usage requires the user to join corresponding threads themselves and + * correctly increment/decrement even in the face of launch/join errors. + * + * aws_thread_join_all_managed() will not return until this count has gone to zero. + */ +AWS_COMMON_API void aws_thread_decrement_unjoined_count(void); + +/** + * Gets name of the current thread. + * Caller is responsible for destroying returned string. + * If thread does not have a name, AWS_OP_SUCCESS is returned and out_name is + * set to NULL. + * If underlying OS call fails, AWS_ERROR_SYS_CALL_FAILURE will be raised + * If OS does not support getting thread name, AWS_ERROR_PLATFORM_NOT_SUPPORTED + * will be raised + */ +AWS_COMMON_API int aws_thread_current_name(struct aws_allocator *allocator, struct aws_string **out_name); + +/** + * Gets name of the thread. + * Caller is responsible for destroying returned string. + * If thread does not have a name, AWS_OP_SUCCESS is returned and out_name is + * set to NULL. + * If underlying OS call fails, AWS_ERROR_SYS_CALL_FAILURE will be raised + * If OS does not support getting thread name, AWS_ERROR_PLATFORM_NOT_SUPPORTED + * will be raised + */ +AWS_COMMON_API int aws_thread_name( + struct aws_allocator *allocator, + aws_thread_id_t thread_id, + struct aws_string **out_name); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_THREAD_H */ diff --git a/include/aws/common/time.h b/include/aws/common/time.h new file mode 100644 index 0000000000000000000000000000000000000000..f5cfe31ad50175adb755ce1e15ebb53f72b7cc09 --- /dev/null +++ b/include/aws/common/time.h @@ -0,0 +1,32 @@ +#ifndef AWS_COMMON_TIME_H +#define AWS_COMMON_TIME_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL +AWS_EXTERN_C_BEGIN + +/** + * Cross platform friendly version of timegm + */ +AWS_COMMON_API time_t aws_timegm(struct tm *const t); + +/** + * Cross platform friendly version of localtime_r + */ +AWS_COMMON_API void aws_localtime(time_t time, struct tm *t); + +/** + * Cross platform friendly version of gmtime_r + */ +AWS_COMMON_API void aws_gmtime(time_t time, struct tm *t); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_TIME_H */ diff --git a/include/aws/common/uri.h b/include/aws/common/uri.h new file mode 100644 index 0000000000000000000000000000000000000000..137ba7df800e7e9f1871b344ecebc31f2278bca0 --- /dev/null +++ b/include/aws/common/uri.h @@ -0,0 +1,187 @@ +#ifndef AWS_COMMON_URI_H +#define AWS_COMMON_URI_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +/** + * Data representing a URI. uri_str is always allocated and filled in. + * The other portions are merely storing offsets into uri_str. + */ +struct aws_uri { + size_t self_size; + struct aws_allocator *allocator; + struct aws_byte_buf uri_str; + struct aws_byte_cursor scheme; + struct aws_byte_cursor authority; + struct aws_byte_cursor userinfo; + struct aws_byte_cursor user; + struct aws_byte_cursor password; + struct aws_byte_cursor host_name; + uint32_t port; + struct aws_byte_cursor path; + struct aws_byte_cursor query_string; + struct aws_byte_cursor path_and_query; +}; + +/** + * key/value pairs for a query string. If the query fragment was not in format key=value, the fragment value + * will be stored in key + */ +struct aws_uri_param { + struct aws_byte_cursor key; + struct aws_byte_cursor value; +}; + +/** + * Arguments for building a URI instance. All members must + * be initialized before passing them to aws_uri_init(). + * + * query_string and query_params are exclusive to each other. If you set + * query_string, do not prepend it with '?' + */ +struct aws_uri_builder_options { + struct aws_byte_cursor scheme; + struct aws_byte_cursor path; + struct aws_byte_cursor host_name; + uint32_t port; + struct aws_array_list *query_params; + struct aws_byte_cursor query_string; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Parses 'uri_str' and initializes uri. Returns AWS_OP_SUCCESS, on success, AWS_OP_ERR on failure. + * After calling this function, the parts can be accessed. + */ +AWS_COMMON_API int aws_uri_init_parse( + struct aws_uri *uri, + struct aws_allocator *allocator, + const struct aws_byte_cursor *uri_str); + +/** + * Initializes uri to values specified in options. Returns AWS_OP_SUCCESS, on success, AWS_OP_ERR on failure. + * After calling this function, the parts can be accessed. + */ +AWS_COMMON_API int aws_uri_init_from_builder_options( + struct aws_uri *uri, + struct aws_allocator *allocator, + struct aws_uri_builder_options *options); +AWS_COMMON_API void aws_uri_clean_up(struct aws_uri *uri); + +/** + * Returns the scheme portion of the uri (e.g. http, https, ftp, ftps, etc...). If the scheme was not present + * in the uri, the returned value will be empty. It is the users job to determine the appropriate defaults + * if this field is empty, based on protocol, port, etc... + */ +AWS_COMMON_API const struct aws_byte_cursor *aws_uri_scheme(const struct aws_uri *uri); + +/** + * Returns the authority portion of the uri (host[:port]). If it was not present, this was a request uri. In that + * case, the value will be empty. + */ +AWS_COMMON_API const struct aws_byte_cursor *aws_uri_authority(const struct aws_uri *uri); + +/** + * Returns the path portion of the uri, including any leading '/'. If not present, this value will be empty. + */ +AWS_COMMON_API const struct aws_byte_cursor *aws_uri_path(const struct aws_uri *uri); + +/** + * Returns the query string portion of the uri, minus the '?'. If not present, this value will be empty. + */ +AWS_COMMON_API const struct aws_byte_cursor *aws_uri_query_string(const struct aws_uri *uri); + +/** + * Returns the 'host_name' portion of the authority. If no authority was present, this value will be empty. + */ +AWS_COMMON_API const struct aws_byte_cursor *aws_uri_host_name(const struct aws_uri *uri); + +/** + * Returns the port portion of the authority if it was present, otherwise, returns 0. + * If this is 0, it is the users job to determine the correct port based on scheme and protocol. + */ +AWS_COMMON_API uint32_t aws_uri_port(const struct aws_uri *uri); + +/** + * Returns the path and query portion of the uri (i.e., the thing you send across the wire). + */ +AWS_COMMON_API const struct aws_byte_cursor *aws_uri_path_and_query(const struct aws_uri *uri); + +/** + * For iterating over the params in the query string. + * `param` is an in/out argument used to track progress, it MUST be zeroed out to start. + * If true is returned, `param` contains the value of the next param. + * If false is returned, there are no further params. + * + * Edge cases: + * 1) Entries without '=' sign are treated as having a key and no value. + * Example: First param in query string "a&b=c" has key="a" value="" + * + * 2) Blank entries are skipped. + * Example: The only param in query string "&&a=b" is key="a" value="b" + */ +AWS_COMMON_API bool aws_query_string_next_param(struct aws_byte_cursor query_string, struct aws_uri_param *param); + +/** + * Parses query string and stores the parameters in 'out_params'. Returns AWS_OP_SUCCESS on success and + * AWS_OP_ERR on failure. The user is responsible for initializing out_params with item size of struct aws_query_param. + * The user is also responsible for cleaning up out_params when finished. + */ +AWS_COMMON_API int aws_query_string_params(struct aws_byte_cursor query_string, struct aws_array_list *out_params); + +/** + * For iterating over the params in the uri query string. + * `param` is an in/out argument used to track progress, it MUST be zeroed out to start. + * If true is returned, `param` contains the value of the next param. + * If false is returned, there are no further params. + * + * Edge cases: + * 1) Entries without '=' sign are treated as having a key and no value. + * Example: First param in query string "a&b=c" has key="a" value="" + * + * 2) Blank entries are skipped. + * Example: The only param in query string "&&a=b" is key="a" value="b" + */ +AWS_COMMON_API bool aws_uri_query_string_next_param(const struct aws_uri *uri, struct aws_uri_param *param); + +/** + * Parses query string and stores the parameters in 'out_params'. Returns AWS_OP_SUCCESS on success and + * AWS_OP_ERR on failure. The user is responsible for initializing out_params with item size of struct aws_query_param. + * The user is also responsible for cleaning up out_params when finished. + */ +AWS_COMMON_API int aws_uri_query_string_params(const struct aws_uri *uri, struct aws_array_list *out_params); + +/** + * Writes the uri path encoding of a cursor to a buffer. This is the modified version of rfc3986 used by + * sigv4 signing. + */ +AWS_COMMON_API int aws_byte_buf_append_encoding_uri_path( + struct aws_byte_buf *buffer, + const struct aws_byte_cursor *cursor); + +/** + * Writes the uri query param encoding (passthrough alnum + '-' '_' '~' '.') of a UTF-8 cursor to a buffer + * For example, reading "a b_c" would write "a%20b_c". + */ +AWS_COMMON_API int aws_byte_buf_append_encoding_uri_param( + struct aws_byte_buf *buffer, + const struct aws_byte_cursor *cursor); + +/** + * Writes the uri decoding of a UTF-8 cursor to a buffer, + * replacing %xx escapes by their single byte equivalent. + * For example, reading "a%20b_c" would write "a b_c". + */ +AWS_COMMON_API int aws_byte_buf_append_decoding_uri(struct aws_byte_buf *buffer, const struct aws_byte_cursor *cursor); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_URI_H */ diff --git a/include/aws/common/uuid.h b/include/aws/common/uuid.h new file mode 100644 index 0000000000000000000000000000000000000000..60e12d703f1e9cfc4681650027f18cc7ecbb5c94 --- /dev/null +++ b/include/aws/common/uuid.h @@ -0,0 +1,35 @@ +#ifndef AWS_COMMON_UUID_H +#define AWS_COMMON_UUID_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_byte_cursor; +struct aws_byte_buf; + +struct aws_uuid { + uint8_t uuid_data[16]; +}; + +/* 36 bytes for the UUID plus one more for the null terminator. */ +enum { AWS_UUID_STR_LEN = 37 }; +/* 32 bytes for the UUID (no dashes) plus one more for the null terminator. */ +enum { AWS_UUID_STR_COMPACT_LEN = 33 }; + +AWS_EXTERN_C_BEGIN + +AWS_COMMON_API int aws_uuid_init(struct aws_uuid *uuid); +AWS_COMMON_API int aws_uuid_init_from_str(struct aws_uuid *uuid, const struct aws_byte_cursor *uuid_str); +AWS_COMMON_API int aws_uuid_to_str(const struct aws_uuid *uuid, struct aws_byte_buf *output); +AWS_COMMON_API int aws_uuid_to_str_compact(const struct aws_uuid *uuid, struct aws_byte_buf *output); +AWS_COMMON_API bool aws_uuid_equals(const struct aws_uuid *a, const struct aws_uuid *b); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_UUID_H */ diff --git a/include/aws/common/xml_parser.h b/include/aws/common/xml_parser.h new file mode 100644 index 0000000000000000000000000000000000000000..2d31d007b11e209bb50baedc8499b649e790e3e5 --- /dev/null +++ b/include/aws/common/xml_parser.h @@ -0,0 +1,97 @@ +#ifndef AWS_COMMON_XML_PARSER_H +#define AWS_COMMON_XML_PARSER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* WARNING: This is not a public API. It is only intended for use within the aws-c libraries. */ +#include +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_xml_node; + +struct aws_xml_attribute { + struct aws_byte_cursor name; + struct aws_byte_cursor value; +}; + +/** + * Callback for when an xml node is encountered in the document. As a user you have a few options: + * + * 1. fail the parse by returning AWS_OP_ERR (after an error has been raised). This will stop any further parsing. + * 2. call aws_xml_node_traverse() on the node to descend into the node with a new callback and user_data. + * 3. call aws_xml_node_as_body() to retrieve the contents of the node as text. + * + * You MUST NOT call both aws_xml_node_traverse() and aws_xml_node_as_body() on the same node. + * + * return true to continue the parsing operation. + */ +typedef int(aws_xml_parser_on_node_encountered_fn)(struct aws_xml_node *node, void *user_data); + +struct aws_xml_parser_options { + /* xml document to parse. */ + struct aws_byte_cursor doc; + + /* Max node depth used for parsing document. */ + size_t max_depth; + + /* Callback invoked on the root node */ + aws_xml_parser_on_node_encountered_fn *on_root_encountered; + + /* User data for callback */ + void *user_data; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Parse an XML document. + * WARNING: This is not a public API. It is only intended for use within the aws-c libraries. + */ +AWS_COMMON_API +int aws_xml_parse(struct aws_allocator *allocator, const struct aws_xml_parser_options *options); + +/** + * Writes the contents of the body of node into out_body. out_body is an output parameter in this case. Upon success, + * out_body will contain the body of the node. + */ +AWS_COMMON_API +int aws_xml_node_as_body(struct aws_xml_node *node, struct aws_byte_cursor *out_body); + +/** + * Traverse node and invoke on_node_encountered when a nested node is encountered. + */ +AWS_COMMON_API +int aws_xml_node_traverse( + struct aws_xml_node *node, + aws_xml_parser_on_node_encountered_fn *on_node_encountered, + void *user_data); + +/* + * Get the name of an xml node. + */ +AWS_COMMON_API +struct aws_byte_cursor aws_xml_node_get_name(const struct aws_xml_node *node); + +/* + * Get the number of attributes for an xml node. + */ +AWS_COMMON_API +size_t aws_xml_node_get_num_attributes(const struct aws_xml_node *node); + +/* + * Get an attribute for an xml node by its index. + */ +AWS_COMMON_API +struct aws_xml_attribute aws_xml_node_get_attribute(const struct aws_xml_node *node, size_t attribute_index); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_XML_PARSER_H */ diff --git a/include/aws/common/zero.inl b/include/aws/common/zero.inl new file mode 100644 index 0000000000000000000000000000000000000000..25887bf3ea8598a2fef98e66b1ed32dcb9e4c921 --- /dev/null +++ b/include/aws/common/zero.inl @@ -0,0 +1,49 @@ +#ifndef AWS_COMMON_ZERO_INL +#define AWS_COMMON_ZERO_INL + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include +#include + +AWS_EXTERN_C_BEGIN +/** + * Returns whether each byte is zero. + */ +AWS_STATIC_IMPL +bool aws_is_mem_zeroed(const void *buf, size_t bufsize) { + /* Optimization idea: vectorized instructions to check more than 64 bits at a time. */ + + /* Check 64 bits at a time */ + const uint64_t *buf_u64 = (const uint64_t *)buf; + const size_t num_u64_checks = bufsize / 8; + size_t i; + for (i = 0; i < num_u64_checks; ++i) { + if (buf_u64[i]) { + return false; + } + } + + /* Update buf to where u64 checks left off */ + buf = buf_u64 + num_u64_checks; + bufsize = bufsize % 8; + + /* Check 8 bits at a time */ + const uint8_t *buf_u8 = (const uint8_t *)buf; + for (i = 0; i < bufsize; ++i) { + if (buf_u8[i]) { + return false; + } + } + + return true; +} + +AWS_EXTERN_C_END + +#endif /* AWS_COMMON_ZERO_INL */ diff --git a/include/aws/config/ConfigServiceClient.h b/include/aws/config/ConfigServiceClient.h new file mode 100644 index 0000000000000000000000000000000000000000..4aa04e78653a5e4d66b57de88ec246db57033b67 --- /dev/null +++ b/include/aws/config/ConfigServiceClient.h @@ -0,0 +1,3309 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ + AWS_CONFIGSERVICE_API extern const char SERVICE_NAME[]; + /** + * Config

Config provides a way to keep track of the + * configurations of all the Amazon Web Services resources associated with your + * Amazon Web Services account. You can use Config to get the current and + * historical configurations of each Amazon Web Services resource and also to get + * information about the relationship between the resources. An Amazon Web Services + * resource can be an Amazon Compute Cloud (Amazon EC2) instance, an Elastic Block + * Store (EBS) volume, an elastic network Interface (ENI), or a security group. For + * a complete list of resources currently supported by Config, see Supported + * Amazon Web Services resources.

You can access and manage Config + * through the Amazon Web Services Management Console, the Amazon Web Services + * Command Line Interface (Amazon Web Services CLI), the Config API, or the Amazon + * Web Services SDKs for Config. This reference guide contains documentation for + * the Config API and the Amazon Web Services CLI commands that you can use to + * manage Config. The Config API uses the Signature Version 4 protocol for signing + * requests. For more information about how to sign a request with this protocol, + * see Signature + * Version 4 Signing Process. For detailed information about Config features + * and their associated actions or commands, as well as how to work with Amazon Web + * Services Management Console, see What + * Is Config in the Config Developer Guide.

+ */ + class AWS_CONFIGSERVICE_API ConfigServiceClient : smithy::client::AwsSmithyClientT, + Aws::Crt::Variant, + ConfigServiceEndpointProviderBase, + smithy::client::JsonOutcomeSerializer, + smithy::client::JsonOutcome, + Aws::Client::ConfigServiceErrorMarshaller>, + Aws::Client::ClientWithAsyncTemplateMethods + { + public: + static const char* GetServiceName(); + static const char* GetAllocationTag(); + inline const char* GetServiceClientName() const override { return "Config Service"; } + + typedef ConfigServiceClientConfiguration ClientConfigurationType; + typedef ConfigServiceEndpointProvider EndpointProviderType; + + /** + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + ConfigServiceClient(const Aws::ConfigService::ConfigServiceClientConfiguration& clientConfiguration = Aws::ConfigService::ConfigServiceClientConfiguration(), + std::shared_ptr endpointProvider = nullptr); + + /** + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + ConfigServiceClient(const Aws::Auth::AWSCredentials& credentials, + std::shared_ptr endpointProvider = nullptr, + const Aws::ConfigService::ConfigServiceClientConfiguration& clientConfiguration = Aws::ConfigService::ConfigServiceClientConfiguration()); + + /** + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, + * the default http client factory will be used + */ + ConfigServiceClient(const std::shared_ptr& credentialsProvider, + std::shared_ptr endpointProvider = nullptr, + const Aws::ConfigService::ConfigServiceClientConfiguration& clientConfiguration = Aws::ConfigService::ConfigServiceClientConfiguration()); + + + /* Legacy constructors due deprecation */ + /** + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + ConfigServiceClient(const Aws::Client::ClientConfiguration& clientConfiguration); + + /** + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + ConfigServiceClient(const Aws::Auth::AWSCredentials& credentials, + const Aws::Client::ClientConfiguration& clientConfiguration); + + /** + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, + * the default http client factory will be used + */ + ConfigServiceClient(const std::shared_ptr& credentialsProvider, + const Aws::Client::ClientConfiguration& clientConfiguration); + + /* End of legacy constructors due deprecation */ + virtual ~ConfigServiceClient(); + + /** + *

Adds all resource types specified in the ResourceTypes list to + * the RecordingGroup + * of specified configuration recorder and includes those resource types when + * recording.

For this operation, the specified configuration recorder must + * use a RecordingStrategy + * that is either INCLUSION_BY_RESOURCE_TYPES or + * EXCLUSION_BY_RESOURCE_TYPES.

See Also:

AWS + * API Reference

+ */ + virtual Model::AssociateResourceTypesOutcome AssociateResourceTypes(const Model::AssociateResourceTypesRequest& request) const; + + /** + * A Callable wrapper for AssociateResourceTypes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::AssociateResourceTypesOutcomeCallable AssociateResourceTypesCallable(const AssociateResourceTypesRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::AssociateResourceTypes, request); + } + + /** + * An Async wrapper for AssociateResourceTypes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void AssociateResourceTypesAsync(const AssociateResourceTypesRequestT& request, const AssociateResourceTypesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::AssociateResourceTypes, request, handler, context); + } + + /** + *

Returns the current configuration items for resources that are present in + * your Config aggregator. The operation also returns a list of resources that are + * not processed in the current request. If there are no unprocessed resources, the + * operation returns an empty unprocessedResourceIdentifiers list. + *

  • The API does not return results for deleted + * resources.

  • The API does not return tags and + * relationships.

See Also:

AWS + * API Reference

+ */ + virtual Model::BatchGetAggregateResourceConfigOutcome BatchGetAggregateResourceConfig(const Model::BatchGetAggregateResourceConfigRequest& request) const; + + /** + * A Callable wrapper for BatchGetAggregateResourceConfig that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::BatchGetAggregateResourceConfigOutcomeCallable BatchGetAggregateResourceConfigCallable(const BatchGetAggregateResourceConfigRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::BatchGetAggregateResourceConfig, request); + } + + /** + * An Async wrapper for BatchGetAggregateResourceConfig that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void BatchGetAggregateResourceConfigAsync(const BatchGetAggregateResourceConfigRequestT& request, const BatchGetAggregateResourceConfigResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::BatchGetAggregateResourceConfig, request, handler, context); + } + + /** + *

Returns the BaseConfigurationItem for one or more requested + * resources. The operation also returns a list of resources that are not processed + * in the current request. If there are no unprocessed resources, the operation + * returns an empty unprocessedResourceKeys list.

  • The API + * does not return results for deleted resources.

  • The API does + * not return any tags for the requested resources. This information is filtered + * out of the supplementaryConfiguration section of the API response.

  • + *

See Also:

AWS + * API Reference

+ */ + virtual Model::BatchGetResourceConfigOutcome BatchGetResourceConfig(const Model::BatchGetResourceConfigRequest& request) const; + + /** + * A Callable wrapper for BatchGetResourceConfig that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::BatchGetResourceConfigOutcomeCallable BatchGetResourceConfigCallable(const BatchGetResourceConfigRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::BatchGetResourceConfig, request); + } + + /** + * An Async wrapper for BatchGetResourceConfig that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void BatchGetResourceConfigAsync(const BatchGetResourceConfigRequestT& request, const BatchGetResourceConfigResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::BatchGetResourceConfig, request, handler, context); + } + + /** + *

Deletes the authorization granted to the specified configuration aggregator + * account in a specified region.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteAggregationAuthorizationOutcome DeleteAggregationAuthorization(const Model::DeleteAggregationAuthorizationRequest& request) const; + + /** + * A Callable wrapper for DeleteAggregationAuthorization that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteAggregationAuthorizationOutcomeCallable DeleteAggregationAuthorizationCallable(const DeleteAggregationAuthorizationRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteAggregationAuthorization, request); + } + + /** + * An Async wrapper for DeleteAggregationAuthorization that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteAggregationAuthorizationAsync(const DeleteAggregationAuthorizationRequestT& request, const DeleteAggregationAuthorizationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteAggregationAuthorization, request, handler, context); + } + + /** + *

Deletes the specified Config rule and all of its evaluation results.

+ *

Config sets the state of a rule to DELETING until the deletion + * is complete. You cannot update a rule while it is in this state. If you make a + * PutConfigRule or DeleteConfigRule request for the + * rule, you will receive a ResourceInUseException.

You can + * check the state of a rule by using the DescribeConfigRules + * request.

Recommendation: Stop recording resource compliance + * before deleting rules

It is highly recommended that you stop + * recording for the AWS::Config::ResourceCompliance resource type + * before you delete rules in your account. Deleting rules creates CIs for + * AWS::Config::ResourceCompliance and can affect your Config configuration + * recorder costs. If you are deleting rules which evaluate a large number of + * resource types, this can lead to a spike in the number of CIs recorded.

+ *

Best practice:

  1. Stop recording + * AWS::Config::ResourceCompliance

  2. Delete + * rule(s)

  3. Turn on recording for + * AWS::Config::ResourceCompliance

See + * Also:

AWS + * API Reference

+ */ + virtual Model::DeleteConfigRuleOutcome DeleteConfigRule(const Model::DeleteConfigRuleRequest& request) const; + + /** + * A Callable wrapper for DeleteConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteConfigRuleOutcomeCallable DeleteConfigRuleCallable(const DeleteConfigRuleRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteConfigRule, request); + } + + /** + * An Async wrapper for DeleteConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteConfigRuleAsync(const DeleteConfigRuleRequestT& request, const DeleteConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteConfigRule, request, handler, context); + } + + /** + *

Deletes the specified configuration aggregator and the aggregated data + * associated with the aggregator.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteConfigurationAggregatorOutcome DeleteConfigurationAggregator(const Model::DeleteConfigurationAggregatorRequest& request) const; + + /** + * A Callable wrapper for DeleteConfigurationAggregator that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteConfigurationAggregatorOutcomeCallable DeleteConfigurationAggregatorCallable(const DeleteConfigurationAggregatorRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteConfigurationAggregator, request); + } + + /** + * An Async wrapper for DeleteConfigurationAggregator that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteConfigurationAggregatorAsync(const DeleteConfigurationAggregatorRequestT& request, const DeleteConfigurationAggregatorResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteConfigurationAggregator, request, handler, context); + } + + /** + *

Deletes the customer managed configuration recorder.

This operation + * does not delete the configuration information that was previously recorded. You + * will be able to access the previously recorded information by using the GetResourceConfigHistory + * operation, but you will not be able to access this information in the Config + * console until you have created a new customer managed configuration + * recorder.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteConfigurationRecorderOutcome DeleteConfigurationRecorder(const Model::DeleteConfigurationRecorderRequest& request) const; + + /** + * A Callable wrapper for DeleteConfigurationRecorder that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteConfigurationRecorderOutcomeCallable DeleteConfigurationRecorderCallable(const DeleteConfigurationRecorderRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteConfigurationRecorder, request); + } + + /** + * An Async wrapper for DeleteConfigurationRecorder that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteConfigurationRecorderAsync(const DeleteConfigurationRecorderRequestT& request, const DeleteConfigurationRecorderResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteConfigurationRecorder, request, handler, context); + } + + /** + *

Deletes the specified conformance pack and all the Config rules, remediation + * actions, and all evaluation results within that conformance pack.

Config + * sets the conformance pack to DELETE_IN_PROGRESS until the deletion + * is complete. You cannot update a conformance pack while it is in this + * state.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteConformancePackOutcome DeleteConformancePack(const Model::DeleteConformancePackRequest& request) const; + + /** + * A Callable wrapper for DeleteConformancePack that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteConformancePackOutcomeCallable DeleteConformancePackCallable(const DeleteConformancePackRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteConformancePack, request); + } + + /** + * An Async wrapper for DeleteConformancePack that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteConformancePackAsync(const DeleteConformancePackRequestT& request, const DeleteConformancePackResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteConformancePack, request, handler, context); + } + + /** + *

Deletes the delivery channel.

Before you can delete the delivery + * channel, you must stop the customer managed configuration recorder. You can use + * the StopConfigurationRecorder operation to stop the customer managed + * configuration recorder.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteDeliveryChannelOutcome DeleteDeliveryChannel(const Model::DeleteDeliveryChannelRequest& request) const; + + /** + * A Callable wrapper for DeleteDeliveryChannel that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteDeliveryChannelOutcomeCallable DeleteDeliveryChannelCallable(const DeleteDeliveryChannelRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteDeliveryChannel, request); + } + + /** + * An Async wrapper for DeleteDeliveryChannel that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteDeliveryChannelAsync(const DeleteDeliveryChannelRequestT& request, const DeleteDeliveryChannelResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteDeliveryChannel, request, handler, context); + } + + /** + *

Deletes the evaluation results for the specified Config rule. You can specify + * one Config rule per request. After you delete the evaluation results, you can + * call the StartConfigRulesEvaluation API to start evaluating your Amazon + * Web Services resources against the rule.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteEvaluationResultsOutcome DeleteEvaluationResults(const Model::DeleteEvaluationResultsRequest& request) const; + + /** + * A Callable wrapper for DeleteEvaluationResults that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteEvaluationResultsOutcomeCallable DeleteEvaluationResultsCallable(const DeleteEvaluationResultsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteEvaluationResults, request); + } + + /** + * An Async wrapper for DeleteEvaluationResults that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteEvaluationResultsAsync(const DeleteEvaluationResultsRequestT& request, const DeleteEvaluationResultsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteEvaluationResults, request, handler, context); + } + + /** + *

Deletes the specified organization Config rule and all of its evaluation + * results from all member accounts in that organization.

Only a management + * account and a delegated administrator account can delete an organization Config + * rule. When calling this API with a delegated administrator, you must ensure + * Organizations ListDelegatedAdministrator permissions are added.

+ *

Config sets the state of a rule to DELETE_IN_PROGRESS until the deletion is + * complete. You cannot update a rule while it is in this state.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::DeleteOrganizationConfigRuleOutcome DeleteOrganizationConfigRule(const Model::DeleteOrganizationConfigRuleRequest& request) const; + + /** + * A Callable wrapper for DeleteOrganizationConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteOrganizationConfigRuleOutcomeCallable DeleteOrganizationConfigRuleCallable(const DeleteOrganizationConfigRuleRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteOrganizationConfigRule, request); + } + + /** + * An Async wrapper for DeleteOrganizationConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteOrganizationConfigRuleAsync(const DeleteOrganizationConfigRuleRequestT& request, const DeleteOrganizationConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteOrganizationConfigRule, request, handler, context); + } + + /** + *

Deletes the specified organization conformance pack and all of the Config + * rules and remediation actions from all member accounts in that organization. + *

Only a management account or a delegated administrator account can + * delete an organization conformance pack. When calling this API with a delegated + * administrator, you must ensure Organizations + * ListDelegatedAdministrator permissions are added.

Config + * sets the state of a conformance pack to DELETE_IN_PROGRESS until the deletion is + * complete. You cannot update a conformance pack while it is in this state. + *

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteOrganizationConformancePackOutcome DeleteOrganizationConformancePack(const Model::DeleteOrganizationConformancePackRequest& request) const; + + /** + * A Callable wrapper for DeleteOrganizationConformancePack that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteOrganizationConformancePackOutcomeCallable DeleteOrganizationConformancePackCallable(const DeleteOrganizationConformancePackRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteOrganizationConformancePack, request); + } + + /** + * An Async wrapper for DeleteOrganizationConformancePack that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteOrganizationConformancePackAsync(const DeleteOrganizationConformancePackRequestT& request, const DeleteOrganizationConformancePackResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteOrganizationConformancePack, request, handler, context); + } + + /** + *

Deletes pending authorization requests for a specified aggregator account in + * a specified region.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeletePendingAggregationRequestOutcome DeletePendingAggregationRequest(const Model::DeletePendingAggregationRequestRequest& request) const; + + /** + * A Callable wrapper for DeletePendingAggregationRequest that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeletePendingAggregationRequestOutcomeCallable DeletePendingAggregationRequestCallable(const DeletePendingAggregationRequestRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeletePendingAggregationRequest, request); + } + + /** + * An Async wrapper for DeletePendingAggregationRequest that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeletePendingAggregationRequestAsync(const DeletePendingAggregationRequestRequestT& request, const DeletePendingAggregationRequestResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeletePendingAggregationRequest, request, handler, context); + } + + /** + *

Deletes the remediation configuration.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteRemediationConfigurationOutcome DeleteRemediationConfiguration(const Model::DeleteRemediationConfigurationRequest& request) const; + + /** + * A Callable wrapper for DeleteRemediationConfiguration that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteRemediationConfigurationOutcomeCallable DeleteRemediationConfigurationCallable(const DeleteRemediationConfigurationRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteRemediationConfiguration, request); + } + + /** + * An Async wrapper for DeleteRemediationConfiguration that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteRemediationConfigurationAsync(const DeleteRemediationConfigurationRequestT& request, const DeleteRemediationConfigurationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteRemediationConfiguration, request, handler, context); + } + + /** + *

Deletes one or more remediation exceptions mentioned in the resource + * keys.

Config generates a remediation exception when a problem + * occurs executing a remediation action to a specific resource. Remediation + * exceptions blocks auto-remediation until the exception is cleared.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteRemediationExceptionsOutcome DeleteRemediationExceptions(const Model::DeleteRemediationExceptionsRequest& request) const; + + /** + * A Callable wrapper for DeleteRemediationExceptions that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteRemediationExceptionsOutcomeCallable DeleteRemediationExceptionsCallable(const DeleteRemediationExceptionsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteRemediationExceptions, request); + } + + /** + * An Async wrapper for DeleteRemediationExceptions that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteRemediationExceptionsAsync(const DeleteRemediationExceptionsRequestT& request, const DeleteRemediationExceptionsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteRemediationExceptions, request, handler, context); + } + + /** + *

Records the configuration state for a custom resource that has been deleted. + * This API records a new ConfigurationItem with a ResourceDeleted status. You can + * retrieve the ConfigurationItems recorded for this resource in your Config + * History.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteResourceConfigOutcome DeleteResourceConfig(const Model::DeleteResourceConfigRequest& request) const; + + /** + * A Callable wrapper for DeleteResourceConfig that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteResourceConfigOutcomeCallable DeleteResourceConfigCallable(const DeleteResourceConfigRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteResourceConfig, request); + } + + /** + * An Async wrapper for DeleteResourceConfig that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteResourceConfigAsync(const DeleteResourceConfigRequestT& request, const DeleteResourceConfigResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteResourceConfig, request, handler, context); + } + + /** + *

Deletes the retention configuration.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteRetentionConfigurationOutcome DeleteRetentionConfiguration(const Model::DeleteRetentionConfigurationRequest& request) const; + + /** + * A Callable wrapper for DeleteRetentionConfiguration that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteRetentionConfigurationOutcomeCallable DeleteRetentionConfigurationCallable(const DeleteRetentionConfigurationRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteRetentionConfiguration, request); + } + + /** + * An Async wrapper for DeleteRetentionConfiguration that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteRetentionConfigurationAsync(const DeleteRetentionConfigurationRequestT& request, const DeleteRetentionConfigurationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteRetentionConfiguration, request, handler, context); + } + + /** + *

Deletes an existing service-linked configuration recorder.

This + * operation does not delete the configuration information that was previously + * recorded. You will be able to access the previously recorded information by + * using the GetResourceConfigHistory + * operation, but you will not be able to access this information in the Config + * console until you have created a new service-linked configuration recorder for + * the same service.

The recording scope determines if you + * receive configuration items

The recording scope is set by the + * service that is linked to the configuration recorder and determines whether you + * receive configuration items (CIs) in the delivery channel. If the recording + * scope is internal, you will not receive CIs in the delivery channel.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteServiceLinkedConfigurationRecorderOutcome DeleteServiceLinkedConfigurationRecorder(const Model::DeleteServiceLinkedConfigurationRecorderRequest& request) const; + + /** + * A Callable wrapper for DeleteServiceLinkedConfigurationRecorder that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteServiceLinkedConfigurationRecorderOutcomeCallable DeleteServiceLinkedConfigurationRecorderCallable(const DeleteServiceLinkedConfigurationRecorderRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteServiceLinkedConfigurationRecorder, request); + } + + /** + * An Async wrapper for DeleteServiceLinkedConfigurationRecorder that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteServiceLinkedConfigurationRecorderAsync(const DeleteServiceLinkedConfigurationRecorderRequestT& request, const DeleteServiceLinkedConfigurationRecorderResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteServiceLinkedConfigurationRecorder, request, handler, context); + } + + /** + *

Deletes the stored query for a single Amazon Web Services account and a + * single Amazon Web Services Region.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteStoredQueryOutcome DeleteStoredQuery(const Model::DeleteStoredQueryRequest& request) const; + + /** + * A Callable wrapper for DeleteStoredQuery that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteStoredQueryOutcomeCallable DeleteStoredQueryCallable(const DeleteStoredQueryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeleteStoredQuery, request); + } + + /** + * An Async wrapper for DeleteStoredQuery that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteStoredQueryAsync(const DeleteStoredQueryRequestT& request, const DeleteStoredQueryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeleteStoredQuery, request, handler, context); + } + + /** + *

Schedules delivery of a configuration snapshot to the Amazon S3 bucket in the + * specified delivery channel. After the delivery has started, Config sends the + * following notifications using an Amazon SNS topic that you have specified.

+ *
  • Notification of the start of the delivery.

  • + *

    Notification of the completion of the delivery, if the delivery was + * successfully completed.

  • Notification of delivery failure, if + * the delivery failed.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeliverConfigSnapshotOutcome DeliverConfigSnapshot(const Model::DeliverConfigSnapshotRequest& request) const; + + /** + * A Callable wrapper for DeliverConfigSnapshot that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeliverConfigSnapshotOutcomeCallable DeliverConfigSnapshotCallable(const DeliverConfigSnapshotRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DeliverConfigSnapshot, request); + } + + /** + * An Async wrapper for DeliverConfigSnapshot that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeliverConfigSnapshotAsync(const DeliverConfigSnapshotRequestT& request, const DeliverConfigSnapshotResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DeliverConfigSnapshot, request, handler, context); + } + + /** + *

Returns a list of compliant and noncompliant rules with the number of + * resources for compliant and noncompliant rules. Does not display rules that do + * not have compliance results.

The results can return an empty + * result page, but if you have a nextToken, the results are displayed + * on the next page.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeAggregateComplianceByConfigRulesOutcome DescribeAggregateComplianceByConfigRules(const Model::DescribeAggregateComplianceByConfigRulesRequest& request) const; + + /** + * A Callable wrapper for DescribeAggregateComplianceByConfigRules that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeAggregateComplianceByConfigRulesOutcomeCallable DescribeAggregateComplianceByConfigRulesCallable(const DescribeAggregateComplianceByConfigRulesRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DescribeAggregateComplianceByConfigRules, request); + } + + /** + * An Async wrapper for DescribeAggregateComplianceByConfigRules that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeAggregateComplianceByConfigRulesAsync(const DescribeAggregateComplianceByConfigRulesRequestT& request, const DescribeAggregateComplianceByConfigRulesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DescribeAggregateComplianceByConfigRules, request, handler, context); + } + + /** + *

Returns a list of the existing and deleted conformance packs and their + * associated compliance status with the count of compliant and noncompliant Config + * rules within each conformance pack. Also returns the total rule count which + * includes compliant rules, noncompliant rules, and rules that cannot be evaluated + * due to insufficient data.

The results can return an empty result + * page, but if you have a nextToken, the results are displayed on the + * next page.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeAggregateComplianceByConformancePacksOutcome DescribeAggregateComplianceByConformancePacks(const Model::DescribeAggregateComplianceByConformancePacksRequest& request) const; + + /** + * A Callable wrapper for DescribeAggregateComplianceByConformancePacks that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeAggregateComplianceByConformancePacksOutcomeCallable DescribeAggregateComplianceByConformancePacksCallable(const DescribeAggregateComplianceByConformancePacksRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DescribeAggregateComplianceByConformancePacks, request); + } + + /** + * An Async wrapper for DescribeAggregateComplianceByConformancePacks that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeAggregateComplianceByConformancePacksAsync(const DescribeAggregateComplianceByConformancePacksRequestT& request, const DescribeAggregateComplianceByConformancePacksResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DescribeAggregateComplianceByConformancePacks, request, handler, context); + } + + /** + *

Returns a list of authorizations granted to various aggregator accounts and + * regions.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeAggregationAuthorizationsOutcome DescribeAggregationAuthorizations(const Model::DescribeAggregationAuthorizationsRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeAggregationAuthorizations that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeAggregationAuthorizationsOutcomeCallable DescribeAggregationAuthorizationsCallable(const DescribeAggregationAuthorizationsRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeAggregationAuthorizations, request); + } + + /** + * An Async wrapper for DescribeAggregationAuthorizations that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeAggregationAuthorizationsAsync(const DescribeAggregationAuthorizationsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeAggregationAuthorizationsRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeAggregationAuthorizations, request, handler, context); + } + + /** + *

Indicates whether the specified Config rules are compliant. If a rule is + * noncompliant, this operation returns the number of Amazon Web Services resources + * that do not comply with the rule.

A rule is compliant if all of the + * evaluated resources comply with it. It is noncompliant if any of these resources + * do not comply.

If Config has no current evaluation results for the rule, + * it returns INSUFFICIENT_DATA. This result might indicate one of the + * following conditions:

  • Config has never invoked an evaluation + * for the rule. To check whether it has, use the + * DescribeConfigRuleEvaluationStatus action to get the + * LastSuccessfulInvocationTime and + * LastFailedInvocationTime.

  • The rule's Lambda + * function is failing to send evaluation results to Config. Verify that the role + * you assigned to your configuration recorder includes the + * config:PutEvaluations permission. If the rule is a custom rule, + * verify that the Lambda execution role includes the + * config:PutEvaluations permission.

  • The rule's + * Lambda function has returned NOT_APPLICABLE for all evaluation + * results. This can occur if the resources were deleted or removed from the rule's + * scope.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeComplianceByConfigRuleOutcome DescribeComplianceByConfigRule(const Model::DescribeComplianceByConfigRuleRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeComplianceByConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeComplianceByConfigRuleOutcomeCallable DescribeComplianceByConfigRuleCallable(const DescribeComplianceByConfigRuleRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeComplianceByConfigRule, request); + } + + /** + * An Async wrapper for DescribeComplianceByConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeComplianceByConfigRuleAsync(const DescribeComplianceByConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeComplianceByConfigRuleRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeComplianceByConfigRule, request, handler, context); + } + + /** + *

Indicates whether the specified Amazon Web Services resources are compliant. + * If a resource is noncompliant, this operation returns the number of Config rules + * that the resource does not comply with.

A resource is compliant if it + * complies with all the Config rules that evaluate it. It is noncompliant if it + * does not comply with one or more of these rules.

If Config has no current + * evaluation results for the resource, it returns INSUFFICIENT_DATA. + * This result might indicate one of the following conditions about the rules that + * evaluate the resource:

  • Config has never invoked an evaluation + * for the rule. To check whether it has, use the + * DescribeConfigRuleEvaluationStatus action to get the + * LastSuccessfulInvocationTime and + * LastFailedInvocationTime.

  • The rule's Lambda + * function is failing to send evaluation results to Config. Verify that the role + * that you assigned to your configuration recorder includes the + * config:PutEvaluations permission. If the rule is a custom rule, + * verify that the Lambda execution role includes the + * config:PutEvaluations permission.

  • The rule's + * Lambda function has returned NOT_APPLICABLE for all evaluation + * results. This can occur if the resources were deleted or removed from the rule's + * scope.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeComplianceByResourceOutcome DescribeComplianceByResource(const Model::DescribeComplianceByResourceRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeComplianceByResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeComplianceByResourceOutcomeCallable DescribeComplianceByResourceCallable(const DescribeComplianceByResourceRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeComplianceByResource, request); + } + + /** + * An Async wrapper for DescribeComplianceByResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeComplianceByResourceAsync(const DescribeComplianceByResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeComplianceByResourceRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeComplianceByResource, request, handler, context); + } + + /** + *

Returns status information for each of your Config managed rules. The status + * includes information such as the last time Config invoked the rule, the last + * time Config failed to invoke the rule, and the related error for the last + * failure.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConfigRuleEvaluationStatusOutcome DescribeConfigRuleEvaluationStatus(const Model::DescribeConfigRuleEvaluationStatusRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeConfigRuleEvaluationStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConfigRuleEvaluationStatusOutcomeCallable DescribeConfigRuleEvaluationStatusCallable(const DescribeConfigRuleEvaluationStatusRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConfigRuleEvaluationStatus, request); + } + + /** + * An Async wrapper for DescribeConfigRuleEvaluationStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConfigRuleEvaluationStatusAsync(const DescribeConfigRuleEvaluationStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeConfigRuleEvaluationStatusRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConfigRuleEvaluationStatus, request, handler, context); + } + + /** + *

Returns details about your Config rules.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConfigRulesOutcome DescribeConfigRules(const Model::DescribeConfigRulesRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeConfigRules that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConfigRulesOutcomeCallable DescribeConfigRulesCallable(const DescribeConfigRulesRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConfigRules, request); + } + + /** + * An Async wrapper for DescribeConfigRules that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConfigRulesAsync(const DescribeConfigRulesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeConfigRulesRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConfigRules, request, handler, context); + } + + /** + *

Returns status information for sources within an aggregator. The status + * includes information about the last time Config verified authorization between + * the source account and an aggregator account. In case of a failure, the status + * contains the related error code or message.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConfigurationAggregatorSourcesStatusOutcome DescribeConfigurationAggregatorSourcesStatus(const Model::DescribeConfigurationAggregatorSourcesStatusRequest& request) const; + + /** + * A Callable wrapper for DescribeConfigurationAggregatorSourcesStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConfigurationAggregatorSourcesStatusOutcomeCallable DescribeConfigurationAggregatorSourcesStatusCallable(const DescribeConfigurationAggregatorSourcesStatusRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConfigurationAggregatorSourcesStatus, request); + } + + /** + * An Async wrapper for DescribeConfigurationAggregatorSourcesStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConfigurationAggregatorSourcesStatusAsync(const DescribeConfigurationAggregatorSourcesStatusRequestT& request, const DescribeConfigurationAggregatorSourcesStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConfigurationAggregatorSourcesStatus, request, handler, context); + } + + /** + *

Returns the details of one or more configuration aggregators. If the + * configuration aggregator is not specified, this operation returns the details + * for all the configuration aggregators associated with the account. + *

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConfigurationAggregatorsOutcome DescribeConfigurationAggregators(const Model::DescribeConfigurationAggregatorsRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeConfigurationAggregators that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConfigurationAggregatorsOutcomeCallable DescribeConfigurationAggregatorsCallable(const DescribeConfigurationAggregatorsRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConfigurationAggregators, request); + } + + /** + * An Async wrapper for DescribeConfigurationAggregators that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConfigurationAggregatorsAsync(const DescribeConfigurationAggregatorsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeConfigurationAggregatorsRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConfigurationAggregators, request, handler, context); + } + + /** + *

Returns the current status of the configuration recorder you specify as well + * as the status of the last recording event for the configuration recorders.

+ *

For a detailed status of recording events over time, add your Config events + * to Amazon CloudWatch metrics and use CloudWatch metrics.

If a + * configuration recorder is not specified, this operation returns the status for + * the customer managed configuration recorder configured for the account, if + * applicable.

When making a request to this operation, you can only + * specify one configuration recorder.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConfigurationRecorderStatusOutcome DescribeConfigurationRecorderStatus(const Model::DescribeConfigurationRecorderStatusRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeConfigurationRecorderStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConfigurationRecorderStatusOutcomeCallable DescribeConfigurationRecorderStatusCallable(const DescribeConfigurationRecorderStatusRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConfigurationRecorderStatus, request); + } + + /** + * An Async wrapper for DescribeConfigurationRecorderStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConfigurationRecorderStatusAsync(const DescribeConfigurationRecorderStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeConfigurationRecorderStatusRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConfigurationRecorderStatus, request, handler, context); + } + + /** + *

Returns details for the configuration recorder you specify.

If a + * configuration recorder is not specified, this operation returns details for the + * customer managed configuration recorder configured for the account, if + * applicable.

When making a request to this operation, you can only + * specify one configuration recorder.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConfigurationRecordersOutcome DescribeConfigurationRecorders(const Model::DescribeConfigurationRecordersRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeConfigurationRecorders that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConfigurationRecordersOutcomeCallable DescribeConfigurationRecordersCallable(const DescribeConfigurationRecordersRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConfigurationRecorders, request); + } + + /** + * An Async wrapper for DescribeConfigurationRecorders that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConfigurationRecordersAsync(const DescribeConfigurationRecordersResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeConfigurationRecordersRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConfigurationRecorders, request, handler, context); + } + + /** + *

Returns compliance details for each rule in that conformance pack.

+ *

You must provide exact rule names.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConformancePackComplianceOutcome DescribeConformancePackCompliance(const Model::DescribeConformancePackComplianceRequest& request) const; + + /** + * A Callable wrapper for DescribeConformancePackCompliance that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConformancePackComplianceOutcomeCallable DescribeConformancePackComplianceCallable(const DescribeConformancePackComplianceRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConformancePackCompliance, request); + } + + /** + * An Async wrapper for DescribeConformancePackCompliance that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConformancePackComplianceAsync(const DescribeConformancePackComplianceRequestT& request, const DescribeConformancePackComplianceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConformancePackCompliance, request, handler, context); + } + + /** + *

Provides one or more conformance packs deployment status.

If + * there are no conformance packs then you will see an empty result.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeConformancePackStatusOutcome DescribeConformancePackStatus(const Model::DescribeConformancePackStatusRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeConformancePackStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConformancePackStatusOutcomeCallable DescribeConformancePackStatusCallable(const DescribeConformancePackStatusRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConformancePackStatus, request); + } + + /** + * An Async wrapper for DescribeConformancePackStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConformancePackStatusAsync(const DescribeConformancePackStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeConformancePackStatusRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConformancePackStatus, request, handler, context); + } + + /** + *

Returns a list of one or more conformance packs.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::DescribeConformancePacksOutcome DescribeConformancePacks(const Model::DescribeConformancePacksRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeConformancePacks that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeConformancePacksOutcomeCallable DescribeConformancePacksCallable(const DescribeConformancePacksRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeConformancePacks, request); + } + + /** + * An Async wrapper for DescribeConformancePacks that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeConformancePacksAsync(const DescribeConformancePacksResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeConformancePacksRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeConformancePacks, request, handler, context); + } + + /** + *

Returns the current status of the specified delivery channel. If a delivery + * channel is not specified, this operation returns the current status of all + * delivery channels associated with the account.

Currently, you can + * specify only one delivery channel per region in your account.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeDeliveryChannelStatusOutcome DescribeDeliveryChannelStatus(const Model::DescribeDeliveryChannelStatusRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeDeliveryChannelStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeDeliveryChannelStatusOutcomeCallable DescribeDeliveryChannelStatusCallable(const DescribeDeliveryChannelStatusRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeDeliveryChannelStatus, request); + } + + /** + * An Async wrapper for DescribeDeliveryChannelStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeDeliveryChannelStatusAsync(const DescribeDeliveryChannelStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeDeliveryChannelStatusRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeDeliveryChannelStatus, request, handler, context); + } + + /** + *

Returns details about the specified delivery channel. If a delivery channel + * is not specified, this operation returns the details of all delivery channels + * associated with the account.

Currently, you can specify only one + * delivery channel per region in your account.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::DescribeDeliveryChannelsOutcome DescribeDeliveryChannels(const Model::DescribeDeliveryChannelsRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeDeliveryChannels that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeDeliveryChannelsOutcomeCallable DescribeDeliveryChannelsCallable(const DescribeDeliveryChannelsRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeDeliveryChannels, request); + } + + /** + * An Async wrapper for DescribeDeliveryChannels that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeDeliveryChannelsAsync(const DescribeDeliveryChannelsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeDeliveryChannelsRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeDeliveryChannels, request, handler, context); + } + + /** + *

Provides organization Config rule deployment status for an organization.

+ *

The status is not considered successful until organization Config rule + * is successfully deployed in all the member accounts with an exception of + * excluded accounts.

When you specify the limit and the next token, you + * receive a paginated response. Limit and next token are not applicable if you + * specify organization Config rule names. It is only applicable, when you request + * all the organization Config rules.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeOrganizationConfigRuleStatusesOutcome DescribeOrganizationConfigRuleStatuses(const Model::DescribeOrganizationConfigRuleStatusesRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeOrganizationConfigRuleStatuses that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeOrganizationConfigRuleStatusesOutcomeCallable DescribeOrganizationConfigRuleStatusesCallable(const DescribeOrganizationConfigRuleStatusesRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeOrganizationConfigRuleStatuses, request); + } + + /** + * An Async wrapper for DescribeOrganizationConfigRuleStatuses that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeOrganizationConfigRuleStatusesAsync(const DescribeOrganizationConfigRuleStatusesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeOrganizationConfigRuleStatusesRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeOrganizationConfigRuleStatuses, request, handler, context); + } + + /** + *

Returns a list of organization Config rules.

When you specify + * the limit and the next token, you receive a paginated response.

Limit and + * next token are not applicable if you specify organization Config rule names. It + * is only applicable, when you request all the organization Config rules.

+ * For accounts within an organization

If you deploy an + * organizational rule or conformance pack in an organization administrator + * account, and then establish a delegated administrator and deploy an + * organizational rule or conformance pack in the delegated administrator account, + * you won't be able to see the organizational rule or conformance pack in the + * organization administrator account from the delegated administrator account or + * see the organizational rule or conformance pack in the delegated administrator + * account from organization administrator account. The + * DescribeOrganizationConfigRules and + * DescribeOrganizationConformancePacks APIs can only see and interact + * with the organization-related resource that were deployed from within the + * account calling those APIs.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeOrganizationConfigRulesOutcome DescribeOrganizationConfigRules(const Model::DescribeOrganizationConfigRulesRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeOrganizationConfigRules that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeOrganizationConfigRulesOutcomeCallable DescribeOrganizationConfigRulesCallable(const DescribeOrganizationConfigRulesRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeOrganizationConfigRules, request); + } + + /** + * An Async wrapper for DescribeOrganizationConfigRules that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeOrganizationConfigRulesAsync(const DescribeOrganizationConfigRulesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeOrganizationConfigRulesRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeOrganizationConfigRules, request, handler, context); + } + + /** + *

Provides organization conformance pack deployment status for an organization. + *

The status is not considered successful until organization + * conformance pack is successfully deployed in all the member accounts with an + * exception of excluded accounts.

When you specify the limit and the next + * token, you receive a paginated response. Limit and next token are not applicable + * if you specify organization conformance pack names. They are only applicable, + * when you request all the organization conformance packs.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::DescribeOrganizationConformancePackStatusesOutcome DescribeOrganizationConformancePackStatuses(const Model::DescribeOrganizationConformancePackStatusesRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeOrganizationConformancePackStatuses that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeOrganizationConformancePackStatusesOutcomeCallable DescribeOrganizationConformancePackStatusesCallable(const DescribeOrganizationConformancePackStatusesRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeOrganizationConformancePackStatuses, request); + } + + /** + * An Async wrapper for DescribeOrganizationConformancePackStatuses that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeOrganizationConformancePackStatusesAsync(const DescribeOrganizationConformancePackStatusesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeOrganizationConformancePackStatusesRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeOrganizationConformancePackStatuses, request, handler, context); + } + + /** + *

Returns a list of organization conformance packs.

When you + * specify the limit and the next token, you receive a paginated response.

+ *

Limit and next token are not applicable if you specify organization + * conformance packs names. They are only applicable, when you request all the + * organization conformance packs.

For accounts within an + * organization

If you deploy an organizational rule or conformance + * pack in an organization administrator account, and then establish a delegated + * administrator and deploy an organizational rule or conformance pack in the + * delegated administrator account, you won't be able to see the organizational + * rule or conformance pack in the organization administrator account from the + * delegated administrator account or see the organizational rule or conformance + * pack in the delegated administrator account from organization administrator + * account. The DescribeOrganizationConfigRules and + * DescribeOrganizationConformancePacks APIs can only see and interact + * with the organization-related resource that were deployed from within the + * account calling those APIs.

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeOrganizationConformancePacksOutcome DescribeOrganizationConformancePacks(const Model::DescribeOrganizationConformancePacksRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeOrganizationConformancePacks that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeOrganizationConformancePacksOutcomeCallable DescribeOrganizationConformancePacksCallable(const DescribeOrganizationConformancePacksRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeOrganizationConformancePacks, request); + } + + /** + * An Async wrapper for DescribeOrganizationConformancePacks that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeOrganizationConformancePacksAsync(const DescribeOrganizationConformancePacksResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeOrganizationConformancePacksRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeOrganizationConformancePacks, request, handler, context); + } + + /** + *

Returns a list of all pending aggregation requests.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::DescribePendingAggregationRequestsOutcome DescribePendingAggregationRequests(const Model::DescribePendingAggregationRequestsRequest& request = {}) const; + + /** + * A Callable wrapper for DescribePendingAggregationRequests that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribePendingAggregationRequestsOutcomeCallable DescribePendingAggregationRequestsCallable(const DescribePendingAggregationRequestsRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribePendingAggregationRequests, request); + } + + /** + * An Async wrapper for DescribePendingAggregationRequests that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribePendingAggregationRequestsAsync(const DescribePendingAggregationRequestsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribePendingAggregationRequestsRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribePendingAggregationRequests, request, handler, context); + } + + /** + *

Returns the details of one or more remediation configurations.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::DescribeRemediationConfigurationsOutcome DescribeRemediationConfigurations(const Model::DescribeRemediationConfigurationsRequest& request) const; + + /** + * A Callable wrapper for DescribeRemediationConfigurations that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeRemediationConfigurationsOutcomeCallable DescribeRemediationConfigurationsCallable(const DescribeRemediationConfigurationsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DescribeRemediationConfigurations, request); + } + + /** + * An Async wrapper for DescribeRemediationConfigurations that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeRemediationConfigurationsAsync(const DescribeRemediationConfigurationsRequestT& request, const DescribeRemediationConfigurationsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DescribeRemediationConfigurations, request, handler, context); + } + + /** + *

Returns the details of one or more remediation exceptions. A detailed view of + * a remediation exception for a set of resources that includes an explanation of + * an exception and the time when the exception will be deleted. When you specify + * the limit and the next token, you receive a paginated response.

+ *

Config generates a remediation exception when a problem occurs executing a + * remediation action to a specific resource. Remediation exceptions blocks + * auto-remediation until the exception is cleared.

When you specify the + * limit and the next token, you receive a paginated response.

Limit and + * next token are not applicable if you request resources in batch. It is only + * applicable, when you request all resources.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::DescribeRemediationExceptionsOutcome DescribeRemediationExceptions(const Model::DescribeRemediationExceptionsRequest& request) const; + + /** + * A Callable wrapper for DescribeRemediationExceptions that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeRemediationExceptionsOutcomeCallable DescribeRemediationExceptionsCallable(const DescribeRemediationExceptionsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DescribeRemediationExceptions, request); + } + + /** + * An Async wrapper for DescribeRemediationExceptions that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeRemediationExceptionsAsync(const DescribeRemediationExceptionsRequestT& request, const DescribeRemediationExceptionsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DescribeRemediationExceptions, request, handler, context); + } + + /** + *

Provides a detailed view of a Remediation Execution for a set of resources + * including state, timestamps for when steps for the remediation execution occur, + * and any error messages for steps that have failed. When you specify the limit + * and the next token, you receive a paginated response.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::DescribeRemediationExecutionStatusOutcome DescribeRemediationExecutionStatus(const Model::DescribeRemediationExecutionStatusRequest& request) const; + + /** + * A Callable wrapper for DescribeRemediationExecutionStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeRemediationExecutionStatusOutcomeCallable DescribeRemediationExecutionStatusCallable(const DescribeRemediationExecutionStatusRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DescribeRemediationExecutionStatus, request); + } + + /** + * An Async wrapper for DescribeRemediationExecutionStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeRemediationExecutionStatusAsync(const DescribeRemediationExecutionStatusRequestT& request, const DescribeRemediationExecutionStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DescribeRemediationExecutionStatus, request, handler, context); + } + + /** + *

Returns the details of one or more retention configurations. If the retention + * configuration name is not specified, this operation returns the details for all + * the retention configurations for that account.

Currently, Config + * supports only one retention configuration per region in your account.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::DescribeRetentionConfigurationsOutcome DescribeRetentionConfigurations(const Model::DescribeRetentionConfigurationsRequest& request = {}) const; + + /** + * A Callable wrapper for DescribeRetentionConfigurations that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DescribeRetentionConfigurationsOutcomeCallable DescribeRetentionConfigurationsCallable(const DescribeRetentionConfigurationsRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::DescribeRetentionConfigurations, request); + } + + /** + * An Async wrapper for DescribeRetentionConfigurations that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DescribeRetentionConfigurationsAsync(const DescribeRetentionConfigurationsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const DescribeRetentionConfigurationsRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::DescribeRetentionConfigurations, request, handler, context); + } + + /** + *

Removes all resource types specified in the ResourceTypes list + * from the RecordingGroup + * of configuration recorder and excludes these resource types when recording.

+ *

For this operation, the configuration recorder must use a RecordingStrategy + * that is either INCLUSION_BY_RESOURCE_TYPES or + * EXCLUSION_BY_RESOURCE_TYPES.

See Also:

AWS + * API Reference

+ */ + virtual Model::DisassociateResourceTypesOutcome DisassociateResourceTypes(const Model::DisassociateResourceTypesRequest& request) const; + + /** + * A Callable wrapper for DisassociateResourceTypes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DisassociateResourceTypesOutcomeCallable DisassociateResourceTypesCallable(const DisassociateResourceTypesRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::DisassociateResourceTypes, request); + } + + /** + * An Async wrapper for DisassociateResourceTypes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DisassociateResourceTypesAsync(const DisassociateResourceTypesRequestT& request, const DisassociateResourceTypesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::DisassociateResourceTypes, request, handler, context); + } + + /** + *

Returns the evaluation results for the specified Config rule for a specific + * resource in a rule. The results indicate which Amazon Web Services resources + * were evaluated by the rule, when each resource was last evaluated, and whether + * each resource complies with the rule.

The results can return an + * empty result page. But if you have a nextToken, the results are + * displayed on the next page.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetAggregateComplianceDetailsByConfigRuleOutcome GetAggregateComplianceDetailsByConfigRule(const Model::GetAggregateComplianceDetailsByConfigRuleRequest& request) const; + + /** + * A Callable wrapper for GetAggregateComplianceDetailsByConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetAggregateComplianceDetailsByConfigRuleOutcomeCallable GetAggregateComplianceDetailsByConfigRuleCallable(const GetAggregateComplianceDetailsByConfigRuleRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetAggregateComplianceDetailsByConfigRule, request); + } + + /** + * An Async wrapper for GetAggregateComplianceDetailsByConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetAggregateComplianceDetailsByConfigRuleAsync(const GetAggregateComplianceDetailsByConfigRuleRequestT& request, const GetAggregateComplianceDetailsByConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetAggregateComplianceDetailsByConfigRule, request, handler, context); + } + + /** + *

Returns the number of compliant and noncompliant rules for one or more + * accounts and regions in an aggregator.

The results can return an + * empty result page, but if you have a nextToken, the results are displayed on the + * next page.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetAggregateConfigRuleComplianceSummaryOutcome GetAggregateConfigRuleComplianceSummary(const Model::GetAggregateConfigRuleComplianceSummaryRequest& request) const; + + /** + * A Callable wrapper for GetAggregateConfigRuleComplianceSummary that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetAggregateConfigRuleComplianceSummaryOutcomeCallable GetAggregateConfigRuleComplianceSummaryCallable(const GetAggregateConfigRuleComplianceSummaryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetAggregateConfigRuleComplianceSummary, request); + } + + /** + * An Async wrapper for GetAggregateConfigRuleComplianceSummary that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetAggregateConfigRuleComplianceSummaryAsync(const GetAggregateConfigRuleComplianceSummaryRequestT& request, const GetAggregateConfigRuleComplianceSummaryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetAggregateConfigRuleComplianceSummary, request, handler, context); + } + + /** + *

Returns the count of compliant and noncompliant conformance packs across all + * Amazon Web Services accounts and Amazon Web Services Regions in an aggregator. + * You can filter based on Amazon Web Services account ID or Amazon Web Services + * Region.

The results can return an empty result page, but if you + * have a nextToken, the results are displayed on the next page.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::GetAggregateConformancePackComplianceSummaryOutcome GetAggregateConformancePackComplianceSummary(const Model::GetAggregateConformancePackComplianceSummaryRequest& request) const; + + /** + * A Callable wrapper for GetAggregateConformancePackComplianceSummary that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetAggregateConformancePackComplianceSummaryOutcomeCallable GetAggregateConformancePackComplianceSummaryCallable(const GetAggregateConformancePackComplianceSummaryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetAggregateConformancePackComplianceSummary, request); + } + + /** + * An Async wrapper for GetAggregateConformancePackComplianceSummary that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetAggregateConformancePackComplianceSummaryAsync(const GetAggregateConformancePackComplianceSummaryRequestT& request, const GetAggregateConformancePackComplianceSummaryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetAggregateConformancePackComplianceSummary, request, handler, context); + } + + /** + *

Returns the resource counts across accounts and regions that are present in + * your Config aggregator. You can request the resource counts by providing filters + * and GroupByKey.

For example, if the input contains accountID 12345678910 + * and region us-east-1 in filters, the API returns the count of resources in + * account ID 12345678910 and region us-east-1. If the input contains ACCOUNT_ID as + * a GroupByKey, the API returns resource counts for all source accounts that are + * present in your aggregator.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetAggregateDiscoveredResourceCountsOutcome GetAggregateDiscoveredResourceCounts(const Model::GetAggregateDiscoveredResourceCountsRequest& request) const; + + /** + * A Callable wrapper for GetAggregateDiscoveredResourceCounts that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetAggregateDiscoveredResourceCountsOutcomeCallable GetAggregateDiscoveredResourceCountsCallable(const GetAggregateDiscoveredResourceCountsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetAggregateDiscoveredResourceCounts, request); + } + + /** + * An Async wrapper for GetAggregateDiscoveredResourceCounts that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetAggregateDiscoveredResourceCountsAsync(const GetAggregateDiscoveredResourceCountsRequestT& request, const GetAggregateDiscoveredResourceCountsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetAggregateDiscoveredResourceCounts, request, handler, context); + } + + /** + *

Returns configuration item that is aggregated for your specific resource in a + * specific source account and region.

The API does not return + * results for deleted resources.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetAggregateResourceConfigOutcome GetAggregateResourceConfig(const Model::GetAggregateResourceConfigRequest& request) const; + + /** + * A Callable wrapper for GetAggregateResourceConfig that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetAggregateResourceConfigOutcomeCallable GetAggregateResourceConfigCallable(const GetAggregateResourceConfigRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetAggregateResourceConfig, request); + } + + /** + * An Async wrapper for GetAggregateResourceConfig that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetAggregateResourceConfigAsync(const GetAggregateResourceConfigRequestT& request, const GetAggregateResourceConfigResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetAggregateResourceConfig, request, handler, context); + } + + /** + *

Returns the evaluation results for the specified Config rule. The results + * indicate which Amazon Web Services resources were evaluated by the rule, when + * each resource was last evaluated, and whether each resource complies with the + * rule.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetComplianceDetailsByConfigRuleOutcome GetComplianceDetailsByConfigRule(const Model::GetComplianceDetailsByConfigRuleRequest& request) const; + + /** + * A Callable wrapper for GetComplianceDetailsByConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetComplianceDetailsByConfigRuleOutcomeCallable GetComplianceDetailsByConfigRuleCallable(const GetComplianceDetailsByConfigRuleRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetComplianceDetailsByConfigRule, request); + } + + /** + * An Async wrapper for GetComplianceDetailsByConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetComplianceDetailsByConfigRuleAsync(const GetComplianceDetailsByConfigRuleRequestT& request, const GetComplianceDetailsByConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetComplianceDetailsByConfigRule, request, handler, context); + } + + /** + *

Returns the evaluation results for the specified Amazon Web Services + * resource. The results indicate which Config rules were used to evaluate the + * resource, when each rule was last invoked, and whether the resource complies + * with each rule.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetComplianceDetailsByResourceOutcome GetComplianceDetailsByResource(const Model::GetComplianceDetailsByResourceRequest& request = {}) const; + + /** + * A Callable wrapper for GetComplianceDetailsByResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetComplianceDetailsByResourceOutcomeCallable GetComplianceDetailsByResourceCallable(const GetComplianceDetailsByResourceRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::GetComplianceDetailsByResource, request); + } + + /** + * An Async wrapper for GetComplianceDetailsByResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetComplianceDetailsByResourceAsync(const GetComplianceDetailsByResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const GetComplianceDetailsByResourceRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::GetComplianceDetailsByResource, request, handler, context); + } + + /** + *

Returns the number of Config rules that are compliant and noncompliant, up to + * a maximum of 25 for each.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetComplianceSummaryByConfigRuleOutcome GetComplianceSummaryByConfigRule(const Model::GetComplianceSummaryByConfigRuleRequest& request = {}) const; + + /** + * A Callable wrapper for GetComplianceSummaryByConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetComplianceSummaryByConfigRuleOutcomeCallable GetComplianceSummaryByConfigRuleCallable(const GetComplianceSummaryByConfigRuleRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::GetComplianceSummaryByConfigRule, request); + } + + /** + * An Async wrapper for GetComplianceSummaryByConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetComplianceSummaryByConfigRuleAsync(const GetComplianceSummaryByConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const GetComplianceSummaryByConfigRuleRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::GetComplianceSummaryByConfigRule, request, handler, context); + } + + /** + *

Returns the number of resources that are compliant and the number that are + * noncompliant. You can specify one or more resource types to get these numbers + * for each resource type. The maximum number returned is 100.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::GetComplianceSummaryByResourceTypeOutcome GetComplianceSummaryByResourceType(const Model::GetComplianceSummaryByResourceTypeRequest& request = {}) const; + + /** + * A Callable wrapper for GetComplianceSummaryByResourceType that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetComplianceSummaryByResourceTypeOutcomeCallable GetComplianceSummaryByResourceTypeCallable(const GetComplianceSummaryByResourceTypeRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::GetComplianceSummaryByResourceType, request); + } + + /** + * An Async wrapper for GetComplianceSummaryByResourceType that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetComplianceSummaryByResourceTypeAsync(const GetComplianceSummaryByResourceTypeResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const GetComplianceSummaryByResourceTypeRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::GetComplianceSummaryByResourceType, request, handler, context); + } + + /** + *

Returns compliance details of a conformance pack for all Amazon Web Services + * resources that are monitered by conformance pack.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetConformancePackComplianceDetailsOutcome GetConformancePackComplianceDetails(const Model::GetConformancePackComplianceDetailsRequest& request) const; + + /** + * A Callable wrapper for GetConformancePackComplianceDetails that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetConformancePackComplianceDetailsOutcomeCallable GetConformancePackComplianceDetailsCallable(const GetConformancePackComplianceDetailsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetConformancePackComplianceDetails, request); + } + + /** + * An Async wrapper for GetConformancePackComplianceDetails that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetConformancePackComplianceDetailsAsync(const GetConformancePackComplianceDetailsRequestT& request, const GetConformancePackComplianceDetailsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetConformancePackComplianceDetails, request, handler, context); + } + + /** + *

Returns compliance details for the conformance pack based on the cumulative + * compliance results of all the rules in that conformance pack.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::GetConformancePackComplianceSummaryOutcome GetConformancePackComplianceSummary(const Model::GetConformancePackComplianceSummaryRequest& request) const; + + /** + * A Callable wrapper for GetConformancePackComplianceSummary that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetConformancePackComplianceSummaryOutcomeCallable GetConformancePackComplianceSummaryCallable(const GetConformancePackComplianceSummaryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetConformancePackComplianceSummary, request); + } + + /** + * An Async wrapper for GetConformancePackComplianceSummary that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetConformancePackComplianceSummaryAsync(const GetConformancePackComplianceSummaryRequestT& request, const GetConformancePackComplianceSummaryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetConformancePackComplianceSummary, request, handler, context); + } + + /** + *

Returns the policy definition containing the logic for your Config Custom + * Policy rule.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetCustomRulePolicyOutcome GetCustomRulePolicy(const Model::GetCustomRulePolicyRequest& request = {}) const; + + /** + * A Callable wrapper for GetCustomRulePolicy that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetCustomRulePolicyOutcomeCallable GetCustomRulePolicyCallable(const GetCustomRulePolicyRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::GetCustomRulePolicy, request); + } + + /** + * An Async wrapper for GetCustomRulePolicy that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetCustomRulePolicyAsync(const GetCustomRulePolicyResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const GetCustomRulePolicyRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::GetCustomRulePolicy, request, handler, context); + } + + /** + *

Returns the resource types, the number of each resource type, and the total + * number of resources that Config is recording in this region for your Amazon Web + * Services account.

Example

  1. Config + * is recording three resource types in the US East (Ohio) Region for your account: + * 25 EC2 instances, 20 IAM users, and 15 S3 buckets.

  2. You make a + * call to the GetDiscoveredResourceCounts action and specify that you + * want all resource types.

  3. Config returns the following:

    + *
    • The resource types (EC2 instances, IAM users, and S3 buckets).

      + *
    • The number of each resource type (25, 20, and 15).

    • + *

      The total number of all resources (60).

The + * response is paginated. By default, Config lists 100 ResourceCount objects + * on each page. You can customize this number with the limit + * parameter. The response includes a nextToken string. To get the + * next page of results, run the request again and specify the string for the + * nextToken parameter.

If you make a call to the + * GetDiscoveredResourceCounts action, you might not immediately receive + * resource counts in the following situations:

  • You are a new + * Config customer.

  • You just enabled resource recording.

    + *

It might take a few minutes for Config to record and count your + * resources. Wait a few minutes and then retry the + * GetDiscoveredResourceCounts action.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::GetDiscoveredResourceCountsOutcome GetDiscoveredResourceCounts(const Model::GetDiscoveredResourceCountsRequest& request = {}) const; + + /** + * A Callable wrapper for GetDiscoveredResourceCounts that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetDiscoveredResourceCountsOutcomeCallable GetDiscoveredResourceCountsCallable(const GetDiscoveredResourceCountsRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::GetDiscoveredResourceCounts, request); + } + + /** + * An Async wrapper for GetDiscoveredResourceCounts that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetDiscoveredResourceCountsAsync(const GetDiscoveredResourceCountsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const GetDiscoveredResourceCountsRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::GetDiscoveredResourceCounts, request, handler, context); + } + + /** + *

Returns detailed status for each member account within an organization for a + * given organization Config rule.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetOrganizationConfigRuleDetailedStatusOutcome GetOrganizationConfigRuleDetailedStatus(const Model::GetOrganizationConfigRuleDetailedStatusRequest& request) const; + + /** + * A Callable wrapper for GetOrganizationConfigRuleDetailedStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetOrganizationConfigRuleDetailedStatusOutcomeCallable GetOrganizationConfigRuleDetailedStatusCallable(const GetOrganizationConfigRuleDetailedStatusRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetOrganizationConfigRuleDetailedStatus, request); + } + + /** + * An Async wrapper for GetOrganizationConfigRuleDetailedStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetOrganizationConfigRuleDetailedStatusAsync(const GetOrganizationConfigRuleDetailedStatusRequestT& request, const GetOrganizationConfigRuleDetailedStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetOrganizationConfigRuleDetailedStatus, request, handler, context); + } + + /** + *

Returns detailed status for each member account within an organization for a + * given organization conformance pack.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetOrganizationConformancePackDetailedStatusOutcome GetOrganizationConformancePackDetailedStatus(const Model::GetOrganizationConformancePackDetailedStatusRequest& request) const; + + /** + * A Callable wrapper for GetOrganizationConformancePackDetailedStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetOrganizationConformancePackDetailedStatusOutcomeCallable GetOrganizationConformancePackDetailedStatusCallable(const GetOrganizationConformancePackDetailedStatusRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetOrganizationConformancePackDetailedStatus, request); + } + + /** + * An Async wrapper for GetOrganizationConformancePackDetailedStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetOrganizationConformancePackDetailedStatusAsync(const GetOrganizationConformancePackDetailedStatusRequestT& request, const GetOrganizationConformancePackDetailedStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetOrganizationConformancePackDetailedStatus, request, handler, context); + } + + /** + *

Returns the policy definition containing the logic for your organization + * Config Custom Policy rule.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetOrganizationCustomRulePolicyOutcome GetOrganizationCustomRulePolicy(const Model::GetOrganizationCustomRulePolicyRequest& request) const; + + /** + * A Callable wrapper for GetOrganizationCustomRulePolicy that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetOrganizationCustomRulePolicyOutcomeCallable GetOrganizationCustomRulePolicyCallable(const GetOrganizationCustomRulePolicyRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetOrganizationCustomRulePolicy, request); + } + + /** + * An Async wrapper for GetOrganizationCustomRulePolicy that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetOrganizationCustomRulePolicyAsync(const GetOrganizationCustomRulePolicyRequestT& request, const GetOrganizationCustomRulePolicyResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetOrganizationCustomRulePolicy, request, handler, context); + } + + /** + *

For accurate reporting on the compliance status, you must record + * the AWS::Config::ResourceCompliance resource type. For more + * information, see Selecting + * Which Resources Config Records.

Returns a list of + * ConfigurationItems for the specified resource. The list contains + * details about each state of the resource during the specified time interval. If + * you specified a retention period to retain your ConfigurationItems + * between a minimum of 30 days and a maximum of 7 years (2557 days), Config + * returns the ConfigurationItems for the specified retention period. + *

The response is paginated. By default, Config returns a limit of 10 + * configuration items per page. You can customize this number with the + * limit parameter. The response includes a nextToken + * string. To get the next page of results, run the request again and specify the + * string for the nextToken parameter.

Each call to the + * API is limited to span a duration of seven days. It is likely that the number of + * records returned is smaller than the specified limit. In such + * cases, you can make another call, using the nextToken.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::GetResourceConfigHistoryOutcome GetResourceConfigHistory(const Model::GetResourceConfigHistoryRequest& request) const; + + /** + * A Callable wrapper for GetResourceConfigHistory that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetResourceConfigHistoryOutcomeCallable GetResourceConfigHistoryCallable(const GetResourceConfigHistoryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetResourceConfigHistory, request); + } + + /** + * An Async wrapper for GetResourceConfigHistory that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetResourceConfigHistoryAsync(const GetResourceConfigHistoryRequestT& request, const GetResourceConfigHistoryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetResourceConfigHistory, request, handler, context); + } + + /** + *

Returns a summary of resource evaluation for the specified resource + * evaluation ID from the proactive rules that were run. The results indicate which + * evaluation context was used to evaluate the rules, which resource details were + * evaluated, the evaluation mode that was run, and whether the resource details + * comply with the configuration of the proactive rules.

To see + * additional information about the evaluation result, such as which rule flagged a + * resource as NON_COMPLIANT, use the GetComplianceDetailsByResource + * API. For more information, see the Examples + * section.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetResourceEvaluationSummaryOutcome GetResourceEvaluationSummary(const Model::GetResourceEvaluationSummaryRequest& request) const; + + /** + * A Callable wrapper for GetResourceEvaluationSummary that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetResourceEvaluationSummaryOutcomeCallable GetResourceEvaluationSummaryCallable(const GetResourceEvaluationSummaryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetResourceEvaluationSummary, request); + } + + /** + * An Async wrapper for GetResourceEvaluationSummary that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetResourceEvaluationSummaryAsync(const GetResourceEvaluationSummaryRequestT& request, const GetResourceEvaluationSummaryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetResourceEvaluationSummary, request, handler, context); + } + + /** + *

Returns the details of a specific stored query.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetStoredQueryOutcome GetStoredQuery(const Model::GetStoredQueryRequest& request) const; + + /** + * A Callable wrapper for GetStoredQuery that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetStoredQueryOutcomeCallable GetStoredQueryCallable(const GetStoredQueryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::GetStoredQuery, request); + } + + /** + * An Async wrapper for GetStoredQuery that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetStoredQueryAsync(const GetStoredQueryRequestT& request, const GetStoredQueryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::GetStoredQuery, request, handler, context); + } + + /** + *

Accepts a resource type and returns a list of resource identifiers that are + * aggregated for a specific resource type across accounts and regions. A resource + * identifier includes the resource type, ID, (if available) the custom resource + * name, source account, and source region. You can narrow the results to include + * only resources that have specific resource IDs, or a resource name, or source + * account ID, or source region.

For example, if the input consists of + * accountID 12345678910 and the region is us-east-1 for resource type + * AWS::EC2::Instance then the API returns all the EC2 instance + * identifiers of accountID 12345678910 and region us-east-1.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::ListAggregateDiscoveredResourcesOutcome ListAggregateDiscoveredResources(const Model::ListAggregateDiscoveredResourcesRequest& request) const; + + /** + * A Callable wrapper for ListAggregateDiscoveredResources that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListAggregateDiscoveredResourcesOutcomeCallable ListAggregateDiscoveredResourcesCallable(const ListAggregateDiscoveredResourcesRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::ListAggregateDiscoveredResources, request); + } + + /** + * An Async wrapper for ListAggregateDiscoveredResources that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListAggregateDiscoveredResourcesAsync(const ListAggregateDiscoveredResourcesRequestT& request, const ListAggregateDiscoveredResourcesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::ListAggregateDiscoveredResources, request, handler, context); + } + + /** + *

Returns a list of configuration recorders depending on the filters you + * specify.

See Also:

AWS + * API Reference

+ */ + virtual Model::ListConfigurationRecordersOutcome ListConfigurationRecorders(const Model::ListConfigurationRecordersRequest& request = {}) const; + + /** + * A Callable wrapper for ListConfigurationRecorders that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListConfigurationRecordersOutcomeCallable ListConfigurationRecordersCallable(const ListConfigurationRecordersRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::ListConfigurationRecorders, request); + } + + /** + * An Async wrapper for ListConfigurationRecorders that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListConfigurationRecordersAsync(const ListConfigurationRecordersResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListConfigurationRecordersRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::ListConfigurationRecorders, request, handler, context); + } + + /** + *

Returns a list of conformance pack compliance scores. A compliance score is + * the percentage of the number of compliant rule-resource combinations in a + * conformance pack compared to the number of total possible rule-resource + * combinations in the conformance pack. This metric provides you with a high-level + * view of the compliance state of your conformance packs. You can use it to + * identify, investigate, and understand the level of compliance in your + * conformance packs.

Conformance packs with no evaluation results + * will have a compliance score of INSUFFICIENT_DATA.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::ListConformancePackComplianceScoresOutcome ListConformancePackComplianceScores(const Model::ListConformancePackComplianceScoresRequest& request = {}) const; + + /** + * A Callable wrapper for ListConformancePackComplianceScores that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListConformancePackComplianceScoresOutcomeCallable ListConformancePackComplianceScoresCallable(const ListConformancePackComplianceScoresRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::ListConformancePackComplianceScores, request); + } + + /** + * An Async wrapper for ListConformancePackComplianceScores that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListConformancePackComplianceScoresAsync(const ListConformancePackComplianceScoresResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListConformancePackComplianceScoresRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::ListConformancePackComplianceScores, request, handler, context); + } + + /** + *

Accepts a resource type and returns a list of resource identifiers for the + * resources of that type. A resource identifier includes the resource type, ID, + * and (if available) the custom resource name. The results consist of resources + * that Config has discovered, including those that Config is not currently + * recording. You can narrow the results to include only resources that have + * specific resource IDs or a resource name.

You can specify either + * resource IDs or a resource name, but not both, in the same request.

+ *

The response is paginated. By default, Config lists 100 resource identifiers + * on each page. You can customize this number with the limit + * parameter. The response includes a nextToken string. To get the + * next page of results, run the request again and specify the string for the + * nextToken parameter.

See Also:

AWS + * API Reference

+ */ + virtual Model::ListDiscoveredResourcesOutcome ListDiscoveredResources(const Model::ListDiscoveredResourcesRequest& request) const; + + /** + * A Callable wrapper for ListDiscoveredResources that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListDiscoveredResourcesOutcomeCallable ListDiscoveredResourcesCallable(const ListDiscoveredResourcesRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::ListDiscoveredResources, request); + } + + /** + * An Async wrapper for ListDiscoveredResources that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListDiscoveredResourcesAsync(const ListDiscoveredResourcesRequestT& request, const ListDiscoveredResourcesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::ListDiscoveredResources, request, handler, context); + } + + /** + *

Returns a list of proactive resource evaluations.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::ListResourceEvaluationsOutcome ListResourceEvaluations(const Model::ListResourceEvaluationsRequest& request = {}) const; + + /** + * A Callable wrapper for ListResourceEvaluations that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListResourceEvaluationsOutcomeCallable ListResourceEvaluationsCallable(const ListResourceEvaluationsRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::ListResourceEvaluations, request); + } + + /** + * An Async wrapper for ListResourceEvaluations that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListResourceEvaluationsAsync(const ListResourceEvaluationsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListResourceEvaluationsRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::ListResourceEvaluations, request, handler, context); + } + + /** + *

Lists the stored queries for a single Amazon Web Services account and a + * single Amazon Web Services Region. The default is 100.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::ListStoredQueriesOutcome ListStoredQueries(const Model::ListStoredQueriesRequest& request = {}) const; + + /** + * A Callable wrapper for ListStoredQueries that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListStoredQueriesOutcomeCallable ListStoredQueriesCallable(const ListStoredQueriesRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::ListStoredQueries, request); + } + + /** + * An Async wrapper for ListStoredQueries that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListStoredQueriesAsync(const ListStoredQueriesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListStoredQueriesRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::ListStoredQueries, request, handler, context); + } + + /** + *

List the tags for Config resource.

See Also:

AWS + * API Reference

+ */ + virtual Model::ListTagsForResourceOutcome ListTagsForResource(const Model::ListTagsForResourceRequest& request) const; + + /** + * A Callable wrapper for ListTagsForResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListTagsForResourceOutcomeCallable ListTagsForResourceCallable(const ListTagsForResourceRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::ListTagsForResource, request); + } + + /** + * An Async wrapper for ListTagsForResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListTagsForResourceAsync(const ListTagsForResourceRequestT& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::ListTagsForResource, request, handler, context); + } + + /** + *

Authorizes the aggregator account and region to collect data from the source + * account and region.

Tags are added at creation and cannot be + * updated with this operation

+ * PutAggregationAuthorization is an idempotent API. Subsequent + * requests won’t create a duplicate resource if one was already created. If a + * following request has different tags values, Config will ignore + * these differences and treat it as an idempotent request of the previous. In this + * case, tags will not be updated, even if they are different.

+ *

Use TagResource + * and UntagResource + * to update tags after creation.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutAggregationAuthorizationOutcome PutAggregationAuthorization(const Model::PutAggregationAuthorizationRequest& request) const; + + /** + * A Callable wrapper for PutAggregationAuthorization that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutAggregationAuthorizationOutcomeCallable PutAggregationAuthorizationCallable(const PutAggregationAuthorizationRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutAggregationAuthorization, request); + } + + /** + * An Async wrapper for PutAggregationAuthorization that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutAggregationAuthorizationAsync(const PutAggregationAuthorizationRequestT& request, const PutAggregationAuthorizationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutAggregationAuthorization, request, handler, context); + } + + /** + *

Adds or updates an Config rule to evaluate if your Amazon Web Services + * resources comply with your desired configurations. For information on how many + * Config rules you can have per account, see + * Service Limits in the Config Developer Guide.

There + * are two types of rules: Config Managed Rules and Config Custom + * Rules. You can use PutConfigRule to create both Config Managed + * Rules and Config Custom Rules.

Config Managed Rules are predefined, + * customizable rules created by Config. For a list of managed rules, see List + * of Config Managed Rules. If you are adding an Config managed rule, you must + * specify the rule's identifier for the SourceIdentifier key.

+ *

Config Custom Rules are rules that you create from scratch. There are two + * ways to create Config custom rules: with Lambda functions ( + * Lambda Developer Guide) and with Guard (Guard GitHub + * Repository), a policy-as-code language. Config custom rules created with + * Lambda are called Config Custom Lambda Rules and Config custom rules + * created with Guard are called Config Custom Policy Rules.

If you + * are adding a new Config Custom Lambda rule, you first need to create an Lambda + * function that the rule invokes to evaluate your resources. When you use + * PutConfigRule to add a Custom Lambda rule to Config, you must + * specify the Amazon Resource Name (ARN) that Lambda assigns to the function. You + * specify the ARN in the SourceIdentifier key. This key is part of + * the Source object, which is part of the ConfigRule + * object.

For any new Config rule that you add, specify the + * ConfigRuleName in the ConfigRule object. Do not + * specify the ConfigRuleArn or the ConfigRuleId. These + * values are generated by Config for new rules.

If you are updating a rule + * that you added previously, you can specify the rule by + * ConfigRuleName, ConfigRuleId, or + * ConfigRuleArn in the ConfigRule data type that you use + * in this request.

For more information about developing and using Config + * rules, see Evaluating + * Resources with Config Rules in the Config Developer Guide.

+ *

Tags are added at creation and cannot be updated with this operation + *

PutConfigRule is an idempotent API. Subsequent requests + * won’t create a duplicate resource if one was already created. If a following + * request has different tags values, Config will ignore these + * differences and treat it as an idempotent request of the previous. In this case, + * tags will not be updated, even if they are different.

Use TagResource + * and UntagResource + * to update tags after creation.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutConfigRuleOutcome PutConfigRule(const Model::PutConfigRuleRequest& request) const; + + /** + * A Callable wrapper for PutConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutConfigRuleOutcomeCallable PutConfigRuleCallable(const PutConfigRuleRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutConfigRule, request); + } + + /** + * An Async wrapper for PutConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutConfigRuleAsync(const PutConfigRuleRequestT& request, const PutConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutConfigRule, request, handler, context); + } + + /** + *

Creates and updates the configuration aggregator with the selected source + * accounts and regions. The source account can be individual account(s) or an + * organization.

accountIds that are passed will be replaced + * with existing accounts. If you want to add additional accounts into the + * aggregator, call DescribeConfigurationAggregators to get the + * previous accounts and then append new ones.

Config should be + * enabled in source accounts and regions you want to aggregate.

If your + * source type is an organization, you must be signed in to the management account + * or a registered delegated administrator and all the features must be enabled in + * your organization. If the caller is a management account, Config calls + * EnableAwsServiceAccess API to enable integration between Config and + * Organizations. If the caller is a registered delegated administrator, Config + * calls ListDelegatedAdministrators API to verify whether the caller + * is a valid delegated administrator.

To register a delegated + * administrator, see Register + * a Delegated Administrator in the Config developer guide.

+ *

Tags are added at creation and cannot be updated with this + * operation

PutConfigurationAggregator is an idempotent + * API. Subsequent requests won’t create a duplicate resource if one was already + * created. If a following request has different tags values, Config + * will ignore these differences and treat it as an idempotent request of the + * previous. In this case, tags will not be updated, even if they are + * different.

Use TagResource + * and UntagResource + * to update tags after creation.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutConfigurationAggregatorOutcome PutConfigurationAggregator(const Model::PutConfigurationAggregatorRequest& request) const; + + /** + * A Callable wrapper for PutConfigurationAggregator that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutConfigurationAggregatorOutcomeCallable PutConfigurationAggregatorCallable(const PutConfigurationAggregatorRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutConfigurationAggregator, request); + } + + /** + * An Async wrapper for PutConfigurationAggregator that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutConfigurationAggregatorAsync(const PutConfigurationAggregatorRequestT& request, const PutConfigurationAggregatorResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutConfigurationAggregator, request, handler, context); + } + + /** + *

Creates or updates the customer managed configuration recorder.

You + * can use this operation to create a new customer managed configuration recorder + * or to update the roleARN and the recordingGroup for an + * existing customer managed configuration recorder.

To start the customer + * managed configuration recorder and begin recording configuration changes for the + * resource types you specify, use the StartConfigurationRecorder + * operation.

For more information, see + * Working with the Configuration Recorder in the Config Developer + * Guide.

One customer managed configuration recorder per + * account per Region

You can create only one customer managed + * configuration recorder for each account for each Amazon Web Services Region.

+ *

Default is to record all supported resource types, excluding the global + * IAM resource types

If you have not specified values for the + * recordingGroup field, the default for the customer managed + * configuration recorder is to record all supported resource types, excluding the + * global IAM resource types: AWS::IAM::Group, + * AWS::IAM::Policy, AWS::IAM::Role, and + * AWS::IAM::User.

Tags are added at creation and cannot be + * updated

PutConfigurationRecorder is an idempotent API. + * Subsequent requests won’t create a duplicate resource if one was already + * created. If a following request has different tags values, Config will ignore + * these differences and treat it as an idempotent request of the previous. In this + * case, tags will not be updated, even if they are different.

Use TagResource + * and UntagResource + * to update tags after creation.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutConfigurationRecorderOutcome PutConfigurationRecorder(const Model::PutConfigurationRecorderRequest& request) const; + + /** + * A Callable wrapper for PutConfigurationRecorder that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutConfigurationRecorderOutcomeCallable PutConfigurationRecorderCallable(const PutConfigurationRecorderRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutConfigurationRecorder, request); + } + + /** + * An Async wrapper for PutConfigurationRecorder that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutConfigurationRecorderAsync(const PutConfigurationRecorderRequestT& request, const PutConfigurationRecorderResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutConfigurationRecorder, request, handler, context); + } + + /** + *

Creates or updates a conformance pack. A conformance pack is a collection of + * Config rules that can be easily deployed in an account and a region and across + * an organization. For information on how many conformance packs you can have per + * account, see + * Service Limits in the Config Developer Guide.

This API + * creates a service-linked role AWSServiceRoleForConfigConforms in + * your account. The service-linked role is created only when the role does not + * exist in your account.

You must specify only one of the follow + * parameters: TemplateS3Uri, TemplateBody or + * TemplateSSMDocumentDetails.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutConformancePackOutcome PutConformancePack(const Model::PutConformancePackRequest& request) const; + + /** + * A Callable wrapper for PutConformancePack that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutConformancePackOutcomeCallable PutConformancePackCallable(const PutConformancePackRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutConformancePack, request); + } + + /** + * An Async wrapper for PutConformancePack that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutConformancePackAsync(const PutConformancePackRequestT& request, const PutConformancePackResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutConformancePack, request, handler, context); + } + + /** + *

Creates or updates a delivery channel to deliver configuration information + * and other compliance information.

You can use this operation to create a + * new delivery channel or to update the Amazon S3 bucket and the Amazon SNS topic + * of an existing delivery channel.

For more information, see + * Working with the Delivery Channel in the Config Developer + * Guide.

One delivery channel per account per Region + *

You can have only one delivery channel for each account for each Amazon + * Web Services Region.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutDeliveryChannelOutcome PutDeliveryChannel(const Model::PutDeliveryChannelRequest& request) const; + + /** + * A Callable wrapper for PutDeliveryChannel that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutDeliveryChannelOutcomeCallable PutDeliveryChannelCallable(const PutDeliveryChannelRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutDeliveryChannel, request); + } + + /** + * An Async wrapper for PutDeliveryChannel that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutDeliveryChannelAsync(const PutDeliveryChannelRequestT& request, const PutDeliveryChannelResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutDeliveryChannel, request, handler, context); + } + + /** + *

Used by an Lambda function to deliver evaluation results to Config. This + * operation is required in every Lambda function that is invoked by an Config + * rule.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutEvaluationsOutcome PutEvaluations(const Model::PutEvaluationsRequest& request) const; + + /** + * A Callable wrapper for PutEvaluations that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutEvaluationsOutcomeCallable PutEvaluationsCallable(const PutEvaluationsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutEvaluations, request); + } + + /** + * An Async wrapper for PutEvaluations that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutEvaluationsAsync(const PutEvaluationsRequestT& request, const PutEvaluationsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutEvaluations, request, handler, context); + } + + /** + *

Add or updates the evaluations for process checks. This API checks if the + * rule is a process check when the name of the Config rule is + * provided.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutExternalEvaluationOutcome PutExternalEvaluation(const Model::PutExternalEvaluationRequest& request) const; + + /** + * A Callable wrapper for PutExternalEvaluation that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutExternalEvaluationOutcomeCallable PutExternalEvaluationCallable(const PutExternalEvaluationRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutExternalEvaluation, request); + } + + /** + * An Async wrapper for PutExternalEvaluation that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutExternalEvaluationAsync(const PutExternalEvaluationRequestT& request, const PutExternalEvaluationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutExternalEvaluation, request, handler, context); + } + + /** + *

Adds or updates an Config rule for your entire organization to evaluate if + * your Amazon Web Services resources comply with your desired configurations. For + * information on how many organization Config rules you can have per account, see + * + * Service Limits in the Config Developer Guide.

Only a + * management account and a delegated administrator can create or update an + * organization Config rule. When calling this API with a delegated administrator, + * you must ensure Organizations ListDelegatedAdministrator + * permissions are added. An organization can have up to 3 delegated + * administrators.

This API enables organization service access through the + * EnableAWSServiceAccess action and creates a service-linked role + * AWSServiceRoleForConfigMultiAccountSetup in the management or + * delegated administrator account of your organization. The service-linked role is + * created only when the role does not exist in the caller account. Config verifies + * the existence of role with GetRole action.

To use this API + * with delegated administrator, register a delegated administrator by calling + * Amazon Web Services Organization register-delegated-administrator + * for config-multiaccountsetup.amazonaws.com.

There are two + * types of rules: Config Managed Rules and Config Custom Rules. You + * can use PutOrganizationConfigRule to create both Config Managed + * Rules and Config Custom Rules.

Config Managed Rules are predefined, + * customizable rules created by Config. For a list of managed rules, see List + * of Config Managed Rules. If you are adding an Config managed rule, you must + * specify the rule's identifier for the RuleIdentifier key.

+ *

Config Custom Rules are rules that you create from scratch. There are two + * ways to create Config custom rules: with Lambda functions ( + * Lambda Developer Guide) and with Guard (Guard GitHub + * Repository), a policy-as-code language. Config custom rules created with + * Lambda are called Config Custom Lambda Rules and Config custom rules + * created with Guard are called Config Custom Policy Rules.

If you + * are adding a new Config Custom Lambda rule, you first need to create an Lambda + * function in the management account or a delegated administrator that the rule + * invokes to evaluate your resources. You also need to create an IAM role in the + * managed account that can be assumed by the Lambda function. When you use + * PutOrganizationConfigRule to add a Custom Lambda rule to Config, + * you must specify the Amazon Resource Name (ARN) that Lambda assigns to the + * function.

Prerequisite: Ensure you call + * EnableAllFeatures API to enable all features in an + * organization.

Make sure to specify one of either + * OrganizationCustomPolicyRuleMetadata for Custom Policy rules, + * OrganizationCustomRuleMetadata for Custom Lambda rules, or + * OrganizationManagedRuleMetadata for managed rules.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::PutOrganizationConfigRuleOutcome PutOrganizationConfigRule(const Model::PutOrganizationConfigRuleRequest& request) const; + + /** + * A Callable wrapper for PutOrganizationConfigRule that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutOrganizationConfigRuleOutcomeCallable PutOrganizationConfigRuleCallable(const PutOrganizationConfigRuleRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutOrganizationConfigRule, request); + } + + /** + * An Async wrapper for PutOrganizationConfigRule that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutOrganizationConfigRuleAsync(const PutOrganizationConfigRuleRequestT& request, const PutOrganizationConfigRuleResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutOrganizationConfigRule, request, handler, context); + } + + /** + *

Deploys conformance packs across member accounts in an Amazon Web Services + * Organization. For information on how many organization conformance packs and how + * many Config rules you can have per account, see + * Service Limits in the Config Developer Guide.

Only a + * management account and a delegated administrator can call this API. When calling + * this API with a delegated administrator, you must ensure Organizations + * ListDelegatedAdministrator permissions are added. An organization + * can have up to 3 delegated administrators.

This API enables organization + * service access for config-multiaccountsetup.amazonaws.com through + * the EnableAWSServiceAccess action and creates a service-linked role + * AWSServiceRoleForConfigMultiAccountSetup in the management or + * delegated administrator account of your organization. The service-linked role is + * created only when the role does not exist in the caller account. To use this API + * with delegated administrator, register a delegated administrator by calling + * Amazon Web Services Organization register-delegate-admin for + * config-multiaccountsetup.amazonaws.com.

Prerequisite: + * Ensure you call EnableAllFeatures API to enable all features in an + * organization.

You must specify either the TemplateS3Uri or + * the TemplateBody parameter, but not both. If you provide both + * Config uses the TemplateS3Uri parameter and ignores the + * TemplateBody parameter.

Config sets the state of a + * conformance pack to CREATE_IN_PROGRESS and UPDATE_IN_PROGRESS until the + * conformance pack is created or updated. You cannot update a conformance pack + * while it is in this state.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutOrganizationConformancePackOutcome PutOrganizationConformancePack(const Model::PutOrganizationConformancePackRequest& request) const; + + /** + * A Callable wrapper for PutOrganizationConformancePack that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutOrganizationConformancePackOutcomeCallable PutOrganizationConformancePackCallable(const PutOrganizationConformancePackRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutOrganizationConformancePack, request); + } + + /** + * An Async wrapper for PutOrganizationConformancePack that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutOrganizationConformancePackAsync(const PutOrganizationConformancePackRequestT& request, const PutOrganizationConformancePackResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutOrganizationConformancePack, request, handler, context); + } + + /** + *

Adds or updates the remediation configuration with a specific Config rule + * with the selected target or action. The API creates the + * RemediationConfiguration object for the Config rule. The Config + * rule must already exist for you to add a remediation configuration. The target + * (SSM document) must exist and have permissions to use the target.

+ *

Be aware of backward incompatible changes

If you make + * backward incompatible changes to the SSM document, you must call this again to + * ensure the remediations can run.

This API does not support adding + * remediation configurations for service-linked Config Rules such as Organization + * Config rules, the rules deployed by conformance packs, and rules deployed by + * Amazon Web Services Security Hub.

Required fields + *

For manual remediation configuration, you need to provide a value for + * automationAssumeRole or use a value in the + * assumeRolefield to remediate your resources. The SSM automation + * document can use either as long as it maps to a valid parameter.

However, + * for automatic remediation configuration, the only valid assumeRole + * field value is AutomationAssumeRole and you need to provide a value + * for AutomationAssumeRole to remediate your resources.

+ *

Auto remediation can be initiated even for compliant resources + *

If you enable auto remediation for a specific Config rule using the PutRemediationConfigurations + * API or the Config console, it initiates the remediation process for all + * non-compliant resources for that specific rule. The auto remediation process + * relies on the compliance data snapshot which is captured on a periodic basis. + * Any non-compliant resource that is updated between the snapshot schedule will + * continue to be remediated based on the last known compliance data snapshot.

+ *

This means that in some cases auto remediation can be initiated even for + * compliant resources, since the bootstrap processor uses a database that can have + * stale evaluation results based on the last known compliance data snapshot.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::PutRemediationConfigurationsOutcome PutRemediationConfigurations(const Model::PutRemediationConfigurationsRequest& request) const; + + /** + * A Callable wrapper for PutRemediationConfigurations that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutRemediationConfigurationsOutcomeCallable PutRemediationConfigurationsCallable(const PutRemediationConfigurationsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutRemediationConfigurations, request); + } + + /** + * An Async wrapper for PutRemediationConfigurations that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutRemediationConfigurationsAsync(const PutRemediationConfigurationsRequestT& request, const PutRemediationConfigurationsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutRemediationConfigurations, request, handler, context); + } + + /** + *

A remediation exception is when a specified resource is no longer considered + * for auto-remediation. This API adds a new exception or updates an existing + * exception for a specified resource with a specified Config rule.

+ * Exceptions block auto remediation

Config generates a remediation + * exception when a problem occurs running a remediation action for a specified + * resource. Remediation exceptions blocks auto-remediation until the exception is + * cleared.

Manual remediation is recommended when + * placing an exception

When placing an exception on an Amazon Web + * Services resource, it is recommended that remediation is set as manual + * remediation until the given Config rule for the specified resource evaluates the + * resource as NON_COMPLIANT. Once the resource has been evaluated as + * NON_COMPLIANT, you can add remediation exceptions and change the + * remediation type back from Manual to Auto if you want to use auto-remediation. + * Otherwise, using auto-remediation before a NON_COMPLIANT evaluation + * result can delete resources before the exception is applied.

+ *

Exceptions can only be performed on non-compliant resources

+ *

Placing an exception can only be performed on resources that are + * NON_COMPLIANT. If you use this API for COMPLIANT + * resources or resources that are NOT_APPLICABLE, a remediation + * exception will not be generated. For more information on the conditions that + * initiate the possible Config evaluation results, see Concepts + * | Config Rules in the Config Developer Guide.

+ * Exceptions cannot be placed on service-linked remediation actions

+ *

You cannot place an exception on service-linked remediation actions, such as + * remediation actions put by an organizational conformance pack.

+ *

Auto remediation can be initiated even for compliant resources + *

If you enable auto remediation for a specific Config rule using the PutRemediationConfigurations + * API or the Config console, it initiates the remediation process for all + * non-compliant resources for that specific rule. The auto remediation process + * relies on the compliance data snapshot which is captured on a periodic basis. + * Any non-compliant resource that is updated between the snapshot schedule will + * continue to be remediated based on the last known compliance data snapshot.

+ *

This means that in some cases auto remediation can be initiated even for + * compliant resources, since the bootstrap processor uses a database that can have + * stale evaluation results based on the last known compliance data snapshot.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::PutRemediationExceptionsOutcome PutRemediationExceptions(const Model::PutRemediationExceptionsRequest& request) const; + + /** + * A Callable wrapper for PutRemediationExceptions that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutRemediationExceptionsOutcomeCallable PutRemediationExceptionsCallable(const PutRemediationExceptionsRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutRemediationExceptions, request); + } + + /** + * An Async wrapper for PutRemediationExceptions that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutRemediationExceptionsAsync(const PutRemediationExceptionsRequestT& request, const PutRemediationExceptionsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutRemediationExceptions, request, handler, context); + } + + /** + *

Records the configuration state for the resource provided in the request. The + * configuration state of a resource is represented in Config as Configuration + * Items. Once this API records the configuration item, you can retrieve the list + * of configuration items for the custom resource type using existing Config APIs. + *

The custom resource type must be registered with CloudFormation. + * This API accepts the configuration item registered with CloudFormation.

+ *

When you call this API, Config only stores configuration state of the + * resource provided in the request. This API does not change or remediate the + * configuration of the resource.

Write-only schema properites are not + * recorded as part of the published configuration item.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::PutResourceConfigOutcome PutResourceConfig(const Model::PutResourceConfigRequest& request) const; + + /** + * A Callable wrapper for PutResourceConfig that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutResourceConfigOutcomeCallable PutResourceConfigCallable(const PutResourceConfigRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutResourceConfig, request); + } + + /** + * An Async wrapper for PutResourceConfig that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutResourceConfigAsync(const PutResourceConfigRequestT& request, const PutResourceConfigResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutResourceConfig, request, handler, context); + } + + /** + *

Creates and updates the retention configuration with details about retention + * period (number of days) that Config stores your historical information. The API + * creates the RetentionConfiguration object and names the object as + * default. When you have a RetentionConfiguration object named + * default, calling the API modifies the default object.

+ *

Currently, Config supports only one retention configuration per region in + * your account.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutRetentionConfigurationOutcome PutRetentionConfiguration(const Model::PutRetentionConfigurationRequest& request) const; + + /** + * A Callable wrapper for PutRetentionConfiguration that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutRetentionConfigurationOutcomeCallable PutRetentionConfigurationCallable(const PutRetentionConfigurationRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutRetentionConfiguration, request); + } + + /** + * An Async wrapper for PutRetentionConfiguration that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutRetentionConfigurationAsync(const PutRetentionConfigurationRequestT& request, const PutRetentionConfigurationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutRetentionConfiguration, request, handler, context); + } + + /** + *

Creates a service-linked configuration recorder that is linked to a specific + * Amazon Web Services service based on the ServicePrincipal you + * specify.

The configuration recorder's name, + * recordingGroup, recordingMode, and + * recordingScope is set by the service that is linked to the + * configuration recorder.

For more information, see + * Working with the Configuration Recorder in the Config Developer + * Guide.

This API creates a service-linked role + * AWSServiceRoleForConfig in your account. The service-linked role is + * created only when the role does not exist in your account.

The + * recording scope determines if you receive configuration items

The + * recording scope is set by the service that is linked to the configuration + * recorder and determines whether you receive configuration items (CIs) in the + * delivery channel. If the recording scope is internal, you will not receive CIs + * in the delivery channel.

Tags are added at creation and cannot be + * updated with this operation

Use TagResource + * and UntagResource + * to update tags after creation.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutServiceLinkedConfigurationRecorderOutcome PutServiceLinkedConfigurationRecorder(const Model::PutServiceLinkedConfigurationRecorderRequest& request) const; + + /** + * A Callable wrapper for PutServiceLinkedConfigurationRecorder that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutServiceLinkedConfigurationRecorderOutcomeCallable PutServiceLinkedConfigurationRecorderCallable(const PutServiceLinkedConfigurationRecorderRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutServiceLinkedConfigurationRecorder, request); + } + + /** + * An Async wrapper for PutServiceLinkedConfigurationRecorder that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutServiceLinkedConfigurationRecorderAsync(const PutServiceLinkedConfigurationRecorderRequestT& request, const PutServiceLinkedConfigurationRecorderResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutServiceLinkedConfigurationRecorder, request, handler, context); + } + + /** + *

Saves a new query or updates an existing saved query. The + * QueryName must be unique for a single Amazon Web Services account + * and a single Amazon Web Services Region. You can create upto 300 queries in a + * single Amazon Web Services account and a single Amazon Web Services Region.

+ *

Tags are added at creation and cannot be updated

+ * PutStoredQuery is an idempotent API. Subsequent requests won’t + * create a duplicate resource if one was already created. If a following request + * has different tags values, Config will ignore these differences and + * treat it as an idempotent request of the previous. In this case, + * tags will not be updated, even if they are different.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::PutStoredQueryOutcome PutStoredQuery(const Model::PutStoredQueryRequest& request) const; + + /** + * A Callable wrapper for PutStoredQuery that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutStoredQueryOutcomeCallable PutStoredQueryCallable(const PutStoredQueryRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::PutStoredQuery, request); + } + + /** + * An Async wrapper for PutStoredQuery that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutStoredQueryAsync(const PutStoredQueryRequestT& request, const PutStoredQueryResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::PutStoredQuery, request, handler, context); + } + + /** + *

Accepts a structured query language (SQL) SELECT command and an aggregator to + * query configuration state of Amazon Web Services resources across multiple + * accounts and regions, performs the corresponding search, and returns resource + * configurations matching the properties.

For more information about query + * components, see the + * Query Components section in the Config Developer Guide.

+ *

If you run an aggregation query (i.e., using GROUP BY or + * using aggregate functions such as COUNT; e.g., SELECT + * resourceId, COUNT(*) WHERE resourceType = 'AWS::IAM::Role' GROUP BY + * resourceId) and do not specify the MaxResults or the + * Limit query parameters, the default page size is set to 500.

+ *

If you run a non-aggregation query (i.e., not using GROUP BY or + * aggregate function; e.g., SELECT * WHERE resourceType = + * 'AWS::IAM::Role') and do not specify the MaxResults or the + * Limit query parameters, the default page size is set to 25.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::SelectAggregateResourceConfigOutcome SelectAggregateResourceConfig(const Model::SelectAggregateResourceConfigRequest& request) const; + + /** + * A Callable wrapper for SelectAggregateResourceConfig that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SelectAggregateResourceConfigOutcomeCallable SelectAggregateResourceConfigCallable(const SelectAggregateResourceConfigRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::SelectAggregateResourceConfig, request); + } + + /** + * An Async wrapper for SelectAggregateResourceConfig that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SelectAggregateResourceConfigAsync(const SelectAggregateResourceConfigRequestT& request, const SelectAggregateResourceConfigResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::SelectAggregateResourceConfig, request, handler, context); + } + + /** + *

Accepts a structured query language (SQL) SELECT command, + * performs the corresponding search, and returns resource configurations matching + * the properties.

For more information about query components, see the + * Query Components section in the Config Developer + * Guide.

See Also:

AWS + * API Reference

+ */ + virtual Model::SelectResourceConfigOutcome SelectResourceConfig(const Model::SelectResourceConfigRequest& request) const; + + /** + * A Callable wrapper for SelectResourceConfig that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SelectResourceConfigOutcomeCallable SelectResourceConfigCallable(const SelectResourceConfigRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::SelectResourceConfig, request); + } + + /** + * An Async wrapper for SelectResourceConfig that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SelectResourceConfigAsync(const SelectResourceConfigRequestT& request, const SelectResourceConfigResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::SelectResourceConfig, request, handler, context); + } + + /** + *

Runs an on-demand evaluation for the specified Config rules against the last + * known configuration state of the resources. Use + * StartConfigRulesEvaluation when you want to test that a rule you + * updated is working as expected. StartConfigRulesEvaluation does not + * re-record the latest configuration state for your resources. It re-runs an + * evaluation against the last known state of your resources.

You can + * specify up to 25 Config rules per request.

An existing + * StartConfigRulesEvaluation call for the specified rules must + * complete before you can call the API again. If you chose to have Config stream + * to an Amazon SNS topic, you will receive a + * ConfigRuleEvaluationStarted notification when the evaluation + * starts.

You don't need to call the + * StartConfigRulesEvaluation API to run an evaluation for a new rule. + * When you create a rule, Config evaluates your resources against the rule + * automatically.

The StartConfigRulesEvaluation API + * is useful if you want to run on-demand evaluations, such as the following + * example:

  1. You have a custom rule that evaluates your IAM + * resources every 24 hours.

  2. You update your Lambda function to + * add additional conditions to your rule.

  3. Instead of waiting for + * the next periodic evaluation, you call the + * StartConfigRulesEvaluation API.

  4. Config invokes + * your Lambda function and evaluates your IAM resources.

  5. Your + * custom rule will still run periodic evaluations every 24 hours.

  6. + *

See Also:

AWS + * API Reference

+ */ + virtual Model::StartConfigRulesEvaluationOutcome StartConfigRulesEvaluation(const Model::StartConfigRulesEvaluationRequest& request = {}) const; + + /** + * A Callable wrapper for StartConfigRulesEvaluation that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::StartConfigRulesEvaluationOutcomeCallable StartConfigRulesEvaluationCallable(const StartConfigRulesEvaluationRequestT& request = {}) const + { + return SubmitCallable(&ConfigServiceClient::StartConfigRulesEvaluation, request); + } + + /** + * An Async wrapper for StartConfigRulesEvaluation that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void StartConfigRulesEvaluationAsync(const StartConfigRulesEvaluationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const StartConfigRulesEvaluationRequestT& request = {}) const + { + return SubmitAsync(&ConfigServiceClient::StartConfigRulesEvaluation, request, handler, context); + } + + /** + *

Starts the customer managed configuration recorder. The customer managed + * configuration recorder will begin recording configuration changes for the + * resource types you specify.

You must have created a delivery channel to + * successfully start the customer managed configuration recorder. You can use the + * PutDeliveryChannel + * operation to create a delivery channel.

See Also:

AWS + * API Reference

+ */ + virtual Model::StartConfigurationRecorderOutcome StartConfigurationRecorder(const Model::StartConfigurationRecorderRequest& request) const; + + /** + * A Callable wrapper for StartConfigurationRecorder that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::StartConfigurationRecorderOutcomeCallable StartConfigurationRecorderCallable(const StartConfigurationRecorderRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::StartConfigurationRecorder, request); + } + + /** + * An Async wrapper for StartConfigurationRecorder that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void StartConfigurationRecorderAsync(const StartConfigurationRecorderRequestT& request, const StartConfigurationRecorderResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::StartConfigurationRecorder, request, handler, context); + } + + /** + *

Runs an on-demand remediation for the specified Config rules against the last + * known remediation configuration. It runs an execution against the current state + * of your resources. Remediation execution is asynchronous.

You can specify + * up to 100 resource keys per request. An existing StartRemediationExecution call + * for the specified resource keys must complete before you can call the API + * again.

See Also:

AWS + * API Reference

+ */ + virtual Model::StartRemediationExecutionOutcome StartRemediationExecution(const Model::StartRemediationExecutionRequest& request) const; + + /** + * A Callable wrapper for StartRemediationExecution that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::StartRemediationExecutionOutcomeCallable StartRemediationExecutionCallable(const StartRemediationExecutionRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::StartRemediationExecution, request); + } + + /** + * An Async wrapper for StartRemediationExecution that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void StartRemediationExecutionAsync(const StartRemediationExecutionRequestT& request, const StartRemediationExecutionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::StartRemediationExecution, request, handler, context); + } + + /** + *

Runs an on-demand evaluation for the specified resource to determine whether + * the resource details will comply with configured Config rules. You can also use + * it for evaluation purposes. Config recommends using an evaluation context. It + * runs an execution against the resource details with all of the Config rules in + * your account that match with the specified proactive mode and resource type.

+ *

Ensure you have the cloudformation:DescribeType role + * setup to validate the resource type schema.

You can find the Resource + * type schema in "Amazon Web Services public extensions" within the + * CloudFormation registry or with the following CLI commmand: aws + * cloudformation describe-type --type-name "AWS::S3::Bucket" --type + * RESOURCE.

For more information, see Managing + * extensions through the CloudFormation registry and Amazon + * Web Services resource and property types reference in the CloudFormation + * User Guide.

See Also:

AWS + * API Reference

+ */ + virtual Model::StartResourceEvaluationOutcome StartResourceEvaluation(const Model::StartResourceEvaluationRequest& request) const; + + /** + * A Callable wrapper for StartResourceEvaluation that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::StartResourceEvaluationOutcomeCallable StartResourceEvaluationCallable(const StartResourceEvaluationRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::StartResourceEvaluation, request); + } + + /** + * An Async wrapper for StartResourceEvaluation that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void StartResourceEvaluationAsync(const StartResourceEvaluationRequestT& request, const StartResourceEvaluationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::StartResourceEvaluation, request, handler, context); + } + + /** + *

Stops the customer managed configuration recorder. The customer managed + * configuration recorder will stop recording configuration changes for the + * resource types you have specified.

See Also:

AWS + * API Reference

+ */ + virtual Model::StopConfigurationRecorderOutcome StopConfigurationRecorder(const Model::StopConfigurationRecorderRequest& request) const; + + /** + * A Callable wrapper for StopConfigurationRecorder that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::StopConfigurationRecorderOutcomeCallable StopConfigurationRecorderCallable(const StopConfigurationRecorderRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::StopConfigurationRecorder, request); + } + + /** + * An Async wrapper for StopConfigurationRecorder that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void StopConfigurationRecorderAsync(const StopConfigurationRecorderRequestT& request, const StopConfigurationRecorderResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::StopConfigurationRecorder, request, handler, context); + } + + /** + *

Associates the specified tags to a resource with the specified + * ResourceArn. If existing tags on a resource are not specified in + * the request parameters, they are not changed. If existing tags are specified, + * however, then their values will be updated. When a resource is deleted, the tags + * associated with that resource are deleted as well.

See Also:

AWS + * API Reference

+ */ + virtual Model::TagResourceOutcome TagResource(const Model::TagResourceRequest& request) const; + + /** + * A Callable wrapper for TagResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::TagResourceOutcomeCallable TagResourceCallable(const TagResourceRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::TagResource, request); + } + + /** + * An Async wrapper for TagResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void TagResourceAsync(const TagResourceRequestT& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::TagResource, request, handler, context); + } + + /** + *

Deletes specified tags from a resource.

See Also:

AWS + * API Reference

+ */ + virtual Model::UntagResourceOutcome UntagResource(const Model::UntagResourceRequest& request) const; + + /** + * A Callable wrapper for UntagResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::UntagResourceOutcomeCallable UntagResourceCallable(const UntagResourceRequestT& request) const + { + return SubmitCallable(&ConfigServiceClient::UntagResource, request); + } + + /** + * An Async wrapper for UntagResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void UntagResourceAsync(const UntagResourceRequestT& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&ConfigServiceClient::UntagResource, request, handler, context); + } + + + void OverrideEndpoint(const Aws::String& endpoint); + std::shared_ptr& accessEndpointProvider(); + private: + friend class Aws::Client::ClientWithAsyncTemplateMethods; + + }; + +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/ConfigServiceEndpointProvider.h b/include/aws/config/ConfigServiceEndpointProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..a22347f87edef52bc6d97c6ba4daaac52cc14f0a --- /dev/null +++ b/include/aws/config/ConfigServiceEndpointProvider.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +#include + + +namespace Aws +{ +namespace ConfigService +{ +namespace Endpoint +{ +using EndpointParameters = Aws::Endpoint::EndpointParameters; +using Aws::Endpoint::EndpointProviderBase; +using Aws::Endpoint::DefaultEndpointProvider; + +using ConfigServiceClientContextParameters = Aws::Endpoint::ClientContextParameters; + +using ConfigServiceClientConfiguration = Aws::Client::GenericClientConfiguration; +using ConfigServiceBuiltInParameters = Aws::Endpoint::BuiltInParameters; + +/** + * The type for the ConfigService Client Endpoint Provider. + * Inherit from this Base class / "Interface" should you want to provide a custom endpoint provider. + * The SDK must use service-specific type for each service per specification. + */ +using ConfigServiceEndpointProviderBase = + EndpointProviderBase; + +using ConfigServiceDefaultEpProviderBase = + DefaultEndpointProvider; + +/** + * Default endpoint provider used for this service + */ +class AWS_CONFIGSERVICE_API ConfigServiceEndpointProvider : public ConfigServiceDefaultEpProviderBase +{ +public: + using ConfigServiceResolveEndpointOutcome = Aws::Endpoint::ResolveEndpointOutcome; + + ConfigServiceEndpointProvider() + : ConfigServiceDefaultEpProviderBase(Aws::ConfigService::ConfigServiceEndpointRules::GetRulesBlob(), Aws::ConfigService::ConfigServiceEndpointRules::RulesBlobSize) + {} + + ~ConfigServiceEndpointProvider() + { + } +}; +} // namespace Endpoint +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/ConfigServiceEndpointRules.h b/include/aws/config/ConfigServiceEndpointRules.h new file mode 100644 index 0000000000000000000000000000000000000000..3e6a0792162874137688973d9c75c2b0ddd4fe3d --- /dev/null +++ b/include/aws/config/ConfigServiceEndpointRules.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +class ConfigServiceEndpointRules +{ +public: + static const size_t RulesBlobStrLen; + static const size_t RulesBlobSize; + + static const char* GetRulesBlob(); +}; +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/ConfigServiceErrorMarshaller.h b/include/aws/config/ConfigServiceErrorMarshaller.h new file mode 100644 index 0000000000000000000000000000000000000000..244939af60298da820567969a95b09c4b652d2d6 --- /dev/null +++ b/include/aws/config/ConfigServiceErrorMarshaller.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ +namespace Client +{ + +class AWS_CONFIGSERVICE_API ConfigServiceErrorMarshaller : public Aws::Client::JsonErrorMarshaller +{ +public: + Aws::Client::AWSError FindErrorByName(const char* exceptionName) const override; +}; + +} // namespace Client +} // namespace Aws diff --git a/include/aws/config/ConfigServiceErrors.h b/include/aws/config/ConfigServiceErrors.h new file mode 100644 index 0000000000000000000000000000000000000000..cb296cdd4c07a5c3a40b1999cd25764e8c244306 --- /dev/null +++ b/include/aws/config/ConfigServiceErrors.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +enum class ConfigServiceErrors +{ + //From Core// + ////////////////////////////////////////////////////////////////////////////////////////// + INCOMPLETE_SIGNATURE = 0, + INTERNAL_FAILURE = 1, + INVALID_ACTION = 2, + INVALID_CLIENT_TOKEN_ID = 3, + INVALID_PARAMETER_COMBINATION = 4, + INVALID_QUERY_PARAMETER = 5, + INVALID_PARAMETER_VALUE = 6, + MISSING_ACTION = 7, // SDK should never allow + MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow + MISSING_PARAMETER = 9, // SDK should never allow + OPT_IN_REQUIRED = 10, + REQUEST_EXPIRED = 11, + SERVICE_UNAVAILABLE = 12, + THROTTLING = 13, + VALIDATION = 14, + ACCESS_DENIED = 15, + RESOURCE_NOT_FOUND = 16, + UNRECOGNIZED_CLIENT = 17, + MALFORMED_QUERY_STRING = 18, + SLOW_DOWN = 19, + REQUEST_TIME_TOO_SKEWED = 20, + INVALID_SIGNATURE = 21, + SIGNATURE_DOES_NOT_MATCH = 22, + INVALID_ACCESS_KEY_ID = 23, + REQUEST_TIMEOUT = 24, + NETWORK_CONNECTION = 99, + + UNKNOWN = 100, + /////////////////////////////////////////////////////////////////////////////////////////// + + CONFLICT= static_cast(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1, + CONFORMANCE_PACK_TEMPLATE_VALIDATION, + IDEMPOTENT_PARAMETER_MISMATCH, + INSUFFICIENT_DELIVERY_POLICY, + INSUFFICIENT_PERMISSIONS, + INVALID_CONFIGURATION_RECORDER_NAME, + INVALID_DELIVERY_CHANNEL_NAME, + INVALID_EXPRESSION, + INVALID_LIMIT, + INVALID_NEXT_TOKEN, + INVALID_RECORDING_GROUP, + INVALID_RESULT_TOKEN, + INVALID_ROLE, + INVALID_S3_KEY_PREFIX, + INVALID_S3_KMS_KEY_ARN, + INVALID_S_N_S_TOPIC_A_R_N, + INVALID_TIME_RANGE, + LAST_DELIVERY_CHANNEL_DELETE_FAILED, + LIMIT_EXCEEDED, + MAX_ACTIVE_RESOURCES_EXCEEDED, + MAX_NUMBER_OF_CONFIGURATION_RECORDERS_EXCEEDED, + MAX_NUMBER_OF_CONFIG_RULES_EXCEEDED, + MAX_NUMBER_OF_CONFORMANCE_PACKS_EXCEEDED, + MAX_NUMBER_OF_DELIVERY_CHANNELS_EXCEEDED, + MAX_NUMBER_OF_ORGANIZATION_CONFIG_RULES_EXCEEDED, + MAX_NUMBER_OF_ORGANIZATION_CONFORMANCE_PACKS_EXCEEDED, + MAX_NUMBER_OF_RETENTION_CONFIGURATIONS_EXCEEDED, + NO_AVAILABLE_CONFIGURATION_RECORDER, + NO_AVAILABLE_DELIVERY_CHANNEL, + NO_AVAILABLE_ORGANIZATION, + NO_RUNNING_CONFIGURATION_RECORDER, + NO_SUCH_BUCKET, + NO_SUCH_CONFIGURATION_AGGREGATOR, + NO_SUCH_CONFIGURATION_RECORDER, + NO_SUCH_CONFIG_RULE, + NO_SUCH_CONFIG_RULE_IN_CONFORMANCE_PACK, + NO_SUCH_CONFORMANCE_PACK, + NO_SUCH_DELIVERY_CHANNEL, + NO_SUCH_ORGANIZATION_CONFIG_RULE, + NO_SUCH_ORGANIZATION_CONFORMANCE_PACK, + NO_SUCH_REMEDIATION_CONFIGURATION, + NO_SUCH_REMEDIATION_EXCEPTION, + NO_SUCH_RETENTION_CONFIGURATION, + ORGANIZATION_ACCESS_DENIED, + ORGANIZATION_ALL_FEATURES_NOT_ENABLED, + ORGANIZATION_CONFORMANCE_PACK_TEMPLATE_VALIDATION, + OVERSIZED_CONFIGURATION_ITEM, + REMEDIATION_IN_PROGRESS, + RESOURCE_CONCURRENT_MODIFICATION, + RESOURCE_IN_USE, + RESOURCE_NOT_DISCOVERED, + TOO_MANY_TAGS, + UNMODIFIABLE_ENTITY +}; + +class AWS_CONFIGSERVICE_API ConfigServiceError : public Aws::Client::AWSError +{ +public: + ConfigServiceError() {} + ConfigServiceError(const Aws::Client::AWSError& rhs) : Aws::Client::AWSError(rhs) {} + ConfigServiceError(Aws::Client::AWSError&& rhs) : Aws::Client::AWSError(rhs) {} + ConfigServiceError(const Aws::Client::AWSError& rhs) : Aws::Client::AWSError(rhs) {} + ConfigServiceError(Aws::Client::AWSError&& rhs) : Aws::Client::AWSError(rhs) {} + + template + T GetModeledError(); +}; + +namespace ConfigServiceErrorMapper +{ + AWS_CONFIGSERVICE_API Aws::Client::AWSError GetErrorForName(const char* errorName); +} + +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/ConfigServiceRequest.h b/include/aws/config/ConfigServiceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..13ba9cbe4eaa1df0f2603a35068f106fe88cbc1a --- /dev/null +++ b/include/aws/config/ConfigServiceRequest.h @@ -0,0 +1,46 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ + class AWS_CONFIGSERVICE_API ConfigServiceRequest : public Aws::AmazonSerializableWebServiceRequest + { + public: + using EndpointParameter = Aws::Endpoint::EndpointParameter; + using EndpointParameters = Aws::Endpoint::EndpointParameters; + + virtual ~ConfigServiceRequest () {} + + void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); } + + inline Aws::Http::HeaderValueCollection GetHeaders() const override + { + auto headers = GetRequestSpecificHeaders(); + + if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0)) + { + headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::AMZN_JSON_CONTENT_TYPE_1_1 )); + } + headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2014-11-12")); + return headers; + } + + protected: + virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); } + + }; + + +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/ConfigServiceServiceClientModel.h b/include/aws/config/ConfigServiceServiceClientModel.h new file mode 100644 index 0000000000000000000000000000000000000000..0e2e336eafc0b2127c08afaf0753999612a6e129 --- /dev/null +++ b/include/aws/config/ConfigServiceServiceClientModel.h @@ -0,0 +1,570 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +/* Generic header includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* End of generic header includes */ + +/* Service model headers required in ConfigServiceClient header */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* End of service model headers required in ConfigServiceClient header */ + +namespace Aws +{ + namespace Http + { + class HttpClient; + class HttpClientFactory; + } // namespace Http + + namespace Utils + { + template< typename R, typename E> class Outcome; + + namespace Threading + { + class Executor; + } // namespace Threading + } // namespace Utils + + namespace Auth + { + class AWSCredentials; + class AWSCredentialsProvider; + } // namespace Auth + + namespace Client + { + class RetryStrategy; + } // namespace Client + + namespace ConfigService + { + using ConfigServiceClientConfiguration = Aws::Client::GenericClientConfiguration; + using ConfigServiceEndpointProviderBase = Aws::ConfigService::Endpoint::ConfigServiceEndpointProviderBase; + using ConfigServiceEndpointProvider = Aws::ConfigService::Endpoint::ConfigServiceEndpointProvider; + + namespace Model + { + /* Service model forward declarations required in ConfigServiceClient header */ + class AssociateResourceTypesRequest; + class BatchGetAggregateResourceConfigRequest; + class BatchGetResourceConfigRequest; + class DeleteAggregationAuthorizationRequest; + class DeleteConfigRuleRequest; + class DeleteConfigurationAggregatorRequest; + class DeleteConfigurationRecorderRequest; + class DeleteConformancePackRequest; + class DeleteDeliveryChannelRequest; + class DeleteEvaluationResultsRequest; + class DeleteOrganizationConfigRuleRequest; + class DeleteOrganizationConformancePackRequest; + class DeletePendingAggregationRequestRequest; + class DeleteRemediationConfigurationRequest; + class DeleteRemediationExceptionsRequest; + class DeleteResourceConfigRequest; + class DeleteRetentionConfigurationRequest; + class DeleteServiceLinkedConfigurationRecorderRequest; + class DeleteStoredQueryRequest; + class DeliverConfigSnapshotRequest; + class DescribeAggregateComplianceByConfigRulesRequest; + class DescribeAggregateComplianceByConformancePacksRequest; + class DescribeAggregationAuthorizationsRequest; + class DescribeComplianceByConfigRuleRequest; + class DescribeComplianceByResourceRequest; + class DescribeConfigRuleEvaluationStatusRequest; + class DescribeConfigRulesRequest; + class DescribeConfigurationAggregatorSourcesStatusRequest; + class DescribeConfigurationAggregatorsRequest; + class DescribeConfigurationRecorderStatusRequest; + class DescribeConfigurationRecordersRequest; + class DescribeConformancePackComplianceRequest; + class DescribeConformancePackStatusRequest; + class DescribeConformancePacksRequest; + class DescribeDeliveryChannelStatusRequest; + class DescribeDeliveryChannelsRequest; + class DescribeOrganizationConfigRuleStatusesRequest; + class DescribeOrganizationConfigRulesRequest; + class DescribeOrganizationConformancePackStatusesRequest; + class DescribeOrganizationConformancePacksRequest; + class DescribePendingAggregationRequestsRequest; + class DescribeRemediationConfigurationsRequest; + class DescribeRemediationExceptionsRequest; + class DescribeRemediationExecutionStatusRequest; + class DescribeRetentionConfigurationsRequest; + class DisassociateResourceTypesRequest; + class GetAggregateComplianceDetailsByConfigRuleRequest; + class GetAggregateConfigRuleComplianceSummaryRequest; + class GetAggregateConformancePackComplianceSummaryRequest; + class GetAggregateDiscoveredResourceCountsRequest; + class GetAggregateResourceConfigRequest; + class GetComplianceDetailsByConfigRuleRequest; + class GetComplianceDetailsByResourceRequest; + class GetComplianceSummaryByConfigRuleRequest; + class GetComplianceSummaryByResourceTypeRequest; + class GetConformancePackComplianceDetailsRequest; + class GetConformancePackComplianceSummaryRequest; + class GetCustomRulePolicyRequest; + class GetDiscoveredResourceCountsRequest; + class GetOrganizationConfigRuleDetailedStatusRequest; + class GetOrganizationConformancePackDetailedStatusRequest; + class GetOrganizationCustomRulePolicyRequest; + class GetResourceConfigHistoryRequest; + class GetResourceEvaluationSummaryRequest; + class GetStoredQueryRequest; + class ListAggregateDiscoveredResourcesRequest; + class ListConfigurationRecordersRequest; + class ListConformancePackComplianceScoresRequest; + class ListDiscoveredResourcesRequest; + class ListResourceEvaluationsRequest; + class ListStoredQueriesRequest; + class ListTagsForResourceRequest; + class PutAggregationAuthorizationRequest; + class PutConfigRuleRequest; + class PutConfigurationAggregatorRequest; + class PutConfigurationRecorderRequest; + class PutConformancePackRequest; + class PutDeliveryChannelRequest; + class PutEvaluationsRequest; + class PutExternalEvaluationRequest; + class PutOrganizationConfigRuleRequest; + class PutOrganizationConformancePackRequest; + class PutRemediationConfigurationsRequest; + class PutRemediationExceptionsRequest; + class PutResourceConfigRequest; + class PutRetentionConfigurationRequest; + class PutServiceLinkedConfigurationRecorderRequest; + class PutStoredQueryRequest; + class SelectAggregateResourceConfigRequest; + class SelectResourceConfigRequest; + class StartConfigRulesEvaluationRequest; + class StartConfigurationRecorderRequest; + class StartRemediationExecutionRequest; + class StartResourceEvaluationRequest; + class StopConfigurationRecorderRequest; + class TagResourceRequest; + class UntagResourceRequest; + /* End of service model forward declarations required in ConfigServiceClient header */ + + /* Service model Outcome class definitions */ + typedef Aws::Utils::Outcome AssociateResourceTypesOutcome; + typedef Aws::Utils::Outcome BatchGetAggregateResourceConfigOutcome; + typedef Aws::Utils::Outcome BatchGetResourceConfigOutcome; + typedef Aws::Utils::Outcome DeleteAggregationAuthorizationOutcome; + typedef Aws::Utils::Outcome DeleteConfigRuleOutcome; + typedef Aws::Utils::Outcome DeleteConfigurationAggregatorOutcome; + typedef Aws::Utils::Outcome DeleteConfigurationRecorderOutcome; + typedef Aws::Utils::Outcome DeleteConformancePackOutcome; + typedef Aws::Utils::Outcome DeleteDeliveryChannelOutcome; + typedef Aws::Utils::Outcome DeleteEvaluationResultsOutcome; + typedef Aws::Utils::Outcome DeleteOrganizationConfigRuleOutcome; + typedef Aws::Utils::Outcome DeleteOrganizationConformancePackOutcome; + typedef Aws::Utils::Outcome DeletePendingAggregationRequestOutcome; + typedef Aws::Utils::Outcome DeleteRemediationConfigurationOutcome; + typedef Aws::Utils::Outcome DeleteRemediationExceptionsOutcome; + typedef Aws::Utils::Outcome DeleteResourceConfigOutcome; + typedef Aws::Utils::Outcome DeleteRetentionConfigurationOutcome; + typedef Aws::Utils::Outcome DeleteServiceLinkedConfigurationRecorderOutcome; + typedef Aws::Utils::Outcome DeleteStoredQueryOutcome; + typedef Aws::Utils::Outcome DeliverConfigSnapshotOutcome; + typedef Aws::Utils::Outcome DescribeAggregateComplianceByConfigRulesOutcome; + typedef Aws::Utils::Outcome DescribeAggregateComplianceByConformancePacksOutcome; + typedef Aws::Utils::Outcome DescribeAggregationAuthorizationsOutcome; + typedef Aws::Utils::Outcome DescribeComplianceByConfigRuleOutcome; + typedef Aws::Utils::Outcome DescribeComplianceByResourceOutcome; + typedef Aws::Utils::Outcome DescribeConfigRuleEvaluationStatusOutcome; + typedef Aws::Utils::Outcome DescribeConfigRulesOutcome; + typedef Aws::Utils::Outcome DescribeConfigurationAggregatorSourcesStatusOutcome; + typedef Aws::Utils::Outcome DescribeConfigurationAggregatorsOutcome; + typedef Aws::Utils::Outcome DescribeConfigurationRecorderStatusOutcome; + typedef Aws::Utils::Outcome DescribeConfigurationRecordersOutcome; + typedef Aws::Utils::Outcome DescribeConformancePackComplianceOutcome; + typedef Aws::Utils::Outcome DescribeConformancePackStatusOutcome; + typedef Aws::Utils::Outcome DescribeConformancePacksOutcome; + typedef Aws::Utils::Outcome DescribeDeliveryChannelStatusOutcome; + typedef Aws::Utils::Outcome DescribeDeliveryChannelsOutcome; + typedef Aws::Utils::Outcome DescribeOrganizationConfigRuleStatusesOutcome; + typedef Aws::Utils::Outcome DescribeOrganizationConfigRulesOutcome; + typedef Aws::Utils::Outcome DescribeOrganizationConformancePackStatusesOutcome; + typedef Aws::Utils::Outcome DescribeOrganizationConformancePacksOutcome; + typedef Aws::Utils::Outcome DescribePendingAggregationRequestsOutcome; + typedef Aws::Utils::Outcome DescribeRemediationConfigurationsOutcome; + typedef Aws::Utils::Outcome DescribeRemediationExceptionsOutcome; + typedef Aws::Utils::Outcome DescribeRemediationExecutionStatusOutcome; + typedef Aws::Utils::Outcome DescribeRetentionConfigurationsOutcome; + typedef Aws::Utils::Outcome DisassociateResourceTypesOutcome; + typedef Aws::Utils::Outcome GetAggregateComplianceDetailsByConfigRuleOutcome; + typedef Aws::Utils::Outcome GetAggregateConfigRuleComplianceSummaryOutcome; + typedef Aws::Utils::Outcome GetAggregateConformancePackComplianceSummaryOutcome; + typedef Aws::Utils::Outcome GetAggregateDiscoveredResourceCountsOutcome; + typedef Aws::Utils::Outcome GetAggregateResourceConfigOutcome; + typedef Aws::Utils::Outcome GetComplianceDetailsByConfigRuleOutcome; + typedef Aws::Utils::Outcome GetComplianceDetailsByResourceOutcome; + typedef Aws::Utils::Outcome GetComplianceSummaryByConfigRuleOutcome; + typedef Aws::Utils::Outcome GetComplianceSummaryByResourceTypeOutcome; + typedef Aws::Utils::Outcome GetConformancePackComplianceDetailsOutcome; + typedef Aws::Utils::Outcome GetConformancePackComplianceSummaryOutcome; + typedef Aws::Utils::Outcome GetCustomRulePolicyOutcome; + typedef Aws::Utils::Outcome GetDiscoveredResourceCountsOutcome; + typedef Aws::Utils::Outcome GetOrganizationConfigRuleDetailedStatusOutcome; + typedef Aws::Utils::Outcome GetOrganizationConformancePackDetailedStatusOutcome; + typedef Aws::Utils::Outcome GetOrganizationCustomRulePolicyOutcome; + typedef Aws::Utils::Outcome GetResourceConfigHistoryOutcome; + typedef Aws::Utils::Outcome GetResourceEvaluationSummaryOutcome; + typedef Aws::Utils::Outcome GetStoredQueryOutcome; + typedef Aws::Utils::Outcome ListAggregateDiscoveredResourcesOutcome; + typedef Aws::Utils::Outcome ListConfigurationRecordersOutcome; + typedef Aws::Utils::Outcome ListConformancePackComplianceScoresOutcome; + typedef Aws::Utils::Outcome ListDiscoveredResourcesOutcome; + typedef Aws::Utils::Outcome ListResourceEvaluationsOutcome; + typedef Aws::Utils::Outcome ListStoredQueriesOutcome; + typedef Aws::Utils::Outcome ListTagsForResourceOutcome; + typedef Aws::Utils::Outcome PutAggregationAuthorizationOutcome; + typedef Aws::Utils::Outcome PutConfigRuleOutcome; + typedef Aws::Utils::Outcome PutConfigurationAggregatorOutcome; + typedef Aws::Utils::Outcome PutConfigurationRecorderOutcome; + typedef Aws::Utils::Outcome PutConformancePackOutcome; + typedef Aws::Utils::Outcome PutDeliveryChannelOutcome; + typedef Aws::Utils::Outcome PutEvaluationsOutcome; + typedef Aws::Utils::Outcome PutExternalEvaluationOutcome; + typedef Aws::Utils::Outcome PutOrganizationConfigRuleOutcome; + typedef Aws::Utils::Outcome PutOrganizationConformancePackOutcome; + typedef Aws::Utils::Outcome PutRemediationConfigurationsOutcome; + typedef Aws::Utils::Outcome PutRemediationExceptionsOutcome; + typedef Aws::Utils::Outcome PutResourceConfigOutcome; + typedef Aws::Utils::Outcome PutRetentionConfigurationOutcome; + typedef Aws::Utils::Outcome PutServiceLinkedConfigurationRecorderOutcome; + typedef Aws::Utils::Outcome PutStoredQueryOutcome; + typedef Aws::Utils::Outcome SelectAggregateResourceConfigOutcome; + typedef Aws::Utils::Outcome SelectResourceConfigOutcome; + typedef Aws::Utils::Outcome StartConfigRulesEvaluationOutcome; + typedef Aws::Utils::Outcome StartConfigurationRecorderOutcome; + typedef Aws::Utils::Outcome StartRemediationExecutionOutcome; + typedef Aws::Utils::Outcome StartResourceEvaluationOutcome; + typedef Aws::Utils::Outcome StopConfigurationRecorderOutcome; + typedef Aws::Utils::Outcome TagResourceOutcome; + typedef Aws::Utils::Outcome UntagResourceOutcome; + /* End of service model Outcome class definitions */ + + /* Service model Outcome callable definitions */ + typedef std::future AssociateResourceTypesOutcomeCallable; + typedef std::future BatchGetAggregateResourceConfigOutcomeCallable; + typedef std::future BatchGetResourceConfigOutcomeCallable; + typedef std::future DeleteAggregationAuthorizationOutcomeCallable; + typedef std::future DeleteConfigRuleOutcomeCallable; + typedef std::future DeleteConfigurationAggregatorOutcomeCallable; + typedef std::future DeleteConfigurationRecorderOutcomeCallable; + typedef std::future DeleteConformancePackOutcomeCallable; + typedef std::future DeleteDeliveryChannelOutcomeCallable; + typedef std::future DeleteEvaluationResultsOutcomeCallable; + typedef std::future DeleteOrganizationConfigRuleOutcomeCallable; + typedef std::future DeleteOrganizationConformancePackOutcomeCallable; + typedef std::future DeletePendingAggregationRequestOutcomeCallable; + typedef std::future DeleteRemediationConfigurationOutcomeCallable; + typedef std::future DeleteRemediationExceptionsOutcomeCallable; + typedef std::future DeleteResourceConfigOutcomeCallable; + typedef std::future DeleteRetentionConfigurationOutcomeCallable; + typedef std::future DeleteServiceLinkedConfigurationRecorderOutcomeCallable; + typedef std::future DeleteStoredQueryOutcomeCallable; + typedef std::future DeliverConfigSnapshotOutcomeCallable; + typedef std::future DescribeAggregateComplianceByConfigRulesOutcomeCallable; + typedef std::future DescribeAggregateComplianceByConformancePacksOutcomeCallable; + typedef std::future DescribeAggregationAuthorizationsOutcomeCallable; + typedef std::future DescribeComplianceByConfigRuleOutcomeCallable; + typedef std::future DescribeComplianceByResourceOutcomeCallable; + typedef std::future DescribeConfigRuleEvaluationStatusOutcomeCallable; + typedef std::future DescribeConfigRulesOutcomeCallable; + typedef std::future DescribeConfigurationAggregatorSourcesStatusOutcomeCallable; + typedef std::future DescribeConfigurationAggregatorsOutcomeCallable; + typedef std::future DescribeConfigurationRecorderStatusOutcomeCallable; + typedef std::future DescribeConfigurationRecordersOutcomeCallable; + typedef std::future DescribeConformancePackComplianceOutcomeCallable; + typedef std::future DescribeConformancePackStatusOutcomeCallable; + typedef std::future DescribeConformancePacksOutcomeCallable; + typedef std::future DescribeDeliveryChannelStatusOutcomeCallable; + typedef std::future DescribeDeliveryChannelsOutcomeCallable; + typedef std::future DescribeOrganizationConfigRuleStatusesOutcomeCallable; + typedef std::future DescribeOrganizationConfigRulesOutcomeCallable; + typedef std::future DescribeOrganizationConformancePackStatusesOutcomeCallable; + typedef std::future DescribeOrganizationConformancePacksOutcomeCallable; + typedef std::future DescribePendingAggregationRequestsOutcomeCallable; + typedef std::future DescribeRemediationConfigurationsOutcomeCallable; + typedef std::future DescribeRemediationExceptionsOutcomeCallable; + typedef std::future DescribeRemediationExecutionStatusOutcomeCallable; + typedef std::future DescribeRetentionConfigurationsOutcomeCallable; + typedef std::future DisassociateResourceTypesOutcomeCallable; + typedef std::future GetAggregateComplianceDetailsByConfigRuleOutcomeCallable; + typedef std::future GetAggregateConfigRuleComplianceSummaryOutcomeCallable; + typedef std::future GetAggregateConformancePackComplianceSummaryOutcomeCallable; + typedef std::future GetAggregateDiscoveredResourceCountsOutcomeCallable; + typedef std::future GetAggregateResourceConfigOutcomeCallable; + typedef std::future GetComplianceDetailsByConfigRuleOutcomeCallable; + typedef std::future GetComplianceDetailsByResourceOutcomeCallable; + typedef std::future GetComplianceSummaryByConfigRuleOutcomeCallable; + typedef std::future GetComplianceSummaryByResourceTypeOutcomeCallable; + typedef std::future GetConformancePackComplianceDetailsOutcomeCallable; + typedef std::future GetConformancePackComplianceSummaryOutcomeCallable; + typedef std::future GetCustomRulePolicyOutcomeCallable; + typedef std::future GetDiscoveredResourceCountsOutcomeCallable; + typedef std::future GetOrganizationConfigRuleDetailedStatusOutcomeCallable; + typedef std::future GetOrganizationConformancePackDetailedStatusOutcomeCallable; + typedef std::future GetOrganizationCustomRulePolicyOutcomeCallable; + typedef std::future GetResourceConfigHistoryOutcomeCallable; + typedef std::future GetResourceEvaluationSummaryOutcomeCallable; + typedef std::future GetStoredQueryOutcomeCallable; + typedef std::future ListAggregateDiscoveredResourcesOutcomeCallable; + typedef std::future ListConfigurationRecordersOutcomeCallable; + typedef std::future ListConformancePackComplianceScoresOutcomeCallable; + typedef std::future ListDiscoveredResourcesOutcomeCallable; + typedef std::future ListResourceEvaluationsOutcomeCallable; + typedef std::future ListStoredQueriesOutcomeCallable; + typedef std::future ListTagsForResourceOutcomeCallable; + typedef std::future PutAggregationAuthorizationOutcomeCallable; + typedef std::future PutConfigRuleOutcomeCallable; + typedef std::future PutConfigurationAggregatorOutcomeCallable; + typedef std::future PutConfigurationRecorderOutcomeCallable; + typedef std::future PutConformancePackOutcomeCallable; + typedef std::future PutDeliveryChannelOutcomeCallable; + typedef std::future PutEvaluationsOutcomeCallable; + typedef std::future PutExternalEvaluationOutcomeCallable; + typedef std::future PutOrganizationConfigRuleOutcomeCallable; + typedef std::future PutOrganizationConformancePackOutcomeCallable; + typedef std::future PutRemediationConfigurationsOutcomeCallable; + typedef std::future PutRemediationExceptionsOutcomeCallable; + typedef std::future PutResourceConfigOutcomeCallable; + typedef std::future PutRetentionConfigurationOutcomeCallable; + typedef std::future PutServiceLinkedConfigurationRecorderOutcomeCallable; + typedef std::future PutStoredQueryOutcomeCallable; + typedef std::future SelectAggregateResourceConfigOutcomeCallable; + typedef std::future SelectResourceConfigOutcomeCallable; + typedef std::future StartConfigRulesEvaluationOutcomeCallable; + typedef std::future StartConfigurationRecorderOutcomeCallable; + typedef std::future StartRemediationExecutionOutcomeCallable; + typedef std::future StartResourceEvaluationOutcomeCallable; + typedef std::future StopConfigurationRecorderOutcomeCallable; + typedef std::future TagResourceOutcomeCallable; + typedef std::future UntagResourceOutcomeCallable; + /* End of service model Outcome callable definitions */ + } // namespace Model + + class ConfigServiceClient; + + /* Service model async handlers definitions */ + typedef std::function&) > AssociateResourceTypesResponseReceivedHandler; + typedef std::function&) > BatchGetAggregateResourceConfigResponseReceivedHandler; + typedef std::function&) > BatchGetResourceConfigResponseReceivedHandler; + typedef std::function&) > DeleteAggregationAuthorizationResponseReceivedHandler; + typedef std::function&) > DeleteConfigRuleResponseReceivedHandler; + typedef std::function&) > DeleteConfigurationAggregatorResponseReceivedHandler; + typedef std::function&) > DeleteConfigurationRecorderResponseReceivedHandler; + typedef std::function&) > DeleteConformancePackResponseReceivedHandler; + typedef std::function&) > DeleteDeliveryChannelResponseReceivedHandler; + typedef std::function&) > DeleteEvaluationResultsResponseReceivedHandler; + typedef std::function&) > DeleteOrganizationConfigRuleResponseReceivedHandler; + typedef std::function&) > DeleteOrganizationConformancePackResponseReceivedHandler; + typedef std::function&) > DeletePendingAggregationRequestResponseReceivedHandler; + typedef std::function&) > DeleteRemediationConfigurationResponseReceivedHandler; + typedef std::function&) > DeleteRemediationExceptionsResponseReceivedHandler; + typedef std::function&) > DeleteResourceConfigResponseReceivedHandler; + typedef std::function&) > DeleteRetentionConfigurationResponseReceivedHandler; + typedef std::function&) > DeleteServiceLinkedConfigurationRecorderResponseReceivedHandler; + typedef std::function&) > DeleteStoredQueryResponseReceivedHandler; + typedef std::function&) > DeliverConfigSnapshotResponseReceivedHandler; + typedef std::function&) > DescribeAggregateComplianceByConfigRulesResponseReceivedHandler; + typedef std::function&) > DescribeAggregateComplianceByConformancePacksResponseReceivedHandler; + typedef std::function&) > DescribeAggregationAuthorizationsResponseReceivedHandler; + typedef std::function&) > DescribeComplianceByConfigRuleResponseReceivedHandler; + typedef std::function&) > DescribeComplianceByResourceResponseReceivedHandler; + typedef std::function&) > DescribeConfigRuleEvaluationStatusResponseReceivedHandler; + typedef std::function&) > DescribeConfigRulesResponseReceivedHandler; + typedef std::function&) > DescribeConfigurationAggregatorSourcesStatusResponseReceivedHandler; + typedef std::function&) > DescribeConfigurationAggregatorsResponseReceivedHandler; + typedef std::function&) > DescribeConfigurationRecorderStatusResponseReceivedHandler; + typedef std::function&) > DescribeConfigurationRecordersResponseReceivedHandler; + typedef std::function&) > DescribeConformancePackComplianceResponseReceivedHandler; + typedef std::function&) > DescribeConformancePackStatusResponseReceivedHandler; + typedef std::function&) > DescribeConformancePacksResponseReceivedHandler; + typedef std::function&) > DescribeDeliveryChannelStatusResponseReceivedHandler; + typedef std::function&) > DescribeDeliveryChannelsResponseReceivedHandler; + typedef std::function&) > DescribeOrganizationConfigRuleStatusesResponseReceivedHandler; + typedef std::function&) > DescribeOrganizationConfigRulesResponseReceivedHandler; + typedef std::function&) > DescribeOrganizationConformancePackStatusesResponseReceivedHandler; + typedef std::function&) > DescribeOrganizationConformancePacksResponseReceivedHandler; + typedef std::function&) > DescribePendingAggregationRequestsResponseReceivedHandler; + typedef std::function&) > DescribeRemediationConfigurationsResponseReceivedHandler; + typedef std::function&) > DescribeRemediationExceptionsResponseReceivedHandler; + typedef std::function&) > DescribeRemediationExecutionStatusResponseReceivedHandler; + typedef std::function&) > DescribeRetentionConfigurationsResponseReceivedHandler; + typedef std::function&) > DisassociateResourceTypesResponseReceivedHandler; + typedef std::function&) > GetAggregateComplianceDetailsByConfigRuleResponseReceivedHandler; + typedef std::function&) > GetAggregateConfigRuleComplianceSummaryResponseReceivedHandler; + typedef std::function&) > GetAggregateConformancePackComplianceSummaryResponseReceivedHandler; + typedef std::function&) > GetAggregateDiscoveredResourceCountsResponseReceivedHandler; + typedef std::function&) > GetAggregateResourceConfigResponseReceivedHandler; + typedef std::function&) > GetComplianceDetailsByConfigRuleResponseReceivedHandler; + typedef std::function&) > GetComplianceDetailsByResourceResponseReceivedHandler; + typedef std::function&) > GetComplianceSummaryByConfigRuleResponseReceivedHandler; + typedef std::function&) > GetComplianceSummaryByResourceTypeResponseReceivedHandler; + typedef std::function&) > GetConformancePackComplianceDetailsResponseReceivedHandler; + typedef std::function&) > GetConformancePackComplianceSummaryResponseReceivedHandler; + typedef std::function&) > GetCustomRulePolicyResponseReceivedHandler; + typedef std::function&) > GetDiscoveredResourceCountsResponseReceivedHandler; + typedef std::function&) > GetOrganizationConfigRuleDetailedStatusResponseReceivedHandler; + typedef std::function&) > GetOrganizationConformancePackDetailedStatusResponseReceivedHandler; + typedef std::function&) > GetOrganizationCustomRulePolicyResponseReceivedHandler; + typedef std::function&) > GetResourceConfigHistoryResponseReceivedHandler; + typedef std::function&) > GetResourceEvaluationSummaryResponseReceivedHandler; + typedef std::function&) > GetStoredQueryResponseReceivedHandler; + typedef std::function&) > ListAggregateDiscoveredResourcesResponseReceivedHandler; + typedef std::function&) > ListConfigurationRecordersResponseReceivedHandler; + typedef std::function&) > ListConformancePackComplianceScoresResponseReceivedHandler; + typedef std::function&) > ListDiscoveredResourcesResponseReceivedHandler; + typedef std::function&) > ListResourceEvaluationsResponseReceivedHandler; + typedef std::function&) > ListStoredQueriesResponseReceivedHandler; + typedef std::function&) > ListTagsForResourceResponseReceivedHandler; + typedef std::function&) > PutAggregationAuthorizationResponseReceivedHandler; + typedef std::function&) > PutConfigRuleResponseReceivedHandler; + typedef std::function&) > PutConfigurationAggregatorResponseReceivedHandler; + typedef std::function&) > PutConfigurationRecorderResponseReceivedHandler; + typedef std::function&) > PutConformancePackResponseReceivedHandler; + typedef std::function&) > PutDeliveryChannelResponseReceivedHandler; + typedef std::function&) > PutEvaluationsResponseReceivedHandler; + typedef std::function&) > PutExternalEvaluationResponseReceivedHandler; + typedef std::function&) > PutOrganizationConfigRuleResponseReceivedHandler; + typedef std::function&) > PutOrganizationConformancePackResponseReceivedHandler; + typedef std::function&) > PutRemediationConfigurationsResponseReceivedHandler; + typedef std::function&) > PutRemediationExceptionsResponseReceivedHandler; + typedef std::function&) > PutResourceConfigResponseReceivedHandler; + typedef std::function&) > PutRetentionConfigurationResponseReceivedHandler; + typedef std::function&) > PutServiceLinkedConfigurationRecorderResponseReceivedHandler; + typedef std::function&) > PutStoredQueryResponseReceivedHandler; + typedef std::function&) > SelectAggregateResourceConfigResponseReceivedHandler; + typedef std::function&) > SelectResourceConfigResponseReceivedHandler; + typedef std::function&) > StartConfigRulesEvaluationResponseReceivedHandler; + typedef std::function&) > StartConfigurationRecorderResponseReceivedHandler; + typedef std::function&) > StartRemediationExecutionResponseReceivedHandler; + typedef std::function&) > StartResourceEvaluationResponseReceivedHandler; + typedef std::function&) > StopConfigurationRecorderResponseReceivedHandler; + typedef std::function&) > TagResourceResponseReceivedHandler; + typedef std::function&) > UntagResourceResponseReceivedHandler; + /* End of service model async handlers definitions */ + } // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/ConfigService_EXPORTS.h b/include/aws/config/ConfigService_EXPORTS.h new file mode 100644 index 0000000000000000000000000000000000000000..2955ff2ab1e8b91900f0b1586bdfaef0d125e9ec --- /dev/null +++ b/include/aws/config/ConfigService_EXPORTS.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#ifdef _MSC_VER + //disable windows complaining about max template size. + #pragma warning (disable : 4503) +#endif // _MSC_VER + +#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #ifdef _MSC_VER + #pragma warning(disable : 4251) + #endif // _MSC_VER + + #ifdef USE_IMPORT_EXPORT + #ifdef AWS_CONFIGSERVICE_EXPORTS + #define AWS_CONFIGSERVICE_API __declspec(dllexport) + #else + #define AWS_CONFIGSERVICE_API __declspec(dllimport) + #endif /* AWS_CONFIGSERVICE_EXPORTS */ + #define AWS_CONFIGSERVICE_EXTERN + #else + #define AWS_CONFIGSERVICE_API + #define AWS_CONFIGSERVICE_EXTERN extern + #endif // USE_IMPORT_EXPORT +#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) + #define AWS_CONFIGSERVICE_API + #define AWS_CONFIGSERVICE_EXTERN extern +#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) diff --git a/include/aws/config/model/AccountAggregationSource.h b/include/aws/config/model/AccountAggregationSource.h new file mode 100644 index 0000000000000000000000000000000000000000..6116e6d380cb36a85418f27f662be5157591c474 --- /dev/null +++ b/include/aws/config/model/AccountAggregationSource.h @@ -0,0 +1,94 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

A collection of accounts and regions.

See Also:

AWS + * API Reference

+ */ + class AccountAggregationSource + { + public: + AWS_CONFIGSERVICE_API AccountAggregationSource(); + AWS_CONFIGSERVICE_API AccountAggregationSource(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AccountAggregationSource& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of the account being aggregated.

+ */ + inline const Aws::Vector& GetAccountIds() const{ return m_accountIds; } + inline bool AccountIdsHasBeenSet() const { return m_accountIdsHasBeenSet; } + inline void SetAccountIds(const Aws::Vector& value) { m_accountIdsHasBeenSet = true; m_accountIds = value; } + inline void SetAccountIds(Aws::Vector&& value) { m_accountIdsHasBeenSet = true; m_accountIds = std::move(value); } + inline AccountAggregationSource& WithAccountIds(const Aws::Vector& value) { SetAccountIds(value); return *this;} + inline AccountAggregationSource& WithAccountIds(Aws::Vector&& value) { SetAccountIds(std::move(value)); return *this;} + inline AccountAggregationSource& AddAccountIds(const Aws::String& value) { m_accountIdsHasBeenSet = true; m_accountIds.push_back(value); return *this; } + inline AccountAggregationSource& AddAccountIds(Aws::String&& value) { m_accountIdsHasBeenSet = true; m_accountIds.push_back(std::move(value)); return *this; } + inline AccountAggregationSource& AddAccountIds(const char* value) { m_accountIdsHasBeenSet = true; m_accountIds.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

If true, aggregate existing Config regions and future regions.

+ */ + inline bool GetAllAwsRegions() const{ return m_allAwsRegions; } + inline bool AllAwsRegionsHasBeenSet() const { return m_allAwsRegionsHasBeenSet; } + inline void SetAllAwsRegions(bool value) { m_allAwsRegionsHasBeenSet = true; m_allAwsRegions = value; } + inline AccountAggregationSource& WithAllAwsRegions(bool value) { SetAllAwsRegions(value); return *this;} + ///@} + + ///@{ + /** + *

The source regions being aggregated.

+ */ + inline const Aws::Vector& GetAwsRegions() const{ return m_awsRegions; } + inline bool AwsRegionsHasBeenSet() const { return m_awsRegionsHasBeenSet; } + inline void SetAwsRegions(const Aws::Vector& value) { m_awsRegionsHasBeenSet = true; m_awsRegions = value; } + inline void SetAwsRegions(Aws::Vector&& value) { m_awsRegionsHasBeenSet = true; m_awsRegions = std::move(value); } + inline AccountAggregationSource& WithAwsRegions(const Aws::Vector& value) { SetAwsRegions(value); return *this;} + inline AccountAggregationSource& WithAwsRegions(Aws::Vector&& value) { SetAwsRegions(std::move(value)); return *this;} + inline AccountAggregationSource& AddAwsRegions(const Aws::String& value) { m_awsRegionsHasBeenSet = true; m_awsRegions.push_back(value); return *this; } + inline AccountAggregationSource& AddAwsRegions(Aws::String&& value) { m_awsRegionsHasBeenSet = true; m_awsRegions.push_back(std::move(value)); return *this; } + inline AccountAggregationSource& AddAwsRegions(const char* value) { m_awsRegionsHasBeenSet = true; m_awsRegions.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_accountIds; + bool m_accountIdsHasBeenSet = false; + + bool m_allAwsRegions; + bool m_allAwsRegionsHasBeenSet = false; + + Aws::Vector m_awsRegions; + bool m_awsRegionsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateComplianceByConfigRule.h b/include/aws/config/model/AggregateComplianceByConfigRule.h new file mode 100644 index 0000000000000000000000000000000000000000..879b4da4799a7fba7a25ef8cb1815a6a65199fd8 --- /dev/null +++ b/include/aws/config/model/AggregateComplianceByConfigRule.h @@ -0,0 +1,115 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Indicates whether an Config rule is compliant based on account ID, region, + * compliance, and rule name.

A rule is compliant if all of the resources + * that the rule evaluated comply with it. It is noncompliant if any of these + * resources do not comply.

See Also:

AWS + * API Reference

+ */ + class AggregateComplianceByConfigRule + { + public: + AWS_CONFIGSERVICE_API AggregateComplianceByConfigRule(); + AWS_CONFIGSERVICE_API AggregateComplianceByConfigRule(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateComplianceByConfigRule& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline AggregateComplianceByConfigRule& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline AggregateComplianceByConfigRule& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline AggregateComplianceByConfigRule& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether an Amazon Web Services resource or Config rule is compliant + * and provides the number of contributors that affect the compliance.

+ */ + inline const Compliance& GetCompliance() const{ return m_compliance; } + inline bool ComplianceHasBeenSet() const { return m_complianceHasBeenSet; } + inline void SetCompliance(const Compliance& value) { m_complianceHasBeenSet = true; m_compliance = value; } + inline void SetCompliance(Compliance&& value) { m_complianceHasBeenSet = true; m_compliance = std::move(value); } + inline AggregateComplianceByConfigRule& WithCompliance(const Compliance& value) { SetCompliance(value); return *this;} + inline AggregateComplianceByConfigRule& WithCompliance(Compliance&& value) { SetCompliance(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline AggregateComplianceByConfigRule& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline AggregateComplianceByConfigRule& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline AggregateComplianceByConfigRule& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source region from where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline AggregateComplianceByConfigRule& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline AggregateComplianceByConfigRule& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline AggregateComplianceByConfigRule& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Compliance m_compliance; + bool m_complianceHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateComplianceByConformancePack.h b/include/aws/config/model/AggregateComplianceByConformancePack.h new file mode 100644 index 0000000000000000000000000000000000000000..357979791630180c01c9f513dd7b07801c5f7395 --- /dev/null +++ b/include/aws/config/model/AggregateComplianceByConformancePack.h @@ -0,0 +1,120 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides aggregate compliance of the conformance pack. Indicates whether a + * conformance pack is compliant based on the name of the conformance pack, account + * ID, and region.

A conformance pack is compliant if all of the rules in a + * conformance packs are compliant. It is noncompliant if any of the rules are not + * compliant. The compliance status of a conformance pack is INSUFFICIENT_DATA only + * if all rules within a conformance pack cannot be evaluated due to insufficient + * data. If some of the rules in a conformance pack are compliant but the + * compliance status of other rules in that same conformance pack is + * INSUFFICIENT_DATA, the conformance pack shows compliant.

See + * Also:

AWS + * API Reference

+ */ + class AggregateComplianceByConformancePack + { + public: + AWS_CONFIGSERVICE_API AggregateComplianceByConformancePack(); + AWS_CONFIGSERVICE_API AggregateComplianceByConformancePack(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateComplianceByConformancePack& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline AggregateComplianceByConformancePack& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline AggregateComplianceByConformancePack& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline AggregateComplianceByConformancePack& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

The compliance status of the conformance pack.

+ */ + inline const AggregateConformancePackCompliance& GetCompliance() const{ return m_compliance; } + inline bool ComplianceHasBeenSet() const { return m_complianceHasBeenSet; } + inline void SetCompliance(const AggregateConformancePackCompliance& value) { m_complianceHasBeenSet = true; m_compliance = value; } + inline void SetCompliance(AggregateConformancePackCompliance&& value) { m_complianceHasBeenSet = true; m_compliance = std::move(value); } + inline AggregateComplianceByConformancePack& WithCompliance(const AggregateConformancePackCompliance& value) { SetCompliance(value); return *this;} + inline AggregateComplianceByConformancePack& WithCompliance(AggregateConformancePackCompliance&& value) { SetCompliance(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit Amazon Web Services account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline AggregateComplianceByConformancePack& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline AggregateComplianceByConformancePack& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline AggregateComplianceByConformancePack& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source Amazon Web Services Region from where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline AggregateComplianceByConformancePack& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline AggregateComplianceByConformancePack& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline AggregateComplianceByConformancePack& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + AggregateConformancePackCompliance m_compliance; + bool m_complianceHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateComplianceCount.h b/include/aws/config/model/AggregateComplianceCount.h new file mode 100644 index 0000000000000000000000000000000000000000..bb70f3559a40abe6ec859fa611613a3617be2076 --- /dev/null +++ b/include/aws/config/model/AggregateComplianceCount.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns the number of compliant and noncompliant rules for one or more + * accounts and regions in an aggregator.

See Also:

AWS + * API Reference

+ */ + class AggregateComplianceCount + { + public: + AWS_CONFIGSERVICE_API AggregateComplianceCount(); + AWS_CONFIGSERVICE_API AggregateComplianceCount(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateComplianceCount& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID or region based on the GroupByKey value.

+ */ + inline const Aws::String& GetGroupName() const{ return m_groupName; } + inline bool GroupNameHasBeenSet() const { return m_groupNameHasBeenSet; } + inline void SetGroupName(const Aws::String& value) { m_groupNameHasBeenSet = true; m_groupName = value; } + inline void SetGroupName(Aws::String&& value) { m_groupNameHasBeenSet = true; m_groupName = std::move(value); } + inline void SetGroupName(const char* value) { m_groupNameHasBeenSet = true; m_groupName.assign(value); } + inline AggregateComplianceCount& WithGroupName(const Aws::String& value) { SetGroupName(value); return *this;} + inline AggregateComplianceCount& WithGroupName(Aws::String&& value) { SetGroupName(std::move(value)); return *this;} + inline AggregateComplianceCount& WithGroupName(const char* value) { SetGroupName(value); return *this;} + ///@} + + ///@{ + /** + *

The number of compliant and noncompliant Config rules.

+ */ + inline const ComplianceSummary& GetComplianceSummary() const{ return m_complianceSummary; } + inline bool ComplianceSummaryHasBeenSet() const { return m_complianceSummaryHasBeenSet; } + inline void SetComplianceSummary(const ComplianceSummary& value) { m_complianceSummaryHasBeenSet = true; m_complianceSummary = value; } + inline void SetComplianceSummary(ComplianceSummary&& value) { m_complianceSummaryHasBeenSet = true; m_complianceSummary = std::move(value); } + inline AggregateComplianceCount& WithComplianceSummary(const ComplianceSummary& value) { SetComplianceSummary(value); return *this;} + inline AggregateComplianceCount& WithComplianceSummary(ComplianceSummary&& value) { SetComplianceSummary(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_groupName; + bool m_groupNameHasBeenSet = false; + + ComplianceSummary m_complianceSummary; + bool m_complianceSummaryHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateConformancePackCompliance.h b/include/aws/config/model/AggregateConformancePackCompliance.h new file mode 100644 index 0000000000000000000000000000000000000000..1b60b36e9e8c1f8ed67a687b01d4a958ec2a0204 --- /dev/null +++ b/include/aws/config/model/AggregateConformancePackCompliance.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides the number of compliant and noncompliant rules within a conformance + * pack. Also provides the compliance status of the conformance pack and the total + * rule count which includes compliant rules, noncompliant rules, and rules that + * cannot be evaluated due to insufficient data.

A conformance pack is + * compliant if all of the rules in a conformance packs are compliant. It is + * noncompliant if any of the rules are not compliant. The compliance status of a + * conformance pack is INSUFFICIENT_DATA only if all rules within a conformance + * pack cannot be evaluated due to insufficient data. If some of the rules in a + * conformance pack are compliant but the compliance status of other rules in that + * same conformance pack is INSUFFICIENT_DATA, the conformance pack shows + * compliant.

See Also:

AWS + * API Reference

+ */ + class AggregateConformancePackCompliance + { + public: + AWS_CONFIGSERVICE_API AggregateConformancePackCompliance(); + AWS_CONFIGSERVICE_API AggregateConformancePackCompliance(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateConformancePackCompliance& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The compliance status of the conformance pack.

+ */ + inline const ConformancePackComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ConformancePackComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ConformancePackComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline AggregateConformancePackCompliance& WithComplianceType(const ConformancePackComplianceType& value) { SetComplianceType(value); return *this;} + inline AggregateConformancePackCompliance& WithComplianceType(ConformancePackComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The number of compliant Config Rules.

+ */ + inline int GetCompliantRuleCount() const{ return m_compliantRuleCount; } + inline bool CompliantRuleCountHasBeenSet() const { return m_compliantRuleCountHasBeenSet; } + inline void SetCompliantRuleCount(int value) { m_compliantRuleCountHasBeenSet = true; m_compliantRuleCount = value; } + inline AggregateConformancePackCompliance& WithCompliantRuleCount(int value) { SetCompliantRuleCount(value); return *this;} + ///@} + + ///@{ + /** + *

The number of noncompliant Config Rules.

+ */ + inline int GetNonCompliantRuleCount() const{ return m_nonCompliantRuleCount; } + inline bool NonCompliantRuleCountHasBeenSet() const { return m_nonCompliantRuleCountHasBeenSet; } + inline void SetNonCompliantRuleCount(int value) { m_nonCompliantRuleCountHasBeenSet = true; m_nonCompliantRuleCount = value; } + inline AggregateConformancePackCompliance& WithNonCompliantRuleCount(int value) { SetNonCompliantRuleCount(value); return *this;} + ///@} + + ///@{ + /** + *

Total number of compliant rules, noncompliant rules, and the rules that do + * not have any applicable resources to evaluate upon resulting in insufficient + * data.

+ */ + inline int GetTotalRuleCount() const{ return m_totalRuleCount; } + inline bool TotalRuleCountHasBeenSet() const { return m_totalRuleCountHasBeenSet; } + inline void SetTotalRuleCount(int value) { m_totalRuleCountHasBeenSet = true; m_totalRuleCount = value; } + inline AggregateConformancePackCompliance& WithTotalRuleCount(int value) { SetTotalRuleCount(value); return *this;} + ///@} + private: + + ConformancePackComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + int m_compliantRuleCount; + bool m_compliantRuleCountHasBeenSet = false; + + int m_nonCompliantRuleCount; + bool m_nonCompliantRuleCountHasBeenSet = false; + + int m_totalRuleCount; + bool m_totalRuleCountHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateConformancePackComplianceCount.h b/include/aws/config/model/AggregateConformancePackComplianceCount.h new file mode 100644 index 0000000000000000000000000000000000000000..54e94a683147528c7b82ad71ec567edc756801cf --- /dev/null +++ b/include/aws/config/model/AggregateConformancePackComplianceCount.h @@ -0,0 +1,69 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The number of conformance packs that are compliant and + * noncompliant.

See Also:

AWS + * API Reference

+ */ + class AggregateConformancePackComplianceCount + { + public: + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceCount(); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceCount(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceCount& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Number of compliant conformance packs.

+ */ + inline int GetCompliantConformancePackCount() const{ return m_compliantConformancePackCount; } + inline bool CompliantConformancePackCountHasBeenSet() const { return m_compliantConformancePackCountHasBeenSet; } + inline void SetCompliantConformancePackCount(int value) { m_compliantConformancePackCountHasBeenSet = true; m_compliantConformancePackCount = value; } + inline AggregateConformancePackComplianceCount& WithCompliantConformancePackCount(int value) { SetCompliantConformancePackCount(value); return *this;} + ///@} + + ///@{ + /** + *

Number of noncompliant conformance packs.

+ */ + inline int GetNonCompliantConformancePackCount() const{ return m_nonCompliantConformancePackCount; } + inline bool NonCompliantConformancePackCountHasBeenSet() const { return m_nonCompliantConformancePackCountHasBeenSet; } + inline void SetNonCompliantConformancePackCount(int value) { m_nonCompliantConformancePackCountHasBeenSet = true; m_nonCompliantConformancePackCount = value; } + inline AggregateConformancePackComplianceCount& WithNonCompliantConformancePackCount(int value) { SetNonCompliantConformancePackCount(value); return *this;} + ///@} + private: + + int m_compliantConformancePackCount; + bool m_compliantConformancePackCountHasBeenSet = false; + + int m_nonCompliantConformancePackCount; + bool m_nonCompliantConformancePackCountHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateConformancePackComplianceFilters.h b/include/aws/config/model/AggregateConformancePackComplianceFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..c795bb6d7d44c2041dc2e65a47f30af98a396409 --- /dev/null +++ b/include/aws/config/model/AggregateConformancePackComplianceFilters.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters the conformance packs based on an account ID, region, compliance + * type, and the name of the conformance pack.

See Also:

AWS + * API Reference

+ */ + class AggregateConformancePackComplianceFilters + { + public: + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceFilters(); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline AggregateConformancePackComplianceFilters& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline AggregateConformancePackComplianceFilters& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline AggregateConformancePackComplianceFilters& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

The compliance status of the conformance pack.

+ */ + inline const ConformancePackComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ConformancePackComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ConformancePackComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline AggregateConformancePackComplianceFilters& WithComplianceType(const ConformancePackComplianceType& value) { SetComplianceType(value); return *this;} + inline AggregateConformancePackComplianceFilters& WithComplianceType(ConformancePackComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit Amazon Web Services account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline AggregateConformancePackComplianceFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline AggregateConformancePackComplianceFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline AggregateConformancePackComplianceFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source Amazon Web Services Region from where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline AggregateConformancePackComplianceFilters& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline AggregateConformancePackComplianceFilters& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline AggregateConformancePackComplianceFilters& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + ConformancePackComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateConformancePackComplianceSummary.h b/include/aws/config/model/AggregateConformancePackComplianceSummary.h new file mode 100644 index 0000000000000000000000000000000000000000..be4fdfacad66f2d0ff7e15a5cdc8a40611ef9b4f --- /dev/null +++ b/include/aws/config/model/AggregateConformancePackComplianceSummary.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides a summary of compliance based on either account ID or region. + *

See Also:

AWS + * API Reference

+ */ + class AggregateConformancePackComplianceSummary + { + public: + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceSummary(); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceSummary(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceSummary& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Returns an AggregateConformancePackComplianceCount object.

+ */ + inline const AggregateConformancePackComplianceCount& GetComplianceSummary() const{ return m_complianceSummary; } + inline bool ComplianceSummaryHasBeenSet() const { return m_complianceSummaryHasBeenSet; } + inline void SetComplianceSummary(const AggregateConformancePackComplianceCount& value) { m_complianceSummaryHasBeenSet = true; m_complianceSummary = value; } + inline void SetComplianceSummary(AggregateConformancePackComplianceCount&& value) { m_complianceSummaryHasBeenSet = true; m_complianceSummary = std::move(value); } + inline AggregateConformancePackComplianceSummary& WithComplianceSummary(const AggregateConformancePackComplianceCount& value) { SetComplianceSummary(value); return *this;} + inline AggregateConformancePackComplianceSummary& WithComplianceSummary(AggregateConformancePackComplianceCount&& value) { SetComplianceSummary(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Groups the result based on Amazon Web Services account ID or Amazon Web + * Services Region.

+ */ + inline const Aws::String& GetGroupName() const{ return m_groupName; } + inline bool GroupNameHasBeenSet() const { return m_groupNameHasBeenSet; } + inline void SetGroupName(const Aws::String& value) { m_groupNameHasBeenSet = true; m_groupName = value; } + inline void SetGroupName(Aws::String&& value) { m_groupNameHasBeenSet = true; m_groupName = std::move(value); } + inline void SetGroupName(const char* value) { m_groupNameHasBeenSet = true; m_groupName.assign(value); } + inline AggregateConformancePackComplianceSummary& WithGroupName(const Aws::String& value) { SetGroupName(value); return *this;} + inline AggregateConformancePackComplianceSummary& WithGroupName(Aws::String&& value) { SetGroupName(std::move(value)); return *this;} + inline AggregateConformancePackComplianceSummary& WithGroupName(const char* value) { SetGroupName(value); return *this;} + ///@} + private: + + AggregateConformancePackComplianceCount m_complianceSummary; + bool m_complianceSummaryHasBeenSet = false; + + Aws::String m_groupName; + bool m_groupNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateConformancePackComplianceSummaryFilters.h b/include/aws/config/model/AggregateConformancePackComplianceSummaryFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..847410ca59ecdc9d4880360d630a0b94fc4e6d3e --- /dev/null +++ b/include/aws/config/model/AggregateConformancePackComplianceSummaryFilters.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters the results based on account ID and region.

See Also:

+ * AWS + * API Reference

+ */ + class AggregateConformancePackComplianceSummaryFilters + { + public: + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceSummaryFilters(); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceSummaryFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateConformancePackComplianceSummaryFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit Amazon Web Services account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline AggregateConformancePackComplianceSummaryFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline AggregateConformancePackComplianceSummaryFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline AggregateConformancePackComplianceSummaryFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source Amazon Web Services Region from where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline AggregateConformancePackComplianceSummaryFilters& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline AggregateConformancePackComplianceSummaryFilters& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline AggregateConformancePackComplianceSummaryFilters& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateConformancePackComplianceSummaryGroupKey.h b/include/aws/config/model/AggregateConformancePackComplianceSummaryGroupKey.h new file mode 100644 index 0000000000000000000000000000000000000000..73474f689e900acb205c8ef9c9971273d9ccf29b --- /dev/null +++ b/include/aws/config/model/AggregateConformancePackComplianceSummaryGroupKey.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class AggregateConformancePackComplianceSummaryGroupKey + { + NOT_SET, + ACCOUNT_ID, + AWS_REGION + }; + +namespace AggregateConformancePackComplianceSummaryGroupKeyMapper +{ +AWS_CONFIGSERVICE_API AggregateConformancePackComplianceSummaryGroupKey GetAggregateConformancePackComplianceSummaryGroupKeyForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForAggregateConformancePackComplianceSummaryGroupKey(AggregateConformancePackComplianceSummaryGroupKey value); +} // namespace AggregateConformancePackComplianceSummaryGroupKeyMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateEvaluationResult.h b/include/aws/config/model/AggregateEvaluationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a535a900da7af9c39ad06d5c8daee5ebc4018a33 --- /dev/null +++ b/include/aws/config/model/AggregateEvaluationResult.h @@ -0,0 +1,165 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details of an Config evaluation for an account ID and region in an + * aggregator. Provides the Amazon Web Services resource that was evaluated, the + * compliance of the resource, related time stamps, and supplementary information. + *

See Also:

AWS + * API Reference

+ */ + class AggregateEvaluationResult + { + public: + AWS_CONFIGSERVICE_API AggregateEvaluationResult(); + AWS_CONFIGSERVICE_API AggregateEvaluationResult(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateEvaluationResult& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Uniquely identifies the evaluation result.

+ */ + inline const EvaluationResultIdentifier& GetEvaluationResultIdentifier() const{ return m_evaluationResultIdentifier; } + inline bool EvaluationResultIdentifierHasBeenSet() const { return m_evaluationResultIdentifierHasBeenSet; } + inline void SetEvaluationResultIdentifier(const EvaluationResultIdentifier& value) { m_evaluationResultIdentifierHasBeenSet = true; m_evaluationResultIdentifier = value; } + inline void SetEvaluationResultIdentifier(EvaluationResultIdentifier&& value) { m_evaluationResultIdentifierHasBeenSet = true; m_evaluationResultIdentifier = std::move(value); } + inline AggregateEvaluationResult& WithEvaluationResultIdentifier(const EvaluationResultIdentifier& value) { SetEvaluationResultIdentifier(value); return *this;} + inline AggregateEvaluationResult& WithEvaluationResultIdentifier(EvaluationResultIdentifier&& value) { SetEvaluationResultIdentifier(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The resource compliance status.

For the + * AggregationEvaluationResult data type, Config supports only the + * COMPLIANT and NON_COMPLIANT. Config does not support + * the NOT_APPLICABLE and INSUFFICIENT_DATA value.

+ */ + inline const ComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline AggregateEvaluationResult& WithComplianceType(const ComplianceType& value) { SetComplianceType(value); return *this;} + inline AggregateEvaluationResult& WithComplianceType(ComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when Config recorded the aggregate evaluation result.

+ */ + inline const Aws::Utils::DateTime& GetResultRecordedTime() const{ return m_resultRecordedTime; } + inline bool ResultRecordedTimeHasBeenSet() const { return m_resultRecordedTimeHasBeenSet; } + inline void SetResultRecordedTime(const Aws::Utils::DateTime& value) { m_resultRecordedTimeHasBeenSet = true; m_resultRecordedTime = value; } + inline void SetResultRecordedTime(Aws::Utils::DateTime&& value) { m_resultRecordedTimeHasBeenSet = true; m_resultRecordedTime = std::move(value); } + inline AggregateEvaluationResult& WithResultRecordedTime(const Aws::Utils::DateTime& value) { SetResultRecordedTime(value); return *this;} + inline AggregateEvaluationResult& WithResultRecordedTime(Aws::Utils::DateTime&& value) { SetResultRecordedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when the Config rule evaluated the Amazon Web Services resource.

+ */ + inline const Aws::Utils::DateTime& GetConfigRuleInvokedTime() const{ return m_configRuleInvokedTime; } + inline bool ConfigRuleInvokedTimeHasBeenSet() const { return m_configRuleInvokedTimeHasBeenSet; } + inline void SetConfigRuleInvokedTime(const Aws::Utils::DateTime& value) { m_configRuleInvokedTimeHasBeenSet = true; m_configRuleInvokedTime = value; } + inline void SetConfigRuleInvokedTime(Aws::Utils::DateTime&& value) { m_configRuleInvokedTimeHasBeenSet = true; m_configRuleInvokedTime = std::move(value); } + inline AggregateEvaluationResult& WithConfigRuleInvokedTime(const Aws::Utils::DateTime& value) { SetConfigRuleInvokedTime(value); return *this;} + inline AggregateEvaluationResult& WithConfigRuleInvokedTime(Aws::Utils::DateTime&& value) { SetConfigRuleInvokedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Supplementary information about how the agrregate evaluation determined the + * compliance.

+ */ + inline const Aws::String& GetAnnotation() const{ return m_annotation; } + inline bool AnnotationHasBeenSet() const { return m_annotationHasBeenSet; } + inline void SetAnnotation(const Aws::String& value) { m_annotationHasBeenSet = true; m_annotation = value; } + inline void SetAnnotation(Aws::String&& value) { m_annotationHasBeenSet = true; m_annotation = std::move(value); } + inline void SetAnnotation(const char* value) { m_annotationHasBeenSet = true; m_annotation.assign(value); } + inline AggregateEvaluationResult& WithAnnotation(const Aws::String& value) { SetAnnotation(value); return *this;} + inline AggregateEvaluationResult& WithAnnotation(Aws::String&& value) { SetAnnotation(std::move(value)); return *this;} + inline AggregateEvaluationResult& WithAnnotation(const char* value) { SetAnnotation(value); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline AggregateEvaluationResult& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline AggregateEvaluationResult& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline AggregateEvaluationResult& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source region from where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline AggregateEvaluationResult& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline AggregateEvaluationResult& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline AggregateEvaluationResult& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + private: + + EvaluationResultIdentifier m_evaluationResultIdentifier; + bool m_evaluationResultIdentifierHasBeenSet = false; + + ComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::Utils::DateTime m_resultRecordedTime; + bool m_resultRecordedTimeHasBeenSet = false; + + Aws::Utils::DateTime m_configRuleInvokedTime; + bool m_configRuleInvokedTimeHasBeenSet = false; + + Aws::String m_annotation; + bool m_annotationHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregateResourceIdentifier.h b/include/aws/config/model/AggregateResourceIdentifier.h new file mode 100644 index 0000000000000000000000000000000000000000..ab9ea70a19c82dab5b8fefcfe9de0616c8d0d7c9 --- /dev/null +++ b/include/aws/config/model/AggregateResourceIdentifier.h @@ -0,0 +1,130 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details that identify a resource that is collected by Config aggregator, + * including the resource type, ID, (if available) the custom resource name, the + * source account, and source region.

See Also:

AWS + * API Reference

+ */ + class AggregateResourceIdentifier + { + public: + AWS_CONFIGSERVICE_API AggregateResourceIdentifier(); + AWS_CONFIGSERVICE_API AggregateResourceIdentifier(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregateResourceIdentifier& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of the source account.

+ */ + inline const Aws::String& GetSourceAccountId() const{ return m_sourceAccountId; } + inline bool SourceAccountIdHasBeenSet() const { return m_sourceAccountIdHasBeenSet; } + inline void SetSourceAccountId(const Aws::String& value) { m_sourceAccountIdHasBeenSet = true; m_sourceAccountId = value; } + inline void SetSourceAccountId(Aws::String&& value) { m_sourceAccountIdHasBeenSet = true; m_sourceAccountId = std::move(value); } + inline void SetSourceAccountId(const char* value) { m_sourceAccountIdHasBeenSet = true; m_sourceAccountId.assign(value); } + inline AggregateResourceIdentifier& WithSourceAccountId(const Aws::String& value) { SetSourceAccountId(value); return *this;} + inline AggregateResourceIdentifier& WithSourceAccountId(Aws::String&& value) { SetSourceAccountId(std::move(value)); return *this;} + inline AggregateResourceIdentifier& WithSourceAccountId(const char* value) { SetSourceAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source region where data is aggregated.

+ */ + inline const Aws::String& GetSourceRegion() const{ return m_sourceRegion; } + inline bool SourceRegionHasBeenSet() const { return m_sourceRegionHasBeenSet; } + inline void SetSourceRegion(const Aws::String& value) { m_sourceRegionHasBeenSet = true; m_sourceRegion = value; } + inline void SetSourceRegion(Aws::String&& value) { m_sourceRegionHasBeenSet = true; m_sourceRegion = std::move(value); } + inline void SetSourceRegion(const char* value) { m_sourceRegionHasBeenSet = true; m_sourceRegion.assign(value); } + inline AggregateResourceIdentifier& WithSourceRegion(const Aws::String& value) { SetSourceRegion(value); return *this;} + inline AggregateResourceIdentifier& WithSourceRegion(Aws::String&& value) { SetSourceRegion(std::move(value)); return *this;} + inline AggregateResourceIdentifier& WithSourceRegion(const char* value) { SetSourceRegion(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline AggregateResourceIdentifier& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline AggregateResourceIdentifier& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline AggregateResourceIdentifier& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The type of the Amazon Web Services resource.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline AggregateResourceIdentifier& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline AggregateResourceIdentifier& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The name of the Amazon Web Services resource.

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline AggregateResourceIdentifier& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline AggregateResourceIdentifier& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline AggregateResourceIdentifier& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + private: + + Aws::String m_sourceAccountId; + bool m_sourceAccountIdHasBeenSet = false; + + Aws::String m_sourceRegion; + bool m_sourceRegionHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregatedSourceStatus.h b/include/aws/config/model/AggregatedSourceStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..2a3d3db2768e0eac0e5c992bde8379bd399f43e5 --- /dev/null +++ b/include/aws/config/model/AggregatedSourceStatus.h @@ -0,0 +1,166 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The current sync status between the source and the aggregator + * account.

See Also:

AWS + * API Reference

+ */ + class AggregatedSourceStatus + { + public: + AWS_CONFIGSERVICE_API AggregatedSourceStatus(); + AWS_CONFIGSERVICE_API AggregatedSourceStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregatedSourceStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The source account ID or an organization.

+ */ + inline const Aws::String& GetSourceId() const{ return m_sourceId; } + inline bool SourceIdHasBeenSet() const { return m_sourceIdHasBeenSet; } + inline void SetSourceId(const Aws::String& value) { m_sourceIdHasBeenSet = true; m_sourceId = value; } + inline void SetSourceId(Aws::String&& value) { m_sourceIdHasBeenSet = true; m_sourceId = std::move(value); } + inline void SetSourceId(const char* value) { m_sourceIdHasBeenSet = true; m_sourceId.assign(value); } + inline AggregatedSourceStatus& WithSourceId(const Aws::String& value) { SetSourceId(value); return *this;} + inline AggregatedSourceStatus& WithSourceId(Aws::String&& value) { SetSourceId(std::move(value)); return *this;} + inline AggregatedSourceStatus& WithSourceId(const char* value) { SetSourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The source account or an organization.

+ */ + inline const AggregatedSourceType& GetSourceType() const{ return m_sourceType; } + inline bool SourceTypeHasBeenSet() const { return m_sourceTypeHasBeenSet; } + inline void SetSourceType(const AggregatedSourceType& value) { m_sourceTypeHasBeenSet = true; m_sourceType = value; } + inline void SetSourceType(AggregatedSourceType&& value) { m_sourceTypeHasBeenSet = true; m_sourceType = std::move(value); } + inline AggregatedSourceStatus& WithSourceType(const AggregatedSourceType& value) { SetSourceType(value); return *this;} + inline AggregatedSourceStatus& WithSourceType(AggregatedSourceType&& value) { SetSourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The region authorized to collect aggregated data.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline AggregatedSourceStatus& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline AggregatedSourceStatus& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline AggregatedSourceStatus& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the last updated status type.

  • Valid value FAILED + * indicates errors while moving data.

  • Valid value SUCCEEDED + * indicates the data was successfully moved.

  • Valid value + * OUTDATED indicates the data is not the most recent.

+ */ + inline const AggregatedSourceStatusType& GetLastUpdateStatus() const{ return m_lastUpdateStatus; } + inline bool LastUpdateStatusHasBeenSet() const { return m_lastUpdateStatusHasBeenSet; } + inline void SetLastUpdateStatus(const AggregatedSourceStatusType& value) { m_lastUpdateStatusHasBeenSet = true; m_lastUpdateStatus = value; } + inline void SetLastUpdateStatus(AggregatedSourceStatusType&& value) { m_lastUpdateStatusHasBeenSet = true; m_lastUpdateStatus = std::move(value); } + inline AggregatedSourceStatus& WithLastUpdateStatus(const AggregatedSourceStatusType& value) { SetLastUpdateStatus(value); return *this;} + inline AggregatedSourceStatus& WithLastUpdateStatus(AggregatedSourceStatusType&& value) { SetLastUpdateStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time of the last update.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; } + inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; } + inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; } + inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); } + inline AggregatedSourceStatus& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;} + inline AggregatedSourceStatus& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The error code that Config returned when the source account aggregation last + * failed.

+ */ + inline const Aws::String& GetLastErrorCode() const{ return m_lastErrorCode; } + inline bool LastErrorCodeHasBeenSet() const { return m_lastErrorCodeHasBeenSet; } + inline void SetLastErrorCode(const Aws::String& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = value; } + inline void SetLastErrorCode(Aws::String&& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = std::move(value); } + inline void SetLastErrorCode(const char* value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode.assign(value); } + inline AggregatedSourceStatus& WithLastErrorCode(const Aws::String& value) { SetLastErrorCode(value); return *this;} + inline AggregatedSourceStatus& WithLastErrorCode(Aws::String&& value) { SetLastErrorCode(std::move(value)); return *this;} + inline AggregatedSourceStatus& WithLastErrorCode(const char* value) { SetLastErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

The message indicating that the source account aggregation failed due to an + * error.

+ */ + inline const Aws::String& GetLastErrorMessage() const{ return m_lastErrorMessage; } + inline bool LastErrorMessageHasBeenSet() const { return m_lastErrorMessageHasBeenSet; } + inline void SetLastErrorMessage(const Aws::String& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = value; } + inline void SetLastErrorMessage(Aws::String&& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = std::move(value); } + inline void SetLastErrorMessage(const char* value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage.assign(value); } + inline AggregatedSourceStatus& WithLastErrorMessage(const Aws::String& value) { SetLastErrorMessage(value); return *this;} + inline AggregatedSourceStatus& WithLastErrorMessage(Aws::String&& value) { SetLastErrorMessage(std::move(value)); return *this;} + inline AggregatedSourceStatus& WithLastErrorMessage(const char* value) { SetLastErrorMessage(value); return *this;} + ///@} + private: + + Aws::String m_sourceId; + bool m_sourceIdHasBeenSet = false; + + AggregatedSourceType m_sourceType; + bool m_sourceTypeHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + + AggregatedSourceStatusType m_lastUpdateStatus; + bool m_lastUpdateStatusHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateTime; + bool m_lastUpdateTimeHasBeenSet = false; + + Aws::String m_lastErrorCode; + bool m_lastErrorCodeHasBeenSet = false; + + Aws::String m_lastErrorMessage; + bool m_lastErrorMessageHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregatedSourceStatusType.h b/include/aws/config/model/AggregatedSourceStatusType.h new file mode 100644 index 0000000000000000000000000000000000000000..9ebed6a73977556f8d804587ceb925cb80702643 --- /dev/null +++ b/include/aws/config/model/AggregatedSourceStatusType.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class AggregatedSourceStatusType + { + NOT_SET, + FAILED, + SUCCEEDED, + OUTDATED + }; + +namespace AggregatedSourceStatusTypeMapper +{ +AWS_CONFIGSERVICE_API AggregatedSourceStatusType GetAggregatedSourceStatusTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForAggregatedSourceStatusType(AggregatedSourceStatusType value); +} // namespace AggregatedSourceStatusTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregatedSourceType.h b/include/aws/config/model/AggregatedSourceType.h new file mode 100644 index 0000000000000000000000000000000000000000..34a879e83da1d3aeef5042272eeddbdca4678ee3 --- /dev/null +++ b/include/aws/config/model/AggregatedSourceType.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class AggregatedSourceType + { + NOT_SET, + ACCOUNT, + ORGANIZATION + }; + +namespace AggregatedSourceTypeMapper +{ +AWS_CONFIGSERVICE_API AggregatedSourceType GetAggregatedSourceTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForAggregatedSourceType(AggregatedSourceType value); +} // namespace AggregatedSourceTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregationAuthorization.h b/include/aws/config/model/AggregationAuthorization.h new file mode 100644 index 0000000000000000000000000000000000000000..70cd2378673170bdbfcca1bb9bf2d6219e43ebaa --- /dev/null +++ b/include/aws/config/model/AggregationAuthorization.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that represents the authorizations granted to aggregator accounts + * and regions.

See Also:

AWS + * API Reference

+ */ + class AggregationAuthorization + { + public: + AWS_CONFIGSERVICE_API AggregationAuthorization(); + AWS_CONFIGSERVICE_API AggregationAuthorization(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregationAuthorization& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the aggregation object.

+ */ + inline const Aws::String& GetAggregationAuthorizationArn() const{ return m_aggregationAuthorizationArn; } + inline bool AggregationAuthorizationArnHasBeenSet() const { return m_aggregationAuthorizationArnHasBeenSet; } + inline void SetAggregationAuthorizationArn(const Aws::String& value) { m_aggregationAuthorizationArnHasBeenSet = true; m_aggregationAuthorizationArn = value; } + inline void SetAggregationAuthorizationArn(Aws::String&& value) { m_aggregationAuthorizationArnHasBeenSet = true; m_aggregationAuthorizationArn = std::move(value); } + inline void SetAggregationAuthorizationArn(const char* value) { m_aggregationAuthorizationArnHasBeenSet = true; m_aggregationAuthorizationArn.assign(value); } + inline AggregationAuthorization& WithAggregationAuthorizationArn(const Aws::String& value) { SetAggregationAuthorizationArn(value); return *this;} + inline AggregationAuthorization& WithAggregationAuthorizationArn(Aws::String&& value) { SetAggregationAuthorizationArn(std::move(value)); return *this;} + inline AggregationAuthorization& WithAggregationAuthorizationArn(const char* value) { SetAggregationAuthorizationArn(value); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit account ID of the account authorized to aggregate data.

+ */ + inline const Aws::String& GetAuthorizedAccountId() const{ return m_authorizedAccountId; } + inline bool AuthorizedAccountIdHasBeenSet() const { return m_authorizedAccountIdHasBeenSet; } + inline void SetAuthorizedAccountId(const Aws::String& value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId = value; } + inline void SetAuthorizedAccountId(Aws::String&& value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId = std::move(value); } + inline void SetAuthorizedAccountId(const char* value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId.assign(value); } + inline AggregationAuthorization& WithAuthorizedAccountId(const Aws::String& value) { SetAuthorizedAccountId(value); return *this;} + inline AggregationAuthorization& WithAuthorizedAccountId(Aws::String&& value) { SetAuthorizedAccountId(std::move(value)); return *this;} + inline AggregationAuthorization& WithAuthorizedAccountId(const char* value) { SetAuthorizedAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The region authorized to collect aggregated data.

+ */ + inline const Aws::String& GetAuthorizedAwsRegion() const{ return m_authorizedAwsRegion; } + inline bool AuthorizedAwsRegionHasBeenSet() const { return m_authorizedAwsRegionHasBeenSet; } + inline void SetAuthorizedAwsRegion(const Aws::String& value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion = value; } + inline void SetAuthorizedAwsRegion(Aws::String&& value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion = std::move(value); } + inline void SetAuthorizedAwsRegion(const char* value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion.assign(value); } + inline AggregationAuthorization& WithAuthorizedAwsRegion(const Aws::String& value) { SetAuthorizedAwsRegion(value); return *this;} + inline AggregationAuthorization& WithAuthorizedAwsRegion(Aws::String&& value) { SetAuthorizedAwsRegion(std::move(value)); return *this;} + inline AggregationAuthorization& WithAuthorizedAwsRegion(const char* value) { SetAuthorizedAwsRegion(value); return *this;} + ///@} + + ///@{ + /** + *

The time stamp when the aggregation authorization was created.

+ */ + inline const Aws::Utils::DateTime& GetCreationTime() const{ return m_creationTime; } + inline bool CreationTimeHasBeenSet() const { return m_creationTimeHasBeenSet; } + inline void SetCreationTime(const Aws::Utils::DateTime& value) { m_creationTimeHasBeenSet = true; m_creationTime = value; } + inline void SetCreationTime(Aws::Utils::DateTime&& value) { m_creationTimeHasBeenSet = true; m_creationTime = std::move(value); } + inline AggregationAuthorization& WithCreationTime(const Aws::Utils::DateTime& value) { SetCreationTime(value); return *this;} + inline AggregationAuthorization& WithCreationTime(Aws::Utils::DateTime&& value) { SetCreationTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_aggregationAuthorizationArn; + bool m_aggregationAuthorizationArnHasBeenSet = false; + + Aws::String m_authorizedAccountId; + bool m_authorizedAccountIdHasBeenSet = false; + + Aws::String m_authorizedAwsRegion; + bool m_authorizedAwsRegionHasBeenSet = false; + + Aws::Utils::DateTime m_creationTime; + bool m_creationTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregatorFilterResourceType.h b/include/aws/config/model/AggregatorFilterResourceType.h new file mode 100644 index 0000000000000000000000000000000000000000..09009faec1878bf26b70a853a6a00f3995bc830b --- /dev/null +++ b/include/aws/config/model/AggregatorFilterResourceType.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object to filter the configuration recorders based on the resource types + * in scope for recording.

See Also:

AWS + * API Reference

+ */ + class AggregatorFilterResourceType + { + public: + AWS_CONFIGSERVICE_API AggregatorFilterResourceType(); + AWS_CONFIGSERVICE_API AggregatorFilterResourceType(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregatorFilterResourceType& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of resource type filter to apply. INCLUDE specifies + * that the list of resource types in the Value field will be + * aggregated and no other resource types will be filtered.

+ */ + inline const AggregatorFilterType& GetType() const{ return m_type; } + inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } + inline void SetType(const AggregatorFilterType& value) { m_typeHasBeenSet = true; m_type = value; } + inline void SetType(AggregatorFilterType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } + inline AggregatorFilterResourceType& WithType(const AggregatorFilterType& value) { SetType(value); return *this;} + inline AggregatorFilterResourceType& WithType(AggregatorFilterType&& value) { SetType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Comma-separate list of resource types to filter your aggregated configuration + * recorders.

+ */ + inline const Aws::Vector& GetValue() const{ return m_value; } + inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; } + inline void SetValue(const Aws::Vector& value) { m_valueHasBeenSet = true; m_value = value; } + inline void SetValue(Aws::Vector&& value) { m_valueHasBeenSet = true; m_value = std::move(value); } + inline AggregatorFilterResourceType& WithValue(const Aws::Vector& value) { SetValue(value); return *this;} + inline AggregatorFilterResourceType& WithValue(Aws::Vector&& value) { SetValue(std::move(value)); return *this;} + inline AggregatorFilterResourceType& AddValue(const Aws::String& value) { m_valueHasBeenSet = true; m_value.push_back(value); return *this; } + inline AggregatorFilterResourceType& AddValue(Aws::String&& value) { m_valueHasBeenSet = true; m_value.push_back(std::move(value)); return *this; } + inline AggregatorFilterResourceType& AddValue(const char* value) { m_valueHasBeenSet = true; m_value.push_back(value); return *this; } + ///@} + private: + + AggregatorFilterType m_type; + bool m_typeHasBeenSet = false; + + Aws::Vector m_value; + bool m_valueHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregatorFilterServicePrincipal.h b/include/aws/config/model/AggregatorFilterServicePrincipal.h new file mode 100644 index 0000000000000000000000000000000000000000..b1ce2f43307f4137f00d6bb4fecca17ee8fb8fd3 --- /dev/null +++ b/include/aws/config/model/AggregatorFilterServicePrincipal.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object to filter service-linked configuration recorders in an aggregator + * based on the linked Amazon Web Services service.

See Also:

AWS + * API Reference

+ */ + class AggregatorFilterServicePrincipal + { + public: + AWS_CONFIGSERVICE_API AggregatorFilterServicePrincipal(); + AWS_CONFIGSERVICE_API AggregatorFilterServicePrincipal(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregatorFilterServicePrincipal& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of service principal filter to apply. INCLUDE specifies + * that the list of service principals in the Value field will be + * aggregated and no other service principals will be filtered.

+ */ + inline const AggregatorFilterType& GetType() const{ return m_type; } + inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } + inline void SetType(const AggregatorFilterType& value) { m_typeHasBeenSet = true; m_type = value; } + inline void SetType(AggregatorFilterType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } + inline AggregatorFilterServicePrincipal& WithType(const AggregatorFilterType& value) { SetType(value); return *this;} + inline AggregatorFilterServicePrincipal& WithType(AggregatorFilterType&& value) { SetType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Comma-separated list of service principals for the linked Amazon Web Services + * services to filter your aggregated service-linked configuration recorders.

+ */ + inline const Aws::Vector& GetValue() const{ return m_value; } + inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; } + inline void SetValue(const Aws::Vector& value) { m_valueHasBeenSet = true; m_value = value; } + inline void SetValue(Aws::Vector&& value) { m_valueHasBeenSet = true; m_value = std::move(value); } + inline AggregatorFilterServicePrincipal& WithValue(const Aws::Vector& value) { SetValue(value); return *this;} + inline AggregatorFilterServicePrincipal& WithValue(Aws::Vector&& value) { SetValue(std::move(value)); return *this;} + inline AggregatorFilterServicePrincipal& AddValue(const Aws::String& value) { m_valueHasBeenSet = true; m_value.push_back(value); return *this; } + inline AggregatorFilterServicePrincipal& AddValue(Aws::String&& value) { m_valueHasBeenSet = true; m_value.push_back(std::move(value)); return *this; } + inline AggregatorFilterServicePrincipal& AddValue(const char* value) { m_valueHasBeenSet = true; m_value.push_back(value); return *this; } + ///@} + private: + + AggregatorFilterType m_type; + bool m_typeHasBeenSet = false; + + Aws::Vector m_value; + bool m_valueHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregatorFilterType.h b/include/aws/config/model/AggregatorFilterType.h new file mode 100644 index 0000000000000000000000000000000000000000..4309772ec0d0719c46dba6ebf644657dbb2edd1e --- /dev/null +++ b/include/aws/config/model/AggregatorFilterType.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class AggregatorFilterType + { + NOT_SET, + INCLUDE + }; + +namespace AggregatorFilterTypeMapper +{ +AWS_CONFIGSERVICE_API AggregatorFilterType GetAggregatorFilterTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForAggregatorFilterType(AggregatorFilterType value); +} // namespace AggregatorFilterTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AggregatorFilters.h b/include/aws/config/model/AggregatorFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..9075ce9afbad8120f0c91846ada7f4329ea3464a --- /dev/null +++ b/include/aws/config/model/AggregatorFilters.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object to filter the data you specify for an aggregator.

See + * Also:

AWS + * API Reference

+ */ + class AggregatorFilters + { + public: + AWS_CONFIGSERVICE_API AggregatorFilters(); + AWS_CONFIGSERVICE_API AggregatorFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API AggregatorFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

An object to filter the configuration recorders based on the resource types + * in scope for recording.

+ */ + inline const AggregatorFilterResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const AggregatorFilterResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(AggregatorFilterResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline AggregatorFilters& WithResourceType(const AggregatorFilterResourceType& value) { SetResourceType(value); return *this;} + inline AggregatorFilters& WithResourceType(AggregatorFilterResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An object to filter service-linked configuration recorders in an aggregator + * based on the linked Amazon Web Services service.

+ */ + inline const AggregatorFilterServicePrincipal& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const AggregatorFilterServicePrincipal& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(AggregatorFilterServicePrincipal&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline AggregatorFilters& WithServicePrincipal(const AggregatorFilterServicePrincipal& value) { SetServicePrincipal(value); return *this;} + inline AggregatorFilters& WithServicePrincipal(AggregatorFilterServicePrincipal&& value) { SetServicePrincipal(std::move(value)); return *this;} + ///@} + private: + + AggregatorFilterResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + AggregatorFilterServicePrincipal m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AssociateResourceTypesRequest.h b/include/aws/config/model/AssociateResourceTypesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..961da7dabae4d1d514767b769737812b66315dfc --- /dev/null +++ b/include/aws/config/model/AssociateResourceTypesRequest.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class AssociateResourceTypesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API AssociateResourceTypesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "AssociateResourceTypes"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the specified configuration recorder.

+ */ + inline const Aws::String& GetConfigurationRecorderArn() const{ return m_configurationRecorderArn; } + inline bool ConfigurationRecorderArnHasBeenSet() const { return m_configurationRecorderArnHasBeenSet; } + inline void SetConfigurationRecorderArn(const Aws::String& value) { m_configurationRecorderArnHasBeenSet = true; m_configurationRecorderArn = value; } + inline void SetConfigurationRecorderArn(Aws::String&& value) { m_configurationRecorderArnHasBeenSet = true; m_configurationRecorderArn = std::move(value); } + inline void SetConfigurationRecorderArn(const char* value) { m_configurationRecorderArnHasBeenSet = true; m_configurationRecorderArn.assign(value); } + inline AssociateResourceTypesRequest& WithConfigurationRecorderArn(const Aws::String& value) { SetConfigurationRecorderArn(value); return *this;} + inline AssociateResourceTypesRequest& WithConfigurationRecorderArn(Aws::String&& value) { SetConfigurationRecorderArn(std::move(value)); return *this;} + inline AssociateResourceTypesRequest& WithConfigurationRecorderArn(const char* value) { SetConfigurationRecorderArn(value); return *this;} + ///@} + + ///@{ + /** + *

The list of resource types you want to add to the recording group of the + * specified configuration recorder.

+ */ + inline const Aws::Vector& GetResourceTypes() const{ return m_resourceTypes; } + inline bool ResourceTypesHasBeenSet() const { return m_resourceTypesHasBeenSet; } + inline void SetResourceTypes(const Aws::Vector& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = value; } + inline void SetResourceTypes(Aws::Vector&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = std::move(value); } + inline AssociateResourceTypesRequest& WithResourceTypes(const Aws::Vector& value) { SetResourceTypes(value); return *this;} + inline AssociateResourceTypesRequest& WithResourceTypes(Aws::Vector&& value) { SetResourceTypes(std::move(value)); return *this;} + inline AssociateResourceTypesRequest& AddResourceTypes(const ResourceType& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + inline AssociateResourceTypesRequest& AddResourceTypes(ResourceType&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_configurationRecorderArn; + bool m_configurationRecorderArnHasBeenSet = false; + + Aws::Vector m_resourceTypes; + bool m_resourceTypesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/AssociateResourceTypesResult.h b/include/aws/config/model/AssociateResourceTypesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..848ccc5cce560992271db5c758d17a71904e38a7 --- /dev/null +++ b/include/aws/config/model/AssociateResourceTypesResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class AssociateResourceTypesResult + { + public: + AWS_CONFIGSERVICE_API AssociateResourceTypesResult(); + AWS_CONFIGSERVICE_API AssociateResourceTypesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API AssociateResourceTypesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ConfigurationRecorder& GetConfigurationRecorder() const{ return m_configurationRecorder; } + inline void SetConfigurationRecorder(const ConfigurationRecorder& value) { m_configurationRecorder = value; } + inline void SetConfigurationRecorder(ConfigurationRecorder&& value) { m_configurationRecorder = std::move(value); } + inline AssociateResourceTypesResult& WithConfigurationRecorder(const ConfigurationRecorder& value) { SetConfigurationRecorder(value); return *this;} + inline AssociateResourceTypesResult& WithConfigurationRecorder(ConfigurationRecorder&& value) { SetConfigurationRecorder(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline AssociateResourceTypesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline AssociateResourceTypesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline AssociateResourceTypesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ConfigurationRecorder m_configurationRecorder; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/BaseConfigurationItem.h b/include/aws/config/model/BaseConfigurationItem.h new file mode 100644 index 0000000000000000000000000000000000000000..08473f0120d8be49dfee6abe37d13faa800759ee --- /dev/null +++ b/include/aws/config/model/BaseConfigurationItem.h @@ -0,0 +1,334 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The detailed configurations of a specified resource.

See Also:

+ * AWS + * API Reference

+ */ + class BaseConfigurationItem + { + public: + AWS_CONFIGSERVICE_API BaseConfigurationItem(); + AWS_CONFIGSERVICE_API BaseConfigurationItem(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API BaseConfigurationItem& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The version number of the resource configuration.

+ */ + inline const Aws::String& GetVersion() const{ return m_version; } + inline bool VersionHasBeenSet() const { return m_versionHasBeenSet; } + inline void SetVersion(const Aws::String& value) { m_versionHasBeenSet = true; m_version = value; } + inline void SetVersion(Aws::String&& value) { m_versionHasBeenSet = true; m_version = std::move(value); } + inline void SetVersion(const char* value) { m_versionHasBeenSet = true; m_version.assign(value); } + inline BaseConfigurationItem& WithVersion(const Aws::String& value) { SetVersion(value); return *this;} + inline BaseConfigurationItem& WithVersion(Aws::String&& value) { SetVersion(std::move(value)); return *this;} + inline BaseConfigurationItem& WithVersion(const char* value) { SetVersion(value); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit Amazon Web Services account ID associated with the resource.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline BaseConfigurationItem& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline BaseConfigurationItem& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline BaseConfigurationItem& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The time when the recording of configuration changes was initiated for the + * resource.

+ */ + inline const Aws::Utils::DateTime& GetConfigurationItemCaptureTime() const{ return m_configurationItemCaptureTime; } + inline bool ConfigurationItemCaptureTimeHasBeenSet() const { return m_configurationItemCaptureTimeHasBeenSet; } + inline void SetConfigurationItemCaptureTime(const Aws::Utils::DateTime& value) { m_configurationItemCaptureTimeHasBeenSet = true; m_configurationItemCaptureTime = value; } + inline void SetConfigurationItemCaptureTime(Aws::Utils::DateTime&& value) { m_configurationItemCaptureTimeHasBeenSet = true; m_configurationItemCaptureTime = std::move(value); } + inline BaseConfigurationItem& WithConfigurationItemCaptureTime(const Aws::Utils::DateTime& value) { SetConfigurationItemCaptureTime(value); return *this;} + inline BaseConfigurationItem& WithConfigurationItemCaptureTime(Aws::Utils::DateTime&& value) { SetConfigurationItemCaptureTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The configuration item status. Valid values include:

  • OK – + * The resource configuration has been updated.

  • + *

    ResourceDiscovered – The resource was newly discovered.

  • + *

    ResourceNotRecorded – The resource was discovered, but its configuration was + * not recorded since the recorder doesn't record resources of this type.

  • + *
  • ResourceDeleted – The resource was deleted

  • + *

    ResourceDeletedNotRecorded – The resource was deleted, but its configuration + * was not recorded since the recorder doesn't record resources of this type.

    + *
+ */ + inline const ConfigurationItemStatus& GetConfigurationItemStatus() const{ return m_configurationItemStatus; } + inline bool ConfigurationItemStatusHasBeenSet() const { return m_configurationItemStatusHasBeenSet; } + inline void SetConfigurationItemStatus(const ConfigurationItemStatus& value) { m_configurationItemStatusHasBeenSet = true; m_configurationItemStatus = value; } + inline void SetConfigurationItemStatus(ConfigurationItemStatus&& value) { m_configurationItemStatusHasBeenSet = true; m_configurationItemStatus = std::move(value); } + inline BaseConfigurationItem& WithConfigurationItemStatus(const ConfigurationItemStatus& value) { SetConfigurationItemStatus(value); return *this;} + inline BaseConfigurationItem& WithConfigurationItemStatus(ConfigurationItemStatus&& value) { SetConfigurationItemStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An identifier that indicates the ordering of the configuration items of a + * resource.

+ */ + inline const Aws::String& GetConfigurationStateId() const{ return m_configurationStateId; } + inline bool ConfigurationStateIdHasBeenSet() const { return m_configurationStateIdHasBeenSet; } + inline void SetConfigurationStateId(const Aws::String& value) { m_configurationStateIdHasBeenSet = true; m_configurationStateId = value; } + inline void SetConfigurationStateId(Aws::String&& value) { m_configurationStateIdHasBeenSet = true; m_configurationStateId = std::move(value); } + inline void SetConfigurationStateId(const char* value) { m_configurationStateIdHasBeenSet = true; m_configurationStateId.assign(value); } + inline BaseConfigurationItem& WithConfigurationStateId(const Aws::String& value) { SetConfigurationStateId(value); return *this;} + inline BaseConfigurationItem& WithConfigurationStateId(Aws::String&& value) { SetConfigurationStateId(std::move(value)); return *this;} + inline BaseConfigurationItem& WithConfigurationStateId(const char* value) { SetConfigurationStateId(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the resource.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline BaseConfigurationItem& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline BaseConfigurationItem& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline BaseConfigurationItem& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The type of Amazon Web Services resource.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline BaseConfigurationItem& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline BaseConfigurationItem& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource (for example., sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline BaseConfigurationItem& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline BaseConfigurationItem& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline BaseConfigurationItem& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The custom name of the resource, if available.

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline BaseConfigurationItem& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline BaseConfigurationItem& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline BaseConfigurationItem& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + + ///@{ + /** + *

The region where the resource resides.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline BaseConfigurationItem& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline BaseConfigurationItem& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline BaseConfigurationItem& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + + ///@{ + /** + *

The Availability Zone associated with the resource.

+ */ + inline const Aws::String& GetAvailabilityZone() const{ return m_availabilityZone; } + inline bool AvailabilityZoneHasBeenSet() const { return m_availabilityZoneHasBeenSet; } + inline void SetAvailabilityZone(const Aws::String& value) { m_availabilityZoneHasBeenSet = true; m_availabilityZone = value; } + inline void SetAvailabilityZone(Aws::String&& value) { m_availabilityZoneHasBeenSet = true; m_availabilityZone = std::move(value); } + inline void SetAvailabilityZone(const char* value) { m_availabilityZoneHasBeenSet = true; m_availabilityZone.assign(value); } + inline BaseConfigurationItem& WithAvailabilityZone(const Aws::String& value) { SetAvailabilityZone(value); return *this;} + inline BaseConfigurationItem& WithAvailabilityZone(Aws::String&& value) { SetAvailabilityZone(std::move(value)); return *this;} + inline BaseConfigurationItem& WithAvailabilityZone(const char* value) { SetAvailabilityZone(value); return *this;} + ///@} + + ///@{ + /** + *

The time stamp when the resource was created.

+ */ + inline const Aws::Utils::DateTime& GetResourceCreationTime() const{ return m_resourceCreationTime; } + inline bool ResourceCreationTimeHasBeenSet() const { return m_resourceCreationTimeHasBeenSet; } + inline void SetResourceCreationTime(const Aws::Utils::DateTime& value) { m_resourceCreationTimeHasBeenSet = true; m_resourceCreationTime = value; } + inline void SetResourceCreationTime(Aws::Utils::DateTime&& value) { m_resourceCreationTimeHasBeenSet = true; m_resourceCreationTime = std::move(value); } + inline BaseConfigurationItem& WithResourceCreationTime(const Aws::Utils::DateTime& value) { SetResourceCreationTime(value); return *this;} + inline BaseConfigurationItem& WithResourceCreationTime(Aws::Utils::DateTime&& value) { SetResourceCreationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The description of the resource configuration.

+ */ + inline const Aws::String& GetConfiguration() const{ return m_configuration; } + inline bool ConfigurationHasBeenSet() const { return m_configurationHasBeenSet; } + inline void SetConfiguration(const Aws::String& value) { m_configurationHasBeenSet = true; m_configuration = value; } + inline void SetConfiguration(Aws::String&& value) { m_configurationHasBeenSet = true; m_configuration = std::move(value); } + inline void SetConfiguration(const char* value) { m_configurationHasBeenSet = true; m_configuration.assign(value); } + inline BaseConfigurationItem& WithConfiguration(const Aws::String& value) { SetConfiguration(value); return *this;} + inline BaseConfigurationItem& WithConfiguration(Aws::String&& value) { SetConfiguration(std::move(value)); return *this;} + inline BaseConfigurationItem& WithConfiguration(const char* value) { SetConfiguration(value); return *this;} + ///@} + + ///@{ + /** + *

Configuration attributes that Config returns for certain resource types to + * supplement the information returned for the configuration parameter.

+ */ + inline const Aws::Map& GetSupplementaryConfiguration() const{ return m_supplementaryConfiguration; } + inline bool SupplementaryConfigurationHasBeenSet() const { return m_supplementaryConfigurationHasBeenSet; } + inline void SetSupplementaryConfiguration(const Aws::Map& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration = value; } + inline void SetSupplementaryConfiguration(Aws::Map&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration = std::move(value); } + inline BaseConfigurationItem& WithSupplementaryConfiguration(const Aws::Map& value) { SetSupplementaryConfiguration(value); return *this;} + inline BaseConfigurationItem& WithSupplementaryConfiguration(Aws::Map&& value) { SetSupplementaryConfiguration(std::move(value)); return *this;} + inline BaseConfigurationItem& AddSupplementaryConfiguration(const Aws::String& key, const Aws::String& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, value); return *this; } + inline BaseConfigurationItem& AddSupplementaryConfiguration(Aws::String&& key, const Aws::String& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(std::move(key), value); return *this; } + inline BaseConfigurationItem& AddSupplementaryConfiguration(const Aws::String& key, Aws::String&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, std::move(value)); return *this; } + inline BaseConfigurationItem& AddSupplementaryConfiguration(Aws::String&& key, Aws::String&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(std::move(key), std::move(value)); return *this; } + inline BaseConfigurationItem& AddSupplementaryConfiguration(const char* key, Aws::String&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, std::move(value)); return *this; } + inline BaseConfigurationItem& AddSupplementaryConfiguration(Aws::String&& key, const char* value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(std::move(key), value); return *this; } + inline BaseConfigurationItem& AddSupplementaryConfiguration(const char* key, const char* value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

The recording frequency that Config uses to record configuration changes for + * the resource.

+ */ + inline const RecordingFrequency& GetRecordingFrequency() const{ return m_recordingFrequency; } + inline bool RecordingFrequencyHasBeenSet() const { return m_recordingFrequencyHasBeenSet; } + inline void SetRecordingFrequency(const RecordingFrequency& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = value; } + inline void SetRecordingFrequency(RecordingFrequency&& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = std::move(value); } + inline BaseConfigurationItem& WithRecordingFrequency(const RecordingFrequency& value) { SetRecordingFrequency(value); return *this;} + inline BaseConfigurationItem& WithRecordingFrequency(RecordingFrequency&& value) { SetRecordingFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when configuration changes for the resource were delivered.

+ *

This field is optional and is not guaranteed to be present in a + * configuration item (CI). If you are using daily recording, this field will be + * populated. However, if you are using continuous recording, this field will be + * omitted since the delivery time is instantaneous as the CI is available right + * away. For more information on daily recording and continuous recording, see Recording + * Frequency in the Config Developer Guide.

+ */ + inline const Aws::Utils::DateTime& GetConfigurationItemDeliveryTime() const{ return m_configurationItemDeliveryTime; } + inline bool ConfigurationItemDeliveryTimeHasBeenSet() const { return m_configurationItemDeliveryTimeHasBeenSet; } + inline void SetConfigurationItemDeliveryTime(const Aws::Utils::DateTime& value) { m_configurationItemDeliveryTimeHasBeenSet = true; m_configurationItemDeliveryTime = value; } + inline void SetConfigurationItemDeliveryTime(Aws::Utils::DateTime&& value) { m_configurationItemDeliveryTimeHasBeenSet = true; m_configurationItemDeliveryTime = std::move(value); } + inline BaseConfigurationItem& WithConfigurationItemDeliveryTime(const Aws::Utils::DateTime& value) { SetConfigurationItemDeliveryTime(value); return *this;} + inline BaseConfigurationItem& WithConfigurationItemDeliveryTime(Aws::Utils::DateTime&& value) { SetConfigurationItemDeliveryTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_version; + bool m_versionHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::Utils::DateTime m_configurationItemCaptureTime; + bool m_configurationItemCaptureTimeHasBeenSet = false; + + ConfigurationItemStatus m_configurationItemStatus; + bool m_configurationItemStatusHasBeenSet = false; + + Aws::String m_configurationStateId; + bool m_configurationStateIdHasBeenSet = false; + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + + Aws::String m_availabilityZone; + bool m_availabilityZoneHasBeenSet = false; + + Aws::Utils::DateTime m_resourceCreationTime; + bool m_resourceCreationTimeHasBeenSet = false; + + Aws::String m_configuration; + bool m_configurationHasBeenSet = false; + + Aws::Map m_supplementaryConfiguration; + bool m_supplementaryConfigurationHasBeenSet = false; + + RecordingFrequency m_recordingFrequency; + bool m_recordingFrequencyHasBeenSet = false; + + Aws::Utils::DateTime m_configurationItemDeliveryTime; + bool m_configurationItemDeliveryTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/BatchGetAggregateResourceConfigRequest.h b/include/aws/config/model/BatchGetAggregateResourceConfigRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..6556eb534459afa53a2050322550bfd239335cb2 --- /dev/null +++ b/include/aws/config/model/BatchGetAggregateResourceConfigRequest.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class BatchGetAggregateResourceConfigRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API BatchGetAggregateResourceConfigRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "BatchGetAggregateResourceConfig"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline BatchGetAggregateResourceConfigRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline BatchGetAggregateResourceConfigRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline BatchGetAggregateResourceConfigRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

A list of aggregate ResourceIdentifiers objects.

+ */ + inline const Aws::Vector& GetResourceIdentifiers() const{ return m_resourceIdentifiers; } + inline bool ResourceIdentifiersHasBeenSet() const { return m_resourceIdentifiersHasBeenSet; } + inline void SetResourceIdentifiers(const Aws::Vector& value) { m_resourceIdentifiersHasBeenSet = true; m_resourceIdentifiers = value; } + inline void SetResourceIdentifiers(Aws::Vector&& value) { m_resourceIdentifiersHasBeenSet = true; m_resourceIdentifiers = std::move(value); } + inline BatchGetAggregateResourceConfigRequest& WithResourceIdentifiers(const Aws::Vector& value) { SetResourceIdentifiers(value); return *this;} + inline BatchGetAggregateResourceConfigRequest& WithResourceIdentifiers(Aws::Vector&& value) { SetResourceIdentifiers(std::move(value)); return *this;} + inline BatchGetAggregateResourceConfigRequest& AddResourceIdentifiers(const AggregateResourceIdentifier& value) { m_resourceIdentifiersHasBeenSet = true; m_resourceIdentifiers.push_back(value); return *this; } + inline BatchGetAggregateResourceConfigRequest& AddResourceIdentifiers(AggregateResourceIdentifier&& value) { m_resourceIdentifiersHasBeenSet = true; m_resourceIdentifiers.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + Aws::Vector m_resourceIdentifiers; + bool m_resourceIdentifiersHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/BatchGetAggregateResourceConfigResult.h b/include/aws/config/model/BatchGetAggregateResourceConfigResult.h new file mode 100644 index 0000000000000000000000000000000000000000..716517ef8857ae92670410b6bf1f7864ca851b8d --- /dev/null +++ b/include/aws/config/model/BatchGetAggregateResourceConfigResult.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class BatchGetAggregateResourceConfigResult + { + public: + AWS_CONFIGSERVICE_API BatchGetAggregateResourceConfigResult(); + AWS_CONFIGSERVICE_API BatchGetAggregateResourceConfigResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API BatchGetAggregateResourceConfigResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list that contains the current configuration of one or more resources.

+ */ + inline const Aws::Vector& GetBaseConfigurationItems() const{ return m_baseConfigurationItems; } + inline void SetBaseConfigurationItems(const Aws::Vector& value) { m_baseConfigurationItems = value; } + inline void SetBaseConfigurationItems(Aws::Vector&& value) { m_baseConfigurationItems = std::move(value); } + inline BatchGetAggregateResourceConfigResult& WithBaseConfigurationItems(const Aws::Vector& value) { SetBaseConfigurationItems(value); return *this;} + inline BatchGetAggregateResourceConfigResult& WithBaseConfigurationItems(Aws::Vector&& value) { SetBaseConfigurationItems(std::move(value)); return *this;} + inline BatchGetAggregateResourceConfigResult& AddBaseConfigurationItems(const BaseConfigurationItem& value) { m_baseConfigurationItems.push_back(value); return *this; } + inline BatchGetAggregateResourceConfigResult& AddBaseConfigurationItems(BaseConfigurationItem&& value) { m_baseConfigurationItems.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A list of resource identifiers that were not processed with current scope. + * The list is empty if all the resources are processed.

+ */ + inline const Aws::Vector& GetUnprocessedResourceIdentifiers() const{ return m_unprocessedResourceIdentifiers; } + inline void SetUnprocessedResourceIdentifiers(const Aws::Vector& value) { m_unprocessedResourceIdentifiers = value; } + inline void SetUnprocessedResourceIdentifiers(Aws::Vector&& value) { m_unprocessedResourceIdentifiers = std::move(value); } + inline BatchGetAggregateResourceConfigResult& WithUnprocessedResourceIdentifiers(const Aws::Vector& value) { SetUnprocessedResourceIdentifiers(value); return *this;} + inline BatchGetAggregateResourceConfigResult& WithUnprocessedResourceIdentifiers(Aws::Vector&& value) { SetUnprocessedResourceIdentifiers(std::move(value)); return *this;} + inline BatchGetAggregateResourceConfigResult& AddUnprocessedResourceIdentifiers(const AggregateResourceIdentifier& value) { m_unprocessedResourceIdentifiers.push_back(value); return *this; } + inline BatchGetAggregateResourceConfigResult& AddUnprocessedResourceIdentifiers(AggregateResourceIdentifier&& value) { m_unprocessedResourceIdentifiers.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline BatchGetAggregateResourceConfigResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline BatchGetAggregateResourceConfigResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline BatchGetAggregateResourceConfigResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_baseConfigurationItems; + + Aws::Vector m_unprocessedResourceIdentifiers; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/BatchGetResourceConfigRequest.h b/include/aws/config/model/BatchGetResourceConfigRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..052ed920f5b1f907ba77d7a1781d722476946d68 --- /dev/null +++ b/include/aws/config/model/BatchGetResourceConfigRequest.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class BatchGetResourceConfigRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API BatchGetResourceConfigRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "BatchGetResourceConfig"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of resource keys to be processed with the current request. Each + * element in the list consists of the resource type and resource ID.

+ */ + inline const Aws::Vector& GetResourceKeys() const{ return m_resourceKeys; } + inline bool ResourceKeysHasBeenSet() const { return m_resourceKeysHasBeenSet; } + inline void SetResourceKeys(const Aws::Vector& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = value; } + inline void SetResourceKeys(Aws::Vector&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = std::move(value); } + inline BatchGetResourceConfigRequest& WithResourceKeys(const Aws::Vector& value) { SetResourceKeys(value); return *this;} + inline BatchGetResourceConfigRequest& WithResourceKeys(Aws::Vector&& value) { SetResourceKeys(std::move(value)); return *this;} + inline BatchGetResourceConfigRequest& AddResourceKeys(const ResourceKey& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(value); return *this; } + inline BatchGetResourceConfigRequest& AddResourceKeys(ResourceKey&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_resourceKeys; + bool m_resourceKeysHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/BatchGetResourceConfigResult.h b/include/aws/config/model/BatchGetResourceConfigResult.h new file mode 100644 index 0000000000000000000000000000000000000000..1db58495c810c039fab338cc58a29af090e9c7f0 --- /dev/null +++ b/include/aws/config/model/BatchGetResourceConfigResult.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class BatchGetResourceConfigResult + { + public: + AWS_CONFIGSERVICE_API BatchGetResourceConfigResult(); + AWS_CONFIGSERVICE_API BatchGetResourceConfigResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API BatchGetResourceConfigResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list that contains the current configuration of one or more resources.

+ */ + inline const Aws::Vector& GetBaseConfigurationItems() const{ return m_baseConfigurationItems; } + inline void SetBaseConfigurationItems(const Aws::Vector& value) { m_baseConfigurationItems = value; } + inline void SetBaseConfigurationItems(Aws::Vector&& value) { m_baseConfigurationItems = std::move(value); } + inline BatchGetResourceConfigResult& WithBaseConfigurationItems(const Aws::Vector& value) { SetBaseConfigurationItems(value); return *this;} + inline BatchGetResourceConfigResult& WithBaseConfigurationItems(Aws::Vector&& value) { SetBaseConfigurationItems(std::move(value)); return *this;} + inline BatchGetResourceConfigResult& AddBaseConfigurationItems(const BaseConfigurationItem& value) { m_baseConfigurationItems.push_back(value); return *this; } + inline BatchGetResourceConfigResult& AddBaseConfigurationItems(BaseConfigurationItem&& value) { m_baseConfigurationItems.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A list of resource keys that were not processed with the current response. + * The unprocessesResourceKeys value is in the same form as ResourceKeys, so the + * value can be directly provided to a subsequent BatchGetResourceConfig operation. + * If there are no unprocessed resource keys, the response contains an empty + * unprocessedResourceKeys list.

+ */ + inline const Aws::Vector& GetUnprocessedResourceKeys() const{ return m_unprocessedResourceKeys; } + inline void SetUnprocessedResourceKeys(const Aws::Vector& value) { m_unprocessedResourceKeys = value; } + inline void SetUnprocessedResourceKeys(Aws::Vector&& value) { m_unprocessedResourceKeys = std::move(value); } + inline BatchGetResourceConfigResult& WithUnprocessedResourceKeys(const Aws::Vector& value) { SetUnprocessedResourceKeys(value); return *this;} + inline BatchGetResourceConfigResult& WithUnprocessedResourceKeys(Aws::Vector&& value) { SetUnprocessedResourceKeys(std::move(value)); return *this;} + inline BatchGetResourceConfigResult& AddUnprocessedResourceKeys(const ResourceKey& value) { m_unprocessedResourceKeys.push_back(value); return *this; } + inline BatchGetResourceConfigResult& AddUnprocessedResourceKeys(ResourceKey&& value) { m_unprocessedResourceKeys.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline BatchGetResourceConfigResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline BatchGetResourceConfigResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline BatchGetResourceConfigResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_baseConfigurationItems; + + Aws::Vector m_unprocessedResourceKeys; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ChronologicalOrder.h b/include/aws/config/model/ChronologicalOrder.h new file mode 100644 index 0000000000000000000000000000000000000000..40a0ee544b9d23bca3d7588764f48ba2f1c693ea --- /dev/null +++ b/include/aws/config/model/ChronologicalOrder.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ChronologicalOrder + { + NOT_SET, + Reverse, + Forward + }; + +namespace ChronologicalOrderMapper +{ +AWS_CONFIGSERVICE_API ChronologicalOrder GetChronologicalOrderForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForChronologicalOrder(ChronologicalOrder value); +} // namespace ChronologicalOrderMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/Compliance.h b/include/aws/config/model/Compliance.h new file mode 100644 index 0000000000000000000000000000000000000000..f73e0b4a8ead08415e24fe0d8bfe13db95c6adda --- /dev/null +++ b/include/aws/config/model/Compliance.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Indicates whether an Amazon Web Services resource or Config rule is compliant + * and provides the number of contributors that affect the + * compliance.

See Also:

AWS + * API Reference

+ */ + class Compliance + { + public: + AWS_CONFIGSERVICE_API Compliance(); + AWS_CONFIGSERVICE_API Compliance(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Compliance& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Indicates whether an Amazon Web Services resource or Config rule is + * compliant.

A resource is compliant if it complies with all of the Config + * rules that evaluate it. A resource is noncompliant if it does not comply with + * one or more of these rules.

A rule is compliant if all of the resources + * that the rule evaluates comply with it. A rule is noncompliant if any of these + * resources do not comply.

Config returns the + * INSUFFICIENT_DATA value when no evaluation results are available + * for the Amazon Web Services resource or Config rule.

For the + * Compliance data type, Config supports only COMPLIANT, + * NON_COMPLIANT, and INSUFFICIENT_DATA values. Config + * does not support the NOT_APPLICABLE value for the + * Compliance data type.

+ */ + inline const ComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline Compliance& WithComplianceType(const ComplianceType& value) { SetComplianceType(value); return *this;} + inline Compliance& WithComplianceType(ComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The number of Amazon Web Services resources or Config rules that cause a + * result of NON_COMPLIANT, up to a maximum number.

+ */ + inline const ComplianceContributorCount& GetComplianceContributorCount() const{ return m_complianceContributorCount; } + inline bool ComplianceContributorCountHasBeenSet() const { return m_complianceContributorCountHasBeenSet; } + inline void SetComplianceContributorCount(const ComplianceContributorCount& value) { m_complianceContributorCountHasBeenSet = true; m_complianceContributorCount = value; } + inline void SetComplianceContributorCount(ComplianceContributorCount&& value) { m_complianceContributorCountHasBeenSet = true; m_complianceContributorCount = std::move(value); } + inline Compliance& WithComplianceContributorCount(const ComplianceContributorCount& value) { SetComplianceContributorCount(value); return *this;} + inline Compliance& WithComplianceContributorCount(ComplianceContributorCount&& value) { SetComplianceContributorCount(std::move(value)); return *this;} + ///@} + private: + + ComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + ComplianceContributorCount m_complianceContributorCount; + bool m_complianceContributorCountHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ComplianceByConfigRule.h b/include/aws/config/model/ComplianceByConfigRule.h new file mode 100644 index 0000000000000000000000000000000000000000..98a4371ab1e3afce80bfe6ece5dec7d82269e4ef --- /dev/null +++ b/include/aws/config/model/ComplianceByConfigRule.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Indicates whether an Config rule is compliant. A rule is compliant if all of + * the resources that the rule evaluated comply with it. A rule is noncompliant if + * any of these resources do not comply.

See Also:

AWS + * API Reference

+ */ + class ComplianceByConfigRule + { + public: + AWS_CONFIGSERVICE_API ComplianceByConfigRule(); + AWS_CONFIGSERVICE_API ComplianceByConfigRule(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ComplianceByConfigRule& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline ComplianceByConfigRule& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline ComplianceByConfigRule& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline ComplianceByConfigRule& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the Config rule is compliant.

+ */ + inline const Compliance& GetCompliance() const{ return m_compliance; } + inline bool ComplianceHasBeenSet() const { return m_complianceHasBeenSet; } + inline void SetCompliance(const Compliance& value) { m_complianceHasBeenSet = true; m_compliance = value; } + inline void SetCompliance(Compliance&& value) { m_complianceHasBeenSet = true; m_compliance = std::move(value); } + inline ComplianceByConfigRule& WithCompliance(const Compliance& value) { SetCompliance(value); return *this;} + inline ComplianceByConfigRule& WithCompliance(Compliance&& value) { SetCompliance(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Compliance m_compliance; + bool m_complianceHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ComplianceByResource.h b/include/aws/config/model/ComplianceByResource.h new file mode 100644 index 0000000000000000000000000000000000000000..f16cb06139e07d230dc81e6b7463e42fbac8af13 --- /dev/null +++ b/include/aws/config/model/ComplianceByResource.h @@ -0,0 +1,98 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Indicates whether an Amazon Web Services resource that is evaluated according + * to one or more Config rules is compliant. A resource is compliant if it complies + * with all of the rules that evaluate it. A resource is noncompliant if it does + * not comply with one or more of these rules.

See Also:

AWS + * API Reference

+ */ + class ComplianceByResource + { + public: + AWS_CONFIGSERVICE_API ComplianceByResource(); + AWS_CONFIGSERVICE_API ComplianceByResource(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ComplianceByResource& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline ComplianceByResource& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline ComplianceByResource& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline ComplianceByResource& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline ComplianceByResource& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline ComplianceByResource& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline ComplianceByResource& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the Amazon Web Services resource complies with all of the + * Config rules that evaluated it.

+ */ + inline const Compliance& GetCompliance() const{ return m_compliance; } + inline bool ComplianceHasBeenSet() const { return m_complianceHasBeenSet; } + inline void SetCompliance(const Compliance& value) { m_complianceHasBeenSet = true; m_compliance = value; } + inline void SetCompliance(Compliance&& value) { m_complianceHasBeenSet = true; m_compliance = std::move(value); } + inline ComplianceByResource& WithCompliance(const Compliance& value) { SetCompliance(value); return *this;} + inline ComplianceByResource& WithCompliance(Compliance&& value) { SetCompliance(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Compliance m_compliance; + bool m_complianceHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ComplianceContributorCount.h b/include/aws/config/model/ComplianceContributorCount.h new file mode 100644 index 0000000000000000000000000000000000000000..a01d267f41f178f99bb93168693687a0075f3097 --- /dev/null +++ b/include/aws/config/model/ComplianceContributorCount.h @@ -0,0 +1,71 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The number of Amazon Web Services resources or Config rules responsible for + * the current compliance of the item, up to a maximum number.

See + * Also:

AWS + * API Reference

+ */ + class ComplianceContributorCount + { + public: + AWS_CONFIGSERVICE_API ComplianceContributorCount(); + AWS_CONFIGSERVICE_API ComplianceContributorCount(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ComplianceContributorCount& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The number of Amazon Web Services resources or Config rules responsible for + * the current compliance of the item.

+ */ + inline int GetCappedCount() const{ return m_cappedCount; } + inline bool CappedCountHasBeenSet() const { return m_cappedCountHasBeenSet; } + inline void SetCappedCount(int value) { m_cappedCountHasBeenSet = true; m_cappedCount = value; } + inline ComplianceContributorCount& WithCappedCount(int value) { SetCappedCount(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the maximum count is reached.

+ */ + inline bool GetCapExceeded() const{ return m_capExceeded; } + inline bool CapExceededHasBeenSet() const { return m_capExceededHasBeenSet; } + inline void SetCapExceeded(bool value) { m_capExceededHasBeenSet = true; m_capExceeded = value; } + inline ComplianceContributorCount& WithCapExceeded(bool value) { SetCapExceeded(value); return *this;} + ///@} + private: + + int m_cappedCount; + bool m_cappedCountHasBeenSet = false; + + bool m_capExceeded; + bool m_capExceededHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ComplianceSummary.h b/include/aws/config/model/ComplianceSummary.h new file mode 100644 index 0000000000000000000000000000000000000000..919d53c47038d42dc28a3140f59f0a68b4f18ac6 --- /dev/null +++ b/include/aws/config/model/ComplianceSummary.h @@ -0,0 +1,93 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The number of Config rules or Amazon Web Services resources that are + * compliant and noncompliant.

See Also:

AWS + * API Reference

+ */ + class ComplianceSummary + { + public: + AWS_CONFIGSERVICE_API ComplianceSummary(); + AWS_CONFIGSERVICE_API ComplianceSummary(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ComplianceSummary& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The number of Config rules or Amazon Web Services resources that are + * compliant, up to a maximum of 25 for rules and 100 for resources.

+ */ + inline const ComplianceContributorCount& GetCompliantResourceCount() const{ return m_compliantResourceCount; } + inline bool CompliantResourceCountHasBeenSet() const { return m_compliantResourceCountHasBeenSet; } + inline void SetCompliantResourceCount(const ComplianceContributorCount& value) { m_compliantResourceCountHasBeenSet = true; m_compliantResourceCount = value; } + inline void SetCompliantResourceCount(ComplianceContributorCount&& value) { m_compliantResourceCountHasBeenSet = true; m_compliantResourceCount = std::move(value); } + inline ComplianceSummary& WithCompliantResourceCount(const ComplianceContributorCount& value) { SetCompliantResourceCount(value); return *this;} + inline ComplianceSummary& WithCompliantResourceCount(ComplianceContributorCount&& value) { SetCompliantResourceCount(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The number of Config rules or Amazon Web Services resources that are + * noncompliant, up to a maximum of 25 for rules and 100 for resources.

+ */ + inline const ComplianceContributorCount& GetNonCompliantResourceCount() const{ return m_nonCompliantResourceCount; } + inline bool NonCompliantResourceCountHasBeenSet() const { return m_nonCompliantResourceCountHasBeenSet; } + inline void SetNonCompliantResourceCount(const ComplianceContributorCount& value) { m_nonCompliantResourceCountHasBeenSet = true; m_nonCompliantResourceCount = value; } + inline void SetNonCompliantResourceCount(ComplianceContributorCount&& value) { m_nonCompliantResourceCountHasBeenSet = true; m_nonCompliantResourceCount = std::move(value); } + inline ComplianceSummary& WithNonCompliantResourceCount(const ComplianceContributorCount& value) { SetNonCompliantResourceCount(value); return *this;} + inline ComplianceSummary& WithNonCompliantResourceCount(ComplianceContributorCount&& value) { SetNonCompliantResourceCount(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time that Config created the compliance summary.

+ */ + inline const Aws::Utils::DateTime& GetComplianceSummaryTimestamp() const{ return m_complianceSummaryTimestamp; } + inline bool ComplianceSummaryTimestampHasBeenSet() const { return m_complianceSummaryTimestampHasBeenSet; } + inline void SetComplianceSummaryTimestamp(const Aws::Utils::DateTime& value) { m_complianceSummaryTimestampHasBeenSet = true; m_complianceSummaryTimestamp = value; } + inline void SetComplianceSummaryTimestamp(Aws::Utils::DateTime&& value) { m_complianceSummaryTimestampHasBeenSet = true; m_complianceSummaryTimestamp = std::move(value); } + inline ComplianceSummary& WithComplianceSummaryTimestamp(const Aws::Utils::DateTime& value) { SetComplianceSummaryTimestamp(value); return *this;} + inline ComplianceSummary& WithComplianceSummaryTimestamp(Aws::Utils::DateTime&& value) { SetComplianceSummaryTimestamp(std::move(value)); return *this;} + ///@} + private: + + ComplianceContributorCount m_compliantResourceCount; + bool m_compliantResourceCountHasBeenSet = false; + + ComplianceContributorCount m_nonCompliantResourceCount; + bool m_nonCompliantResourceCountHasBeenSet = false; + + Aws::Utils::DateTime m_complianceSummaryTimestamp; + bool m_complianceSummaryTimestampHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ComplianceSummaryByResourceType.h b/include/aws/config/model/ComplianceSummaryByResourceType.h new file mode 100644 index 0000000000000000000000000000000000000000..61c77cd9ac87975041e69af096ab313dc01659f5 --- /dev/null +++ b/include/aws/config/model/ComplianceSummaryByResourceType.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The number of Amazon Web Services resources of a specific type that are + * compliant or noncompliant, up to a maximum of 100 for each.

See + * Also:

AWS + * API Reference

+ */ + class ComplianceSummaryByResourceType + { + public: + AWS_CONFIGSERVICE_API ComplianceSummaryByResourceType(); + AWS_CONFIGSERVICE_API ComplianceSummaryByResourceType(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ComplianceSummaryByResourceType& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of Amazon Web Services resource.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline ComplianceSummaryByResourceType& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline ComplianceSummaryByResourceType& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline ComplianceSummaryByResourceType& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The number of Amazon Web Services resources that are compliant or + * noncompliant, up to a maximum of 100 for each.

+ */ + inline const ComplianceSummary& GetComplianceSummary() const{ return m_complianceSummary; } + inline bool ComplianceSummaryHasBeenSet() const { return m_complianceSummaryHasBeenSet; } + inline void SetComplianceSummary(const ComplianceSummary& value) { m_complianceSummaryHasBeenSet = true; m_complianceSummary = value; } + inline void SetComplianceSummary(ComplianceSummary&& value) { m_complianceSummaryHasBeenSet = true; m_complianceSummary = std::move(value); } + inline ComplianceSummaryByResourceType& WithComplianceSummary(const ComplianceSummary& value) { SetComplianceSummary(value); return *this;} + inline ComplianceSummaryByResourceType& WithComplianceSummary(ComplianceSummary&& value) { SetComplianceSummary(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + ComplianceSummary m_complianceSummary; + bool m_complianceSummaryHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ComplianceType.h b/include/aws/config/model/ComplianceType.h new file mode 100644 index 0000000000000000000000000000000000000000..69324765695d1108f9a1204c7f48b7fb6c960f63 --- /dev/null +++ b/include/aws/config/model/ComplianceType.h @@ -0,0 +1,33 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ComplianceType + { + NOT_SET, + COMPLIANT, + NON_COMPLIANT, + NOT_APPLICABLE, + INSUFFICIENT_DATA + }; + +namespace ComplianceTypeMapper +{ +AWS_CONFIGSERVICE_API ComplianceType GetComplianceTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForComplianceType(ComplianceType value); +} // namespace ComplianceTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigExportDeliveryInfo.h b/include/aws/config/model/ConfigExportDeliveryInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..3aa1de9269259e0f7bcab02eafd624fdee45840d --- /dev/null +++ b/include/aws/config/model/ConfigExportDeliveryInfo.h @@ -0,0 +1,143 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides status of the delivery of the snapshot or the configuration history + * to the specified Amazon S3 bucket. Also provides the status of notifications + * about the Amazon S3 delivery to the specified Amazon SNS topic.

See + * Also:

AWS + * API Reference

+ */ + class ConfigExportDeliveryInfo + { + public: + AWS_CONFIGSERVICE_API ConfigExportDeliveryInfo(); + AWS_CONFIGSERVICE_API ConfigExportDeliveryInfo(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigExportDeliveryInfo& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Status of the last attempted delivery.

+ */ + inline const DeliveryStatus& GetLastStatus() const{ return m_lastStatus; } + inline bool LastStatusHasBeenSet() const { return m_lastStatusHasBeenSet; } + inline void SetLastStatus(const DeliveryStatus& value) { m_lastStatusHasBeenSet = true; m_lastStatus = value; } + inline void SetLastStatus(DeliveryStatus&& value) { m_lastStatusHasBeenSet = true; m_lastStatus = std::move(value); } + inline ConfigExportDeliveryInfo& WithLastStatus(const DeliveryStatus& value) { SetLastStatus(value); return *this;} + inline ConfigExportDeliveryInfo& WithLastStatus(DeliveryStatus&& value) { SetLastStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The error code from the last attempted delivery.

+ */ + inline const Aws::String& GetLastErrorCode() const{ return m_lastErrorCode; } + inline bool LastErrorCodeHasBeenSet() const { return m_lastErrorCodeHasBeenSet; } + inline void SetLastErrorCode(const Aws::String& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = value; } + inline void SetLastErrorCode(Aws::String&& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = std::move(value); } + inline void SetLastErrorCode(const char* value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode.assign(value); } + inline ConfigExportDeliveryInfo& WithLastErrorCode(const Aws::String& value) { SetLastErrorCode(value); return *this;} + inline ConfigExportDeliveryInfo& WithLastErrorCode(Aws::String&& value) { SetLastErrorCode(std::move(value)); return *this;} + inline ConfigExportDeliveryInfo& WithLastErrorCode(const char* value) { SetLastErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

The error message from the last attempted delivery.

+ */ + inline const Aws::String& GetLastErrorMessage() const{ return m_lastErrorMessage; } + inline bool LastErrorMessageHasBeenSet() const { return m_lastErrorMessageHasBeenSet; } + inline void SetLastErrorMessage(const Aws::String& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = value; } + inline void SetLastErrorMessage(Aws::String&& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = std::move(value); } + inline void SetLastErrorMessage(const char* value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage.assign(value); } + inline ConfigExportDeliveryInfo& WithLastErrorMessage(const Aws::String& value) { SetLastErrorMessage(value); return *this;} + inline ConfigExportDeliveryInfo& WithLastErrorMessage(Aws::String&& value) { SetLastErrorMessage(std::move(value)); return *this;} + inline ConfigExportDeliveryInfo& WithLastErrorMessage(const char* value) { SetLastErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The time of the last attempted delivery.

+ */ + inline const Aws::Utils::DateTime& GetLastAttemptTime() const{ return m_lastAttemptTime; } + inline bool LastAttemptTimeHasBeenSet() const { return m_lastAttemptTimeHasBeenSet; } + inline void SetLastAttemptTime(const Aws::Utils::DateTime& value) { m_lastAttemptTimeHasBeenSet = true; m_lastAttemptTime = value; } + inline void SetLastAttemptTime(Aws::Utils::DateTime&& value) { m_lastAttemptTimeHasBeenSet = true; m_lastAttemptTime = std::move(value); } + inline ConfigExportDeliveryInfo& WithLastAttemptTime(const Aws::Utils::DateTime& value) { SetLastAttemptTime(value); return *this;} + inline ConfigExportDeliveryInfo& WithLastAttemptTime(Aws::Utils::DateTime&& value) { SetLastAttemptTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time of the last successful delivery.

+ */ + inline const Aws::Utils::DateTime& GetLastSuccessfulTime() const{ return m_lastSuccessfulTime; } + inline bool LastSuccessfulTimeHasBeenSet() const { return m_lastSuccessfulTimeHasBeenSet; } + inline void SetLastSuccessfulTime(const Aws::Utils::DateTime& value) { m_lastSuccessfulTimeHasBeenSet = true; m_lastSuccessfulTime = value; } + inline void SetLastSuccessfulTime(Aws::Utils::DateTime&& value) { m_lastSuccessfulTimeHasBeenSet = true; m_lastSuccessfulTime = std::move(value); } + inline ConfigExportDeliveryInfo& WithLastSuccessfulTime(const Aws::Utils::DateTime& value) { SetLastSuccessfulTime(value); return *this;} + inline ConfigExportDeliveryInfo& WithLastSuccessfulTime(Aws::Utils::DateTime&& value) { SetLastSuccessfulTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time that the next delivery occurs.

+ */ + inline const Aws::Utils::DateTime& GetNextDeliveryTime() const{ return m_nextDeliveryTime; } + inline bool NextDeliveryTimeHasBeenSet() const { return m_nextDeliveryTimeHasBeenSet; } + inline void SetNextDeliveryTime(const Aws::Utils::DateTime& value) { m_nextDeliveryTimeHasBeenSet = true; m_nextDeliveryTime = value; } + inline void SetNextDeliveryTime(Aws::Utils::DateTime&& value) { m_nextDeliveryTimeHasBeenSet = true; m_nextDeliveryTime = std::move(value); } + inline ConfigExportDeliveryInfo& WithNextDeliveryTime(const Aws::Utils::DateTime& value) { SetNextDeliveryTime(value); return *this;} + inline ConfigExportDeliveryInfo& WithNextDeliveryTime(Aws::Utils::DateTime&& value) { SetNextDeliveryTime(std::move(value)); return *this;} + ///@} + private: + + DeliveryStatus m_lastStatus; + bool m_lastStatusHasBeenSet = false; + + Aws::String m_lastErrorCode; + bool m_lastErrorCodeHasBeenSet = false; + + Aws::String m_lastErrorMessage; + bool m_lastErrorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_lastAttemptTime; + bool m_lastAttemptTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastSuccessfulTime; + bool m_lastSuccessfulTimeHasBeenSet = false; + + Aws::Utils::DateTime m_nextDeliveryTime; + bool m_nextDeliveryTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigRule.h b/include/aws/config/model/ConfigRule.h new file mode 100644 index 0000000000000000000000000000000000000000..9425b91d50bc2df8c2b9f64f4a5239a7d4321e1e --- /dev/null +++ b/include/aws/config/model/ConfigRule.h @@ -0,0 +1,284 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Config rules evaluate the configuration settings of your Amazon Web Services + * resources. A rule can run when Config detects a configuration change to an + * Amazon Web Services resource or at a periodic frequency that you choose (for + * example, every 24 hours). There are two types of rules: Config Managed + * Rules and Config Custom Rules.

Config Managed Rules are + * predefined, customizable rules created by Config. For a list of managed rules, + * see List + * of Config Managed Rules.

Config Custom Rules are rules that you + * create from scratch. There are two ways to create Config custom rules: with + * Lambda functions ( + * Lambda Developer Guide) and with Guard (Guard GitHub + * Repository), a policy-as-code language. Config custom rules created with + * Lambda are called Config Custom Lambda Rules and Config custom rules + * created with Guard are called Config Custom Policy Rules.

For more + * information about developing and using Config rules, see Evaluating + * Resource with Config Rules in the Config Developer Guide.

+ *

You can use the Amazon Web Services CLI and Amazon Web Services SDKs if you + * want to create a rule that triggers evaluations for your resources when Config + * delivers the configuration snapshot. For more information, see + * ConfigSnapshotDeliveryProperties.

See Also:

AWS + * API Reference

+ */ + class ConfigRule + { + public: + AWS_CONFIGSERVICE_API ConfigRule(); + AWS_CONFIGSERVICE_API ConfigRule(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigRule& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name that you assign to the Config rule. The name is required if you are + * adding a new rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline ConfigRule& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline ConfigRule& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline ConfigRule& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleArn() const{ return m_configRuleArn; } + inline bool ConfigRuleArnHasBeenSet() const { return m_configRuleArnHasBeenSet; } + inline void SetConfigRuleArn(const Aws::String& value) { m_configRuleArnHasBeenSet = true; m_configRuleArn = value; } + inline void SetConfigRuleArn(Aws::String&& value) { m_configRuleArnHasBeenSet = true; m_configRuleArn = std::move(value); } + inline void SetConfigRuleArn(const char* value) { m_configRuleArnHasBeenSet = true; m_configRuleArn.assign(value); } + inline ConfigRule& WithConfigRuleArn(const Aws::String& value) { SetConfigRuleArn(value); return *this;} + inline ConfigRule& WithConfigRuleArn(Aws::String&& value) { SetConfigRuleArn(std::move(value)); return *this;} + inline ConfigRule& WithConfigRuleArn(const char* value) { SetConfigRuleArn(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleId() const{ return m_configRuleId; } + inline bool ConfigRuleIdHasBeenSet() const { return m_configRuleIdHasBeenSet; } + inline void SetConfigRuleId(const Aws::String& value) { m_configRuleIdHasBeenSet = true; m_configRuleId = value; } + inline void SetConfigRuleId(Aws::String&& value) { m_configRuleIdHasBeenSet = true; m_configRuleId = std::move(value); } + inline void SetConfigRuleId(const char* value) { m_configRuleIdHasBeenSet = true; m_configRuleId.assign(value); } + inline ConfigRule& WithConfigRuleId(const Aws::String& value) { SetConfigRuleId(value); return *this;} + inline ConfigRule& WithConfigRuleId(Aws::String&& value) { SetConfigRuleId(std::move(value)); return *this;} + inline ConfigRule& WithConfigRuleId(const char* value) { SetConfigRuleId(value); return *this;} + ///@} + + ///@{ + /** + *

The description that you provide for the Config rule.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline ConfigRule& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline ConfigRule& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline ConfigRule& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

Defines which resources can trigger an evaluation for the rule. The scope can + * include one or more resource types, a combination of one resource type and one + * resource ID, or a combination of a tag key and value. Specify a scope to + * constrain the resources that can trigger an evaluation for the rule. If you do + * not specify a scope, evaluations are triggered when any resource in the + * recording group changes.

The scope can be empty.

+ */ + inline const Scope& GetScope() const{ return m_scope; } + inline bool ScopeHasBeenSet() const { return m_scopeHasBeenSet; } + inline void SetScope(const Scope& value) { m_scopeHasBeenSet = true; m_scope = value; } + inline void SetScope(Scope&& value) { m_scopeHasBeenSet = true; m_scope = std::move(value); } + inline ConfigRule& WithScope(const Scope& value) { SetScope(value); return *this;} + inline ConfigRule& WithScope(Scope&& value) { SetScope(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Provides the rule owner (Amazon Web Services for managed rules, + * CUSTOM_POLICY for Custom Policy rules, and + * CUSTOM_LAMBDA for Custom Lambda rules), the rule identifier, and + * the notifications that cause the function to evaluate your Amazon Web Services + * resources.

+ */ + inline const Source& GetSource() const{ return m_source; } + inline bool SourceHasBeenSet() const { return m_sourceHasBeenSet; } + inline void SetSource(const Source& value) { m_sourceHasBeenSet = true; m_source = value; } + inline void SetSource(Source&& value) { m_sourceHasBeenSet = true; m_source = std::move(value); } + inline ConfigRule& WithSource(const Source& value) { SetSource(value); return *this;} + inline ConfigRule& WithSource(Source&& value) { SetSource(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A string, in JSON format, that is passed to the Config rule Lambda + * function.

+ */ + inline const Aws::String& GetInputParameters() const{ return m_inputParameters; } + inline bool InputParametersHasBeenSet() const { return m_inputParametersHasBeenSet; } + inline void SetInputParameters(const Aws::String& value) { m_inputParametersHasBeenSet = true; m_inputParameters = value; } + inline void SetInputParameters(Aws::String&& value) { m_inputParametersHasBeenSet = true; m_inputParameters = std::move(value); } + inline void SetInputParameters(const char* value) { m_inputParametersHasBeenSet = true; m_inputParameters.assign(value); } + inline ConfigRule& WithInputParameters(const Aws::String& value) { SetInputParameters(value); return *this;} + inline ConfigRule& WithInputParameters(Aws::String&& value) { SetInputParameters(std::move(value)); return *this;} + inline ConfigRule& WithInputParameters(const char* value) { SetInputParameters(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum frequency with which Config runs evaluations for a rule. You can + * specify a value for MaximumExecutionFrequency when:

  • + *

    This is for an Config managed rule that is triggered at a periodic + * frequency.

  • Your custom rule is triggered when Config delivers + * the configuration snapshot. For more information, see + * ConfigSnapshotDeliveryProperties.

By default, + * rules with a periodic trigger are evaluated every 24 hours. To change the + * frequency, specify a valid value for the MaximumExecutionFrequency + * parameter.

+ */ + inline const MaximumExecutionFrequency& GetMaximumExecutionFrequency() const{ return m_maximumExecutionFrequency; } + inline bool MaximumExecutionFrequencyHasBeenSet() const { return m_maximumExecutionFrequencyHasBeenSet; } + inline void SetMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = value; } + inline void SetMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = std::move(value); } + inline ConfigRule& WithMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { SetMaximumExecutionFrequency(value); return *this;} + inline ConfigRule& WithMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { SetMaximumExecutionFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the Config rule is active or is currently being deleted by + * Config. It can also indicate the evaluation status for the Config rule.

+ *

Config sets the state of the rule to EVALUATING temporarily + * after you use the StartConfigRulesEvaluation request to evaluate + * your resources against the Config rule.

Config sets the state of the rule + * to DELETING_RESULTS temporarily after you use the + * DeleteEvaluationResults request to delete the current evaluation + * results for the Config rule.

Config temporarily sets the state of a rule + * to DELETING after you use the DeleteConfigRule request + * to delete the rule. After Config deletes the rule, the rule and all of its + * evaluations are erased and are no longer available.

+ */ + inline const ConfigRuleState& GetConfigRuleState() const{ return m_configRuleState; } + inline bool ConfigRuleStateHasBeenSet() const { return m_configRuleStateHasBeenSet; } + inline void SetConfigRuleState(const ConfigRuleState& value) { m_configRuleStateHasBeenSet = true; m_configRuleState = value; } + inline void SetConfigRuleState(ConfigRuleState&& value) { m_configRuleStateHasBeenSet = true; m_configRuleState = std::move(value); } + inline ConfigRule& WithConfigRuleState(const ConfigRuleState& value) { SetConfigRuleState(value); return *this;} + inline ConfigRule& WithConfigRuleState(ConfigRuleState&& value) { SetConfigRuleState(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Service principal name of the service that created the rule.

+ *

The field is populated only if the service-linked rule is created by a + * service. The field is empty if you create your own rule.

+ */ + inline const Aws::String& GetCreatedBy() const{ return m_createdBy; } + inline bool CreatedByHasBeenSet() const { return m_createdByHasBeenSet; } + inline void SetCreatedBy(const Aws::String& value) { m_createdByHasBeenSet = true; m_createdBy = value; } + inline void SetCreatedBy(Aws::String&& value) { m_createdByHasBeenSet = true; m_createdBy = std::move(value); } + inline void SetCreatedBy(const char* value) { m_createdByHasBeenSet = true; m_createdBy.assign(value); } + inline ConfigRule& WithCreatedBy(const Aws::String& value) { SetCreatedBy(value); return *this;} + inline ConfigRule& WithCreatedBy(Aws::String&& value) { SetCreatedBy(std::move(value)); return *this;} + inline ConfigRule& WithCreatedBy(const char* value) { SetCreatedBy(value); return *this;} + ///@} + + ///@{ + /** + *

The modes the Config rule can be evaluated in. The valid values are distinct + * objects. By default, the value is Detective evaluation mode only.

+ */ + inline const Aws::Vector& GetEvaluationModes() const{ return m_evaluationModes; } + inline bool EvaluationModesHasBeenSet() const { return m_evaluationModesHasBeenSet; } + inline void SetEvaluationModes(const Aws::Vector& value) { m_evaluationModesHasBeenSet = true; m_evaluationModes = value; } + inline void SetEvaluationModes(Aws::Vector&& value) { m_evaluationModesHasBeenSet = true; m_evaluationModes = std::move(value); } + inline ConfigRule& WithEvaluationModes(const Aws::Vector& value) { SetEvaluationModes(value); return *this;} + inline ConfigRule& WithEvaluationModes(Aws::Vector&& value) { SetEvaluationModes(std::move(value)); return *this;} + inline ConfigRule& AddEvaluationModes(const EvaluationModeConfiguration& value) { m_evaluationModesHasBeenSet = true; m_evaluationModes.push_back(value); return *this; } + inline ConfigRule& AddEvaluationModes(EvaluationModeConfiguration&& value) { m_evaluationModesHasBeenSet = true; m_evaluationModes.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::String m_configRuleArn; + bool m_configRuleArnHasBeenSet = false; + + Aws::String m_configRuleId; + bool m_configRuleIdHasBeenSet = false; + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + Scope m_scope; + bool m_scopeHasBeenSet = false; + + Source m_source; + bool m_sourceHasBeenSet = false; + + Aws::String m_inputParameters; + bool m_inputParametersHasBeenSet = false; + + MaximumExecutionFrequency m_maximumExecutionFrequency; + bool m_maximumExecutionFrequencyHasBeenSet = false; + + ConfigRuleState m_configRuleState; + bool m_configRuleStateHasBeenSet = false; + + Aws::String m_createdBy; + bool m_createdByHasBeenSet = false; + + Aws::Vector m_evaluationModes; + bool m_evaluationModesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigRuleComplianceFilters.h b/include/aws/config/model/ConfigRuleComplianceFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..d2bae10e43cac44908e4fe5cdc72dd668e9f0daa --- /dev/null +++ b/include/aws/config/model/ConfigRuleComplianceFilters.h @@ -0,0 +1,116 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters the compliance results based on account ID, region, compliance type, + * and rule name.

See Also:

AWS + * API Reference

+ */ + class ConfigRuleComplianceFilters + { + public: + AWS_CONFIGSERVICE_API ConfigRuleComplianceFilters(); + AWS_CONFIGSERVICE_API ConfigRuleComplianceFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigRuleComplianceFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline ConfigRuleComplianceFilters& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline ConfigRuleComplianceFilters& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline ConfigRuleComplianceFilters& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The rule compliance status.

For the + * ConfigRuleComplianceFilters data type, Config supports only + * COMPLIANT and NON_COMPLIANT. Config does not support + * the NOT_APPLICABLE and the INSUFFICIENT_DATA + * values.

+ */ + inline const ComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline ConfigRuleComplianceFilters& WithComplianceType(const ComplianceType& value) { SetComplianceType(value); return *this;} + inline ConfigRuleComplianceFilters& WithComplianceType(ComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline ConfigRuleComplianceFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline ConfigRuleComplianceFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline ConfigRuleComplianceFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source region where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline ConfigRuleComplianceFilters& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline ConfigRuleComplianceFilters& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline ConfigRuleComplianceFilters& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + ComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigRuleComplianceSummaryFilters.h b/include/aws/config/model/ConfigRuleComplianceSummaryFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..498db6e2983a3fa9857d058a59e2143d836a8a34 --- /dev/null +++ b/include/aws/config/model/ConfigRuleComplianceSummaryFilters.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters the results based on the account IDs and regions.

See + * Also:

AWS + * API Reference

+ */ + class ConfigRuleComplianceSummaryFilters + { + public: + AWS_CONFIGSERVICE_API ConfigRuleComplianceSummaryFilters(); + AWS_CONFIGSERVICE_API ConfigRuleComplianceSummaryFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigRuleComplianceSummaryFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline ConfigRuleComplianceSummaryFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline ConfigRuleComplianceSummaryFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline ConfigRuleComplianceSummaryFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source region where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline ConfigRuleComplianceSummaryFilters& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline ConfigRuleComplianceSummaryFilters& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline ConfigRuleComplianceSummaryFilters& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigRuleComplianceSummaryGroupKey.h b/include/aws/config/model/ConfigRuleComplianceSummaryGroupKey.h new file mode 100644 index 0000000000000000000000000000000000000000..6f6474a877f31232c9c190463f9864e26525926a --- /dev/null +++ b/include/aws/config/model/ConfigRuleComplianceSummaryGroupKey.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ConfigRuleComplianceSummaryGroupKey + { + NOT_SET, + ACCOUNT_ID, + AWS_REGION + }; + +namespace ConfigRuleComplianceSummaryGroupKeyMapper +{ +AWS_CONFIGSERVICE_API ConfigRuleComplianceSummaryGroupKey GetConfigRuleComplianceSummaryGroupKeyForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForConfigRuleComplianceSummaryGroupKey(ConfigRuleComplianceSummaryGroupKey value); +} // namespace ConfigRuleComplianceSummaryGroupKeyMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigRuleEvaluationStatus.h b/include/aws/config/model/ConfigRuleEvaluationStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..9e24812e0cd2007459952fd705aa207df62809af --- /dev/null +++ b/include/aws/config/model/ConfigRuleEvaluationStatus.h @@ -0,0 +1,297 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Status information for your Config Managed rules and Config Custom Policy + * rules. The status includes information such as the last time the rule ran, the + * last time it failed, and the related error for the last failure.

This + * operation does not return status information about Config Custom Lambda + * rules.

See Also:

AWS + * API Reference

+ */ + class ConfigRuleEvaluationStatus + { + public: + AWS_CONFIGSERVICE_API ConfigRuleEvaluationStatus(); + AWS_CONFIGSERVICE_API ConfigRuleEvaluationStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigRuleEvaluationStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline ConfigRuleEvaluationStatus& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline ConfigRuleEvaluationStatus& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline ConfigRuleEvaluationStatus& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleArn() const{ return m_configRuleArn; } + inline bool ConfigRuleArnHasBeenSet() const { return m_configRuleArnHasBeenSet; } + inline void SetConfigRuleArn(const Aws::String& value) { m_configRuleArnHasBeenSet = true; m_configRuleArn = value; } + inline void SetConfigRuleArn(Aws::String&& value) { m_configRuleArnHasBeenSet = true; m_configRuleArn = std::move(value); } + inline void SetConfigRuleArn(const char* value) { m_configRuleArnHasBeenSet = true; m_configRuleArn.assign(value); } + inline ConfigRuleEvaluationStatus& WithConfigRuleArn(const Aws::String& value) { SetConfigRuleArn(value); return *this;} + inline ConfigRuleEvaluationStatus& WithConfigRuleArn(Aws::String&& value) { SetConfigRuleArn(std::move(value)); return *this;} + inline ConfigRuleEvaluationStatus& WithConfigRuleArn(const char* value) { SetConfigRuleArn(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleId() const{ return m_configRuleId; } + inline bool ConfigRuleIdHasBeenSet() const { return m_configRuleIdHasBeenSet; } + inline void SetConfigRuleId(const Aws::String& value) { m_configRuleIdHasBeenSet = true; m_configRuleId = value; } + inline void SetConfigRuleId(Aws::String&& value) { m_configRuleIdHasBeenSet = true; m_configRuleId = std::move(value); } + inline void SetConfigRuleId(const char* value) { m_configRuleIdHasBeenSet = true; m_configRuleId.assign(value); } + inline ConfigRuleEvaluationStatus& WithConfigRuleId(const Aws::String& value) { SetConfigRuleId(value); return *this;} + inline ConfigRuleEvaluationStatus& WithConfigRuleId(Aws::String&& value) { SetConfigRuleId(std::move(value)); return *this;} + inline ConfigRuleEvaluationStatus& WithConfigRuleId(const char* value) { SetConfigRuleId(value); return *this;} + ///@} + + ///@{ + /** + *

The time that Config last successfully invoked the Config rule to evaluate + * your Amazon Web Services resources.

+ */ + inline const Aws::Utils::DateTime& GetLastSuccessfulInvocationTime() const{ return m_lastSuccessfulInvocationTime; } + inline bool LastSuccessfulInvocationTimeHasBeenSet() const { return m_lastSuccessfulInvocationTimeHasBeenSet; } + inline void SetLastSuccessfulInvocationTime(const Aws::Utils::DateTime& value) { m_lastSuccessfulInvocationTimeHasBeenSet = true; m_lastSuccessfulInvocationTime = value; } + inline void SetLastSuccessfulInvocationTime(Aws::Utils::DateTime&& value) { m_lastSuccessfulInvocationTimeHasBeenSet = true; m_lastSuccessfulInvocationTime = std::move(value); } + inline ConfigRuleEvaluationStatus& WithLastSuccessfulInvocationTime(const Aws::Utils::DateTime& value) { SetLastSuccessfulInvocationTime(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastSuccessfulInvocationTime(Aws::Utils::DateTime&& value) { SetLastSuccessfulInvocationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time that Config last failed to invoke the Config rule to evaluate your + * Amazon Web Services resources.

+ */ + inline const Aws::Utils::DateTime& GetLastFailedInvocationTime() const{ return m_lastFailedInvocationTime; } + inline bool LastFailedInvocationTimeHasBeenSet() const { return m_lastFailedInvocationTimeHasBeenSet; } + inline void SetLastFailedInvocationTime(const Aws::Utils::DateTime& value) { m_lastFailedInvocationTimeHasBeenSet = true; m_lastFailedInvocationTime = value; } + inline void SetLastFailedInvocationTime(Aws::Utils::DateTime&& value) { m_lastFailedInvocationTimeHasBeenSet = true; m_lastFailedInvocationTime = std::move(value); } + inline ConfigRuleEvaluationStatus& WithLastFailedInvocationTime(const Aws::Utils::DateTime& value) { SetLastFailedInvocationTime(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastFailedInvocationTime(Aws::Utils::DateTime&& value) { SetLastFailedInvocationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time that Config last successfully evaluated your Amazon Web Services + * resources against the rule.

+ */ + inline const Aws::Utils::DateTime& GetLastSuccessfulEvaluationTime() const{ return m_lastSuccessfulEvaluationTime; } + inline bool LastSuccessfulEvaluationTimeHasBeenSet() const { return m_lastSuccessfulEvaluationTimeHasBeenSet; } + inline void SetLastSuccessfulEvaluationTime(const Aws::Utils::DateTime& value) { m_lastSuccessfulEvaluationTimeHasBeenSet = true; m_lastSuccessfulEvaluationTime = value; } + inline void SetLastSuccessfulEvaluationTime(Aws::Utils::DateTime&& value) { m_lastSuccessfulEvaluationTimeHasBeenSet = true; m_lastSuccessfulEvaluationTime = std::move(value); } + inline ConfigRuleEvaluationStatus& WithLastSuccessfulEvaluationTime(const Aws::Utils::DateTime& value) { SetLastSuccessfulEvaluationTime(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastSuccessfulEvaluationTime(Aws::Utils::DateTime&& value) { SetLastSuccessfulEvaluationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time that Config last failed to evaluate your Amazon Web Services + * resources against the rule.

+ */ + inline const Aws::Utils::DateTime& GetLastFailedEvaluationTime() const{ return m_lastFailedEvaluationTime; } + inline bool LastFailedEvaluationTimeHasBeenSet() const { return m_lastFailedEvaluationTimeHasBeenSet; } + inline void SetLastFailedEvaluationTime(const Aws::Utils::DateTime& value) { m_lastFailedEvaluationTimeHasBeenSet = true; m_lastFailedEvaluationTime = value; } + inline void SetLastFailedEvaluationTime(Aws::Utils::DateTime&& value) { m_lastFailedEvaluationTimeHasBeenSet = true; m_lastFailedEvaluationTime = std::move(value); } + inline ConfigRuleEvaluationStatus& WithLastFailedEvaluationTime(const Aws::Utils::DateTime& value) { SetLastFailedEvaluationTime(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastFailedEvaluationTime(Aws::Utils::DateTime&& value) { SetLastFailedEvaluationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time that you first activated the Config rule.

+ */ + inline const Aws::Utils::DateTime& GetFirstActivatedTime() const{ return m_firstActivatedTime; } + inline bool FirstActivatedTimeHasBeenSet() const { return m_firstActivatedTimeHasBeenSet; } + inline void SetFirstActivatedTime(const Aws::Utils::DateTime& value) { m_firstActivatedTimeHasBeenSet = true; m_firstActivatedTime = value; } + inline void SetFirstActivatedTime(Aws::Utils::DateTime&& value) { m_firstActivatedTimeHasBeenSet = true; m_firstActivatedTime = std::move(value); } + inline ConfigRuleEvaluationStatus& WithFirstActivatedTime(const Aws::Utils::DateTime& value) { SetFirstActivatedTime(value); return *this;} + inline ConfigRuleEvaluationStatus& WithFirstActivatedTime(Aws::Utils::DateTime&& value) { SetFirstActivatedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time that you last turned off the Config rule.

+ */ + inline const Aws::Utils::DateTime& GetLastDeactivatedTime() const{ return m_lastDeactivatedTime; } + inline bool LastDeactivatedTimeHasBeenSet() const { return m_lastDeactivatedTimeHasBeenSet; } + inline void SetLastDeactivatedTime(const Aws::Utils::DateTime& value) { m_lastDeactivatedTimeHasBeenSet = true; m_lastDeactivatedTime = value; } + inline void SetLastDeactivatedTime(Aws::Utils::DateTime&& value) { m_lastDeactivatedTimeHasBeenSet = true; m_lastDeactivatedTime = std::move(value); } + inline ConfigRuleEvaluationStatus& WithLastDeactivatedTime(const Aws::Utils::DateTime& value) { SetLastDeactivatedTime(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastDeactivatedTime(Aws::Utils::DateTime&& value) { SetLastDeactivatedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The error code that Config returned when the rule last failed.

+ */ + inline const Aws::String& GetLastErrorCode() const{ return m_lastErrorCode; } + inline bool LastErrorCodeHasBeenSet() const { return m_lastErrorCodeHasBeenSet; } + inline void SetLastErrorCode(const Aws::String& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = value; } + inline void SetLastErrorCode(Aws::String&& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = std::move(value); } + inline void SetLastErrorCode(const char* value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode.assign(value); } + inline ConfigRuleEvaluationStatus& WithLastErrorCode(const Aws::String& value) { SetLastErrorCode(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastErrorCode(Aws::String&& value) { SetLastErrorCode(std::move(value)); return *this;} + inline ConfigRuleEvaluationStatus& WithLastErrorCode(const char* value) { SetLastErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

The error message that Config returned when the rule last failed.

+ */ + inline const Aws::String& GetLastErrorMessage() const{ return m_lastErrorMessage; } + inline bool LastErrorMessageHasBeenSet() const { return m_lastErrorMessageHasBeenSet; } + inline void SetLastErrorMessage(const Aws::String& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = value; } + inline void SetLastErrorMessage(Aws::String&& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = std::move(value); } + inline void SetLastErrorMessage(const char* value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage.assign(value); } + inline ConfigRuleEvaluationStatus& WithLastErrorMessage(const Aws::String& value) { SetLastErrorMessage(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastErrorMessage(Aws::String&& value) { SetLastErrorMessage(std::move(value)); return *this;} + inline ConfigRuleEvaluationStatus& WithLastErrorMessage(const char* value) { SetLastErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether Config has evaluated your resources against the rule at + * least once.

  • true - Config has evaluated your + * Amazon Web Services resources against the rule at least once.

  • + * false - Config has not finished evaluating your Amazon Web Services + * resources against the rule at least once.

+ */ + inline bool GetFirstEvaluationStarted() const{ return m_firstEvaluationStarted; } + inline bool FirstEvaluationStartedHasBeenSet() const { return m_firstEvaluationStartedHasBeenSet; } + inline void SetFirstEvaluationStarted(bool value) { m_firstEvaluationStartedHasBeenSet = true; m_firstEvaluationStarted = value; } + inline ConfigRuleEvaluationStatus& WithFirstEvaluationStarted(bool value) { SetFirstEvaluationStarted(value); return *this;} + ///@} + + ///@{ + /** + *

The status of the last attempted delivery of a debug log for your Config + * Custom Policy rules. Either Successful or Failed.

+ */ + inline const Aws::String& GetLastDebugLogDeliveryStatus() const{ return m_lastDebugLogDeliveryStatus; } + inline bool LastDebugLogDeliveryStatusHasBeenSet() const { return m_lastDebugLogDeliveryStatusHasBeenSet; } + inline void SetLastDebugLogDeliveryStatus(const Aws::String& value) { m_lastDebugLogDeliveryStatusHasBeenSet = true; m_lastDebugLogDeliveryStatus = value; } + inline void SetLastDebugLogDeliveryStatus(Aws::String&& value) { m_lastDebugLogDeliveryStatusHasBeenSet = true; m_lastDebugLogDeliveryStatus = std::move(value); } + inline void SetLastDebugLogDeliveryStatus(const char* value) { m_lastDebugLogDeliveryStatusHasBeenSet = true; m_lastDebugLogDeliveryStatus.assign(value); } + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryStatus(const Aws::String& value) { SetLastDebugLogDeliveryStatus(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryStatus(Aws::String&& value) { SetLastDebugLogDeliveryStatus(std::move(value)); return *this;} + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryStatus(const char* value) { SetLastDebugLogDeliveryStatus(value); return *this;} + ///@} + + ///@{ + /** + *

The reason Config was not able to deliver a debug log. This is for the last + * failed attempt to retrieve a debug log for your Config Custom Policy rules.

+ */ + inline const Aws::String& GetLastDebugLogDeliveryStatusReason() const{ return m_lastDebugLogDeliveryStatusReason; } + inline bool LastDebugLogDeliveryStatusReasonHasBeenSet() const { return m_lastDebugLogDeliveryStatusReasonHasBeenSet; } + inline void SetLastDebugLogDeliveryStatusReason(const Aws::String& value) { m_lastDebugLogDeliveryStatusReasonHasBeenSet = true; m_lastDebugLogDeliveryStatusReason = value; } + inline void SetLastDebugLogDeliveryStatusReason(Aws::String&& value) { m_lastDebugLogDeliveryStatusReasonHasBeenSet = true; m_lastDebugLogDeliveryStatusReason = std::move(value); } + inline void SetLastDebugLogDeliveryStatusReason(const char* value) { m_lastDebugLogDeliveryStatusReasonHasBeenSet = true; m_lastDebugLogDeliveryStatusReason.assign(value); } + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryStatusReason(const Aws::String& value) { SetLastDebugLogDeliveryStatusReason(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryStatusReason(Aws::String&& value) { SetLastDebugLogDeliveryStatusReason(std::move(value)); return *this;} + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryStatusReason(const char* value) { SetLastDebugLogDeliveryStatusReason(value); return *this;} + ///@} + + ///@{ + /** + *

The time Config last attempted to deliver a debug log for your Config Custom + * Policy rules.

+ */ + inline const Aws::Utils::DateTime& GetLastDebugLogDeliveryTime() const{ return m_lastDebugLogDeliveryTime; } + inline bool LastDebugLogDeliveryTimeHasBeenSet() const { return m_lastDebugLogDeliveryTimeHasBeenSet; } + inline void SetLastDebugLogDeliveryTime(const Aws::Utils::DateTime& value) { m_lastDebugLogDeliveryTimeHasBeenSet = true; m_lastDebugLogDeliveryTime = value; } + inline void SetLastDebugLogDeliveryTime(Aws::Utils::DateTime&& value) { m_lastDebugLogDeliveryTimeHasBeenSet = true; m_lastDebugLogDeliveryTime = std::move(value); } + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryTime(const Aws::Utils::DateTime& value) { SetLastDebugLogDeliveryTime(value); return *this;} + inline ConfigRuleEvaluationStatus& WithLastDebugLogDeliveryTime(Aws::Utils::DateTime&& value) { SetLastDebugLogDeliveryTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::String m_configRuleArn; + bool m_configRuleArnHasBeenSet = false; + + Aws::String m_configRuleId; + bool m_configRuleIdHasBeenSet = false; + + Aws::Utils::DateTime m_lastSuccessfulInvocationTime; + bool m_lastSuccessfulInvocationTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastFailedInvocationTime; + bool m_lastFailedInvocationTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastSuccessfulEvaluationTime; + bool m_lastSuccessfulEvaluationTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastFailedEvaluationTime; + bool m_lastFailedEvaluationTimeHasBeenSet = false; + + Aws::Utils::DateTime m_firstActivatedTime; + bool m_firstActivatedTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastDeactivatedTime; + bool m_lastDeactivatedTimeHasBeenSet = false; + + Aws::String m_lastErrorCode; + bool m_lastErrorCodeHasBeenSet = false; + + Aws::String m_lastErrorMessage; + bool m_lastErrorMessageHasBeenSet = false; + + bool m_firstEvaluationStarted; + bool m_firstEvaluationStartedHasBeenSet = false; + + Aws::String m_lastDebugLogDeliveryStatus; + bool m_lastDebugLogDeliveryStatusHasBeenSet = false; + + Aws::String m_lastDebugLogDeliveryStatusReason; + bool m_lastDebugLogDeliveryStatusReasonHasBeenSet = false; + + Aws::Utils::DateTime m_lastDebugLogDeliveryTime; + bool m_lastDebugLogDeliveryTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigRuleState.h b/include/aws/config/model/ConfigRuleState.h new file mode 100644 index 0000000000000000000000000000000000000000..44da3176ef84de0462cd3783cabfccf841642811 --- /dev/null +++ b/include/aws/config/model/ConfigRuleState.h @@ -0,0 +1,33 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ConfigRuleState + { + NOT_SET, + ACTIVE, + DELETING, + DELETING_RESULTS, + EVALUATING + }; + +namespace ConfigRuleStateMapper +{ +AWS_CONFIGSERVICE_API ConfigRuleState GetConfigRuleStateForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForConfigRuleState(ConfigRuleState value); +} // namespace ConfigRuleStateMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigSnapshotDeliveryProperties.h b/include/aws/config/model/ConfigSnapshotDeliveryProperties.h new file mode 100644 index 0000000000000000000000000000000000000000..00ce9f6772f0df51a8900245b601e4c7fd6a1633 --- /dev/null +++ b/include/aws/config/model/ConfigSnapshotDeliveryProperties.h @@ -0,0 +1,87 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides options for how often Config delivers configuration snapshots to the + * Amazon S3 bucket in your delivery channel.

The frequency for a rule that + * triggers evaluations for your resources when Config delivers the configuration + * snapshot is set by one of two values, depending on which is less frequent:

+ *
  • The value for the deliveryFrequency parameter within + * the delivery channel configuration, which sets how often Config delivers + * configuration snapshots. This value also sets how often Config invokes + * evaluations for Config rules.

  • The value for the + * MaximumExecutionFrequency parameter, which sets the maximum + * frequency with which Config invokes evaluations for the rule. For more + * information, see ConfigRule.

If the + * deliveryFrequency value is less frequent than the + * MaximumExecutionFrequency value for a rule, Config invokes the rule + * only as often as the deliveryFrequency value.

  1. For + * example, you want your rule to run evaluations when Config delivers the + * configuration snapshot.

  2. You specify the + * MaximumExecutionFrequency value for Six_Hours.

    + *
  3. You then specify the delivery channel + * deliveryFrequency value for TwentyFour_Hours.

    + *
  4. Because the value for deliveryFrequency is less + * frequent than MaximumExecutionFrequency, Config invokes evaluations + * for the rule every 24 hours.

You should set the + * MaximumExecutionFrequency value to be at least as frequent as the + * deliveryFrequency value. You can view the + * deliveryFrequency value by using the + * DescribeDeliveryChannnels action.

To update the + * deliveryFrequency with which Config delivers your configuration + * snapshots, use the PutDeliveryChannel action.

See + * Also:

AWS + * API Reference

+ */ + class ConfigSnapshotDeliveryProperties + { + public: + AWS_CONFIGSERVICE_API ConfigSnapshotDeliveryProperties(); + AWS_CONFIGSERVICE_API ConfigSnapshotDeliveryProperties(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigSnapshotDeliveryProperties& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The frequency with which Config delivers configuration snapshots.

+ */ + inline const MaximumExecutionFrequency& GetDeliveryFrequency() const{ return m_deliveryFrequency; } + inline bool DeliveryFrequencyHasBeenSet() const { return m_deliveryFrequencyHasBeenSet; } + inline void SetDeliveryFrequency(const MaximumExecutionFrequency& value) { m_deliveryFrequencyHasBeenSet = true; m_deliveryFrequency = value; } + inline void SetDeliveryFrequency(MaximumExecutionFrequency&& value) { m_deliveryFrequencyHasBeenSet = true; m_deliveryFrequency = std::move(value); } + inline ConfigSnapshotDeliveryProperties& WithDeliveryFrequency(const MaximumExecutionFrequency& value) { SetDeliveryFrequency(value); return *this;} + inline ConfigSnapshotDeliveryProperties& WithDeliveryFrequency(MaximumExecutionFrequency&& value) { SetDeliveryFrequency(std::move(value)); return *this;} + ///@} + private: + + MaximumExecutionFrequency m_deliveryFrequency; + bool m_deliveryFrequencyHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigStreamDeliveryInfo.h b/include/aws/config/model/ConfigStreamDeliveryInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..5ad5b8936b780ee0c8a5c3aed92c2d752b2387ec --- /dev/null +++ b/include/aws/config/model/ConfigStreamDeliveryInfo.h @@ -0,0 +1,115 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

A list that contains the status of the delivery of the configuration stream + * notification to the Amazon SNS topic.

See Also:

AWS + * API Reference

+ */ + class ConfigStreamDeliveryInfo + { + public: + AWS_CONFIGSERVICE_API ConfigStreamDeliveryInfo(); + AWS_CONFIGSERVICE_API ConfigStreamDeliveryInfo(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigStreamDeliveryInfo& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Status of the last attempted delivery.

Note Providing an SNS + * topic on a DeliveryChannel + * for Config is optional. If the SNS delivery is turned off, the last status will + * be Not_Applicable.

+ */ + inline const DeliveryStatus& GetLastStatus() const{ return m_lastStatus; } + inline bool LastStatusHasBeenSet() const { return m_lastStatusHasBeenSet; } + inline void SetLastStatus(const DeliveryStatus& value) { m_lastStatusHasBeenSet = true; m_lastStatus = value; } + inline void SetLastStatus(DeliveryStatus&& value) { m_lastStatusHasBeenSet = true; m_lastStatus = std::move(value); } + inline ConfigStreamDeliveryInfo& WithLastStatus(const DeliveryStatus& value) { SetLastStatus(value); return *this;} + inline ConfigStreamDeliveryInfo& WithLastStatus(DeliveryStatus&& value) { SetLastStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The error code from the last attempted delivery.

+ */ + inline const Aws::String& GetLastErrorCode() const{ return m_lastErrorCode; } + inline bool LastErrorCodeHasBeenSet() const { return m_lastErrorCodeHasBeenSet; } + inline void SetLastErrorCode(const Aws::String& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = value; } + inline void SetLastErrorCode(Aws::String&& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = std::move(value); } + inline void SetLastErrorCode(const char* value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode.assign(value); } + inline ConfigStreamDeliveryInfo& WithLastErrorCode(const Aws::String& value) { SetLastErrorCode(value); return *this;} + inline ConfigStreamDeliveryInfo& WithLastErrorCode(Aws::String&& value) { SetLastErrorCode(std::move(value)); return *this;} + inline ConfigStreamDeliveryInfo& WithLastErrorCode(const char* value) { SetLastErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

The error message from the last attempted delivery.

+ */ + inline const Aws::String& GetLastErrorMessage() const{ return m_lastErrorMessage; } + inline bool LastErrorMessageHasBeenSet() const { return m_lastErrorMessageHasBeenSet; } + inline void SetLastErrorMessage(const Aws::String& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = value; } + inline void SetLastErrorMessage(Aws::String&& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = std::move(value); } + inline void SetLastErrorMessage(const char* value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage.assign(value); } + inline ConfigStreamDeliveryInfo& WithLastErrorMessage(const Aws::String& value) { SetLastErrorMessage(value); return *this;} + inline ConfigStreamDeliveryInfo& WithLastErrorMessage(Aws::String&& value) { SetLastErrorMessage(std::move(value)); return *this;} + inline ConfigStreamDeliveryInfo& WithLastErrorMessage(const char* value) { SetLastErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The time from the last status change.

+ */ + inline const Aws::Utils::DateTime& GetLastStatusChangeTime() const{ return m_lastStatusChangeTime; } + inline bool LastStatusChangeTimeHasBeenSet() const { return m_lastStatusChangeTimeHasBeenSet; } + inline void SetLastStatusChangeTime(const Aws::Utils::DateTime& value) { m_lastStatusChangeTimeHasBeenSet = true; m_lastStatusChangeTime = value; } + inline void SetLastStatusChangeTime(Aws::Utils::DateTime&& value) { m_lastStatusChangeTimeHasBeenSet = true; m_lastStatusChangeTime = std::move(value); } + inline ConfigStreamDeliveryInfo& WithLastStatusChangeTime(const Aws::Utils::DateTime& value) { SetLastStatusChangeTime(value); return *this;} + inline ConfigStreamDeliveryInfo& WithLastStatusChangeTime(Aws::Utils::DateTime&& value) { SetLastStatusChangeTime(std::move(value)); return *this;} + ///@} + private: + + DeliveryStatus m_lastStatus; + bool m_lastStatusHasBeenSet = false; + + Aws::String m_lastErrorCode; + bool m_lastErrorCodeHasBeenSet = false; + + Aws::String m_lastErrorMessage; + bool m_lastErrorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_lastStatusChangeTime; + bool m_lastStatusChangeTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationAggregator.h b/include/aws/config/model/ConfigurationAggregator.h new file mode 100644 index 0000000000000000000000000000000000000000..4e60fbc05fc5fa2da478dc5abbbbc13f313120c1 --- /dev/null +++ b/include/aws/config/model/ConfigurationAggregator.h @@ -0,0 +1,179 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details about the configuration aggregator, including information about + * source accounts, regions, and metadata of the aggregator.

See + * Also:

AWS + * API Reference

+ */ + class ConfigurationAggregator + { + public: + AWS_CONFIGSERVICE_API ConfigurationAggregator(); + AWS_CONFIGSERVICE_API ConfigurationAggregator(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigurationAggregator& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline ConfigurationAggregator& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline ConfigurationAggregator& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline ConfigurationAggregator& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorArn() const{ return m_configurationAggregatorArn; } + inline bool ConfigurationAggregatorArnHasBeenSet() const { return m_configurationAggregatorArnHasBeenSet; } + inline void SetConfigurationAggregatorArn(const Aws::String& value) { m_configurationAggregatorArnHasBeenSet = true; m_configurationAggregatorArn = value; } + inline void SetConfigurationAggregatorArn(Aws::String&& value) { m_configurationAggregatorArnHasBeenSet = true; m_configurationAggregatorArn = std::move(value); } + inline void SetConfigurationAggregatorArn(const char* value) { m_configurationAggregatorArnHasBeenSet = true; m_configurationAggregatorArn.assign(value); } + inline ConfigurationAggregator& WithConfigurationAggregatorArn(const Aws::String& value) { SetConfigurationAggregatorArn(value); return *this;} + inline ConfigurationAggregator& WithConfigurationAggregatorArn(Aws::String&& value) { SetConfigurationAggregatorArn(std::move(value)); return *this;} + inline ConfigurationAggregator& WithConfigurationAggregatorArn(const char* value) { SetConfigurationAggregatorArn(value); return *this;} + ///@} + + ///@{ + /** + *

Provides a list of source accounts and regions to be aggregated.

+ */ + inline const Aws::Vector& GetAccountAggregationSources() const{ return m_accountAggregationSources; } + inline bool AccountAggregationSourcesHasBeenSet() const { return m_accountAggregationSourcesHasBeenSet; } + inline void SetAccountAggregationSources(const Aws::Vector& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources = value; } + inline void SetAccountAggregationSources(Aws::Vector&& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources = std::move(value); } + inline ConfigurationAggregator& WithAccountAggregationSources(const Aws::Vector& value) { SetAccountAggregationSources(value); return *this;} + inline ConfigurationAggregator& WithAccountAggregationSources(Aws::Vector&& value) { SetAccountAggregationSources(std::move(value)); return *this;} + inline ConfigurationAggregator& AddAccountAggregationSources(const AccountAggregationSource& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources.push_back(value); return *this; } + inline ConfigurationAggregator& AddAccountAggregationSources(AccountAggregationSource&& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Provides an organization and list of regions to be aggregated.

+ */ + inline const OrganizationAggregationSource& GetOrganizationAggregationSource() const{ return m_organizationAggregationSource; } + inline bool OrganizationAggregationSourceHasBeenSet() const { return m_organizationAggregationSourceHasBeenSet; } + inline void SetOrganizationAggregationSource(const OrganizationAggregationSource& value) { m_organizationAggregationSourceHasBeenSet = true; m_organizationAggregationSource = value; } + inline void SetOrganizationAggregationSource(OrganizationAggregationSource&& value) { m_organizationAggregationSourceHasBeenSet = true; m_organizationAggregationSource = std::move(value); } + inline ConfigurationAggregator& WithOrganizationAggregationSource(const OrganizationAggregationSource& value) { SetOrganizationAggregationSource(value); return *this;} + inline ConfigurationAggregator& WithOrganizationAggregationSource(OrganizationAggregationSource&& value) { SetOrganizationAggregationSource(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time stamp when the configuration aggregator was created.

+ */ + inline const Aws::Utils::DateTime& GetCreationTime() const{ return m_creationTime; } + inline bool CreationTimeHasBeenSet() const { return m_creationTimeHasBeenSet; } + inline void SetCreationTime(const Aws::Utils::DateTime& value) { m_creationTimeHasBeenSet = true; m_creationTime = value; } + inline void SetCreationTime(Aws::Utils::DateTime&& value) { m_creationTimeHasBeenSet = true; m_creationTime = std::move(value); } + inline ConfigurationAggregator& WithCreationTime(const Aws::Utils::DateTime& value) { SetCreationTime(value); return *this;} + inline ConfigurationAggregator& WithCreationTime(Aws::Utils::DateTime&& value) { SetCreationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time of the last update.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdatedTime() const{ return m_lastUpdatedTime; } + inline bool LastUpdatedTimeHasBeenSet() const { return m_lastUpdatedTimeHasBeenSet; } + inline void SetLastUpdatedTime(const Aws::Utils::DateTime& value) { m_lastUpdatedTimeHasBeenSet = true; m_lastUpdatedTime = value; } + inline void SetLastUpdatedTime(Aws::Utils::DateTime&& value) { m_lastUpdatedTimeHasBeenSet = true; m_lastUpdatedTime = std::move(value); } + inline ConfigurationAggregator& WithLastUpdatedTime(const Aws::Utils::DateTime& value) { SetLastUpdatedTime(value); return *this;} + inline ConfigurationAggregator& WithLastUpdatedTime(Aws::Utils::DateTime&& value) { SetLastUpdatedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Amazon Web Services service that created the configuration aggregator.

+ */ + inline const Aws::String& GetCreatedBy() const{ return m_createdBy; } + inline bool CreatedByHasBeenSet() const { return m_createdByHasBeenSet; } + inline void SetCreatedBy(const Aws::String& value) { m_createdByHasBeenSet = true; m_createdBy = value; } + inline void SetCreatedBy(Aws::String&& value) { m_createdByHasBeenSet = true; m_createdBy = std::move(value); } + inline void SetCreatedBy(const char* value) { m_createdByHasBeenSet = true; m_createdBy.assign(value); } + inline ConfigurationAggregator& WithCreatedBy(const Aws::String& value) { SetCreatedBy(value); return *this;} + inline ConfigurationAggregator& WithCreatedBy(Aws::String&& value) { SetCreatedBy(std::move(value)); return *this;} + inline ConfigurationAggregator& WithCreatedBy(const char* value) { SetCreatedBy(value); return *this;} + ///@} + + ///@{ + /** + *

An object to filter the data you specify for an aggregator.

+ */ + inline const AggregatorFilters& GetAggregatorFilters() const{ return m_aggregatorFilters; } + inline bool AggregatorFiltersHasBeenSet() const { return m_aggregatorFiltersHasBeenSet; } + inline void SetAggregatorFilters(const AggregatorFilters& value) { m_aggregatorFiltersHasBeenSet = true; m_aggregatorFilters = value; } + inline void SetAggregatorFilters(AggregatorFilters&& value) { m_aggregatorFiltersHasBeenSet = true; m_aggregatorFilters = std::move(value); } + inline ConfigurationAggregator& WithAggregatorFilters(const AggregatorFilters& value) { SetAggregatorFilters(value); return *this;} + inline ConfigurationAggregator& WithAggregatorFilters(AggregatorFilters&& value) { SetAggregatorFilters(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + Aws::String m_configurationAggregatorArn; + bool m_configurationAggregatorArnHasBeenSet = false; + + Aws::Vector m_accountAggregationSources; + bool m_accountAggregationSourcesHasBeenSet = false; + + OrganizationAggregationSource m_organizationAggregationSource; + bool m_organizationAggregationSourceHasBeenSet = false; + + Aws::Utils::DateTime m_creationTime; + bool m_creationTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdatedTime; + bool m_lastUpdatedTimeHasBeenSet = false; + + Aws::String m_createdBy; + bool m_createdByHasBeenSet = false; + + AggregatorFilters m_aggregatorFilters; + bool m_aggregatorFiltersHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationItem.h b/include/aws/config/model/ConfigurationItem.h new file mode 100644 index 0000000000000000000000000000000000000000..585313624852f0622cc5d3007d683736f0c935a5 --- /dev/null +++ b/include/aws/config/model/ConfigurationItem.h @@ -0,0 +1,421 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

A list that contains detailed configurations of a specified + * resource.

See Also:

AWS + * API Reference

+ */ + class ConfigurationItem + { + public: + AWS_CONFIGSERVICE_API ConfigurationItem(); + AWS_CONFIGSERVICE_API ConfigurationItem(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigurationItem& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The version number of the resource configuration.

+ */ + inline const Aws::String& GetVersion() const{ return m_version; } + inline bool VersionHasBeenSet() const { return m_versionHasBeenSet; } + inline void SetVersion(const Aws::String& value) { m_versionHasBeenSet = true; m_version = value; } + inline void SetVersion(Aws::String&& value) { m_versionHasBeenSet = true; m_version = std::move(value); } + inline void SetVersion(const char* value) { m_versionHasBeenSet = true; m_version.assign(value); } + inline ConfigurationItem& WithVersion(const Aws::String& value) { SetVersion(value); return *this;} + inline ConfigurationItem& WithVersion(Aws::String&& value) { SetVersion(std::move(value)); return *this;} + inline ConfigurationItem& WithVersion(const char* value) { SetVersion(value); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit Amazon Web Services account ID associated with the resource.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline ConfigurationItem& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline ConfigurationItem& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline ConfigurationItem& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The time when the recording of configuration changes was initiated for the + * resource.

+ */ + inline const Aws::Utils::DateTime& GetConfigurationItemCaptureTime() const{ return m_configurationItemCaptureTime; } + inline bool ConfigurationItemCaptureTimeHasBeenSet() const { return m_configurationItemCaptureTimeHasBeenSet; } + inline void SetConfigurationItemCaptureTime(const Aws::Utils::DateTime& value) { m_configurationItemCaptureTimeHasBeenSet = true; m_configurationItemCaptureTime = value; } + inline void SetConfigurationItemCaptureTime(Aws::Utils::DateTime&& value) { m_configurationItemCaptureTimeHasBeenSet = true; m_configurationItemCaptureTime = std::move(value); } + inline ConfigurationItem& WithConfigurationItemCaptureTime(const Aws::Utils::DateTime& value) { SetConfigurationItemCaptureTime(value); return *this;} + inline ConfigurationItem& WithConfigurationItemCaptureTime(Aws::Utils::DateTime&& value) { SetConfigurationItemCaptureTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The configuration item status. Valid values include:

  • OK – + * The resource configuration has been updated

  • ResourceDiscovered + * – The resource was newly discovered

  • ResourceNotRecorded – The + * resource was discovered but its configuration was not recorded since the + * recorder doesn't record resources of this type

  • ResourceDeleted + * – The resource was deleted

  • ResourceDeletedNotRecorded – The + * resource was deleted but its configuration was not recorded since the recorder + * doesn't record resources of this type

+ */ + inline const ConfigurationItemStatus& GetConfigurationItemStatus() const{ return m_configurationItemStatus; } + inline bool ConfigurationItemStatusHasBeenSet() const { return m_configurationItemStatusHasBeenSet; } + inline void SetConfigurationItemStatus(const ConfigurationItemStatus& value) { m_configurationItemStatusHasBeenSet = true; m_configurationItemStatus = value; } + inline void SetConfigurationItemStatus(ConfigurationItemStatus&& value) { m_configurationItemStatusHasBeenSet = true; m_configurationItemStatus = std::move(value); } + inline ConfigurationItem& WithConfigurationItemStatus(const ConfigurationItemStatus& value) { SetConfigurationItemStatus(value); return *this;} + inline ConfigurationItem& WithConfigurationItemStatus(ConfigurationItemStatus&& value) { SetConfigurationItemStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An identifier that indicates the ordering of the configuration items of a + * resource.

+ */ + inline const Aws::String& GetConfigurationStateId() const{ return m_configurationStateId; } + inline bool ConfigurationStateIdHasBeenSet() const { return m_configurationStateIdHasBeenSet; } + inline void SetConfigurationStateId(const Aws::String& value) { m_configurationStateIdHasBeenSet = true; m_configurationStateId = value; } + inline void SetConfigurationStateId(Aws::String&& value) { m_configurationStateIdHasBeenSet = true; m_configurationStateId = std::move(value); } + inline void SetConfigurationStateId(const char* value) { m_configurationStateIdHasBeenSet = true; m_configurationStateId.assign(value); } + inline ConfigurationItem& WithConfigurationStateId(const Aws::String& value) { SetConfigurationStateId(value); return *this;} + inline ConfigurationItem& WithConfigurationStateId(Aws::String&& value) { SetConfigurationStateId(std::move(value)); return *this;} + inline ConfigurationItem& WithConfigurationStateId(const char* value) { SetConfigurationStateId(value); return *this;} + ///@} + + ///@{ + /** + *

Unique MD5 hash that represents the configuration item's state.

You + * can use MD5 hash to compare the states of two or more configuration items that + * are associated with the same resource.

+ */ + inline const Aws::String& GetConfigurationItemMD5Hash() const{ return m_configurationItemMD5Hash; } + inline bool ConfigurationItemMD5HashHasBeenSet() const { return m_configurationItemMD5HashHasBeenSet; } + inline void SetConfigurationItemMD5Hash(const Aws::String& value) { m_configurationItemMD5HashHasBeenSet = true; m_configurationItemMD5Hash = value; } + inline void SetConfigurationItemMD5Hash(Aws::String&& value) { m_configurationItemMD5HashHasBeenSet = true; m_configurationItemMD5Hash = std::move(value); } + inline void SetConfigurationItemMD5Hash(const char* value) { m_configurationItemMD5HashHasBeenSet = true; m_configurationItemMD5Hash.assign(value); } + inline ConfigurationItem& WithConfigurationItemMD5Hash(const Aws::String& value) { SetConfigurationItemMD5Hash(value); return *this;} + inline ConfigurationItem& WithConfigurationItemMD5Hash(Aws::String&& value) { SetConfigurationItemMD5Hash(std::move(value)); return *this;} + inline ConfigurationItem& WithConfigurationItemMD5Hash(const char* value) { SetConfigurationItemMD5Hash(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) associated with the resource.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline ConfigurationItem& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline ConfigurationItem& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline ConfigurationItem& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The type of Amazon Web Services resource.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline ConfigurationItem& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline ConfigurationItem& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource (for example, sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline ConfigurationItem& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline ConfigurationItem& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline ConfigurationItem& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The custom name of the resource, if available.

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline ConfigurationItem& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline ConfigurationItem& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline ConfigurationItem& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + + ///@{ + /** + *

The region where the resource resides.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline ConfigurationItem& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline ConfigurationItem& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline ConfigurationItem& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + + ///@{ + /** + *

The Availability Zone associated with the resource.

+ */ + inline const Aws::String& GetAvailabilityZone() const{ return m_availabilityZone; } + inline bool AvailabilityZoneHasBeenSet() const { return m_availabilityZoneHasBeenSet; } + inline void SetAvailabilityZone(const Aws::String& value) { m_availabilityZoneHasBeenSet = true; m_availabilityZone = value; } + inline void SetAvailabilityZone(Aws::String&& value) { m_availabilityZoneHasBeenSet = true; m_availabilityZone = std::move(value); } + inline void SetAvailabilityZone(const char* value) { m_availabilityZoneHasBeenSet = true; m_availabilityZone.assign(value); } + inline ConfigurationItem& WithAvailabilityZone(const Aws::String& value) { SetAvailabilityZone(value); return *this;} + inline ConfigurationItem& WithAvailabilityZone(Aws::String&& value) { SetAvailabilityZone(std::move(value)); return *this;} + inline ConfigurationItem& WithAvailabilityZone(const char* value) { SetAvailabilityZone(value); return *this;} + ///@} + + ///@{ + /** + *

The time stamp when the resource was created.

+ */ + inline const Aws::Utils::DateTime& GetResourceCreationTime() const{ return m_resourceCreationTime; } + inline bool ResourceCreationTimeHasBeenSet() const { return m_resourceCreationTimeHasBeenSet; } + inline void SetResourceCreationTime(const Aws::Utils::DateTime& value) { m_resourceCreationTimeHasBeenSet = true; m_resourceCreationTime = value; } + inline void SetResourceCreationTime(Aws::Utils::DateTime&& value) { m_resourceCreationTimeHasBeenSet = true; m_resourceCreationTime = std::move(value); } + inline ConfigurationItem& WithResourceCreationTime(const Aws::Utils::DateTime& value) { SetResourceCreationTime(value); return *this;} + inline ConfigurationItem& WithResourceCreationTime(Aws::Utils::DateTime&& value) { SetResourceCreationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A mapping of key value tags associated with the resource.

+ */ + inline const Aws::Map& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Map& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Map&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline ConfigurationItem& WithTags(const Aws::Map& value) { SetTags(value); return *this;} + inline ConfigurationItem& WithTags(Aws::Map&& value) { SetTags(std::move(value)); return *this;} + inline ConfigurationItem& AddTags(const Aws::String& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + inline ConfigurationItem& AddTags(Aws::String&& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline ConfigurationItem& AddTags(const Aws::String& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline ConfigurationItem& AddTags(Aws::String&& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), std::move(value)); return *this; } + inline ConfigurationItem& AddTags(const char* key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline ConfigurationItem& AddTags(Aws::String&& key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline ConfigurationItem& AddTags(const char* key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

A list of CloudTrail event IDs.

A populated field indicates that the + * current configuration was initiated by the events recorded in the CloudTrail + * log. For more information about CloudTrail, see What + * Is CloudTrail.

An empty field indicates that the current + * configuration was not initiated by any event. As of Version 1.3, the + * relatedEvents field is empty. You can access the LookupEvents + * API in the CloudTrail API Reference to retrieve the events for the + * resource.

+ */ + inline const Aws::Vector& GetRelatedEvents() const{ return m_relatedEvents; } + inline bool RelatedEventsHasBeenSet() const { return m_relatedEventsHasBeenSet; } + inline void SetRelatedEvents(const Aws::Vector& value) { m_relatedEventsHasBeenSet = true; m_relatedEvents = value; } + inline void SetRelatedEvents(Aws::Vector&& value) { m_relatedEventsHasBeenSet = true; m_relatedEvents = std::move(value); } + inline ConfigurationItem& WithRelatedEvents(const Aws::Vector& value) { SetRelatedEvents(value); return *this;} + inline ConfigurationItem& WithRelatedEvents(Aws::Vector&& value) { SetRelatedEvents(std::move(value)); return *this;} + inline ConfigurationItem& AddRelatedEvents(const Aws::String& value) { m_relatedEventsHasBeenSet = true; m_relatedEvents.push_back(value); return *this; } + inline ConfigurationItem& AddRelatedEvents(Aws::String&& value) { m_relatedEventsHasBeenSet = true; m_relatedEvents.push_back(std::move(value)); return *this; } + inline ConfigurationItem& AddRelatedEvents(const char* value) { m_relatedEventsHasBeenSet = true; m_relatedEvents.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

A list of related Amazon Web Services resources.

+ */ + inline const Aws::Vector& GetRelationships() const{ return m_relationships; } + inline bool RelationshipsHasBeenSet() const { return m_relationshipsHasBeenSet; } + inline void SetRelationships(const Aws::Vector& value) { m_relationshipsHasBeenSet = true; m_relationships = value; } + inline void SetRelationships(Aws::Vector&& value) { m_relationshipsHasBeenSet = true; m_relationships = std::move(value); } + inline ConfigurationItem& WithRelationships(const Aws::Vector& value) { SetRelationships(value); return *this;} + inline ConfigurationItem& WithRelationships(Aws::Vector&& value) { SetRelationships(std::move(value)); return *this;} + inline ConfigurationItem& AddRelationships(const Relationship& value) { m_relationshipsHasBeenSet = true; m_relationships.push_back(value); return *this; } + inline ConfigurationItem& AddRelationships(Relationship&& value) { m_relationshipsHasBeenSet = true; m_relationships.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The description of the resource configuration.

+ */ + inline const Aws::String& GetConfiguration() const{ return m_configuration; } + inline bool ConfigurationHasBeenSet() const { return m_configurationHasBeenSet; } + inline void SetConfiguration(const Aws::String& value) { m_configurationHasBeenSet = true; m_configuration = value; } + inline void SetConfiguration(Aws::String&& value) { m_configurationHasBeenSet = true; m_configuration = std::move(value); } + inline void SetConfiguration(const char* value) { m_configurationHasBeenSet = true; m_configuration.assign(value); } + inline ConfigurationItem& WithConfiguration(const Aws::String& value) { SetConfiguration(value); return *this;} + inline ConfigurationItem& WithConfiguration(Aws::String&& value) { SetConfiguration(std::move(value)); return *this;} + inline ConfigurationItem& WithConfiguration(const char* value) { SetConfiguration(value); return *this;} + ///@} + + ///@{ + /** + *

Configuration attributes that Config returns for certain resource types to + * supplement the information returned for the configuration + * parameter.

+ */ + inline const Aws::Map& GetSupplementaryConfiguration() const{ return m_supplementaryConfiguration; } + inline bool SupplementaryConfigurationHasBeenSet() const { return m_supplementaryConfigurationHasBeenSet; } + inline void SetSupplementaryConfiguration(const Aws::Map& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration = value; } + inline void SetSupplementaryConfiguration(Aws::Map&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration = std::move(value); } + inline ConfigurationItem& WithSupplementaryConfiguration(const Aws::Map& value) { SetSupplementaryConfiguration(value); return *this;} + inline ConfigurationItem& WithSupplementaryConfiguration(Aws::Map&& value) { SetSupplementaryConfiguration(std::move(value)); return *this;} + inline ConfigurationItem& AddSupplementaryConfiguration(const Aws::String& key, const Aws::String& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, value); return *this; } + inline ConfigurationItem& AddSupplementaryConfiguration(Aws::String&& key, const Aws::String& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(std::move(key), value); return *this; } + inline ConfigurationItem& AddSupplementaryConfiguration(const Aws::String& key, Aws::String&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, std::move(value)); return *this; } + inline ConfigurationItem& AddSupplementaryConfiguration(Aws::String&& key, Aws::String&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(std::move(key), std::move(value)); return *this; } + inline ConfigurationItem& AddSupplementaryConfiguration(const char* key, Aws::String&& value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, std::move(value)); return *this; } + inline ConfigurationItem& AddSupplementaryConfiguration(Aws::String&& key, const char* value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(std::move(key), value); return *this; } + inline ConfigurationItem& AddSupplementaryConfiguration(const char* key, const char* value) { m_supplementaryConfigurationHasBeenSet = true; m_supplementaryConfiguration.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

The recording frequency that Config uses to record configuration changes for + * the resource.

+ */ + inline const RecordingFrequency& GetRecordingFrequency() const{ return m_recordingFrequency; } + inline bool RecordingFrequencyHasBeenSet() const { return m_recordingFrequencyHasBeenSet; } + inline void SetRecordingFrequency(const RecordingFrequency& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = value; } + inline void SetRecordingFrequency(RecordingFrequency&& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = std::move(value); } + inline ConfigurationItem& WithRecordingFrequency(const RecordingFrequency& value) { SetRecordingFrequency(value); return *this;} + inline ConfigurationItem& WithRecordingFrequency(RecordingFrequency&& value) { SetRecordingFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when configuration changes for the resource were delivered.

+ *

This field is optional and is not guaranteed to be present in a + * configuration item (CI). If you are using daily recording, this field will be + * populated. However, if you are using continuous recording, this field will be + * omitted since the delivery time is instantaneous as the CI is available right + * away. For more information on daily recording and continuous recording, see Recording + * Frequency in the Config Developer Guide.

+ */ + inline const Aws::Utils::DateTime& GetConfigurationItemDeliveryTime() const{ return m_configurationItemDeliveryTime; } + inline bool ConfigurationItemDeliveryTimeHasBeenSet() const { return m_configurationItemDeliveryTimeHasBeenSet; } + inline void SetConfigurationItemDeliveryTime(const Aws::Utils::DateTime& value) { m_configurationItemDeliveryTimeHasBeenSet = true; m_configurationItemDeliveryTime = value; } + inline void SetConfigurationItemDeliveryTime(Aws::Utils::DateTime&& value) { m_configurationItemDeliveryTimeHasBeenSet = true; m_configurationItemDeliveryTime = std::move(value); } + inline ConfigurationItem& WithConfigurationItemDeliveryTime(const Aws::Utils::DateTime& value) { SetConfigurationItemDeliveryTime(value); return *this;} + inline ConfigurationItem& WithConfigurationItemDeliveryTime(Aws::Utils::DateTime&& value) { SetConfigurationItemDeliveryTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_version; + bool m_versionHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::Utils::DateTime m_configurationItemCaptureTime; + bool m_configurationItemCaptureTimeHasBeenSet = false; + + ConfigurationItemStatus m_configurationItemStatus; + bool m_configurationItemStatusHasBeenSet = false; + + Aws::String m_configurationStateId; + bool m_configurationStateIdHasBeenSet = false; + + Aws::String m_configurationItemMD5Hash; + bool m_configurationItemMD5HashHasBeenSet = false; + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + + Aws::String m_availabilityZone; + bool m_availabilityZoneHasBeenSet = false; + + Aws::Utils::DateTime m_resourceCreationTime; + bool m_resourceCreationTimeHasBeenSet = false; + + Aws::Map m_tags; + bool m_tagsHasBeenSet = false; + + Aws::Vector m_relatedEvents; + bool m_relatedEventsHasBeenSet = false; + + Aws::Vector m_relationships; + bool m_relationshipsHasBeenSet = false; + + Aws::String m_configuration; + bool m_configurationHasBeenSet = false; + + Aws::Map m_supplementaryConfiguration; + bool m_supplementaryConfigurationHasBeenSet = false; + + RecordingFrequency m_recordingFrequency; + bool m_recordingFrequencyHasBeenSet = false; + + Aws::Utils::DateTime m_configurationItemDeliveryTime; + bool m_configurationItemDeliveryTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationItemStatus.h b/include/aws/config/model/ConfigurationItemStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..ad09b3c984617fafbee6f2604a2161a12c250478 --- /dev/null +++ b/include/aws/config/model/ConfigurationItemStatus.h @@ -0,0 +1,34 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ConfigurationItemStatus + { + NOT_SET, + OK, + ResourceDiscovered, + ResourceNotRecorded, + ResourceDeleted, + ResourceDeletedNotRecorded + }; + +namespace ConfigurationItemStatusMapper +{ +AWS_CONFIGSERVICE_API ConfigurationItemStatus GetConfigurationItemStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForConfigurationItemStatus(ConfigurationItemStatus value); +} // namespace ConfigurationItemStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationRecorder.h b/include/aws/config/model/ConfigurationRecorder.h new file mode 100644 index 0000000000000000000000000000000000000000..148cd3333180f9dfe3eed489b3dac8c66790a047 --- /dev/null +++ b/include/aws/config/model/ConfigurationRecorder.h @@ -0,0 +1,232 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Records configuration changes to the resource types in scope.

For more + * information about the configuration recorder, see + * Working with the Configuration Recorder in the Config Developer + * Guide.

See Also:

AWS + * API Reference

+ */ + class ConfigurationRecorder + { + public: + AWS_CONFIGSERVICE_API ConfigurationRecorder(); + AWS_CONFIGSERVICE_API ConfigurationRecorder(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigurationRecorder& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the specified configuration recorder.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline ConfigurationRecorder& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline ConfigurationRecorder& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline ConfigurationRecorder& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the configuration recorder.

For customer managed + * configuration recorders, Config automatically assigns the name of "default" when + * creating a configuration recorder if you do not specify a name at creation + * time.

For service-linked configuration recorders, Config automatically + * assigns a name that has the prefix "AWS" to a new service-linked + * configuration recorder.

Changing the name of a configuration + * recorder

To change the name of the customer managed configuration + * recorder, you must delete it and create a new customer managed configuration + * recorder with a new name.

You cannot change the name of a service-linked + * configuration recorder.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline ConfigurationRecorder& WithName(const Aws::String& value) { SetName(value); return *this;} + inline ConfigurationRecorder& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline ConfigurationRecorder& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the IAM role assumed by Config and used by + * the specified configuration recorder.

The server will reject a + * request without a defined roleARN for the configuration + * recorder

While the API model does not require this field, the server + * will reject a request without a defined roleARN for the + * configuration recorder.

Policies and compliance results

+ * IAM + * policies and other + * policies managed in Organizations can impact whether Config has permissions + * to record configuration changes for your resources. Additionally, rules directly + * evaluate the configuration of a resource and rules don't take into account these + * policies when running evaluations. Make sure that the policies in effect align + * with how you intend to use Config.

Keep Minimum Permisions When + * Reusing an IAM role

If you use an Amazon Web Services service that + * uses Config, such as Security Hub or Control Tower, and an IAM role has already + * been created, make sure that the IAM role that you use when setting up Config + * keeps the same minimum permissions as the pre-existing IAM role. You must do + * this to ensure that the other Amazon Web Services service continues to run as + * expected.

For example, if Control Tower has an IAM role that allows + * Config to read S3 objects, make sure that the same permissions are granted to + * the IAM role you use when setting up Config. Otherwise, it may interfere with + * how Control Tower operates.

The service-linked IAM role for Config + * must be used for service-linked configuration recorders

For + * service-linked configuration recorders, you must use the service-linked IAM role + * for Config: AWSServiceRoleForConfig.

+ * + */ + inline const Aws::String& GetRoleARN() const{ return m_roleARN; } + inline bool RoleARNHasBeenSet() const { return m_roleARNHasBeenSet; } + inline void SetRoleARN(const Aws::String& value) { m_roleARNHasBeenSet = true; m_roleARN = value; } + inline void SetRoleARN(Aws::String&& value) { m_roleARNHasBeenSet = true; m_roleARN = std::move(value); } + inline void SetRoleARN(const char* value) { m_roleARNHasBeenSet = true; m_roleARN.assign(value); } + inline ConfigurationRecorder& WithRoleARN(const Aws::String& value) { SetRoleARN(value); return *this;} + inline ConfigurationRecorder& WithRoleARN(Aws::String&& value) { SetRoleARN(std::move(value)); return *this;} + inline ConfigurationRecorder& WithRoleARN(const char* value) { SetRoleARN(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies which resource types are in scope for the configuration recorder to + * record.

High Number of Config Evaluations

You + * might notice increased activity in your account during your initial month + * recording with Config when compared to subsequent months. During the initial + * bootstrapping process, Config runs evaluations on all the resources in your + * account that you have selected for Config to record.

If you are running + * ephemeral workloads, you may see increased activity from Config as it records + * configuration changes associated with creating and deleting these temporary + * resources. An ephemeral workload is a temporary use of computing + * resources that are loaded and run when needed. Examples include Amazon Elastic + * Compute Cloud (Amazon EC2) Spot Instances, Amazon EMR jobs, and Auto + * Scaling.

If you want to avoid the increased activity from running + * ephemeral workloads, you can set up the configuration recorder to exclude these + * resource types from being recorded, or run these types of workloads in a + * separate account with Config turned off to avoid increased configuration + * recording and rule evaluations.

+ */ + inline const RecordingGroup& GetRecordingGroup() const{ return m_recordingGroup; } + inline bool RecordingGroupHasBeenSet() const { return m_recordingGroupHasBeenSet; } + inline void SetRecordingGroup(const RecordingGroup& value) { m_recordingGroupHasBeenSet = true; m_recordingGroup = value; } + inline void SetRecordingGroup(RecordingGroup&& value) { m_recordingGroupHasBeenSet = true; m_recordingGroup = std::move(value); } + inline ConfigurationRecorder& WithRecordingGroup(const RecordingGroup& value) { SetRecordingGroup(value); return *this;} + inline ConfigurationRecorder& WithRecordingGroup(RecordingGroup&& value) { SetRecordingGroup(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the default recording frequency for the configuration recorder. + * Config supports Continuous recording and Daily recording.

    + *
  • Continuous recording allows you to record configuration changes + * continuously whenever a change occurs.

  • Daily recording allows + * you to receive a configuration item (CI) representing the most recent state of + * your resources over the last 24-hour period, only if it’s different from the + * previous CI recorded.

Some resource types require + * continuous recording

Firewall Manager depends on continuous + * recording to monitor your resources. If you are using Firewall Manager, it is + * recommended that you set the recording frequency to Continuous.

+ *

You can also override the recording frequency for specific resource + * types.

+ */ + inline const RecordingMode& GetRecordingMode() const{ return m_recordingMode; } + inline bool RecordingModeHasBeenSet() const { return m_recordingModeHasBeenSet; } + inline void SetRecordingMode(const RecordingMode& value) { m_recordingModeHasBeenSet = true; m_recordingMode = value; } + inline void SetRecordingMode(RecordingMode&& value) { m_recordingModeHasBeenSet = true; m_recordingMode = std::move(value); } + inline ConfigurationRecorder& WithRecordingMode(const RecordingMode& value) { SetRecordingMode(value); return *this;} + inline ConfigurationRecorder& WithRecordingMode(RecordingMode&& value) { SetRecordingMode(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether the ConfigurationItems + * in scope for the specified configuration recorder are recorded for free + * (INTERNAL) or if it impacts the costs to your bill + * (PAID).

+ */ + inline const RecordingScope& GetRecordingScope() const{ return m_recordingScope; } + inline bool RecordingScopeHasBeenSet() const { return m_recordingScopeHasBeenSet; } + inline void SetRecordingScope(const RecordingScope& value) { m_recordingScopeHasBeenSet = true; m_recordingScope = value; } + inline void SetRecordingScope(RecordingScope&& value) { m_recordingScopeHasBeenSet = true; m_recordingScope = std::move(value); } + inline ConfigurationRecorder& WithRecordingScope(const RecordingScope& value) { SetRecordingScope(value); return *this;} + inline ConfigurationRecorder& WithRecordingScope(RecordingScope&& value) { SetRecordingScope(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

For service-linked configuration recorders, specifies the linked Amazon Web + * Services service for the configuration recorder.

+ */ + inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); } + inline ConfigurationRecorder& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;} + inline ConfigurationRecorder& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;} + inline ConfigurationRecorder& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;} + ///@} + private: + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + Aws::String m_roleARN; + bool m_roleARNHasBeenSet = false; + + RecordingGroup m_recordingGroup; + bool m_recordingGroupHasBeenSet = false; + + RecordingMode m_recordingMode; + bool m_recordingModeHasBeenSet = false; + + RecordingScope m_recordingScope; + bool m_recordingScopeHasBeenSet = false; + + Aws::String m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationRecorderFilter.h b/include/aws/config/model/ConfigurationRecorderFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..8a5853db333702de077d99d79087d86e8522edb9 --- /dev/null +++ b/include/aws/config/model/ConfigurationRecorderFilter.h @@ -0,0 +1,88 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters configuration recorders by recording scope.

See Also:

+ * AWS + * API Reference

+ */ + class ConfigurationRecorderFilter + { + public: + AWS_CONFIGSERVICE_API ConfigurationRecorderFilter(); + AWS_CONFIGSERVICE_API ConfigurationRecorderFilter(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigurationRecorderFilter& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the type of filter. Currently, only recordingScope + * is supported.

+ */ + inline const ConfigurationRecorderFilterName& GetFilterName() const{ return m_filterName; } + inline bool FilterNameHasBeenSet() const { return m_filterNameHasBeenSet; } + inline void SetFilterName(const ConfigurationRecorderFilterName& value) { m_filterNameHasBeenSet = true; m_filterName = value; } + inline void SetFilterName(ConfigurationRecorderFilterName&& value) { m_filterNameHasBeenSet = true; m_filterName = std::move(value); } + inline ConfigurationRecorderFilter& WithFilterName(const ConfigurationRecorderFilterName& value) { SetFilterName(value); return *this;} + inline ConfigurationRecorderFilter& WithFilterName(ConfigurationRecorderFilterName&& value) { SetFilterName(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The value of the filter. For recordingScope, valid values + * include: INTERNAL and PAID.

+ * INTERNAL indicates that the ConfigurationItems + * in scope for the configuration recorder are recorded for free.

+ * PAID indicates that the ConfigurationItems + * in scope for the configuration recorder impact the costs to your bill.

+ */ + inline const Aws::Vector& GetFilterValue() const{ return m_filterValue; } + inline bool FilterValueHasBeenSet() const { return m_filterValueHasBeenSet; } + inline void SetFilterValue(const Aws::Vector& value) { m_filterValueHasBeenSet = true; m_filterValue = value; } + inline void SetFilterValue(Aws::Vector&& value) { m_filterValueHasBeenSet = true; m_filterValue = std::move(value); } + inline ConfigurationRecorderFilter& WithFilterValue(const Aws::Vector& value) { SetFilterValue(value); return *this;} + inline ConfigurationRecorderFilter& WithFilterValue(Aws::Vector&& value) { SetFilterValue(std::move(value)); return *this;} + inline ConfigurationRecorderFilter& AddFilterValue(const Aws::String& value) { m_filterValueHasBeenSet = true; m_filterValue.push_back(value); return *this; } + inline ConfigurationRecorderFilter& AddFilterValue(Aws::String&& value) { m_filterValueHasBeenSet = true; m_filterValue.push_back(std::move(value)); return *this; } + inline ConfigurationRecorderFilter& AddFilterValue(const char* value) { m_filterValueHasBeenSet = true; m_filterValue.push_back(value); return *this; } + ///@} + private: + + ConfigurationRecorderFilterName m_filterName; + bool m_filterNameHasBeenSet = false; + + Aws::Vector m_filterValue; + bool m_filterValueHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationRecorderFilterName.h b/include/aws/config/model/ConfigurationRecorderFilterName.h new file mode 100644 index 0000000000000000000000000000000000000000..58bc7d0d7ffc1afde5e8b6e2cb68ec2886d7e92c --- /dev/null +++ b/include/aws/config/model/ConfigurationRecorderFilterName.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ConfigurationRecorderFilterName + { + NOT_SET, + recordingScope + }; + +namespace ConfigurationRecorderFilterNameMapper +{ +AWS_CONFIGSERVICE_API ConfigurationRecorderFilterName GetConfigurationRecorderFilterNameForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForConfigurationRecorderFilterName(ConfigurationRecorderFilterName value); +} // namespace ConfigurationRecorderFilterNameMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationRecorderStatus.h b/include/aws/config/model/ConfigurationRecorderStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..d76640021bef041f7f72883495373087e54ea187 --- /dev/null +++ b/include/aws/config/model/ConfigurationRecorderStatus.h @@ -0,0 +1,208 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The current status of the configuration recorder.

For a detailed + * status of recording events over time, add your Config events to CloudWatch + * metrics and use CloudWatch metrics.

See Also:

AWS + * API Reference

+ */ + class ConfigurationRecorderStatus + { + public: + AWS_CONFIGSERVICE_API ConfigurationRecorderStatus(); + AWS_CONFIGSERVICE_API ConfigurationRecorderStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigurationRecorderStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the configuration recorder.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline ConfigurationRecorderStatus& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline ConfigurationRecorderStatus& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline ConfigurationRecorderStatus& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the configuration recorder.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline ConfigurationRecorderStatus& WithName(const Aws::String& value) { SetName(value); return *this;} + inline ConfigurationRecorderStatus& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline ConfigurationRecorderStatus& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

The time the recorder was last started.

+ */ + inline const Aws::Utils::DateTime& GetLastStartTime() const{ return m_lastStartTime; } + inline bool LastStartTimeHasBeenSet() const { return m_lastStartTimeHasBeenSet; } + inline void SetLastStartTime(const Aws::Utils::DateTime& value) { m_lastStartTimeHasBeenSet = true; m_lastStartTime = value; } + inline void SetLastStartTime(Aws::Utils::DateTime&& value) { m_lastStartTimeHasBeenSet = true; m_lastStartTime = std::move(value); } + inline ConfigurationRecorderStatus& WithLastStartTime(const Aws::Utils::DateTime& value) { SetLastStartTime(value); return *this;} + inline ConfigurationRecorderStatus& WithLastStartTime(Aws::Utils::DateTime&& value) { SetLastStartTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time the recorder was last stopped.

+ */ + inline const Aws::Utils::DateTime& GetLastStopTime() const{ return m_lastStopTime; } + inline bool LastStopTimeHasBeenSet() const { return m_lastStopTimeHasBeenSet; } + inline void SetLastStopTime(const Aws::Utils::DateTime& value) { m_lastStopTimeHasBeenSet = true; m_lastStopTime = value; } + inline void SetLastStopTime(Aws::Utils::DateTime&& value) { m_lastStopTimeHasBeenSet = true; m_lastStopTime = std::move(value); } + inline ConfigurationRecorderStatus& WithLastStopTime(const Aws::Utils::DateTime& value) { SetLastStopTime(value); return *this;} + inline ConfigurationRecorderStatus& WithLastStopTime(Aws::Utils::DateTime&& value) { SetLastStopTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether or not the recorder is currently recording.

+ */ + inline bool GetRecording() const{ return m_recording; } + inline bool RecordingHasBeenSet() const { return m_recordingHasBeenSet; } + inline void SetRecording(bool value) { m_recordingHasBeenSet = true; m_recording = value; } + inline ConfigurationRecorderStatus& WithRecording(bool value) { SetRecording(value); return *this;} + ///@} + + ///@{ + /** + *

The status of the latest recording event processed by the recorder.

+ */ + inline const RecorderStatus& GetLastStatus() const{ return m_lastStatus; } + inline bool LastStatusHasBeenSet() const { return m_lastStatusHasBeenSet; } + inline void SetLastStatus(const RecorderStatus& value) { m_lastStatusHasBeenSet = true; m_lastStatus = value; } + inline void SetLastStatus(RecorderStatus&& value) { m_lastStatusHasBeenSet = true; m_lastStatus = std::move(value); } + inline ConfigurationRecorderStatus& WithLastStatus(const RecorderStatus& value) { SetLastStatus(value); return *this;} + inline ConfigurationRecorderStatus& WithLastStatus(RecorderStatus&& value) { SetLastStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The latest error code from when the recorder last failed.

+ */ + inline const Aws::String& GetLastErrorCode() const{ return m_lastErrorCode; } + inline bool LastErrorCodeHasBeenSet() const { return m_lastErrorCodeHasBeenSet; } + inline void SetLastErrorCode(const Aws::String& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = value; } + inline void SetLastErrorCode(Aws::String&& value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode = std::move(value); } + inline void SetLastErrorCode(const char* value) { m_lastErrorCodeHasBeenSet = true; m_lastErrorCode.assign(value); } + inline ConfigurationRecorderStatus& WithLastErrorCode(const Aws::String& value) { SetLastErrorCode(value); return *this;} + inline ConfigurationRecorderStatus& WithLastErrorCode(Aws::String&& value) { SetLastErrorCode(std::move(value)); return *this;} + inline ConfigurationRecorderStatus& WithLastErrorCode(const char* value) { SetLastErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

The latest error message from when the recorder last failed.

+ */ + inline const Aws::String& GetLastErrorMessage() const{ return m_lastErrorMessage; } + inline bool LastErrorMessageHasBeenSet() const { return m_lastErrorMessageHasBeenSet; } + inline void SetLastErrorMessage(const Aws::String& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = value; } + inline void SetLastErrorMessage(Aws::String&& value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage = std::move(value); } + inline void SetLastErrorMessage(const char* value) { m_lastErrorMessageHasBeenSet = true; m_lastErrorMessage.assign(value); } + inline ConfigurationRecorderStatus& WithLastErrorMessage(const Aws::String& value) { SetLastErrorMessage(value); return *this;} + inline ConfigurationRecorderStatus& WithLastErrorMessage(Aws::String&& value) { SetLastErrorMessage(std::move(value)); return *this;} + inline ConfigurationRecorderStatus& WithLastErrorMessage(const char* value) { SetLastErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The time of the latest change in status of an recording event processed by + * the recorder.

+ */ + inline const Aws::Utils::DateTime& GetLastStatusChangeTime() const{ return m_lastStatusChangeTime; } + inline bool LastStatusChangeTimeHasBeenSet() const { return m_lastStatusChangeTimeHasBeenSet; } + inline void SetLastStatusChangeTime(const Aws::Utils::DateTime& value) { m_lastStatusChangeTimeHasBeenSet = true; m_lastStatusChangeTime = value; } + inline void SetLastStatusChangeTime(Aws::Utils::DateTime&& value) { m_lastStatusChangeTimeHasBeenSet = true; m_lastStatusChangeTime = std::move(value); } + inline ConfigurationRecorderStatus& WithLastStatusChangeTime(const Aws::Utils::DateTime& value) { SetLastStatusChangeTime(value); return *this;} + inline ConfigurationRecorderStatus& WithLastStatusChangeTime(Aws::Utils::DateTime&& value) { SetLastStatusChangeTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

For service-linked configuration recorders, the service principal of the + * linked Amazon Web Services service.

+ */ + inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); } + inline ConfigurationRecorderStatus& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;} + inline ConfigurationRecorderStatus& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;} + inline ConfigurationRecorderStatus& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;} + ///@} + private: + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + Aws::Utils::DateTime m_lastStartTime; + bool m_lastStartTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastStopTime; + bool m_lastStopTimeHasBeenSet = false; + + bool m_recording; + bool m_recordingHasBeenSet = false; + + RecorderStatus m_lastStatus; + bool m_lastStatusHasBeenSet = false; + + Aws::String m_lastErrorCode; + bool m_lastErrorCodeHasBeenSet = false; + + Aws::String m_lastErrorMessage; + bool m_lastErrorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_lastStatusChangeTime; + bool m_lastStatusChangeTimeHasBeenSet = false; + + Aws::String m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConfigurationRecorderSummary.h b/include/aws/config/model/ConfigurationRecorderSummary.h new file mode 100644 index 0000000000000000000000000000000000000000..76e14324146321d89026b1d1a258fac035e14981 --- /dev/null +++ b/include/aws/config/model/ConfigurationRecorderSummary.h @@ -0,0 +1,118 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

A summary of a configuration recorder, including the arn, + * name, servicePrincipal, and + * recordingScope.

See Also:

AWS + * API Reference

+ */ + class ConfigurationRecorderSummary + { + public: + AWS_CONFIGSERVICE_API ConfigurationRecorderSummary(); + AWS_CONFIGSERVICE_API ConfigurationRecorderSummary(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConfigurationRecorderSummary& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the configuration recorder.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline ConfigurationRecorderSummary& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline ConfigurationRecorderSummary& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline ConfigurationRecorderSummary& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the configuration recorder.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline ConfigurationRecorderSummary& WithName(const Aws::String& value) { SetName(value); return *this;} + inline ConfigurationRecorderSummary& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline ConfigurationRecorderSummary& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

For service-linked configuration recorders, indicates which Amazon Web + * Services service the configuration recorder is linked to.

+ */ + inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); } + inline ConfigurationRecorderSummary& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;} + inline ConfigurationRecorderSummary& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;} + inline ConfigurationRecorderSummary& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the ConfigurationItems + * in scope for the configuration recorder are recorded for free + * (INTERNAL) or if you are charged a service fee for recording + * (PAID).

+ */ + inline const RecordingScope& GetRecordingScope() const{ return m_recordingScope; } + inline bool RecordingScopeHasBeenSet() const { return m_recordingScopeHasBeenSet; } + inline void SetRecordingScope(const RecordingScope& value) { m_recordingScopeHasBeenSet = true; m_recordingScope = value; } + inline void SetRecordingScope(RecordingScope&& value) { m_recordingScopeHasBeenSet = true; m_recordingScope = std::move(value); } + inline ConfigurationRecorderSummary& WithRecordingScope(const RecordingScope& value) { SetRecordingScope(value); return *this;} + inline ConfigurationRecorderSummary& WithRecordingScope(RecordingScope&& value) { SetRecordingScope(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + Aws::String m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + + RecordingScope m_recordingScope; + bool m_recordingScopeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackComplianceFilters.h b/include/aws/config/model/ConformancePackComplianceFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..81d924aee778fa3a65ca397a1d68b753a6e7c6f4 --- /dev/null +++ b/include/aws/config/model/ConformancePackComplianceFilters.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters the conformance pack by compliance types and Config rule + * names.

See Also:

AWS + * API Reference

+ */ + class ConformancePackComplianceFilters + { + public: + AWS_CONFIGSERVICE_API ConformancePackComplianceFilters(); + AWS_CONFIGSERVICE_API ConformancePackComplianceFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackComplianceFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Filters the results by Config rule names.

+ */ + inline const Aws::Vector& GetConfigRuleNames() const{ return m_configRuleNames; } + inline bool ConfigRuleNamesHasBeenSet() const { return m_configRuleNamesHasBeenSet; } + inline void SetConfigRuleNames(const Aws::Vector& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = value; } + inline void SetConfigRuleNames(Aws::Vector&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = std::move(value); } + inline ConformancePackComplianceFilters& WithConfigRuleNames(const Aws::Vector& value) { SetConfigRuleNames(value); return *this;} + inline ConformancePackComplianceFilters& WithConfigRuleNames(Aws::Vector&& value) { SetConfigRuleNames(std::move(value)); return *this;} + inline ConformancePackComplianceFilters& AddConfigRuleNames(const Aws::String& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + inline ConformancePackComplianceFilters& AddConfigRuleNames(Aws::String&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(std::move(value)); return *this; } + inline ConformancePackComplianceFilters& AddConfigRuleNames(const char* value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Filters the results by compliance.

The allowed values are + * COMPLIANT and NON_COMPLIANT. + * INSUFFICIENT_DATA is not supported.

+ */ + inline const ConformancePackComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ConformancePackComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ConformancePackComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline ConformancePackComplianceFilters& WithComplianceType(const ConformancePackComplianceType& value) { SetComplianceType(value); return *this;} + inline ConformancePackComplianceFilters& WithComplianceType(ConformancePackComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_configRuleNames; + bool m_configRuleNamesHasBeenSet = false; + + ConformancePackComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackComplianceScore.h b/include/aws/config/model/ConformancePackComplianceScore.h new file mode 100644 index 0000000000000000000000000000000000000000..50c5a3efe4c52a46412d255041dbd7f6c53efe60 --- /dev/null +++ b/include/aws/config/model/ConformancePackComplianceScore.h @@ -0,0 +1,101 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

A compliance score is the percentage of the number of compliant rule-resource + * combinations in a conformance pack compared to the number of total possible + * rule-resource combinations in the conformance pack. This metric provides you + * with a high-level view of the compliance state of your conformance packs. You + * can use it to identify, investigate, and understand the level of compliance in + * your conformance packs.

See Also:

AWS + * API Reference

+ */ + class ConformancePackComplianceScore + { + public: + AWS_CONFIGSERVICE_API ConformancePackComplianceScore(); + AWS_CONFIGSERVICE_API ConformancePackComplianceScore(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackComplianceScore& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Compliance score for the conformance pack. Conformance packs with no + * evaluation results will have a compliance score of + * INSUFFICIENT_DATA.

+ */ + inline const Aws::String& GetScore() const{ return m_score; } + inline bool ScoreHasBeenSet() const { return m_scoreHasBeenSet; } + inline void SetScore(const Aws::String& value) { m_scoreHasBeenSet = true; m_score = value; } + inline void SetScore(Aws::String&& value) { m_scoreHasBeenSet = true; m_score = std::move(value); } + inline void SetScore(const char* value) { m_scoreHasBeenSet = true; m_score.assign(value); } + inline ConformancePackComplianceScore& WithScore(const Aws::String& value) { SetScore(value); return *this;} + inline ConformancePackComplianceScore& WithScore(Aws::String&& value) { SetScore(std::move(value)); return *this;} + inline ConformancePackComplianceScore& WithScore(const char* value) { SetScore(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline ConformancePackComplianceScore& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline ConformancePackComplianceScore& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline ConformancePackComplianceScore& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

The time that the conformance pack compliance score was last updated.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdatedTime() const{ return m_lastUpdatedTime; } + inline bool LastUpdatedTimeHasBeenSet() const { return m_lastUpdatedTimeHasBeenSet; } + inline void SetLastUpdatedTime(const Aws::Utils::DateTime& value) { m_lastUpdatedTimeHasBeenSet = true; m_lastUpdatedTime = value; } + inline void SetLastUpdatedTime(Aws::Utils::DateTime&& value) { m_lastUpdatedTimeHasBeenSet = true; m_lastUpdatedTime = std::move(value); } + inline ConformancePackComplianceScore& WithLastUpdatedTime(const Aws::Utils::DateTime& value) { SetLastUpdatedTime(value); return *this;} + inline ConformancePackComplianceScore& WithLastUpdatedTime(Aws::Utils::DateTime&& value) { SetLastUpdatedTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_score; + bool m_scoreHasBeenSet = false; + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdatedTime; + bool m_lastUpdatedTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackComplianceScoresFilters.h b/include/aws/config/model/ConformancePackComplianceScoresFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..4c5b2083327a80ba3c6002852352a7424aea24f4 --- /dev/null +++ b/include/aws/config/model/ConformancePackComplianceScoresFilters.h @@ -0,0 +1,68 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

A list of filters to apply to the conformance pack compliance score result + * set.

See Also:

AWS + * API Reference

+ */ + class ConformancePackComplianceScoresFilters + { + public: + AWS_CONFIGSERVICE_API ConformancePackComplianceScoresFilters(); + AWS_CONFIGSERVICE_API ConformancePackComplianceScoresFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackComplianceScoresFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The names of the conformance packs whose compliance scores you want to + * include in the conformance pack compliance score result set. You can include up + * to 25 conformance packs in the ConformancePackNames array of + * strings, each with a character limit of 256 characters for the conformance pack + * name.

+ */ + inline const Aws::Vector& GetConformancePackNames() const{ return m_conformancePackNames; } + inline bool ConformancePackNamesHasBeenSet() const { return m_conformancePackNamesHasBeenSet; } + inline void SetConformancePackNames(const Aws::Vector& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = value; } + inline void SetConformancePackNames(Aws::Vector&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = std::move(value); } + inline ConformancePackComplianceScoresFilters& WithConformancePackNames(const Aws::Vector& value) { SetConformancePackNames(value); return *this;} + inline ConformancePackComplianceScoresFilters& WithConformancePackNames(Aws::Vector&& value) { SetConformancePackNames(std::move(value)); return *this;} + inline ConformancePackComplianceScoresFilters& AddConformancePackNames(const Aws::String& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + inline ConformancePackComplianceScoresFilters& AddConformancePackNames(Aws::String&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(std::move(value)); return *this; } + inline ConformancePackComplianceScoresFilters& AddConformancePackNames(const char* value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_conformancePackNames; + bool m_conformancePackNamesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackComplianceSummary.h b/include/aws/config/model/ConformancePackComplianceSummary.h new file mode 100644 index 0000000000000000000000000000000000000000..4f2198f48514aaade85425a36651e35b9415ddfc --- /dev/null +++ b/include/aws/config/model/ConformancePackComplianceSummary.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Summary includes the name and status of the conformance pack.

See + * Also:

AWS + * API Reference

+ */ + class ConformancePackComplianceSummary + { + public: + AWS_CONFIGSERVICE_API ConformancePackComplianceSummary(); + AWS_CONFIGSERVICE_API ConformancePackComplianceSummary(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackComplianceSummary& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the conformance pack name.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline ConformancePackComplianceSummary& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline ConformancePackComplianceSummary& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline ConformancePackComplianceSummary& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

The status of the conformance pack.

+ */ + inline const ConformancePackComplianceType& GetConformancePackComplianceStatus() const{ return m_conformancePackComplianceStatus; } + inline bool ConformancePackComplianceStatusHasBeenSet() const { return m_conformancePackComplianceStatusHasBeenSet; } + inline void SetConformancePackComplianceStatus(const ConformancePackComplianceType& value) { m_conformancePackComplianceStatusHasBeenSet = true; m_conformancePackComplianceStatus = value; } + inline void SetConformancePackComplianceStatus(ConformancePackComplianceType&& value) { m_conformancePackComplianceStatusHasBeenSet = true; m_conformancePackComplianceStatus = std::move(value); } + inline ConformancePackComplianceSummary& WithConformancePackComplianceStatus(const ConformancePackComplianceType& value) { SetConformancePackComplianceStatus(value); return *this;} + inline ConformancePackComplianceSummary& WithConformancePackComplianceStatus(ConformancePackComplianceType&& value) { SetConformancePackComplianceStatus(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + ConformancePackComplianceType m_conformancePackComplianceStatus; + bool m_conformancePackComplianceStatusHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackComplianceType.h b/include/aws/config/model/ConformancePackComplianceType.h new file mode 100644 index 0000000000000000000000000000000000000000..f5e36dcea30c80dc2314c57a22a8ab3d887c54bf --- /dev/null +++ b/include/aws/config/model/ConformancePackComplianceType.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ConformancePackComplianceType + { + NOT_SET, + COMPLIANT, + NON_COMPLIANT, + INSUFFICIENT_DATA + }; + +namespace ConformancePackComplianceTypeMapper +{ +AWS_CONFIGSERVICE_API ConformancePackComplianceType GetConformancePackComplianceTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForConformancePackComplianceType(ConformancePackComplianceType value); +} // namespace ConformancePackComplianceTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackDetail.h b/include/aws/config/model/ConformancePackDetail.h new file mode 100644 index 0000000000000000000000000000000000000000..7f593d03ce443e748060ecd494ffe25548c9c910 --- /dev/null +++ b/include/aws/config/model/ConformancePackDetail.h @@ -0,0 +1,203 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns details of a conformance pack. A conformance pack is a collection of + * Config rules and remediation actions that can be easily deployed in an account + * and a region.

See Also:

AWS + * API Reference

+ */ + class ConformancePackDetail + { + public: + AWS_CONFIGSERVICE_API ConformancePackDetail(); + AWS_CONFIGSERVICE_API ConformancePackDetail(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackDetail& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline ConformancePackDetail& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline ConformancePackDetail& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline ConformancePackDetail& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackArn() const{ return m_conformancePackArn; } + inline bool ConformancePackArnHasBeenSet() const { return m_conformancePackArnHasBeenSet; } + inline void SetConformancePackArn(const Aws::String& value) { m_conformancePackArnHasBeenSet = true; m_conformancePackArn = value; } + inline void SetConformancePackArn(Aws::String&& value) { m_conformancePackArnHasBeenSet = true; m_conformancePackArn = std::move(value); } + inline void SetConformancePackArn(const char* value) { m_conformancePackArnHasBeenSet = true; m_conformancePackArn.assign(value); } + inline ConformancePackDetail& WithConformancePackArn(const Aws::String& value) { SetConformancePackArn(value); return *this;} + inline ConformancePackDetail& WithConformancePackArn(Aws::String&& value) { SetConformancePackArn(std::move(value)); return *this;} + inline ConformancePackDetail& WithConformancePackArn(const char* value) { SetConformancePackArn(value); return *this;} + ///@} + + ///@{ + /** + *

ID of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackId() const{ return m_conformancePackId; } + inline bool ConformancePackIdHasBeenSet() const { return m_conformancePackIdHasBeenSet; } + inline void SetConformancePackId(const Aws::String& value) { m_conformancePackIdHasBeenSet = true; m_conformancePackId = value; } + inline void SetConformancePackId(Aws::String&& value) { m_conformancePackIdHasBeenSet = true; m_conformancePackId = std::move(value); } + inline void SetConformancePackId(const char* value) { m_conformancePackIdHasBeenSet = true; m_conformancePackId.assign(value); } + inline ConformancePackDetail& WithConformancePackId(const Aws::String& value) { SetConformancePackId(value); return *this;} + inline ConformancePackDetail& WithConformancePackId(Aws::String&& value) { SetConformancePackId(std::move(value)); return *this;} + inline ConformancePackDetail& WithConformancePackId(const char* value) { SetConformancePackId(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the Amazon S3 bucket where Config stores conformance pack + * templates.

This field is optional.

+ */ + inline const Aws::String& GetDeliveryS3Bucket() const{ return m_deliveryS3Bucket; } + inline bool DeliveryS3BucketHasBeenSet() const { return m_deliveryS3BucketHasBeenSet; } + inline void SetDeliveryS3Bucket(const Aws::String& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = value; } + inline void SetDeliveryS3Bucket(Aws::String&& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = std::move(value); } + inline void SetDeliveryS3Bucket(const char* value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket.assign(value); } + inline ConformancePackDetail& WithDeliveryS3Bucket(const Aws::String& value) { SetDeliveryS3Bucket(value); return *this;} + inline ConformancePackDetail& WithDeliveryS3Bucket(Aws::String&& value) { SetDeliveryS3Bucket(std::move(value)); return *this;} + inline ConformancePackDetail& WithDeliveryS3Bucket(const char* value) { SetDeliveryS3Bucket(value); return *this;} + ///@} + + ///@{ + /** + *

The prefix for the Amazon S3 bucket.

This field is + * optional.

+ */ + inline const Aws::String& GetDeliveryS3KeyPrefix() const{ return m_deliveryS3KeyPrefix; } + inline bool DeliveryS3KeyPrefixHasBeenSet() const { return m_deliveryS3KeyPrefixHasBeenSet; } + inline void SetDeliveryS3KeyPrefix(const Aws::String& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = value; } + inline void SetDeliveryS3KeyPrefix(Aws::String&& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = std::move(value); } + inline void SetDeliveryS3KeyPrefix(const char* value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix.assign(value); } + inline ConformancePackDetail& WithDeliveryS3KeyPrefix(const Aws::String& value) { SetDeliveryS3KeyPrefix(value); return *this;} + inline ConformancePackDetail& WithDeliveryS3KeyPrefix(Aws::String&& value) { SetDeliveryS3KeyPrefix(std::move(value)); return *this;} + inline ConformancePackDetail& WithDeliveryS3KeyPrefix(const char* value) { SetDeliveryS3KeyPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

A list of ConformancePackInputParameter objects.

+ */ + inline const Aws::Vector& GetConformancePackInputParameters() const{ return m_conformancePackInputParameters; } + inline bool ConformancePackInputParametersHasBeenSet() const { return m_conformancePackInputParametersHasBeenSet; } + inline void SetConformancePackInputParameters(const Aws::Vector& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = value; } + inline void SetConformancePackInputParameters(Aws::Vector&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = std::move(value); } + inline ConformancePackDetail& WithConformancePackInputParameters(const Aws::Vector& value) { SetConformancePackInputParameters(value); return *this;} + inline ConformancePackDetail& WithConformancePackInputParameters(Aws::Vector&& value) { SetConformancePackInputParameters(std::move(value)); return *this;} + inline ConformancePackDetail& AddConformancePackInputParameters(const ConformancePackInputParameter& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(value); return *this; } + inline ConformancePackDetail& AddConformancePackInputParameters(ConformancePackInputParameter&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The last time a conformation pack update was requested.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateRequestedTime() const{ return m_lastUpdateRequestedTime; } + inline bool LastUpdateRequestedTimeHasBeenSet() const { return m_lastUpdateRequestedTimeHasBeenSet; } + inline void SetLastUpdateRequestedTime(const Aws::Utils::DateTime& value) { m_lastUpdateRequestedTimeHasBeenSet = true; m_lastUpdateRequestedTime = value; } + inline void SetLastUpdateRequestedTime(Aws::Utils::DateTime&& value) { m_lastUpdateRequestedTimeHasBeenSet = true; m_lastUpdateRequestedTime = std::move(value); } + inline ConformancePackDetail& WithLastUpdateRequestedTime(const Aws::Utils::DateTime& value) { SetLastUpdateRequestedTime(value); return *this;} + inline ConformancePackDetail& WithLastUpdateRequestedTime(Aws::Utils::DateTime&& value) { SetLastUpdateRequestedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Web Services service that created the conformance pack.

+ */ + inline const Aws::String& GetCreatedBy() const{ return m_createdBy; } + inline bool CreatedByHasBeenSet() const { return m_createdByHasBeenSet; } + inline void SetCreatedBy(const Aws::String& value) { m_createdByHasBeenSet = true; m_createdBy = value; } + inline void SetCreatedBy(Aws::String&& value) { m_createdByHasBeenSet = true; m_createdBy = std::move(value); } + inline void SetCreatedBy(const char* value) { m_createdByHasBeenSet = true; m_createdBy.assign(value); } + inline ConformancePackDetail& WithCreatedBy(const Aws::String& value) { SetCreatedBy(value); return *this;} + inline ConformancePackDetail& WithCreatedBy(Aws::String&& value) { SetCreatedBy(std::move(value)); return *this;} + inline ConformancePackDetail& WithCreatedBy(const char* value) { SetCreatedBy(value); return *this;} + ///@} + + ///@{ + /** + *

An object that contains the name or Amazon Resource Name (ARN) of the Amazon + * Web Services Systems Manager document (SSM document) and the version of the SSM + * document that is used to create a conformance pack.

+ */ + inline const TemplateSSMDocumentDetails& GetTemplateSSMDocumentDetails() const{ return m_templateSSMDocumentDetails; } + inline bool TemplateSSMDocumentDetailsHasBeenSet() const { return m_templateSSMDocumentDetailsHasBeenSet; } + inline void SetTemplateSSMDocumentDetails(const TemplateSSMDocumentDetails& value) { m_templateSSMDocumentDetailsHasBeenSet = true; m_templateSSMDocumentDetails = value; } + inline void SetTemplateSSMDocumentDetails(TemplateSSMDocumentDetails&& value) { m_templateSSMDocumentDetailsHasBeenSet = true; m_templateSSMDocumentDetails = std::move(value); } + inline ConformancePackDetail& WithTemplateSSMDocumentDetails(const TemplateSSMDocumentDetails& value) { SetTemplateSSMDocumentDetails(value); return *this;} + inline ConformancePackDetail& WithTemplateSSMDocumentDetails(TemplateSSMDocumentDetails&& value) { SetTemplateSSMDocumentDetails(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + Aws::String m_conformancePackArn; + bool m_conformancePackArnHasBeenSet = false; + + Aws::String m_conformancePackId; + bool m_conformancePackIdHasBeenSet = false; + + Aws::String m_deliveryS3Bucket; + bool m_deliveryS3BucketHasBeenSet = false; + + Aws::String m_deliveryS3KeyPrefix; + bool m_deliveryS3KeyPrefixHasBeenSet = false; + + Aws::Vector m_conformancePackInputParameters; + bool m_conformancePackInputParametersHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateRequestedTime; + bool m_lastUpdateRequestedTimeHasBeenSet = false; + + Aws::String m_createdBy; + bool m_createdByHasBeenSet = false; + + TemplateSSMDocumentDetails m_templateSSMDocumentDetails; + bool m_templateSSMDocumentDetailsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackEvaluationFilters.h b/include/aws/config/model/ConformancePackEvaluationFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..cb73a8e84aa5899d17aa50efdacb951227c71885 --- /dev/null +++ b/include/aws/config/model/ConformancePackEvaluationFilters.h @@ -0,0 +1,120 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters a conformance pack by Config rule names, compliance types, Amazon Web + * Services resource types, and resource IDs.

See Also:

AWS + * API Reference

+ */ + class ConformancePackEvaluationFilters + { + public: + AWS_CONFIGSERVICE_API ConformancePackEvaluationFilters(); + AWS_CONFIGSERVICE_API ConformancePackEvaluationFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackEvaluationFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Filters the results by Config rule names.

+ */ + inline const Aws::Vector& GetConfigRuleNames() const{ return m_configRuleNames; } + inline bool ConfigRuleNamesHasBeenSet() const { return m_configRuleNamesHasBeenSet; } + inline void SetConfigRuleNames(const Aws::Vector& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = value; } + inline void SetConfigRuleNames(Aws::Vector&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = std::move(value); } + inline ConformancePackEvaluationFilters& WithConfigRuleNames(const Aws::Vector& value) { SetConfigRuleNames(value); return *this;} + inline ConformancePackEvaluationFilters& WithConfigRuleNames(Aws::Vector&& value) { SetConfigRuleNames(std::move(value)); return *this;} + inline ConformancePackEvaluationFilters& AddConfigRuleNames(const Aws::String& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + inline ConformancePackEvaluationFilters& AddConfigRuleNames(Aws::String&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(std::move(value)); return *this; } + inline ConformancePackEvaluationFilters& AddConfigRuleNames(const char* value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Filters the results by compliance.

The allowed values are + * COMPLIANT and NON_COMPLIANT. + * INSUFFICIENT_DATA is not supported.

+ */ + inline const ConformancePackComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ConformancePackComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ConformancePackComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline ConformancePackEvaluationFilters& WithComplianceType(const ConformancePackComplianceType& value) { SetComplianceType(value); return *this;} + inline ConformancePackEvaluationFilters& WithComplianceType(ConformancePackComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Filters the results by the resource type (for example, + * "AWS::EC2::Instance").

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline ConformancePackEvaluationFilters& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline ConformancePackEvaluationFilters& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline ConformancePackEvaluationFilters& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results by resource IDs.

This is valid only when + * you provide resource type. If there is no resource type, you will see an + * error.

+ */ + inline const Aws::Vector& GetResourceIds() const{ return m_resourceIds; } + inline bool ResourceIdsHasBeenSet() const { return m_resourceIdsHasBeenSet; } + inline void SetResourceIds(const Aws::Vector& value) { m_resourceIdsHasBeenSet = true; m_resourceIds = value; } + inline void SetResourceIds(Aws::Vector&& value) { m_resourceIdsHasBeenSet = true; m_resourceIds = std::move(value); } + inline ConformancePackEvaluationFilters& WithResourceIds(const Aws::Vector& value) { SetResourceIds(value); return *this;} + inline ConformancePackEvaluationFilters& WithResourceIds(Aws::Vector&& value) { SetResourceIds(std::move(value)); return *this;} + inline ConformancePackEvaluationFilters& AddResourceIds(const Aws::String& value) { m_resourceIdsHasBeenSet = true; m_resourceIds.push_back(value); return *this; } + inline ConformancePackEvaluationFilters& AddResourceIds(Aws::String&& value) { m_resourceIdsHasBeenSet = true; m_resourceIds.push_back(std::move(value)); return *this; } + inline ConformancePackEvaluationFilters& AddResourceIds(const char* value) { m_resourceIdsHasBeenSet = true; m_resourceIds.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_configRuleNames; + bool m_configRuleNamesHasBeenSet = false; + + ConformancePackComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::Vector m_resourceIds; + bool m_resourceIdsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackEvaluationResult.h b/include/aws/config/model/ConformancePackEvaluationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..cfdd306efaece88c739edc7d71c3e43633efec94 --- /dev/null +++ b/include/aws/config/model/ConformancePackEvaluationResult.h @@ -0,0 +1,127 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details of a conformance pack evaluation. Provides Config rule and Amazon + * Web Services resource type that was evaluated, the compliance of the conformance + * pack, related time stamps, and supplementary information.

See + * Also:

AWS + * API Reference

+ */ + class ConformancePackEvaluationResult + { + public: + AWS_CONFIGSERVICE_API ConformancePackEvaluationResult(); + AWS_CONFIGSERVICE_API ConformancePackEvaluationResult(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackEvaluationResult& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The compliance type. The allowed values are COMPLIANT and + * NON_COMPLIANT. INSUFFICIENT_DATA is not supported.

+ */ + inline const ConformancePackComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ConformancePackComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ConformancePackComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline ConformancePackEvaluationResult& WithComplianceType(const ConformancePackComplianceType& value) { SetComplianceType(value); return *this;} + inline ConformancePackEvaluationResult& WithComplianceType(ConformancePackComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const EvaluationResultIdentifier& GetEvaluationResultIdentifier() const{ return m_evaluationResultIdentifier; } + inline bool EvaluationResultIdentifierHasBeenSet() const { return m_evaluationResultIdentifierHasBeenSet; } + inline void SetEvaluationResultIdentifier(const EvaluationResultIdentifier& value) { m_evaluationResultIdentifierHasBeenSet = true; m_evaluationResultIdentifier = value; } + inline void SetEvaluationResultIdentifier(EvaluationResultIdentifier&& value) { m_evaluationResultIdentifierHasBeenSet = true; m_evaluationResultIdentifier = std::move(value); } + inline ConformancePackEvaluationResult& WithEvaluationResultIdentifier(const EvaluationResultIdentifier& value) { SetEvaluationResultIdentifier(value); return *this;} + inline ConformancePackEvaluationResult& WithEvaluationResultIdentifier(EvaluationResultIdentifier&& value) { SetEvaluationResultIdentifier(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when Config rule evaluated Amazon Web Services resource.

+ */ + inline const Aws::Utils::DateTime& GetConfigRuleInvokedTime() const{ return m_configRuleInvokedTime; } + inline bool ConfigRuleInvokedTimeHasBeenSet() const { return m_configRuleInvokedTimeHasBeenSet; } + inline void SetConfigRuleInvokedTime(const Aws::Utils::DateTime& value) { m_configRuleInvokedTimeHasBeenSet = true; m_configRuleInvokedTime = value; } + inline void SetConfigRuleInvokedTime(Aws::Utils::DateTime&& value) { m_configRuleInvokedTimeHasBeenSet = true; m_configRuleInvokedTime = std::move(value); } + inline ConformancePackEvaluationResult& WithConfigRuleInvokedTime(const Aws::Utils::DateTime& value) { SetConfigRuleInvokedTime(value); return *this;} + inline ConformancePackEvaluationResult& WithConfigRuleInvokedTime(Aws::Utils::DateTime&& value) { SetConfigRuleInvokedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when Config recorded the evaluation result.

+ */ + inline const Aws::Utils::DateTime& GetResultRecordedTime() const{ return m_resultRecordedTime; } + inline bool ResultRecordedTimeHasBeenSet() const { return m_resultRecordedTimeHasBeenSet; } + inline void SetResultRecordedTime(const Aws::Utils::DateTime& value) { m_resultRecordedTimeHasBeenSet = true; m_resultRecordedTime = value; } + inline void SetResultRecordedTime(Aws::Utils::DateTime&& value) { m_resultRecordedTimeHasBeenSet = true; m_resultRecordedTime = std::move(value); } + inline ConformancePackEvaluationResult& WithResultRecordedTime(const Aws::Utils::DateTime& value) { SetResultRecordedTime(value); return *this;} + inline ConformancePackEvaluationResult& WithResultRecordedTime(Aws::Utils::DateTime&& value) { SetResultRecordedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Supplementary information about how the evaluation determined the compliance. + *

+ */ + inline const Aws::String& GetAnnotation() const{ return m_annotation; } + inline bool AnnotationHasBeenSet() const { return m_annotationHasBeenSet; } + inline void SetAnnotation(const Aws::String& value) { m_annotationHasBeenSet = true; m_annotation = value; } + inline void SetAnnotation(Aws::String&& value) { m_annotationHasBeenSet = true; m_annotation = std::move(value); } + inline void SetAnnotation(const char* value) { m_annotationHasBeenSet = true; m_annotation.assign(value); } + inline ConformancePackEvaluationResult& WithAnnotation(const Aws::String& value) { SetAnnotation(value); return *this;} + inline ConformancePackEvaluationResult& WithAnnotation(Aws::String&& value) { SetAnnotation(std::move(value)); return *this;} + inline ConformancePackEvaluationResult& WithAnnotation(const char* value) { SetAnnotation(value); return *this;} + ///@} + private: + + ConformancePackComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + EvaluationResultIdentifier m_evaluationResultIdentifier; + bool m_evaluationResultIdentifierHasBeenSet = false; + + Aws::Utils::DateTime m_configRuleInvokedTime; + bool m_configRuleInvokedTimeHasBeenSet = false; + + Aws::Utils::DateTime m_resultRecordedTime; + bool m_resultRecordedTimeHasBeenSet = false; + + Aws::String m_annotation; + bool m_annotationHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackInputParameter.h b/include/aws/config/model/ConformancePackInputParameter.h new file mode 100644 index 0000000000000000000000000000000000000000..75f815c12613be9d45e7be66cd07939ec795fc92 --- /dev/null +++ b/include/aws/config/model/ConformancePackInputParameter.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Input parameters in the form of key-value pairs for the conformance pack, + * both of which you define. Keys can have a maximum character length of 255 + * characters, and values can have a maximum length of 4096 + * characters.

See Also:

AWS + * API Reference

+ */ + class ConformancePackInputParameter + { + public: + AWS_CONFIGSERVICE_API ConformancePackInputParameter(); + AWS_CONFIGSERVICE_API ConformancePackInputParameter(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackInputParameter& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

One part of a key-value pair.

+ */ + inline const Aws::String& GetParameterName() const{ return m_parameterName; } + inline bool ParameterNameHasBeenSet() const { return m_parameterNameHasBeenSet; } + inline void SetParameterName(const Aws::String& value) { m_parameterNameHasBeenSet = true; m_parameterName = value; } + inline void SetParameterName(Aws::String&& value) { m_parameterNameHasBeenSet = true; m_parameterName = std::move(value); } + inline void SetParameterName(const char* value) { m_parameterNameHasBeenSet = true; m_parameterName.assign(value); } + inline ConformancePackInputParameter& WithParameterName(const Aws::String& value) { SetParameterName(value); return *this;} + inline ConformancePackInputParameter& WithParameterName(Aws::String&& value) { SetParameterName(std::move(value)); return *this;} + inline ConformancePackInputParameter& WithParameterName(const char* value) { SetParameterName(value); return *this;} + ///@} + + ///@{ + /** + *

Another part of the key-value pair.

+ */ + inline const Aws::String& GetParameterValue() const{ return m_parameterValue; } + inline bool ParameterValueHasBeenSet() const { return m_parameterValueHasBeenSet; } + inline void SetParameterValue(const Aws::String& value) { m_parameterValueHasBeenSet = true; m_parameterValue = value; } + inline void SetParameterValue(Aws::String&& value) { m_parameterValueHasBeenSet = true; m_parameterValue = std::move(value); } + inline void SetParameterValue(const char* value) { m_parameterValueHasBeenSet = true; m_parameterValue.assign(value); } + inline ConformancePackInputParameter& WithParameterValue(const Aws::String& value) { SetParameterValue(value); return *this;} + inline ConformancePackInputParameter& WithParameterValue(Aws::String&& value) { SetParameterValue(std::move(value)); return *this;} + inline ConformancePackInputParameter& WithParameterValue(const char* value) { SetParameterValue(value); return *this;} + ///@} + private: + + Aws::String m_parameterName; + bool m_parameterNameHasBeenSet = false; + + Aws::String m_parameterValue; + bool m_parameterValueHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackRuleCompliance.h b/include/aws/config/model/ConformancePackRuleCompliance.h new file mode 100644 index 0000000000000000000000000000000000000000..6418c3a6529e0824a93c15b98e9397d15ac417eb --- /dev/null +++ b/include/aws/config/model/ConformancePackRuleCompliance.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Compliance information of one or more Config rules within a conformance pack. + * You can filter using Config rule names and compliance types.

See + * Also:

AWS + * API Reference

+ */ + class ConformancePackRuleCompliance + { + public: + AWS_CONFIGSERVICE_API ConformancePackRuleCompliance(); + AWS_CONFIGSERVICE_API ConformancePackRuleCompliance(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackRuleCompliance& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline ConformancePackRuleCompliance& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline ConformancePackRuleCompliance& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline ConformancePackRuleCompliance& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

Compliance of the Config rule.

+ */ + inline const ConformancePackComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ConformancePackComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ConformancePackComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline ConformancePackRuleCompliance& WithComplianceType(const ConformancePackComplianceType& value) { SetComplianceType(value); return *this;} + inline ConformancePackRuleCompliance& WithComplianceType(ConformancePackComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Controls for the conformance pack. A control is a process to prevent or + * detect problems while meeting objectives. A control can align with a specific + * compliance regime or map to internal controls defined by an organization.

+ */ + inline const Aws::Vector& GetControls() const{ return m_controls; } + inline bool ControlsHasBeenSet() const { return m_controlsHasBeenSet; } + inline void SetControls(const Aws::Vector& value) { m_controlsHasBeenSet = true; m_controls = value; } + inline void SetControls(Aws::Vector&& value) { m_controlsHasBeenSet = true; m_controls = std::move(value); } + inline ConformancePackRuleCompliance& WithControls(const Aws::Vector& value) { SetControls(value); return *this;} + inline ConformancePackRuleCompliance& WithControls(Aws::Vector&& value) { SetControls(std::move(value)); return *this;} + inline ConformancePackRuleCompliance& AddControls(const Aws::String& value) { m_controlsHasBeenSet = true; m_controls.push_back(value); return *this; } + inline ConformancePackRuleCompliance& AddControls(Aws::String&& value) { m_controlsHasBeenSet = true; m_controls.push_back(std::move(value)); return *this; } + inline ConformancePackRuleCompliance& AddControls(const char* value) { m_controlsHasBeenSet = true; m_controls.push_back(value); return *this; } + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + ConformancePackComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::Vector m_controls; + bool m_controlsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackState.h b/include/aws/config/model/ConformancePackState.h new file mode 100644 index 0000000000000000000000000000000000000000..0b21a59aaf359cdd0726ab61ac49951a1f95f9f7 --- /dev/null +++ b/include/aws/config/model/ConformancePackState.h @@ -0,0 +1,34 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ConformancePackState + { + NOT_SET, + CREATE_IN_PROGRESS, + CREATE_COMPLETE, + CREATE_FAILED, + DELETE_IN_PROGRESS, + DELETE_FAILED + }; + +namespace ConformancePackStateMapper +{ +AWS_CONFIGSERVICE_API ConformancePackState GetConformancePackStateForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForConformancePackState(ConformancePackState value); +} // namespace ConformancePackStateMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ConformancePackStatusDetail.h b/include/aws/config/model/ConformancePackStatusDetail.h new file mode 100644 index 0000000000000000000000000000000000000000..0a6203e9b90ac991249d5a685c73967b4f9081a5 --- /dev/null +++ b/include/aws/config/model/ConformancePackStatusDetail.h @@ -0,0 +1,183 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Status details of a conformance pack.

See Also:

AWS + * API Reference

+ */ + class ConformancePackStatusDetail + { + public: + AWS_CONFIGSERVICE_API ConformancePackStatusDetail(); + AWS_CONFIGSERVICE_API ConformancePackStatusDetail(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ConformancePackStatusDetail& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline ConformancePackStatusDetail& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline ConformancePackStatusDetail& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline ConformancePackStatusDetail& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

ID of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackId() const{ return m_conformancePackId; } + inline bool ConformancePackIdHasBeenSet() const { return m_conformancePackIdHasBeenSet; } + inline void SetConformancePackId(const Aws::String& value) { m_conformancePackIdHasBeenSet = true; m_conformancePackId = value; } + inline void SetConformancePackId(Aws::String&& value) { m_conformancePackIdHasBeenSet = true; m_conformancePackId = std::move(value); } + inline void SetConformancePackId(const char* value) { m_conformancePackIdHasBeenSet = true; m_conformancePackId.assign(value); } + inline ConformancePackStatusDetail& WithConformancePackId(const Aws::String& value) { SetConformancePackId(value); return *this;} + inline ConformancePackStatusDetail& WithConformancePackId(Aws::String&& value) { SetConformancePackId(std::move(value)); return *this;} + inline ConformancePackStatusDetail& WithConformancePackId(const char* value) { SetConformancePackId(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of comformance pack.

+ */ + inline const Aws::String& GetConformancePackArn() const{ return m_conformancePackArn; } + inline bool ConformancePackArnHasBeenSet() const { return m_conformancePackArnHasBeenSet; } + inline void SetConformancePackArn(const Aws::String& value) { m_conformancePackArnHasBeenSet = true; m_conformancePackArn = value; } + inline void SetConformancePackArn(Aws::String&& value) { m_conformancePackArnHasBeenSet = true; m_conformancePackArn = std::move(value); } + inline void SetConformancePackArn(const char* value) { m_conformancePackArnHasBeenSet = true; m_conformancePackArn.assign(value); } + inline ConformancePackStatusDetail& WithConformancePackArn(const Aws::String& value) { SetConformancePackArn(value); return *this;} + inline ConformancePackStatusDetail& WithConformancePackArn(Aws::String&& value) { SetConformancePackArn(std::move(value)); return *this;} + inline ConformancePackStatusDetail& WithConformancePackArn(const char* value) { SetConformancePackArn(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates deployment status of conformance pack.

Config sets the state + * of the conformance pack to:

  • CREATE_IN_PROGRESS when a + * conformance pack creation is in progress for an account.

  • + *

    CREATE_COMPLETE when a conformance pack has been successfully created in your + * account.

  • CREATE_FAILED when a conformance pack creation failed + * in your account.

  • DELETE_IN_PROGRESS when a conformance pack + * deletion is in progress.

  • DELETE_FAILED when a conformance + * pack deletion failed in your account.

+ */ + inline const ConformancePackState& GetConformancePackState() const{ return m_conformancePackState; } + inline bool ConformancePackStateHasBeenSet() const { return m_conformancePackStateHasBeenSet; } + inline void SetConformancePackState(const ConformancePackState& value) { m_conformancePackStateHasBeenSet = true; m_conformancePackState = value; } + inline void SetConformancePackState(ConformancePackState&& value) { m_conformancePackStateHasBeenSet = true; m_conformancePackState = std::move(value); } + inline ConformancePackStatusDetail& WithConformancePackState(const ConformancePackState& value) { SetConformancePackState(value); return *this;} + inline ConformancePackStatusDetail& WithConformancePackState(ConformancePackState&& value) { SetConformancePackState(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of CloudFormation stack.

+ */ + inline const Aws::String& GetStackArn() const{ return m_stackArn; } + inline bool StackArnHasBeenSet() const { return m_stackArnHasBeenSet; } + inline void SetStackArn(const Aws::String& value) { m_stackArnHasBeenSet = true; m_stackArn = value; } + inline void SetStackArn(Aws::String&& value) { m_stackArnHasBeenSet = true; m_stackArn = std::move(value); } + inline void SetStackArn(const char* value) { m_stackArnHasBeenSet = true; m_stackArn.assign(value); } + inline ConformancePackStatusDetail& WithStackArn(const Aws::String& value) { SetStackArn(value); return *this;} + inline ConformancePackStatusDetail& WithStackArn(Aws::String&& value) { SetStackArn(std::move(value)); return *this;} + inline ConformancePackStatusDetail& WithStackArn(const char* value) { SetStackArn(value); return *this;} + ///@} + + ///@{ + /** + *

The reason of conformance pack creation failure.

+ */ + inline const Aws::String& GetConformancePackStatusReason() const{ return m_conformancePackStatusReason; } + inline bool ConformancePackStatusReasonHasBeenSet() const { return m_conformancePackStatusReasonHasBeenSet; } + inline void SetConformancePackStatusReason(const Aws::String& value) { m_conformancePackStatusReasonHasBeenSet = true; m_conformancePackStatusReason = value; } + inline void SetConformancePackStatusReason(Aws::String&& value) { m_conformancePackStatusReasonHasBeenSet = true; m_conformancePackStatusReason = std::move(value); } + inline void SetConformancePackStatusReason(const char* value) { m_conformancePackStatusReasonHasBeenSet = true; m_conformancePackStatusReason.assign(value); } + inline ConformancePackStatusDetail& WithConformancePackStatusReason(const Aws::String& value) { SetConformancePackStatusReason(value); return *this;} + inline ConformancePackStatusDetail& WithConformancePackStatusReason(Aws::String&& value) { SetConformancePackStatusReason(std::move(value)); return *this;} + inline ConformancePackStatusDetail& WithConformancePackStatusReason(const char* value) { SetConformancePackStatusReason(value); return *this;} + ///@} + + ///@{ + /** + *

Last time when conformation pack creation and update was requested.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateRequestedTime() const{ return m_lastUpdateRequestedTime; } + inline bool LastUpdateRequestedTimeHasBeenSet() const { return m_lastUpdateRequestedTimeHasBeenSet; } + inline void SetLastUpdateRequestedTime(const Aws::Utils::DateTime& value) { m_lastUpdateRequestedTimeHasBeenSet = true; m_lastUpdateRequestedTime = value; } + inline void SetLastUpdateRequestedTime(Aws::Utils::DateTime&& value) { m_lastUpdateRequestedTimeHasBeenSet = true; m_lastUpdateRequestedTime = std::move(value); } + inline ConformancePackStatusDetail& WithLastUpdateRequestedTime(const Aws::Utils::DateTime& value) { SetLastUpdateRequestedTime(value); return *this;} + inline ConformancePackStatusDetail& WithLastUpdateRequestedTime(Aws::Utils::DateTime&& value) { SetLastUpdateRequestedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Last time when conformation pack creation and update was successful.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateCompletedTime() const{ return m_lastUpdateCompletedTime; } + inline bool LastUpdateCompletedTimeHasBeenSet() const { return m_lastUpdateCompletedTimeHasBeenSet; } + inline void SetLastUpdateCompletedTime(const Aws::Utils::DateTime& value) { m_lastUpdateCompletedTimeHasBeenSet = true; m_lastUpdateCompletedTime = value; } + inline void SetLastUpdateCompletedTime(Aws::Utils::DateTime&& value) { m_lastUpdateCompletedTimeHasBeenSet = true; m_lastUpdateCompletedTime = std::move(value); } + inline ConformancePackStatusDetail& WithLastUpdateCompletedTime(const Aws::Utils::DateTime& value) { SetLastUpdateCompletedTime(value); return *this;} + inline ConformancePackStatusDetail& WithLastUpdateCompletedTime(Aws::Utils::DateTime&& value) { SetLastUpdateCompletedTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + Aws::String m_conformancePackId; + bool m_conformancePackIdHasBeenSet = false; + + Aws::String m_conformancePackArn; + bool m_conformancePackArnHasBeenSet = false; + + ConformancePackState m_conformancePackState; + bool m_conformancePackStateHasBeenSet = false; + + Aws::String m_stackArn; + bool m_stackArnHasBeenSet = false; + + Aws::String m_conformancePackStatusReason; + bool m_conformancePackStatusReasonHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateRequestedTime; + bool m_lastUpdateRequestedTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateCompletedTime; + bool m_lastUpdateCompletedTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/CustomPolicyDetails.h b/include/aws/config/model/CustomPolicyDetails.h new file mode 100644 index 0000000000000000000000000000000000000000..eedf19f86a307614225bd588585061a56caf457c --- /dev/null +++ b/include/aws/config/model/CustomPolicyDetails.h @@ -0,0 +1,99 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides the runtime system, policy definition, and whether debug logging + * enabled. You can specify the following CustomPolicyDetails parameter values only + * for Config Custom Policy rules.

See Also:

AWS + * API Reference

+ */ + class CustomPolicyDetails + { + public: + AWS_CONFIGSERVICE_API CustomPolicyDetails(); + AWS_CONFIGSERVICE_API CustomPolicyDetails(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API CustomPolicyDetails& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The runtime system for your Config Custom Policy rule. Guard is a + * policy-as-code language that allows you to write policies that are enforced by + * Config Custom Policy rules. For more information about Guard, see the Guard GitHub + * Repository.

+ */ + inline const Aws::String& GetPolicyRuntime() const{ return m_policyRuntime; } + inline bool PolicyRuntimeHasBeenSet() const { return m_policyRuntimeHasBeenSet; } + inline void SetPolicyRuntime(const Aws::String& value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime = value; } + inline void SetPolicyRuntime(Aws::String&& value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime = std::move(value); } + inline void SetPolicyRuntime(const char* value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime.assign(value); } + inline CustomPolicyDetails& WithPolicyRuntime(const Aws::String& value) { SetPolicyRuntime(value); return *this;} + inline CustomPolicyDetails& WithPolicyRuntime(Aws::String&& value) { SetPolicyRuntime(std::move(value)); return *this;} + inline CustomPolicyDetails& WithPolicyRuntime(const char* value) { SetPolicyRuntime(value); return *this;} + ///@} + + ///@{ + /** + *

The policy definition containing the logic for your Config Custom Policy + * rule.

+ */ + inline const Aws::String& GetPolicyText() const{ return m_policyText; } + inline bool PolicyTextHasBeenSet() const { return m_policyTextHasBeenSet; } + inline void SetPolicyText(const Aws::String& value) { m_policyTextHasBeenSet = true; m_policyText = value; } + inline void SetPolicyText(Aws::String&& value) { m_policyTextHasBeenSet = true; m_policyText = std::move(value); } + inline void SetPolicyText(const char* value) { m_policyTextHasBeenSet = true; m_policyText.assign(value); } + inline CustomPolicyDetails& WithPolicyText(const Aws::String& value) { SetPolicyText(value); return *this;} + inline CustomPolicyDetails& WithPolicyText(Aws::String&& value) { SetPolicyText(std::move(value)); return *this;} + inline CustomPolicyDetails& WithPolicyText(const char* value) { SetPolicyText(value); return *this;} + ///@} + + ///@{ + /** + *

The boolean expression for enabling debug logging for your Config Custom + * Policy rule. The default value is false.

+ */ + inline bool GetEnableDebugLogDelivery() const{ return m_enableDebugLogDelivery; } + inline bool EnableDebugLogDeliveryHasBeenSet() const { return m_enableDebugLogDeliveryHasBeenSet; } + inline void SetEnableDebugLogDelivery(bool value) { m_enableDebugLogDeliveryHasBeenSet = true; m_enableDebugLogDelivery = value; } + inline CustomPolicyDetails& WithEnableDebugLogDelivery(bool value) { SetEnableDebugLogDelivery(value); return *this;} + ///@} + private: + + Aws::String m_policyRuntime; + bool m_policyRuntimeHasBeenSet = false; + + Aws::String m_policyText; + bool m_policyTextHasBeenSet = false; + + bool m_enableDebugLogDelivery; + bool m_enableDebugLogDeliveryHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteAggregationAuthorizationRequest.h b/include/aws/config/model/DeleteAggregationAuthorizationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e7f695648f37fbcbadd941d7dab022b0c66b96a8 --- /dev/null +++ b/include/aws/config/model/DeleteAggregationAuthorizationRequest.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteAggregationAuthorizationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteAggregationAuthorizationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteAggregationAuthorization"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The 12-digit account ID of the account authorized to aggregate data.

+ */ + inline const Aws::String& GetAuthorizedAccountId() const{ return m_authorizedAccountId; } + inline bool AuthorizedAccountIdHasBeenSet() const { return m_authorizedAccountIdHasBeenSet; } + inline void SetAuthorizedAccountId(const Aws::String& value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId = value; } + inline void SetAuthorizedAccountId(Aws::String&& value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId = std::move(value); } + inline void SetAuthorizedAccountId(const char* value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId.assign(value); } + inline DeleteAggregationAuthorizationRequest& WithAuthorizedAccountId(const Aws::String& value) { SetAuthorizedAccountId(value); return *this;} + inline DeleteAggregationAuthorizationRequest& WithAuthorizedAccountId(Aws::String&& value) { SetAuthorizedAccountId(std::move(value)); return *this;} + inline DeleteAggregationAuthorizationRequest& WithAuthorizedAccountId(const char* value) { SetAuthorizedAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The region authorized to collect aggregated data.

+ */ + inline const Aws::String& GetAuthorizedAwsRegion() const{ return m_authorizedAwsRegion; } + inline bool AuthorizedAwsRegionHasBeenSet() const { return m_authorizedAwsRegionHasBeenSet; } + inline void SetAuthorizedAwsRegion(const Aws::String& value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion = value; } + inline void SetAuthorizedAwsRegion(Aws::String&& value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion = std::move(value); } + inline void SetAuthorizedAwsRegion(const char* value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion.assign(value); } + inline DeleteAggregationAuthorizationRequest& WithAuthorizedAwsRegion(const Aws::String& value) { SetAuthorizedAwsRegion(value); return *this;} + inline DeleteAggregationAuthorizationRequest& WithAuthorizedAwsRegion(Aws::String&& value) { SetAuthorizedAwsRegion(std::move(value)); return *this;} + inline DeleteAggregationAuthorizationRequest& WithAuthorizedAwsRegion(const char* value) { SetAuthorizedAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_authorizedAccountId; + bool m_authorizedAccountIdHasBeenSet = false; + + Aws::String m_authorizedAwsRegion; + bool m_authorizedAwsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteConfigRuleRequest.h b/include/aws/config/model/DeleteConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..faf90b6971b3b5705634ebc32845a7cbc062afa4 --- /dev/null +++ b/include/aws/config/model/DeleteConfigRuleRequest.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DeleteConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule that you want to delete.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline DeleteConfigRuleRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline DeleteConfigRuleRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline DeleteConfigRuleRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteConfigurationAggregatorRequest.h b/include/aws/config/model/DeleteConfigurationAggregatorRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5ec170d022c7d779a6475e3243d89646ba14076a --- /dev/null +++ b/include/aws/config/model/DeleteConfigurationAggregatorRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteConfigurationAggregatorRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteConfigurationAggregatorRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteConfigurationAggregator"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline DeleteConfigurationAggregatorRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline DeleteConfigurationAggregatorRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline DeleteConfigurationAggregatorRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteConfigurationRecorderRequest.h b/include/aws/config/model/DeleteConfigurationRecorderRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a77115dd36e169d6bd6a4c0d76861b263b219578 --- /dev/null +++ b/include/aws/config/model/DeleteConfigurationRecorderRequest.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The request object for the DeleteConfigurationRecorder + * operation.

See Also:

AWS + * API Reference

+ */ + class DeleteConfigurationRecorderRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteConfigurationRecorderRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteConfigurationRecorder"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the customer managed configuration recorder that you want to + * delete. You can retrieve the name of your configuration recorders by using the + * DescribeConfigurationRecorders + * operation.

+ */ + inline const Aws::String& GetConfigurationRecorderName() const{ return m_configurationRecorderName; } + inline bool ConfigurationRecorderNameHasBeenSet() const { return m_configurationRecorderNameHasBeenSet; } + inline void SetConfigurationRecorderName(const Aws::String& value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName = value; } + inline void SetConfigurationRecorderName(Aws::String&& value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName = std::move(value); } + inline void SetConfigurationRecorderName(const char* value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName.assign(value); } + inline DeleteConfigurationRecorderRequest& WithConfigurationRecorderName(const Aws::String& value) { SetConfigurationRecorderName(value); return *this;} + inline DeleteConfigurationRecorderRequest& WithConfigurationRecorderName(Aws::String&& value) { SetConfigurationRecorderName(std::move(value)); return *this;} + inline DeleteConfigurationRecorderRequest& WithConfigurationRecorderName(const char* value) { SetConfigurationRecorderName(value); return *this;} + ///@} + private: + + Aws::String m_configurationRecorderName; + bool m_configurationRecorderNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteConformancePackRequest.h b/include/aws/config/model/DeleteConformancePackRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..9006573eb7036bb6154538e78245c610eb5e931f --- /dev/null +++ b/include/aws/config/model/DeleteConformancePackRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteConformancePackRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteConformancePackRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteConformancePack"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Name of the conformance pack you want to delete.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline DeleteConformancePackRequest& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline DeleteConformancePackRequest& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline DeleteConformancePackRequest& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteDeliveryChannelRequest.h b/include/aws/config/model/DeleteDeliveryChannelRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..09c42d6fbdaa51d12da98fe9b624701c3caa4352 --- /dev/null +++ b/include/aws/config/model/DeleteDeliveryChannelRequest.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the DeleteDeliveryChannel action. The action accepts the + * following data, in JSON format.

See Also:

AWS + * API Reference

+ */ + class DeleteDeliveryChannelRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteDeliveryChannelRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteDeliveryChannel"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the delivery channel that you want to delete.

+ */ + inline const Aws::String& GetDeliveryChannelName() const{ return m_deliveryChannelName; } + inline bool DeliveryChannelNameHasBeenSet() const { return m_deliveryChannelNameHasBeenSet; } + inline void SetDeliveryChannelName(const Aws::String& value) { m_deliveryChannelNameHasBeenSet = true; m_deliveryChannelName = value; } + inline void SetDeliveryChannelName(Aws::String&& value) { m_deliveryChannelNameHasBeenSet = true; m_deliveryChannelName = std::move(value); } + inline void SetDeliveryChannelName(const char* value) { m_deliveryChannelNameHasBeenSet = true; m_deliveryChannelName.assign(value); } + inline DeleteDeliveryChannelRequest& WithDeliveryChannelName(const Aws::String& value) { SetDeliveryChannelName(value); return *this;} + inline DeleteDeliveryChannelRequest& WithDeliveryChannelName(Aws::String&& value) { SetDeliveryChannelName(std::move(value)); return *this;} + inline DeleteDeliveryChannelRequest& WithDeliveryChannelName(const char* value) { SetDeliveryChannelName(value); return *this;} + ///@} + private: + + Aws::String m_deliveryChannelName; + bool m_deliveryChannelNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteEvaluationResultsRequest.h b/include/aws/config/model/DeleteEvaluationResultsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..6a04911e4eeadbdf277227ccce765df26280a02d --- /dev/null +++ b/include/aws/config/model/DeleteEvaluationResultsRequest.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DeleteEvaluationResultsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteEvaluationResultsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteEvaluationResults"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule for which you want to delete the evaluation + * results.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline DeleteEvaluationResultsRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline DeleteEvaluationResultsRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline DeleteEvaluationResultsRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteEvaluationResultsResult.h b/include/aws/config/model/DeleteEvaluationResultsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a06862acd952a931c3b64c800de18ca8c3f7fe4d --- /dev/null +++ b/include/aws/config/model/DeleteEvaluationResultsResult.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output when you delete the evaluation results for the specified Config + * rule.

See Also:

AWS + * API Reference

+ */ + class DeleteEvaluationResultsResult + { + public: + AWS_CONFIGSERVICE_API DeleteEvaluationResultsResult(); + AWS_CONFIGSERVICE_API DeleteEvaluationResultsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DeleteEvaluationResultsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteEvaluationResultsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteEvaluationResultsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteEvaluationResultsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteOrganizationConfigRuleRequest.h b/include/aws/config/model/DeleteOrganizationConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5eba3fdb4852990a0e50c14bb877963eb2407851 --- /dev/null +++ b/include/aws/config/model/DeleteOrganizationConfigRuleRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteOrganizationConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteOrganizationConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteOrganizationConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of organization Config rule that you want to delete.

+ */ + inline const Aws::String& GetOrganizationConfigRuleName() const{ return m_organizationConfigRuleName; } + inline bool OrganizationConfigRuleNameHasBeenSet() const { return m_organizationConfigRuleNameHasBeenSet; } + inline void SetOrganizationConfigRuleName(const Aws::String& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = value; } + inline void SetOrganizationConfigRuleName(Aws::String&& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = std::move(value); } + inline void SetOrganizationConfigRuleName(const char* value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName.assign(value); } + inline DeleteOrganizationConfigRuleRequest& WithOrganizationConfigRuleName(const Aws::String& value) { SetOrganizationConfigRuleName(value); return *this;} + inline DeleteOrganizationConfigRuleRequest& WithOrganizationConfigRuleName(Aws::String&& value) { SetOrganizationConfigRuleName(std::move(value)); return *this;} + inline DeleteOrganizationConfigRuleRequest& WithOrganizationConfigRuleName(const char* value) { SetOrganizationConfigRuleName(value); return *this;} + ///@} + private: + + Aws::String m_organizationConfigRuleName; + bool m_organizationConfigRuleNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteOrganizationConformancePackRequest.h b/include/aws/config/model/DeleteOrganizationConformancePackRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..ebcf82af703d6172daa890635119e76dcd3ab56a --- /dev/null +++ b/include/aws/config/model/DeleteOrganizationConformancePackRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteOrganizationConformancePackRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteOrganizationConformancePackRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteOrganizationConformancePack"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of organization conformance pack that you want to delete.

+ */ + inline const Aws::String& GetOrganizationConformancePackName() const{ return m_organizationConformancePackName; } + inline bool OrganizationConformancePackNameHasBeenSet() const { return m_organizationConformancePackNameHasBeenSet; } + inline void SetOrganizationConformancePackName(const Aws::String& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = value; } + inline void SetOrganizationConformancePackName(Aws::String&& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = std::move(value); } + inline void SetOrganizationConformancePackName(const char* value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName.assign(value); } + inline DeleteOrganizationConformancePackRequest& WithOrganizationConformancePackName(const Aws::String& value) { SetOrganizationConformancePackName(value); return *this;} + inline DeleteOrganizationConformancePackRequest& WithOrganizationConformancePackName(Aws::String&& value) { SetOrganizationConformancePackName(std::move(value)); return *this;} + inline DeleteOrganizationConformancePackRequest& WithOrganizationConformancePackName(const char* value) { SetOrganizationConformancePackName(value); return *this;} + ///@} + private: + + Aws::String m_organizationConformancePackName; + bool m_organizationConformancePackNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeletePendingAggregationRequestRequest.h b/include/aws/config/model/DeletePendingAggregationRequestRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5d9b2bd3024f9a77986cdc358777fc5a060e1b47 --- /dev/null +++ b/include/aws/config/model/DeletePendingAggregationRequestRequest.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeletePendingAggregationRequestRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeletePendingAggregationRequestRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeletePendingAggregationRequest"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The 12-digit account ID of the account requesting to aggregate data.

+ */ + inline const Aws::String& GetRequesterAccountId() const{ return m_requesterAccountId; } + inline bool RequesterAccountIdHasBeenSet() const { return m_requesterAccountIdHasBeenSet; } + inline void SetRequesterAccountId(const Aws::String& value) { m_requesterAccountIdHasBeenSet = true; m_requesterAccountId = value; } + inline void SetRequesterAccountId(Aws::String&& value) { m_requesterAccountIdHasBeenSet = true; m_requesterAccountId = std::move(value); } + inline void SetRequesterAccountId(const char* value) { m_requesterAccountIdHasBeenSet = true; m_requesterAccountId.assign(value); } + inline DeletePendingAggregationRequestRequest& WithRequesterAccountId(const Aws::String& value) { SetRequesterAccountId(value); return *this;} + inline DeletePendingAggregationRequestRequest& WithRequesterAccountId(Aws::String&& value) { SetRequesterAccountId(std::move(value)); return *this;} + inline DeletePendingAggregationRequestRequest& WithRequesterAccountId(const char* value) { SetRequesterAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The region requesting to aggregate data.

+ */ + inline const Aws::String& GetRequesterAwsRegion() const{ return m_requesterAwsRegion; } + inline bool RequesterAwsRegionHasBeenSet() const { return m_requesterAwsRegionHasBeenSet; } + inline void SetRequesterAwsRegion(const Aws::String& value) { m_requesterAwsRegionHasBeenSet = true; m_requesterAwsRegion = value; } + inline void SetRequesterAwsRegion(Aws::String&& value) { m_requesterAwsRegionHasBeenSet = true; m_requesterAwsRegion = std::move(value); } + inline void SetRequesterAwsRegion(const char* value) { m_requesterAwsRegionHasBeenSet = true; m_requesterAwsRegion.assign(value); } + inline DeletePendingAggregationRequestRequest& WithRequesterAwsRegion(const Aws::String& value) { SetRequesterAwsRegion(value); return *this;} + inline DeletePendingAggregationRequestRequest& WithRequesterAwsRegion(Aws::String&& value) { SetRequesterAwsRegion(std::move(value)); return *this;} + inline DeletePendingAggregationRequestRequest& WithRequesterAwsRegion(const char* value) { SetRequesterAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_requesterAccountId; + bool m_requesterAccountIdHasBeenSet = false; + + Aws::String m_requesterAwsRegion; + bool m_requesterAwsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteRemediationConfigurationRequest.h b/include/aws/config/model/DeleteRemediationConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..b013aceb5a0cb60329385441e934fa4cf778132b --- /dev/null +++ b/include/aws/config/model/DeleteRemediationConfigurationRequest.h @@ -0,0 +1,76 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteRemediationConfigurationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteRemediationConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteRemediationConfiguration"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule for which you want to delete remediation + * configuration.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline DeleteRemediationConfigurationRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline DeleteRemediationConfigurationRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline DeleteRemediationConfigurationRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The type of a resource.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline DeleteRemediationConfigurationRequest& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline DeleteRemediationConfigurationRequest& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline DeleteRemediationConfigurationRequest& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteRemediationConfigurationResult.h b/include/aws/config/model/DeleteRemediationConfigurationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..8a6da56410165b7ca322a309aae9423c887e0eaf --- /dev/null +++ b/include/aws/config/model/DeleteRemediationConfigurationResult.h @@ -0,0 +1,52 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DeleteRemediationConfigurationResult + { + public: + AWS_CONFIGSERVICE_API DeleteRemediationConfigurationResult(); + AWS_CONFIGSERVICE_API DeleteRemediationConfigurationResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DeleteRemediationConfigurationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteRemediationConfigurationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteRemediationConfigurationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteRemediationConfigurationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteRemediationExceptionsRequest.h b/include/aws/config/model/DeleteRemediationExceptionsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5f01f30298979a9e8ef9b393f31606536e04659a --- /dev/null +++ b/include/aws/config/model/DeleteRemediationExceptionsRequest.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteRemediationExceptionsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteRemediationExceptionsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteRemediationExceptions"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule for which you want to delete remediation + * exception configuration.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline DeleteRemediationExceptionsRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline DeleteRemediationExceptionsRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline DeleteRemediationExceptionsRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

An exception list of resource exception keys to be processed with the current + * request. Config adds exception for each resource key. For example, Config adds 3 + * exceptions for 3 resource keys.

+ */ + inline const Aws::Vector& GetResourceKeys() const{ return m_resourceKeys; } + inline bool ResourceKeysHasBeenSet() const { return m_resourceKeysHasBeenSet; } + inline void SetResourceKeys(const Aws::Vector& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = value; } + inline void SetResourceKeys(Aws::Vector&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = std::move(value); } + inline DeleteRemediationExceptionsRequest& WithResourceKeys(const Aws::Vector& value) { SetResourceKeys(value); return *this;} + inline DeleteRemediationExceptionsRequest& WithResourceKeys(Aws::Vector&& value) { SetResourceKeys(std::move(value)); return *this;} + inline DeleteRemediationExceptionsRequest& AddResourceKeys(const RemediationExceptionResourceKey& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(value); return *this; } + inline DeleteRemediationExceptionsRequest& AddResourceKeys(RemediationExceptionResourceKey&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::Vector m_resourceKeys; + bool m_resourceKeysHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteRemediationExceptionsResult.h b/include/aws/config/model/DeleteRemediationExceptionsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..6331491bb6869e7e66bb49608158ac99172e7e07 --- /dev/null +++ b/include/aws/config/model/DeleteRemediationExceptionsResult.h @@ -0,0 +1,70 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DeleteRemediationExceptionsResult + { + public: + AWS_CONFIGSERVICE_API DeleteRemediationExceptionsResult(); + AWS_CONFIGSERVICE_API DeleteRemediationExceptionsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DeleteRemediationExceptionsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of failed delete remediation exceptions batch objects. Each + * object in the batch consists of a list of failed items and failure messages.

+ */ + inline const Aws::Vector& GetFailedBatches() const{ return m_failedBatches; } + inline void SetFailedBatches(const Aws::Vector& value) { m_failedBatches = value; } + inline void SetFailedBatches(Aws::Vector&& value) { m_failedBatches = std::move(value); } + inline DeleteRemediationExceptionsResult& WithFailedBatches(const Aws::Vector& value) { SetFailedBatches(value); return *this;} + inline DeleteRemediationExceptionsResult& WithFailedBatches(Aws::Vector&& value) { SetFailedBatches(std::move(value)); return *this;} + inline DeleteRemediationExceptionsResult& AddFailedBatches(const FailedDeleteRemediationExceptionsBatch& value) { m_failedBatches.push_back(value); return *this; } + inline DeleteRemediationExceptionsResult& AddFailedBatches(FailedDeleteRemediationExceptionsBatch&& value) { m_failedBatches.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteRemediationExceptionsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteRemediationExceptionsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteRemediationExceptionsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_failedBatches; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteResourceConfigRequest.h b/include/aws/config/model/DeleteResourceConfigRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..16e23607704fe4171616ca081aa19cc94a550e32 --- /dev/null +++ b/include/aws/config/model/DeleteResourceConfigRequest.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteResourceConfigRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteResourceConfigRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteResourceConfig"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The type of the resource.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline DeleteResourceConfigRequest& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline DeleteResourceConfigRequest& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline DeleteResourceConfigRequest& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

Unique identifier of the resource.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline DeleteResourceConfigRequest& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline DeleteResourceConfigRequest& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline DeleteResourceConfigRequest& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + private: + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteRetentionConfigurationRequest.h b/include/aws/config/model/DeleteRetentionConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..eec929b30b25587a7e25c3086c1614a80df9d058 --- /dev/null +++ b/include/aws/config/model/DeleteRetentionConfigurationRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteRetentionConfigurationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteRetentionConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteRetentionConfiguration"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the retention configuration to delete.

+ */ + inline const Aws::String& GetRetentionConfigurationName() const{ return m_retentionConfigurationName; } + inline bool RetentionConfigurationNameHasBeenSet() const { return m_retentionConfigurationNameHasBeenSet; } + inline void SetRetentionConfigurationName(const Aws::String& value) { m_retentionConfigurationNameHasBeenSet = true; m_retentionConfigurationName = value; } + inline void SetRetentionConfigurationName(Aws::String&& value) { m_retentionConfigurationNameHasBeenSet = true; m_retentionConfigurationName = std::move(value); } + inline void SetRetentionConfigurationName(const char* value) { m_retentionConfigurationNameHasBeenSet = true; m_retentionConfigurationName.assign(value); } + inline DeleteRetentionConfigurationRequest& WithRetentionConfigurationName(const Aws::String& value) { SetRetentionConfigurationName(value); return *this;} + inline DeleteRetentionConfigurationRequest& WithRetentionConfigurationName(Aws::String&& value) { SetRetentionConfigurationName(std::move(value)); return *this;} + inline DeleteRetentionConfigurationRequest& WithRetentionConfigurationName(const char* value) { SetRetentionConfigurationName(value); return *this;} + ///@} + private: + + Aws::String m_retentionConfigurationName; + bool m_retentionConfigurationNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteServiceLinkedConfigurationRecorderRequest.h b/include/aws/config/model/DeleteServiceLinkedConfigurationRecorderRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..dbd580e4b8dc25e4d8220a3b78d792fe47db5cb8 --- /dev/null +++ b/include/aws/config/model/DeleteServiceLinkedConfigurationRecorderRequest.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteServiceLinkedConfigurationRecorderRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteServiceLinkedConfigurationRecorderRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteServiceLinkedConfigurationRecorder"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The service principal of the Amazon Web Services service for the + * service-linked configuration recorder that you want to delete.

+ */ + inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); } + inline DeleteServiceLinkedConfigurationRecorderRequest& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;} + inline DeleteServiceLinkedConfigurationRecorderRequest& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;} + inline DeleteServiceLinkedConfigurationRecorderRequest& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;} + ///@} + private: + + Aws::String m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteServiceLinkedConfigurationRecorderResult.h b/include/aws/config/model/DeleteServiceLinkedConfigurationRecorderResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f1ce0b7e39e3dc821a7b2f265aea717fa326f378 --- /dev/null +++ b/include/aws/config/model/DeleteServiceLinkedConfigurationRecorderResult.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DeleteServiceLinkedConfigurationRecorderResult + { + public: + AWS_CONFIGSERVICE_API DeleteServiceLinkedConfigurationRecorderResult(); + AWS_CONFIGSERVICE_API DeleteServiceLinkedConfigurationRecorderResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DeleteServiceLinkedConfigurationRecorderResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the specified configuration recorder.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline void SetArn(const Aws::String& value) { m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arn.assign(value); } + inline DeleteServiceLinkedConfigurationRecorderResult& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline DeleteServiceLinkedConfigurationRecorderResult& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline DeleteServiceLinkedConfigurationRecorderResult& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the specified configuration recorder.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline void SetName(const Aws::String& value) { m_name = value; } + inline void SetName(Aws::String&& value) { m_name = std::move(value); } + inline void SetName(const char* value) { m_name.assign(value); } + inline DeleteServiceLinkedConfigurationRecorderResult& WithName(const Aws::String& value) { SetName(value); return *this;} + inline DeleteServiceLinkedConfigurationRecorderResult& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline DeleteServiceLinkedConfigurationRecorderResult& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteServiceLinkedConfigurationRecorderResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteServiceLinkedConfigurationRecorderResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteServiceLinkedConfigurationRecorderResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_arn; + + Aws::String m_name; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteStoredQueryRequest.h b/include/aws/config/model/DeleteStoredQueryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d9c484c0bbed50efda17f8e371cf21654f5575b8 --- /dev/null +++ b/include/aws/config/model/DeleteStoredQueryRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DeleteStoredQueryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeleteStoredQueryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteStoredQuery"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the query that you want to delete.

+ */ + inline const Aws::String& GetQueryName() const{ return m_queryName; } + inline bool QueryNameHasBeenSet() const { return m_queryNameHasBeenSet; } + inline void SetQueryName(const Aws::String& value) { m_queryNameHasBeenSet = true; m_queryName = value; } + inline void SetQueryName(Aws::String&& value) { m_queryNameHasBeenSet = true; m_queryName = std::move(value); } + inline void SetQueryName(const char* value) { m_queryNameHasBeenSet = true; m_queryName.assign(value); } + inline DeleteStoredQueryRequest& WithQueryName(const Aws::String& value) { SetQueryName(value); return *this;} + inline DeleteStoredQueryRequest& WithQueryName(Aws::String&& value) { SetQueryName(std::move(value)); return *this;} + inline DeleteStoredQueryRequest& WithQueryName(const char* value) { SetQueryName(value); return *this;} + ///@} + private: + + Aws::String m_queryName; + bool m_queryNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeleteStoredQueryResult.h b/include/aws/config/model/DeleteStoredQueryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..660073a2f41550b6be805adcfcdae650af4e3354 --- /dev/null +++ b/include/aws/config/model/DeleteStoredQueryResult.h @@ -0,0 +1,52 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DeleteStoredQueryResult + { + public: + AWS_CONFIGSERVICE_API DeleteStoredQueryResult(); + AWS_CONFIGSERVICE_API DeleteStoredQueryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DeleteStoredQueryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteStoredQueryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteStoredQueryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteStoredQueryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeliverConfigSnapshotRequest.h b/include/aws/config/model/DeliverConfigSnapshotRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..7c67490245d0ffdfb0ff72653c3a066d058b45b2 --- /dev/null +++ b/include/aws/config/model/DeliverConfigSnapshotRequest.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the DeliverConfigSnapshot action.

See + * Also:

AWS + * API Reference

+ */ + class DeliverConfigSnapshotRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DeliverConfigSnapshotRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeliverConfigSnapshot"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the delivery channel through which the snapshot is delivered.

+ */ + inline const Aws::String& GetDeliveryChannelName() const{ return m_deliveryChannelName; } + inline bool DeliveryChannelNameHasBeenSet() const { return m_deliveryChannelNameHasBeenSet; } + inline void SetDeliveryChannelName(const Aws::String& value) { m_deliveryChannelNameHasBeenSet = true; m_deliveryChannelName = value; } + inline void SetDeliveryChannelName(Aws::String&& value) { m_deliveryChannelNameHasBeenSet = true; m_deliveryChannelName = std::move(value); } + inline void SetDeliveryChannelName(const char* value) { m_deliveryChannelNameHasBeenSet = true; m_deliveryChannelName.assign(value); } + inline DeliverConfigSnapshotRequest& WithDeliveryChannelName(const Aws::String& value) { SetDeliveryChannelName(value); return *this;} + inline DeliverConfigSnapshotRequest& WithDeliveryChannelName(Aws::String&& value) { SetDeliveryChannelName(std::move(value)); return *this;} + inline DeliverConfigSnapshotRequest& WithDeliveryChannelName(const char* value) { SetDeliveryChannelName(value); return *this;} + ///@} + private: + + Aws::String m_deliveryChannelName; + bool m_deliveryChannelNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeliverConfigSnapshotResult.h b/include/aws/config/model/DeliverConfigSnapshotResult.h new file mode 100644 index 0000000000000000000000000000000000000000..ea615fe1bf940d7b9fead2f8d96e3bfb38d8e8cd --- /dev/null +++ b/include/aws/config/model/DeliverConfigSnapshotResult.h @@ -0,0 +1,73 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output for the DeliverConfigSnapshot action, in JSON + * format.

See Also:

AWS + * API Reference

+ */ + class DeliverConfigSnapshotResult + { + public: + AWS_CONFIGSERVICE_API DeliverConfigSnapshotResult(); + AWS_CONFIGSERVICE_API DeliverConfigSnapshotResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DeliverConfigSnapshotResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The ID of the snapshot that is being created.

+ */ + inline const Aws::String& GetConfigSnapshotId() const{ return m_configSnapshotId; } + inline void SetConfigSnapshotId(const Aws::String& value) { m_configSnapshotId = value; } + inline void SetConfigSnapshotId(Aws::String&& value) { m_configSnapshotId = std::move(value); } + inline void SetConfigSnapshotId(const char* value) { m_configSnapshotId.assign(value); } + inline DeliverConfigSnapshotResult& WithConfigSnapshotId(const Aws::String& value) { SetConfigSnapshotId(value); return *this;} + inline DeliverConfigSnapshotResult& WithConfigSnapshotId(Aws::String&& value) { SetConfigSnapshotId(std::move(value)); return *this;} + inline DeliverConfigSnapshotResult& WithConfigSnapshotId(const char* value) { SetConfigSnapshotId(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeliverConfigSnapshotResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeliverConfigSnapshotResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeliverConfigSnapshotResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_configSnapshotId; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeliveryChannel.h b/include/aws/config/model/DeliveryChannel.h new file mode 100644 index 0000000000000000000000000000000000000000..3326dc2836ddba9d245f01749b9e6a31fc163eaa --- /dev/null +++ b/include/aws/config/model/DeliveryChannel.h @@ -0,0 +1,163 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The channel through which Config delivers notifications and updated + * configuration states.

See Also:

AWS + * API Reference

+ */ + class DeliveryChannel + { + public: + AWS_CONFIGSERVICE_API DeliveryChannel(); + AWS_CONFIGSERVICE_API DeliveryChannel(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API DeliveryChannel& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the delivery channel. By default, Config assigns the name + * "default" when creating the delivery channel. To change the delivery channel + * name, you must use the DeleteDeliveryChannel action to delete your current + * delivery channel, and then you must use the PutDeliveryChannel command to create + * a delivery channel that has the desired name.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline DeliveryChannel& WithName(const Aws::String& value) { SetName(value); return *this;} + inline DeliveryChannel& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline DeliveryChannel& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the Amazon S3 bucket to which Config delivers configuration + * snapshots and configuration history files.

If you specify a bucket that + * belongs to another Amazon Web Services account, that bucket must have policies + * that grant access permissions to Config. For more information, see Permissions + * for the Amazon S3 Bucket in the Config Developer Guide.

+ */ + inline const Aws::String& GetS3BucketName() const{ return m_s3BucketName; } + inline bool S3BucketNameHasBeenSet() const { return m_s3BucketNameHasBeenSet; } + inline void SetS3BucketName(const Aws::String& value) { m_s3BucketNameHasBeenSet = true; m_s3BucketName = value; } + inline void SetS3BucketName(Aws::String&& value) { m_s3BucketNameHasBeenSet = true; m_s3BucketName = std::move(value); } + inline void SetS3BucketName(const char* value) { m_s3BucketNameHasBeenSet = true; m_s3BucketName.assign(value); } + inline DeliveryChannel& WithS3BucketName(const Aws::String& value) { SetS3BucketName(value); return *this;} + inline DeliveryChannel& WithS3BucketName(Aws::String&& value) { SetS3BucketName(std::move(value)); return *this;} + inline DeliveryChannel& WithS3BucketName(const char* value) { SetS3BucketName(value); return *this;} + ///@} + + ///@{ + /** + *

The prefix for the specified Amazon S3 bucket.

+ */ + inline const Aws::String& GetS3KeyPrefix() const{ return m_s3KeyPrefix; } + inline bool S3KeyPrefixHasBeenSet() const { return m_s3KeyPrefixHasBeenSet; } + inline void SetS3KeyPrefix(const Aws::String& value) { m_s3KeyPrefixHasBeenSet = true; m_s3KeyPrefix = value; } + inline void SetS3KeyPrefix(Aws::String&& value) { m_s3KeyPrefixHasBeenSet = true; m_s3KeyPrefix = std::move(value); } + inline void SetS3KeyPrefix(const char* value) { m_s3KeyPrefixHasBeenSet = true; m_s3KeyPrefix.assign(value); } + inline DeliveryChannel& WithS3KeyPrefix(const Aws::String& value) { SetS3KeyPrefix(value); return *this;} + inline DeliveryChannel& WithS3KeyPrefix(Aws::String&& value) { SetS3KeyPrefix(std::move(value)); return *this;} + inline DeliveryChannel& WithS3KeyPrefix(const char* value) { SetS3KeyPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the Key Management Service (KMS ) KMS key + * (KMS key) used to encrypt objects delivered by Config. Must belong to the same + * Region as the destination S3 bucket.

+ */ + inline const Aws::String& GetS3KmsKeyArn() const{ return m_s3KmsKeyArn; } + inline bool S3KmsKeyArnHasBeenSet() const { return m_s3KmsKeyArnHasBeenSet; } + inline void SetS3KmsKeyArn(const Aws::String& value) { m_s3KmsKeyArnHasBeenSet = true; m_s3KmsKeyArn = value; } + inline void SetS3KmsKeyArn(Aws::String&& value) { m_s3KmsKeyArnHasBeenSet = true; m_s3KmsKeyArn = std::move(value); } + inline void SetS3KmsKeyArn(const char* value) { m_s3KmsKeyArnHasBeenSet = true; m_s3KmsKeyArn.assign(value); } + inline DeliveryChannel& WithS3KmsKeyArn(const Aws::String& value) { SetS3KmsKeyArn(value); return *this;} + inline DeliveryChannel& WithS3KmsKeyArn(Aws::String&& value) { SetS3KmsKeyArn(std::move(value)); return *this;} + inline DeliveryChannel& WithS3KmsKeyArn(const char* value) { SetS3KmsKeyArn(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the Amazon SNS topic to which Config sends + * notifications about configuration changes.

If you choose a topic from + * another account, the topic must have policies that grant access permissions to + * Config. For more information, see Permissions + * for the Amazon SNS Topic in the Config Developer Guide.

+ */ + inline const Aws::String& GetSnsTopicARN() const{ return m_snsTopicARN; } + inline bool SnsTopicARNHasBeenSet() const { return m_snsTopicARNHasBeenSet; } + inline void SetSnsTopicARN(const Aws::String& value) { m_snsTopicARNHasBeenSet = true; m_snsTopicARN = value; } + inline void SetSnsTopicARN(Aws::String&& value) { m_snsTopicARNHasBeenSet = true; m_snsTopicARN = std::move(value); } + inline void SetSnsTopicARN(const char* value) { m_snsTopicARNHasBeenSet = true; m_snsTopicARN.assign(value); } + inline DeliveryChannel& WithSnsTopicARN(const Aws::String& value) { SetSnsTopicARN(value); return *this;} + inline DeliveryChannel& WithSnsTopicARN(Aws::String&& value) { SetSnsTopicARN(std::move(value)); return *this;} + inline DeliveryChannel& WithSnsTopicARN(const char* value) { SetSnsTopicARN(value); return *this;} + ///@} + + ///@{ + /** + *

The options for how often Config delivers configuration snapshots to the + * Amazon S3 bucket.

+ */ + inline const ConfigSnapshotDeliveryProperties& GetConfigSnapshotDeliveryProperties() const{ return m_configSnapshotDeliveryProperties; } + inline bool ConfigSnapshotDeliveryPropertiesHasBeenSet() const { return m_configSnapshotDeliveryPropertiesHasBeenSet; } + inline void SetConfigSnapshotDeliveryProperties(const ConfigSnapshotDeliveryProperties& value) { m_configSnapshotDeliveryPropertiesHasBeenSet = true; m_configSnapshotDeliveryProperties = value; } + inline void SetConfigSnapshotDeliveryProperties(ConfigSnapshotDeliveryProperties&& value) { m_configSnapshotDeliveryPropertiesHasBeenSet = true; m_configSnapshotDeliveryProperties = std::move(value); } + inline DeliveryChannel& WithConfigSnapshotDeliveryProperties(const ConfigSnapshotDeliveryProperties& value) { SetConfigSnapshotDeliveryProperties(value); return *this;} + inline DeliveryChannel& WithConfigSnapshotDeliveryProperties(ConfigSnapshotDeliveryProperties&& value) { SetConfigSnapshotDeliveryProperties(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + Aws::String m_s3BucketName; + bool m_s3BucketNameHasBeenSet = false; + + Aws::String m_s3KeyPrefix; + bool m_s3KeyPrefixHasBeenSet = false; + + Aws::String m_s3KmsKeyArn; + bool m_s3KmsKeyArnHasBeenSet = false; + + Aws::String m_snsTopicARN; + bool m_snsTopicARNHasBeenSet = false; + + ConfigSnapshotDeliveryProperties m_configSnapshotDeliveryProperties; + bool m_configSnapshotDeliveryPropertiesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeliveryChannelStatus.h b/include/aws/config/model/DeliveryChannelStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..ede9922a2bbfffa1fdec1f534ecbbb321312ccff --- /dev/null +++ b/include/aws/config/model/DeliveryChannelStatus.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The status of a specified delivery channel.

Valid values: + * Success | Failure

See Also:

AWS + * API Reference

+ */ + class DeliveryChannelStatus + { + public: + AWS_CONFIGSERVICE_API DeliveryChannelStatus(); + AWS_CONFIGSERVICE_API DeliveryChannelStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API DeliveryChannelStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the delivery channel.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline DeliveryChannelStatus& WithName(const Aws::String& value) { SetName(value); return *this;} + inline DeliveryChannelStatus& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline DeliveryChannelStatus& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

A list containing the status of the delivery of the snapshot to the specified + * Amazon S3 bucket.

+ */ + inline const ConfigExportDeliveryInfo& GetConfigSnapshotDeliveryInfo() const{ return m_configSnapshotDeliveryInfo; } + inline bool ConfigSnapshotDeliveryInfoHasBeenSet() const { return m_configSnapshotDeliveryInfoHasBeenSet; } + inline void SetConfigSnapshotDeliveryInfo(const ConfigExportDeliveryInfo& value) { m_configSnapshotDeliveryInfoHasBeenSet = true; m_configSnapshotDeliveryInfo = value; } + inline void SetConfigSnapshotDeliveryInfo(ConfigExportDeliveryInfo&& value) { m_configSnapshotDeliveryInfoHasBeenSet = true; m_configSnapshotDeliveryInfo = std::move(value); } + inline DeliveryChannelStatus& WithConfigSnapshotDeliveryInfo(const ConfigExportDeliveryInfo& value) { SetConfigSnapshotDeliveryInfo(value); return *this;} + inline DeliveryChannelStatus& WithConfigSnapshotDeliveryInfo(ConfigExportDeliveryInfo&& value) { SetConfigSnapshotDeliveryInfo(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A list that contains the status of the delivery of the configuration history + * to the specified Amazon S3 bucket.

+ */ + inline const ConfigExportDeliveryInfo& GetConfigHistoryDeliveryInfo() const{ return m_configHistoryDeliveryInfo; } + inline bool ConfigHistoryDeliveryInfoHasBeenSet() const { return m_configHistoryDeliveryInfoHasBeenSet; } + inline void SetConfigHistoryDeliveryInfo(const ConfigExportDeliveryInfo& value) { m_configHistoryDeliveryInfoHasBeenSet = true; m_configHistoryDeliveryInfo = value; } + inline void SetConfigHistoryDeliveryInfo(ConfigExportDeliveryInfo&& value) { m_configHistoryDeliveryInfoHasBeenSet = true; m_configHistoryDeliveryInfo = std::move(value); } + inline DeliveryChannelStatus& WithConfigHistoryDeliveryInfo(const ConfigExportDeliveryInfo& value) { SetConfigHistoryDeliveryInfo(value); return *this;} + inline DeliveryChannelStatus& WithConfigHistoryDeliveryInfo(ConfigExportDeliveryInfo&& value) { SetConfigHistoryDeliveryInfo(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A list containing the status of the delivery of the configuration stream + * notification to the specified Amazon SNS topic.

+ */ + inline const ConfigStreamDeliveryInfo& GetConfigStreamDeliveryInfo() const{ return m_configStreamDeliveryInfo; } + inline bool ConfigStreamDeliveryInfoHasBeenSet() const { return m_configStreamDeliveryInfoHasBeenSet; } + inline void SetConfigStreamDeliveryInfo(const ConfigStreamDeliveryInfo& value) { m_configStreamDeliveryInfoHasBeenSet = true; m_configStreamDeliveryInfo = value; } + inline void SetConfigStreamDeliveryInfo(ConfigStreamDeliveryInfo&& value) { m_configStreamDeliveryInfoHasBeenSet = true; m_configStreamDeliveryInfo = std::move(value); } + inline DeliveryChannelStatus& WithConfigStreamDeliveryInfo(const ConfigStreamDeliveryInfo& value) { SetConfigStreamDeliveryInfo(value); return *this;} + inline DeliveryChannelStatus& WithConfigStreamDeliveryInfo(ConfigStreamDeliveryInfo&& value) { SetConfigStreamDeliveryInfo(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + ConfigExportDeliveryInfo m_configSnapshotDeliveryInfo; + bool m_configSnapshotDeliveryInfoHasBeenSet = false; + + ConfigExportDeliveryInfo m_configHistoryDeliveryInfo; + bool m_configHistoryDeliveryInfoHasBeenSet = false; + + ConfigStreamDeliveryInfo m_configStreamDeliveryInfo; + bool m_configStreamDeliveryInfoHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DeliveryStatus.h b/include/aws/config/model/DeliveryStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..213d9bb64c7deebc988052be1ea4eb5cf6406dfc --- /dev/null +++ b/include/aws/config/model/DeliveryStatus.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class DeliveryStatus + { + NOT_SET, + Success, + Failure, + Not_Applicable + }; + +namespace DeliveryStatusMapper +{ +AWS_CONFIGSERVICE_API DeliveryStatus GetDeliveryStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForDeliveryStatus(DeliveryStatus value); +} // namespace DeliveryStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeAggregateComplianceByConfigRulesRequest.h b/include/aws/config/model/DescribeAggregateComplianceByConfigRulesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..bdd3d36211bd2646161361aa764f263e3418782d --- /dev/null +++ b/include/aws/config/model/DescribeAggregateComplianceByConfigRulesRequest.h @@ -0,0 +1,106 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeAggregateComplianceByConfigRulesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConfigRulesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeAggregateComplianceByConfigRules"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline DescribeAggregateComplianceByConfigRulesRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline DescribeAggregateComplianceByConfigRulesRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConfigRulesRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results by ConfigRuleComplianceFilters object.

+ */ + inline const ConfigRuleComplianceFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ConfigRuleComplianceFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ConfigRuleComplianceFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline DescribeAggregateComplianceByConfigRulesRequest& WithFilters(const ConfigRuleComplianceFilters& value) { SetFilters(value); return *this;} + inline DescribeAggregateComplianceByConfigRulesRequest& WithFilters(ConfigRuleComplianceFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of evaluation results returned on each page. The default + * is maximum. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeAggregateComplianceByConfigRulesRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeAggregateComplianceByConfigRulesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeAggregateComplianceByConfigRulesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConfigRulesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + ConfigRuleComplianceFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeAggregateComplianceByConfigRulesResult.h b/include/aws/config/model/DescribeAggregateComplianceByConfigRulesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..2d9dd759b3e110315805d1953f453cb0d48bf034 --- /dev/null +++ b/include/aws/config/model/DescribeAggregateComplianceByConfigRulesResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeAggregateComplianceByConfigRulesResult + { + public: + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConfigRulesResult(); + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConfigRulesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConfigRulesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of AggregateComplianceByConfigRule object.

+ */ + inline const Aws::Vector& GetAggregateComplianceByConfigRules() const{ return m_aggregateComplianceByConfigRules; } + inline void SetAggregateComplianceByConfigRules(const Aws::Vector& value) { m_aggregateComplianceByConfigRules = value; } + inline void SetAggregateComplianceByConfigRules(Aws::Vector&& value) { m_aggregateComplianceByConfigRules = std::move(value); } + inline DescribeAggregateComplianceByConfigRulesResult& WithAggregateComplianceByConfigRules(const Aws::Vector& value) { SetAggregateComplianceByConfigRules(value); return *this;} + inline DescribeAggregateComplianceByConfigRulesResult& WithAggregateComplianceByConfigRules(Aws::Vector&& value) { SetAggregateComplianceByConfigRules(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConfigRulesResult& AddAggregateComplianceByConfigRules(const AggregateComplianceByConfigRule& value) { m_aggregateComplianceByConfigRules.push_back(value); return *this; } + inline DescribeAggregateComplianceByConfigRulesResult& AddAggregateComplianceByConfigRules(AggregateComplianceByConfigRule&& value) { m_aggregateComplianceByConfigRules.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeAggregateComplianceByConfigRulesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeAggregateComplianceByConfigRulesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConfigRulesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeAggregateComplianceByConfigRulesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeAggregateComplianceByConfigRulesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConfigRulesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_aggregateComplianceByConfigRules; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeAggregateComplianceByConformancePacksRequest.h b/include/aws/config/model/DescribeAggregateComplianceByConformancePacksRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c8a66c8e38db3d38579b65dfeb67d6bfccaa344f --- /dev/null +++ b/include/aws/config/model/DescribeAggregateComplianceByConformancePacksRequest.h @@ -0,0 +1,107 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeAggregateComplianceByConformancePacksRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConformancePacksRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeAggregateComplianceByConformancePacks"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline DescribeAggregateComplianceByConformancePacksRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline DescribeAggregateComplianceByConformancePacksRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConformancePacksRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the result by AggregateConformancePackComplianceFilters + * object.

+ */ + inline const AggregateConformancePackComplianceFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const AggregateConformancePackComplianceFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(AggregateConformancePackComplianceFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline DescribeAggregateComplianceByConformancePacksRequest& WithFilters(const AggregateConformancePackComplianceFilters& value) { SetFilters(value); return *this;} + inline DescribeAggregateComplianceByConformancePacksRequest& WithFilters(AggregateConformancePackComplianceFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of conformance packs compliance details returned on each + * page. The default is maximum. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeAggregateComplianceByConformancePacksRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeAggregateComplianceByConformancePacksRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeAggregateComplianceByConformancePacksRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConformancePacksRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + AggregateConformancePackComplianceFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeAggregateComplianceByConformancePacksResult.h b/include/aws/config/model/DescribeAggregateComplianceByConformancePacksResult.h new file mode 100644 index 0000000000000000000000000000000000000000..8df9c16b3781a2e7711a72f09fb8725c03dc1383 --- /dev/null +++ b/include/aws/config/model/DescribeAggregateComplianceByConformancePacksResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeAggregateComplianceByConformancePacksResult + { + public: + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConformancePacksResult(); + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConformancePacksResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeAggregateComplianceByConformancePacksResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns the AggregateComplianceByConformancePack object.

+ */ + inline const Aws::Vector& GetAggregateComplianceByConformancePacks() const{ return m_aggregateComplianceByConformancePacks; } + inline void SetAggregateComplianceByConformancePacks(const Aws::Vector& value) { m_aggregateComplianceByConformancePacks = value; } + inline void SetAggregateComplianceByConformancePacks(Aws::Vector&& value) { m_aggregateComplianceByConformancePacks = std::move(value); } + inline DescribeAggregateComplianceByConformancePacksResult& WithAggregateComplianceByConformancePacks(const Aws::Vector& value) { SetAggregateComplianceByConformancePacks(value); return *this;} + inline DescribeAggregateComplianceByConformancePacksResult& WithAggregateComplianceByConformancePacks(Aws::Vector&& value) { SetAggregateComplianceByConformancePacks(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConformancePacksResult& AddAggregateComplianceByConformancePacks(const AggregateComplianceByConformancePack& value) { m_aggregateComplianceByConformancePacks.push_back(value); return *this; } + inline DescribeAggregateComplianceByConformancePacksResult& AddAggregateComplianceByConformancePacks(AggregateComplianceByConformancePack&& value) { m_aggregateComplianceByConformancePacks.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeAggregateComplianceByConformancePacksResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeAggregateComplianceByConformancePacksResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConformancePacksResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeAggregateComplianceByConformancePacksResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeAggregateComplianceByConformancePacksResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeAggregateComplianceByConformancePacksResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_aggregateComplianceByConformancePacks; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeAggregationAuthorizationsRequest.h b/include/aws/config/model/DescribeAggregationAuthorizationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..b3ff75bf66565d22901dbc68a69f1b8026ff5c72 --- /dev/null +++ b/include/aws/config/model/DescribeAggregationAuthorizationsRequest.h @@ -0,0 +1,73 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeAggregationAuthorizationsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeAggregationAuthorizationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeAggregationAuthorizations"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The maximum number of AggregationAuthorizations returned on each page. The + * default is maximum. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeAggregationAuthorizationsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeAggregationAuthorizationsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeAggregationAuthorizationsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeAggregationAuthorizationsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeAggregationAuthorizationsResult.h b/include/aws/config/model/DescribeAggregationAuthorizationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..bbf49992f489ccc7b22754bcf51d71a381d97edd --- /dev/null +++ b/include/aws/config/model/DescribeAggregationAuthorizationsResult.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeAggregationAuthorizationsResult + { + public: + AWS_CONFIGSERVICE_API DescribeAggregationAuthorizationsResult(); + AWS_CONFIGSERVICE_API DescribeAggregationAuthorizationsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeAggregationAuthorizationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of authorizations granted to various aggregator accounts and + * regions.

+ */ + inline const Aws::Vector& GetAggregationAuthorizations() const{ return m_aggregationAuthorizations; } + inline void SetAggregationAuthorizations(const Aws::Vector& value) { m_aggregationAuthorizations = value; } + inline void SetAggregationAuthorizations(Aws::Vector&& value) { m_aggregationAuthorizations = std::move(value); } + inline DescribeAggregationAuthorizationsResult& WithAggregationAuthorizations(const Aws::Vector& value) { SetAggregationAuthorizations(value); return *this;} + inline DescribeAggregationAuthorizationsResult& WithAggregationAuthorizations(Aws::Vector&& value) { SetAggregationAuthorizations(std::move(value)); return *this;} + inline DescribeAggregationAuthorizationsResult& AddAggregationAuthorizations(const AggregationAuthorization& value) { m_aggregationAuthorizations.push_back(value); return *this; } + inline DescribeAggregationAuthorizationsResult& AddAggregationAuthorizations(AggregationAuthorization&& value) { m_aggregationAuthorizations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeAggregationAuthorizationsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeAggregationAuthorizationsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeAggregationAuthorizationsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeAggregationAuthorizationsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeAggregationAuthorizationsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeAggregationAuthorizationsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_aggregationAuthorizations; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeComplianceByConfigRuleRequest.h b/include/aws/config/model/DescribeComplianceByConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..7b6a1526706aafd0feda94cd617b05222d37097d --- /dev/null +++ b/include/aws/config/model/DescribeComplianceByConfigRuleRequest.h @@ -0,0 +1,99 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeComplianceByConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeComplianceByConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeComplianceByConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Specify one or more Config rule names to filter the results by rule.

+ */ + inline const Aws::Vector& GetConfigRuleNames() const{ return m_configRuleNames; } + inline bool ConfigRuleNamesHasBeenSet() const { return m_configRuleNamesHasBeenSet; } + inline void SetConfigRuleNames(const Aws::Vector& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = value; } + inline void SetConfigRuleNames(Aws::Vector&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = std::move(value); } + inline DescribeComplianceByConfigRuleRequest& WithConfigRuleNames(const Aws::Vector& value) { SetConfigRuleNames(value); return *this;} + inline DescribeComplianceByConfigRuleRequest& WithConfigRuleNames(Aws::Vector&& value) { SetConfigRuleNames(std::move(value)); return *this;} + inline DescribeComplianceByConfigRuleRequest& AddConfigRuleNames(const Aws::String& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + inline DescribeComplianceByConfigRuleRequest& AddConfigRuleNames(Aws::String&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(std::move(value)); return *this; } + inline DescribeComplianceByConfigRuleRequest& AddConfigRuleNames(const char* value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Filters the results by compliance.

+ */ + inline const Aws::Vector& GetComplianceTypes() const{ return m_complianceTypes; } + inline bool ComplianceTypesHasBeenSet() const { return m_complianceTypesHasBeenSet; } + inline void SetComplianceTypes(const Aws::Vector& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = value; } + inline void SetComplianceTypes(Aws::Vector&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = std::move(value); } + inline DescribeComplianceByConfigRuleRequest& WithComplianceTypes(const Aws::Vector& value) { SetComplianceTypes(value); return *this;} + inline DescribeComplianceByConfigRuleRequest& WithComplianceTypes(Aws::Vector&& value) { SetComplianceTypes(std::move(value)); return *this;} + inline DescribeComplianceByConfigRuleRequest& AddComplianceTypes(const ComplianceType& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(value); return *this; } + inline DescribeComplianceByConfigRuleRequest& AddComplianceTypes(ComplianceType&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeComplianceByConfigRuleRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeComplianceByConfigRuleRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeComplianceByConfigRuleRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_configRuleNames; + bool m_configRuleNamesHasBeenSet = false; + + Aws::Vector m_complianceTypes; + bool m_complianceTypesHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeComplianceByConfigRuleResult.h b/include/aws/config/model/DescribeComplianceByConfigRuleResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c9465d6185ca39573af10e8311a9b3ed29c77bbb --- /dev/null +++ b/include/aws/config/model/DescribeComplianceByConfigRuleResult.h @@ -0,0 +1,90 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeComplianceByConfigRuleResult + { + public: + AWS_CONFIGSERVICE_API DescribeComplianceByConfigRuleResult(); + AWS_CONFIGSERVICE_API DescribeComplianceByConfigRuleResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeComplianceByConfigRuleResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether each of the specified Config rules is compliant.

+ */ + inline const Aws::Vector& GetComplianceByConfigRules() const{ return m_complianceByConfigRules; } + inline void SetComplianceByConfigRules(const Aws::Vector& value) { m_complianceByConfigRules = value; } + inline void SetComplianceByConfigRules(Aws::Vector&& value) { m_complianceByConfigRules = std::move(value); } + inline DescribeComplianceByConfigRuleResult& WithComplianceByConfigRules(const Aws::Vector& value) { SetComplianceByConfigRules(value); return *this;} + inline DescribeComplianceByConfigRuleResult& WithComplianceByConfigRules(Aws::Vector&& value) { SetComplianceByConfigRules(std::move(value)); return *this;} + inline DescribeComplianceByConfigRuleResult& AddComplianceByConfigRules(const ComplianceByConfigRule& value) { m_complianceByConfigRules.push_back(value); return *this; } + inline DescribeComplianceByConfigRuleResult& AddComplianceByConfigRules(ComplianceByConfigRule&& value) { m_complianceByConfigRules.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeComplianceByConfigRuleResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeComplianceByConfigRuleResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeComplianceByConfigRuleResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeComplianceByConfigRuleResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeComplianceByConfigRuleResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeComplianceByConfigRuleResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_complianceByConfigRules; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeComplianceByResourceRequest.h b/include/aws/config/model/DescribeComplianceByResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e6053150386a5ea4cff8dbb7476670acf0738742 --- /dev/null +++ b/include/aws/config/model/DescribeComplianceByResourceRequest.h @@ -0,0 +1,135 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeComplianceByResourceRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeComplianceByResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeComplianceByResource"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The types of Amazon Web Services resources for which you want compliance + * information (for example, AWS::EC2::Instance). For this operation, + * you can specify that the resource type is an Amazon Web Services account by + * specifying AWS::::Account.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline DescribeComplianceByResourceRequest& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline DescribeComplianceByResourceRequest& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline DescribeComplianceByResourceRequest& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource for which you want compliance + * information. You can specify only one resource ID. If you specify a resource ID, + * you must also specify a type for ResourceType.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline DescribeComplianceByResourceRequest& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline DescribeComplianceByResourceRequest& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline DescribeComplianceByResourceRequest& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results by compliance.

+ */ + inline const Aws::Vector& GetComplianceTypes() const{ return m_complianceTypes; } + inline bool ComplianceTypesHasBeenSet() const { return m_complianceTypesHasBeenSet; } + inline void SetComplianceTypes(const Aws::Vector& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = value; } + inline void SetComplianceTypes(Aws::Vector&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = std::move(value); } + inline DescribeComplianceByResourceRequest& WithComplianceTypes(const Aws::Vector& value) { SetComplianceTypes(value); return *this;} + inline DescribeComplianceByResourceRequest& WithComplianceTypes(Aws::Vector&& value) { SetComplianceTypes(std::move(value)); return *this;} + inline DescribeComplianceByResourceRequest& AddComplianceTypes(const ComplianceType& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(value); return *this; } + inline DescribeComplianceByResourceRequest& AddComplianceTypes(ComplianceType&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of evaluation results returned on each page. The default + * is 10. You cannot specify a number greater than 100. If you specify 0, Config + * uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeComplianceByResourceRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeComplianceByResourceRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeComplianceByResourceRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeComplianceByResourceRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::Vector m_complianceTypes; + bool m_complianceTypesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeComplianceByResourceResult.h b/include/aws/config/model/DescribeComplianceByResourceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..ee0a2e28f2a7ddb23c0d15b0cdf174f021e89153 --- /dev/null +++ b/include/aws/config/model/DescribeComplianceByResourceResult.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeComplianceByResourceResult + { + public: + AWS_CONFIGSERVICE_API DescribeComplianceByResourceResult(); + AWS_CONFIGSERVICE_API DescribeComplianceByResourceResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeComplianceByResourceResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether the specified Amazon Web Services resource complies with + * all of the Config rules that evaluate it.

+ */ + inline const Aws::Vector& GetComplianceByResources() const{ return m_complianceByResources; } + inline void SetComplianceByResources(const Aws::Vector& value) { m_complianceByResources = value; } + inline void SetComplianceByResources(Aws::Vector&& value) { m_complianceByResources = std::move(value); } + inline DescribeComplianceByResourceResult& WithComplianceByResources(const Aws::Vector& value) { SetComplianceByResources(value); return *this;} + inline DescribeComplianceByResourceResult& WithComplianceByResources(Aws::Vector&& value) { SetComplianceByResources(std::move(value)); return *this;} + inline DescribeComplianceByResourceResult& AddComplianceByResources(const ComplianceByResource& value) { m_complianceByResources.push_back(value); return *this; } + inline DescribeComplianceByResourceResult& AddComplianceByResources(ComplianceByResource&& value) { m_complianceByResources.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeComplianceByResourceResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeComplianceByResourceResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeComplianceByResourceResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeComplianceByResourceResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeComplianceByResourceResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeComplianceByResourceResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_complianceByResources; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigRuleEvaluationStatusRequest.h b/include/aws/config/model/DescribeConfigRuleEvaluationStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f6900166b9f3a5203aad0e2c16d4cb42bb201302 --- /dev/null +++ b/include/aws/config/model/DescribeConfigRuleEvaluationStatusRequest.h @@ -0,0 +1,101 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeConfigRuleEvaluationStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConfigRuleEvaluationStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConfigRuleEvaluationStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config managed rules for which you want status information. + * If you do not specify any names, Config returns status information for all + * Config managed rules that you use.

+ */ + inline const Aws::Vector& GetConfigRuleNames() const{ return m_configRuleNames; } + inline bool ConfigRuleNamesHasBeenSet() const { return m_configRuleNamesHasBeenSet; } + inline void SetConfigRuleNames(const Aws::Vector& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = value; } + inline void SetConfigRuleNames(Aws::Vector&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = std::move(value); } + inline DescribeConfigRuleEvaluationStatusRequest& WithConfigRuleNames(const Aws::Vector& value) { SetConfigRuleNames(value); return *this;} + inline DescribeConfigRuleEvaluationStatusRequest& WithConfigRuleNames(Aws::Vector&& value) { SetConfigRuleNames(std::move(value)); return *this;} + inline DescribeConfigRuleEvaluationStatusRequest& AddConfigRuleNames(const Aws::String& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + inline DescribeConfigRuleEvaluationStatusRequest& AddConfigRuleNames(Aws::String&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(std::move(value)); return *this; } + inline DescribeConfigRuleEvaluationStatusRequest& AddConfigRuleNames(const char* value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeConfigRuleEvaluationStatusRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigRuleEvaluationStatusRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigRuleEvaluationStatusRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

The number of rule evaluation results that you want returned.

This + * parameter is required if the rule limit for your account is more than the + * default of 1000 rules.

For information about requesting a rule limit + * increase, see Config + * Limits in the Amazon Web Services General Reference Guide.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeConfigRuleEvaluationStatusRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + private: + + Aws::Vector m_configRuleNames; + bool m_configRuleNamesHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigRuleEvaluationStatusResult.h b/include/aws/config/model/DescribeConfigRuleEvaluationStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a9f0d82a0888a849084e6527c7ca80ca6b5bddee --- /dev/null +++ b/include/aws/config/model/DescribeConfigRuleEvaluationStatusResult.h @@ -0,0 +1,90 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeConfigRuleEvaluationStatusResult + { + public: + AWS_CONFIGSERVICE_API DescribeConfigRuleEvaluationStatusResult(); + AWS_CONFIGSERVICE_API DescribeConfigRuleEvaluationStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConfigRuleEvaluationStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Status information about your Config managed rules.

+ */ + inline const Aws::Vector& GetConfigRulesEvaluationStatus() const{ return m_configRulesEvaluationStatus; } + inline void SetConfigRulesEvaluationStatus(const Aws::Vector& value) { m_configRulesEvaluationStatus = value; } + inline void SetConfigRulesEvaluationStatus(Aws::Vector&& value) { m_configRulesEvaluationStatus = std::move(value); } + inline DescribeConfigRuleEvaluationStatusResult& WithConfigRulesEvaluationStatus(const Aws::Vector& value) { SetConfigRulesEvaluationStatus(value); return *this;} + inline DescribeConfigRuleEvaluationStatusResult& WithConfigRulesEvaluationStatus(Aws::Vector&& value) { SetConfigRulesEvaluationStatus(std::move(value)); return *this;} + inline DescribeConfigRuleEvaluationStatusResult& AddConfigRulesEvaluationStatus(const ConfigRuleEvaluationStatus& value) { m_configRulesEvaluationStatus.push_back(value); return *this; } + inline DescribeConfigRuleEvaluationStatusResult& AddConfigRulesEvaluationStatus(ConfigRuleEvaluationStatus&& value) { m_configRulesEvaluationStatus.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeConfigRuleEvaluationStatusResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigRuleEvaluationStatusResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigRuleEvaluationStatusResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConfigRuleEvaluationStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConfigRuleEvaluationStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConfigRuleEvaluationStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_configRulesEvaluationStatus; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigRulesFilters.h b/include/aws/config/model/DescribeConfigRulesFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..c27d8c3965d52bcc9d275d9edd888e2e5c48f5e9 --- /dev/null +++ b/include/aws/config/model/DescribeConfigRulesFilters.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns a filtered list of Detective or Proactive Config rules. By default, + * if the filter is not defined, this API returns an unfiltered list. For more + * information on Detective or Proactive Config rules, see + * Evaluation Mode in the Config Developer Guide.

See + * Also:

AWS + * API Reference

+ */ + class DescribeConfigRulesFilters + { + public: + AWS_CONFIGSERVICE_API DescribeConfigRulesFilters(); + AWS_CONFIGSERVICE_API DescribeConfigRulesFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API DescribeConfigRulesFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The mode of an evaluation. The valid values are Detective or Proactive.

+ */ + inline const EvaluationMode& GetEvaluationMode() const{ return m_evaluationMode; } + inline bool EvaluationModeHasBeenSet() const { return m_evaluationModeHasBeenSet; } + inline void SetEvaluationMode(const EvaluationMode& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = value; } + inline void SetEvaluationMode(EvaluationMode&& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = std::move(value); } + inline DescribeConfigRulesFilters& WithEvaluationMode(const EvaluationMode& value) { SetEvaluationMode(value); return *this;} + inline DescribeConfigRulesFilters& WithEvaluationMode(EvaluationMode&& value) { SetEvaluationMode(std::move(value)); return *this;} + ///@} + private: + + EvaluationMode m_evaluationMode; + bool m_evaluationModeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigRulesRequest.h b/include/aws/config/model/DescribeConfigRulesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a2059bcbe3b86cb1f6a7ce29702f3f5e67d48fad --- /dev/null +++ b/include/aws/config/model/DescribeConfigRulesRequest.h @@ -0,0 +1,102 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeConfigRulesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConfigRulesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConfigRules"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The names of the Config rules for which you want details. If you do not + * specify any names, Config returns details for all your rules.

+ */ + inline const Aws::Vector& GetConfigRuleNames() const{ return m_configRuleNames; } + inline bool ConfigRuleNamesHasBeenSet() const { return m_configRuleNamesHasBeenSet; } + inline void SetConfigRuleNames(const Aws::Vector& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = value; } + inline void SetConfigRuleNames(Aws::Vector&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = std::move(value); } + inline DescribeConfigRulesRequest& WithConfigRuleNames(const Aws::Vector& value) { SetConfigRuleNames(value); return *this;} + inline DescribeConfigRulesRequest& WithConfigRuleNames(Aws::Vector&& value) { SetConfigRuleNames(std::move(value)); return *this;} + inline DescribeConfigRulesRequest& AddConfigRuleNames(const Aws::String& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + inline DescribeConfigRulesRequest& AddConfigRuleNames(Aws::String&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(std::move(value)); return *this; } + inline DescribeConfigRulesRequest& AddConfigRuleNames(const char* value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeConfigRulesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigRulesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigRulesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

Returns a list of Detective or Proactive Config rules. By default, this API + * returns an unfiltered list. For more information on Detective or Proactive + * Config rules, see + * Evaluation Mode in the Config Developer Guide.

+ */ + inline const DescribeConfigRulesFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const DescribeConfigRulesFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(DescribeConfigRulesFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline DescribeConfigRulesRequest& WithFilters(const DescribeConfigRulesFilters& value) { SetFilters(value); return *this;} + inline DescribeConfigRulesRequest& WithFilters(DescribeConfigRulesFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_configRuleNames; + bool m_configRuleNamesHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + DescribeConfigRulesFilters m_filters; + bool m_filtersHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigRulesResult.h b/include/aws/config/model/DescribeConfigRulesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..ab76fc175d9d3013e74ced61b37747446f9eeff7 --- /dev/null +++ b/include/aws/config/model/DescribeConfigRulesResult.h @@ -0,0 +1,90 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class DescribeConfigRulesResult + { + public: + AWS_CONFIGSERVICE_API DescribeConfigRulesResult(); + AWS_CONFIGSERVICE_API DescribeConfigRulesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConfigRulesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The details about your Config rules.

+ */ + inline const Aws::Vector& GetConfigRules() const{ return m_configRules; } + inline void SetConfigRules(const Aws::Vector& value) { m_configRules = value; } + inline void SetConfigRules(Aws::Vector&& value) { m_configRules = std::move(value); } + inline DescribeConfigRulesResult& WithConfigRules(const Aws::Vector& value) { SetConfigRules(value); return *this;} + inline DescribeConfigRulesResult& WithConfigRules(Aws::Vector&& value) { SetConfigRules(std::move(value)); return *this;} + inline DescribeConfigRulesResult& AddConfigRules(const ConfigRule& value) { m_configRules.push_back(value); return *this; } + inline DescribeConfigRulesResult& AddConfigRules(ConfigRule&& value) { m_configRules.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeConfigRulesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigRulesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigRulesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConfigRulesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConfigRulesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConfigRulesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_configRules; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationAggregatorSourcesStatusRequest.h b/include/aws/config/model/DescribeConfigurationAggregatorSourcesStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e9c5b3935f7ae6f81d2552f31e04eb0aaad304fc --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationAggregatorSourcesStatusRequest.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeConfigurationAggregatorSourcesStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorSourcesStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConfigurationAggregatorSourcesStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the status type.

  • Valid value FAILED indicates errors + * while moving data.

  • Valid value SUCCEEDED indicates the data + * was successfully moved.

  • Valid value OUTDATED indicates the + * data is not the most recent.

+ */ + inline const Aws::Vector& GetUpdateStatus() const{ return m_updateStatus; } + inline bool UpdateStatusHasBeenSet() const { return m_updateStatusHasBeenSet; } + inline void SetUpdateStatus(const Aws::Vector& value) { m_updateStatusHasBeenSet = true; m_updateStatus = value; } + inline void SetUpdateStatus(Aws::Vector&& value) { m_updateStatusHasBeenSet = true; m_updateStatus = std::move(value); } + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithUpdateStatus(const Aws::Vector& value) { SetUpdateStatus(value); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithUpdateStatus(Aws::Vector&& value) { SetUpdateStatus(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusRequest& AddUpdateStatus(const AggregatedSourceStatusType& value) { m_updateStatusHasBeenSet = true; m_updateStatus.push_back(value); return *this; } + inline DescribeConfigurationAggregatorSourcesStatusRequest& AddUpdateStatus(AggregatedSourceStatusType&& value) { m_updateStatusHasBeenSet = true; m_updateStatus.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of AggregatorSourceStatus returned on each page. The + * default is maximum. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeConfigurationAggregatorSourcesStatusRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + Aws::Vector m_updateStatus; + bool m_updateStatusHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationAggregatorSourcesStatusResult.h b/include/aws/config/model/DescribeConfigurationAggregatorSourcesStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..522c17f98cae52f90d7366cad5e1b9a4dd3b8ec1 --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationAggregatorSourcesStatusResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeConfigurationAggregatorSourcesStatusResult + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorSourcesStatusResult(); + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorSourcesStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorSourcesStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns an AggregatedSourceStatus object.

+ */ + inline const Aws::Vector& GetAggregatedSourceStatusList() const{ return m_aggregatedSourceStatusList; } + inline void SetAggregatedSourceStatusList(const Aws::Vector& value) { m_aggregatedSourceStatusList = value; } + inline void SetAggregatedSourceStatusList(Aws::Vector&& value) { m_aggregatedSourceStatusList = std::move(value); } + inline DescribeConfigurationAggregatorSourcesStatusResult& WithAggregatedSourceStatusList(const Aws::Vector& value) { SetAggregatedSourceStatusList(value); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusResult& WithAggregatedSourceStatusList(Aws::Vector&& value) { SetAggregatedSourceStatusList(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusResult& AddAggregatedSourceStatusList(const AggregatedSourceStatus& value) { m_aggregatedSourceStatusList.push_back(value); return *this; } + inline DescribeConfigurationAggregatorSourcesStatusResult& AddAggregatedSourceStatusList(AggregatedSourceStatus&& value) { m_aggregatedSourceStatusList.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeConfigurationAggregatorSourcesStatusResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConfigurationAggregatorSourcesStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorSourcesStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_aggregatedSourceStatusList; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationAggregatorsRequest.h b/include/aws/config/model/DescribeConfigurationAggregatorsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..783c95c191b5c3226003520a03316ef0f04d93cd --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationAggregatorsRequest.h @@ -0,0 +1,92 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeConfigurationAggregatorsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConfigurationAggregators"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregators.

+ */ + inline const Aws::Vector& GetConfigurationAggregatorNames() const{ return m_configurationAggregatorNames; } + inline bool ConfigurationAggregatorNamesHasBeenSet() const { return m_configurationAggregatorNamesHasBeenSet; } + inline void SetConfigurationAggregatorNames(const Aws::Vector& value) { m_configurationAggregatorNamesHasBeenSet = true; m_configurationAggregatorNames = value; } + inline void SetConfigurationAggregatorNames(Aws::Vector&& value) { m_configurationAggregatorNamesHasBeenSet = true; m_configurationAggregatorNames = std::move(value); } + inline DescribeConfigurationAggregatorsRequest& WithConfigurationAggregatorNames(const Aws::Vector& value) { SetConfigurationAggregatorNames(value); return *this;} + inline DescribeConfigurationAggregatorsRequest& WithConfigurationAggregatorNames(Aws::Vector&& value) { SetConfigurationAggregatorNames(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorsRequest& AddConfigurationAggregatorNames(const Aws::String& value) { m_configurationAggregatorNamesHasBeenSet = true; m_configurationAggregatorNames.push_back(value); return *this; } + inline DescribeConfigurationAggregatorsRequest& AddConfigurationAggregatorNames(Aws::String&& value) { m_configurationAggregatorNamesHasBeenSet = true; m_configurationAggregatorNames.push_back(std::move(value)); return *this; } + inline DescribeConfigurationAggregatorsRequest& AddConfigurationAggregatorNames(const char* value) { m_configurationAggregatorNamesHasBeenSet = true; m_configurationAggregatorNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeConfigurationAggregatorsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigurationAggregatorsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of configuration aggregators returned on each page. The + * default is maximum. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeConfigurationAggregatorsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationAggregatorNames; + bool m_configurationAggregatorNamesHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationAggregatorsResult.h b/include/aws/config/model/DescribeConfigurationAggregatorsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..13b6c179ece6d91f0a0f3f50ec52cea4ab75a051 --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationAggregatorsResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeConfigurationAggregatorsResult + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorsResult(); + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConfigurationAggregatorsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a ConfigurationAggregators object.

+ */ + inline const Aws::Vector& GetConfigurationAggregators() const{ return m_configurationAggregators; } + inline void SetConfigurationAggregators(const Aws::Vector& value) { m_configurationAggregators = value; } + inline void SetConfigurationAggregators(Aws::Vector&& value) { m_configurationAggregators = std::move(value); } + inline DescribeConfigurationAggregatorsResult& WithConfigurationAggregators(const Aws::Vector& value) { SetConfigurationAggregators(value); return *this;} + inline DescribeConfigurationAggregatorsResult& WithConfigurationAggregators(Aws::Vector&& value) { SetConfigurationAggregators(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorsResult& AddConfigurationAggregators(const ConfigurationAggregator& value) { m_configurationAggregators.push_back(value); return *this; } + inline DescribeConfigurationAggregatorsResult& AddConfigurationAggregators(ConfigurationAggregator&& value) { m_configurationAggregators.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeConfigurationAggregatorsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConfigurationAggregatorsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConfigurationAggregatorsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConfigurationAggregatorsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConfigurationAggregatorsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationAggregators; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationRecorderStatusRequest.h b/include/aws/config/model/DescribeConfigurationRecorderStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e6d461ff29c2fc545b676af091d3247c29f126c7 --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationRecorderStatusRequest.h @@ -0,0 +1,104 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the DescribeConfigurationRecorderStatus + * action.

See Also:

AWS + * API Reference

+ */ + class DescribeConfigurationRecorderStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationRecorderStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConfigurationRecorderStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration recorder. If the name is not specified, the + * opertation returns the status for the customer managed configuration recorder + * configured for the account, if applicable.

When making a request + * to this operation, you can only specify one configuration recorder.

+ */ + inline const Aws::Vector& GetConfigurationRecorderNames() const{ return m_configurationRecorderNames; } + inline bool ConfigurationRecorderNamesHasBeenSet() const { return m_configurationRecorderNamesHasBeenSet; } + inline void SetConfigurationRecorderNames(const Aws::Vector& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames = value; } + inline void SetConfigurationRecorderNames(Aws::Vector&& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames = std::move(value); } + inline DescribeConfigurationRecorderStatusRequest& WithConfigurationRecorderNames(const Aws::Vector& value) { SetConfigurationRecorderNames(value); return *this;} + inline DescribeConfigurationRecorderStatusRequest& WithConfigurationRecorderNames(Aws::Vector&& value) { SetConfigurationRecorderNames(std::move(value)); return *this;} + inline DescribeConfigurationRecorderStatusRequest& AddConfigurationRecorderNames(const Aws::String& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames.push_back(value); return *this; } + inline DescribeConfigurationRecorderStatusRequest& AddConfigurationRecorderNames(Aws::String&& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames.push_back(std::move(value)); return *this; } + inline DescribeConfigurationRecorderStatusRequest& AddConfigurationRecorderNames(const char* value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

For service-linked configuration recorders, you can use the service principal + * of the linked Amazon Web Services service to specify the configuration + * recorder.

+ */ + inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); } + inline DescribeConfigurationRecorderStatusRequest& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;} + inline DescribeConfigurationRecorderStatusRequest& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;} + inline DescribeConfigurationRecorderStatusRequest& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the configuration recorder that you want to + * specify.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline DescribeConfigurationRecorderStatusRequest& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline DescribeConfigurationRecorderStatusRequest& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline DescribeConfigurationRecorderStatusRequest& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationRecorderNames; + bool m_configurationRecorderNamesHasBeenSet = false; + + Aws::String m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationRecorderStatusResult.h b/include/aws/config/model/DescribeConfigurationRecorderStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..5cfa74ffec87bbab3163179b693815175d593448 --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationRecorderStatusResult.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output for the DescribeConfigurationRecorderStatus action, in JSON + * format.

See Also:

AWS + * API Reference

+ */ + class DescribeConfigurationRecorderStatusResult + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationRecorderStatusResult(); + AWS_CONFIGSERVICE_API DescribeConfigurationRecorderStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConfigurationRecorderStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list that contains status of the specified recorders.

+ */ + inline const Aws::Vector& GetConfigurationRecordersStatus() const{ return m_configurationRecordersStatus; } + inline void SetConfigurationRecordersStatus(const Aws::Vector& value) { m_configurationRecordersStatus = value; } + inline void SetConfigurationRecordersStatus(Aws::Vector&& value) { m_configurationRecordersStatus = std::move(value); } + inline DescribeConfigurationRecorderStatusResult& WithConfigurationRecordersStatus(const Aws::Vector& value) { SetConfigurationRecordersStatus(value); return *this;} + inline DescribeConfigurationRecorderStatusResult& WithConfigurationRecordersStatus(Aws::Vector&& value) { SetConfigurationRecordersStatus(std::move(value)); return *this;} + inline DescribeConfigurationRecorderStatusResult& AddConfigurationRecordersStatus(const ConfigurationRecorderStatus& value) { m_configurationRecordersStatus.push_back(value); return *this; } + inline DescribeConfigurationRecorderStatusResult& AddConfigurationRecordersStatus(ConfigurationRecorderStatus&& value) { m_configurationRecordersStatus.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConfigurationRecorderStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConfigurationRecorderStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConfigurationRecorderStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationRecordersStatus; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationRecordersRequest.h b/include/aws/config/model/DescribeConfigurationRecordersRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..cac8282731dc85ab6ddf6ee1a0fc276f7e9b6ee0 --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationRecordersRequest.h @@ -0,0 +1,101 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the DescribeConfigurationRecorders action.

See + * Also:

AWS + * API Reference

+ */ + class DescribeConfigurationRecordersRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationRecordersRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConfigurationRecorders"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of names of the configuration recorders that you want to specify.

+ */ + inline const Aws::Vector& GetConfigurationRecorderNames() const{ return m_configurationRecorderNames; } + inline bool ConfigurationRecorderNamesHasBeenSet() const { return m_configurationRecorderNamesHasBeenSet; } + inline void SetConfigurationRecorderNames(const Aws::Vector& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames = value; } + inline void SetConfigurationRecorderNames(Aws::Vector&& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames = std::move(value); } + inline DescribeConfigurationRecordersRequest& WithConfigurationRecorderNames(const Aws::Vector& value) { SetConfigurationRecorderNames(value); return *this;} + inline DescribeConfigurationRecordersRequest& WithConfigurationRecorderNames(Aws::Vector&& value) { SetConfigurationRecorderNames(std::move(value)); return *this;} + inline DescribeConfigurationRecordersRequest& AddConfigurationRecorderNames(const Aws::String& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames.push_back(value); return *this; } + inline DescribeConfigurationRecordersRequest& AddConfigurationRecorderNames(Aws::String&& value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames.push_back(std::move(value)); return *this; } + inline DescribeConfigurationRecordersRequest& AddConfigurationRecorderNames(const char* value) { m_configurationRecorderNamesHasBeenSet = true; m_configurationRecorderNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

For service-linked configuration recorders, you can use the service principal + * of the linked Amazon Web Services service to specify the configuration + * recorder.

+ */ + inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); } + inline DescribeConfigurationRecordersRequest& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;} + inline DescribeConfigurationRecordersRequest& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;} + inline DescribeConfigurationRecordersRequest& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the configuration recorder that you want to + * specify.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline DescribeConfigurationRecordersRequest& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline DescribeConfigurationRecordersRequest& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline DescribeConfigurationRecordersRequest& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationRecorderNames; + bool m_configurationRecorderNamesHasBeenSet = false; + + Aws::String m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConfigurationRecordersResult.h b/include/aws/config/model/DescribeConfigurationRecordersResult.h new file mode 100644 index 0000000000000000000000000000000000000000..60bd237abde9743fff517bb99ecd751a82e2828d --- /dev/null +++ b/include/aws/config/model/DescribeConfigurationRecordersResult.h @@ -0,0 +1,76 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output for the DescribeConfigurationRecorders + * action.

See Also:

AWS + * API Reference

+ */ + class DescribeConfigurationRecordersResult + { + public: + AWS_CONFIGSERVICE_API DescribeConfigurationRecordersResult(); + AWS_CONFIGSERVICE_API DescribeConfigurationRecordersResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConfigurationRecordersResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list that contains the descriptions of the specified configuration + * recorders.

+ */ + inline const Aws::Vector& GetConfigurationRecorders() const{ return m_configurationRecorders; } + inline void SetConfigurationRecorders(const Aws::Vector& value) { m_configurationRecorders = value; } + inline void SetConfigurationRecorders(Aws::Vector&& value) { m_configurationRecorders = std::move(value); } + inline DescribeConfigurationRecordersResult& WithConfigurationRecorders(const Aws::Vector& value) { SetConfigurationRecorders(value); return *this;} + inline DescribeConfigurationRecordersResult& WithConfigurationRecorders(Aws::Vector&& value) { SetConfigurationRecorders(std::move(value)); return *this;} + inline DescribeConfigurationRecordersResult& AddConfigurationRecorders(const ConfigurationRecorder& value) { m_configurationRecorders.push_back(value); return *this; } + inline DescribeConfigurationRecordersResult& AddConfigurationRecorders(ConfigurationRecorder&& value) { m_configurationRecorders.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConfigurationRecordersResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConfigurationRecordersResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConfigurationRecordersResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationRecorders; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConformancePackComplianceRequest.h b/include/aws/config/model/DescribeConformancePackComplianceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..4823b08e8931d0929636eb8fa7fa7fb707fa84fb --- /dev/null +++ b/include/aws/config/model/DescribeConformancePackComplianceRequest.h @@ -0,0 +1,106 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeConformancePackComplianceRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConformancePackComplianceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConformancePackCompliance"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline DescribeConformancePackComplianceRequest& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline DescribeConformancePackComplianceRequest& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline DescribeConformancePackComplianceRequest& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

A ConformancePackComplianceFilters object.

+ */ + inline const ConformancePackComplianceFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ConformancePackComplianceFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ConformancePackComplianceFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline DescribeConformancePackComplianceRequest& WithFilters(const ConformancePackComplianceFilters& value) { SetFilters(value); return *this;} + inline DescribeConformancePackComplianceRequest& WithFilters(ConformancePackComplianceFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of Config rules within a conformance pack are returned on + * each page.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeConformancePackComplianceRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeConformancePackComplianceRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConformancePackComplianceRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConformancePackComplianceRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + ConformancePackComplianceFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConformancePackComplianceResult.h b/include/aws/config/model/DescribeConformancePackComplianceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..ab579618164cf3fa849d7c35aed650bcf9485e22 --- /dev/null +++ b/include/aws/config/model/DescribeConformancePackComplianceResult.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeConformancePackComplianceResult + { + public: + AWS_CONFIGSERVICE_API DescribeConformancePackComplianceResult(); + AWS_CONFIGSERVICE_API DescribeConformancePackComplianceResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConformancePackComplianceResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackName.assign(value); } + inline DescribeConformancePackComplianceResult& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline DescribeConformancePackComplianceResult& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline DescribeConformancePackComplianceResult& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

Returns a list of ConformancePackRuleCompliance objects.

+ */ + inline const Aws::Vector& GetConformancePackRuleComplianceList() const{ return m_conformancePackRuleComplianceList; } + inline void SetConformancePackRuleComplianceList(const Aws::Vector& value) { m_conformancePackRuleComplianceList = value; } + inline void SetConformancePackRuleComplianceList(Aws::Vector&& value) { m_conformancePackRuleComplianceList = std::move(value); } + inline DescribeConformancePackComplianceResult& WithConformancePackRuleComplianceList(const Aws::Vector& value) { SetConformancePackRuleComplianceList(value); return *this;} + inline DescribeConformancePackComplianceResult& WithConformancePackRuleComplianceList(Aws::Vector&& value) { SetConformancePackRuleComplianceList(std::move(value)); return *this;} + inline DescribeConformancePackComplianceResult& AddConformancePackRuleComplianceList(const ConformancePackRuleCompliance& value) { m_conformancePackRuleComplianceList.push_back(value); return *this; } + inline DescribeConformancePackComplianceResult& AddConformancePackRuleComplianceList(ConformancePackRuleCompliance&& value) { m_conformancePackRuleComplianceList.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeConformancePackComplianceResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConformancePackComplianceResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConformancePackComplianceResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConformancePackComplianceResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConformancePackComplianceResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConformancePackComplianceResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + + Aws::Vector m_conformancePackRuleComplianceList; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConformancePackStatusRequest.h b/include/aws/config/model/DescribeConformancePackStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..cb27c378e83f28517e543c3062a1b1aa957e29c8 --- /dev/null +++ b/include/aws/config/model/DescribeConformancePackStatusRequest.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeConformancePackStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConformancePackStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConformancePackStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Comma-separated list of conformance pack names.

+ */ + inline const Aws::Vector& GetConformancePackNames() const{ return m_conformancePackNames; } + inline bool ConformancePackNamesHasBeenSet() const { return m_conformancePackNamesHasBeenSet; } + inline void SetConformancePackNames(const Aws::Vector& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = value; } + inline void SetConformancePackNames(Aws::Vector&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = std::move(value); } + inline DescribeConformancePackStatusRequest& WithConformancePackNames(const Aws::Vector& value) { SetConformancePackNames(value); return *this;} + inline DescribeConformancePackStatusRequest& WithConformancePackNames(Aws::Vector&& value) { SetConformancePackNames(std::move(value)); return *this;} + inline DescribeConformancePackStatusRequest& AddConformancePackNames(const Aws::String& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + inline DescribeConformancePackStatusRequest& AddConformancePackNames(Aws::String&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(std::move(value)); return *this; } + inline DescribeConformancePackStatusRequest& AddConformancePackNames(const char* value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of conformance packs status returned on each page.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeConformancePackStatusRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeConformancePackStatusRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConformancePackStatusRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConformancePackStatusRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_conformancePackNames; + bool m_conformancePackNamesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConformancePackStatusResult.h b/include/aws/config/model/DescribeConformancePackStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..b6a33a1f3800b2aec729efb04a6e653b6f3e8e71 --- /dev/null +++ b/include/aws/config/model/DescribeConformancePackStatusResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeConformancePackStatusResult + { + public: + AWS_CONFIGSERVICE_API DescribeConformancePackStatusResult(); + AWS_CONFIGSERVICE_API DescribeConformancePackStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConformancePackStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of ConformancePackStatusDetail objects.

+ */ + inline const Aws::Vector& GetConformancePackStatusDetails() const{ return m_conformancePackStatusDetails; } + inline void SetConformancePackStatusDetails(const Aws::Vector& value) { m_conformancePackStatusDetails = value; } + inline void SetConformancePackStatusDetails(Aws::Vector&& value) { m_conformancePackStatusDetails = std::move(value); } + inline DescribeConformancePackStatusResult& WithConformancePackStatusDetails(const Aws::Vector& value) { SetConformancePackStatusDetails(value); return *this;} + inline DescribeConformancePackStatusResult& WithConformancePackStatusDetails(Aws::Vector&& value) { SetConformancePackStatusDetails(std::move(value)); return *this;} + inline DescribeConformancePackStatusResult& AddConformancePackStatusDetails(const ConformancePackStatusDetail& value) { m_conformancePackStatusDetails.push_back(value); return *this; } + inline DescribeConformancePackStatusResult& AddConformancePackStatusDetails(ConformancePackStatusDetail&& value) { m_conformancePackStatusDetails.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeConformancePackStatusResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConformancePackStatusResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConformancePackStatusResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConformancePackStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConformancePackStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConformancePackStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_conformancePackStatusDetails; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConformancePacksRequest.h b/include/aws/config/model/DescribeConformancePacksRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..6b7a34869a900b14ab845042c620a8f1b448183e --- /dev/null +++ b/include/aws/config/model/DescribeConformancePacksRequest.h @@ -0,0 +1,93 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeConformancePacksRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeConformancePacksRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeConformancePacks"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Comma-separated list of conformance pack names for which you want details. If + * you do not specify any names, Config returns details for all your conformance + * packs.

+ */ + inline const Aws::Vector& GetConformancePackNames() const{ return m_conformancePackNames; } + inline bool ConformancePackNamesHasBeenSet() const { return m_conformancePackNamesHasBeenSet; } + inline void SetConformancePackNames(const Aws::Vector& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = value; } + inline void SetConformancePackNames(Aws::Vector&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = std::move(value); } + inline DescribeConformancePacksRequest& WithConformancePackNames(const Aws::Vector& value) { SetConformancePackNames(value); return *this;} + inline DescribeConformancePacksRequest& WithConformancePackNames(Aws::Vector&& value) { SetConformancePackNames(std::move(value)); return *this;} + inline DescribeConformancePacksRequest& AddConformancePackNames(const Aws::String& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + inline DescribeConformancePacksRequest& AddConformancePackNames(Aws::String&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(std::move(value)); return *this; } + inline DescribeConformancePacksRequest& AddConformancePackNames(const char* value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of conformance packs returned on each page.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeConformancePacksRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeConformancePacksRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConformancePacksRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConformancePacksRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_conformancePackNames; + bool m_conformancePackNamesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeConformancePacksResult.h b/include/aws/config/model/DescribeConformancePacksResult.h new file mode 100644 index 0000000000000000000000000000000000000000..81734d2b8ed4918a7e4b131f30cfc58cf13c4eaa --- /dev/null +++ b/include/aws/config/model/DescribeConformancePacksResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeConformancePacksResult + { + public: + AWS_CONFIGSERVICE_API DescribeConformancePacksResult(); + AWS_CONFIGSERVICE_API DescribeConformancePacksResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeConformancePacksResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of ConformancePackDetail objects.

+ */ + inline const Aws::Vector& GetConformancePackDetails() const{ return m_conformancePackDetails; } + inline void SetConformancePackDetails(const Aws::Vector& value) { m_conformancePackDetails = value; } + inline void SetConformancePackDetails(Aws::Vector&& value) { m_conformancePackDetails = std::move(value); } + inline DescribeConformancePacksResult& WithConformancePackDetails(const Aws::Vector& value) { SetConformancePackDetails(value); return *this;} + inline DescribeConformancePacksResult& WithConformancePackDetails(Aws::Vector&& value) { SetConformancePackDetails(std::move(value)); return *this;} + inline DescribeConformancePacksResult& AddConformancePackDetails(const ConformancePackDetail& value) { m_conformancePackDetails.push_back(value); return *this; } + inline DescribeConformancePacksResult& AddConformancePackDetails(ConformancePackDetail&& value) { m_conformancePackDetails.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeConformancePacksResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeConformancePacksResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeConformancePacksResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeConformancePacksResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeConformancePacksResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeConformancePacksResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_conformancePackDetails; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeDeliveryChannelStatusRequest.h b/include/aws/config/model/DescribeDeliveryChannelStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..ec270755b92467970c3d2e5ca9135593086fdc96 --- /dev/null +++ b/include/aws/config/model/DescribeDeliveryChannelStatusRequest.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the DeliveryChannelStatus action.

See + * Also:

AWS + * API Reference

+ */ + class DescribeDeliveryChannelStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeDeliveryChannelStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeDeliveryChannelStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of delivery channel names.

+ */ + inline const Aws::Vector& GetDeliveryChannelNames() const{ return m_deliveryChannelNames; } + inline bool DeliveryChannelNamesHasBeenSet() const { return m_deliveryChannelNamesHasBeenSet; } + inline void SetDeliveryChannelNames(const Aws::Vector& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames = value; } + inline void SetDeliveryChannelNames(Aws::Vector&& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames = std::move(value); } + inline DescribeDeliveryChannelStatusRequest& WithDeliveryChannelNames(const Aws::Vector& value) { SetDeliveryChannelNames(value); return *this;} + inline DescribeDeliveryChannelStatusRequest& WithDeliveryChannelNames(Aws::Vector&& value) { SetDeliveryChannelNames(std::move(value)); return *this;} + inline DescribeDeliveryChannelStatusRequest& AddDeliveryChannelNames(const Aws::String& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames.push_back(value); return *this; } + inline DescribeDeliveryChannelStatusRequest& AddDeliveryChannelNames(Aws::String&& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames.push_back(std::move(value)); return *this; } + inline DescribeDeliveryChannelStatusRequest& AddDeliveryChannelNames(const char* value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_deliveryChannelNames; + bool m_deliveryChannelNamesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeDeliveryChannelStatusResult.h b/include/aws/config/model/DescribeDeliveryChannelStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..b8a7eea2e00ada09999dbfd7cfbff24ab4a8e363 --- /dev/null +++ b/include/aws/config/model/DescribeDeliveryChannelStatusResult.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output for the DescribeDeliveryChannelStatus action.

See + * Also:

AWS + * API Reference

+ */ + class DescribeDeliveryChannelStatusResult + { + public: + AWS_CONFIGSERVICE_API DescribeDeliveryChannelStatusResult(); + AWS_CONFIGSERVICE_API DescribeDeliveryChannelStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeDeliveryChannelStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list that contains the status of a specified delivery channel.

+ */ + inline const Aws::Vector& GetDeliveryChannelsStatus() const{ return m_deliveryChannelsStatus; } + inline void SetDeliveryChannelsStatus(const Aws::Vector& value) { m_deliveryChannelsStatus = value; } + inline void SetDeliveryChannelsStatus(Aws::Vector&& value) { m_deliveryChannelsStatus = std::move(value); } + inline DescribeDeliveryChannelStatusResult& WithDeliveryChannelsStatus(const Aws::Vector& value) { SetDeliveryChannelsStatus(value); return *this;} + inline DescribeDeliveryChannelStatusResult& WithDeliveryChannelsStatus(Aws::Vector&& value) { SetDeliveryChannelsStatus(std::move(value)); return *this;} + inline DescribeDeliveryChannelStatusResult& AddDeliveryChannelsStatus(const DeliveryChannelStatus& value) { m_deliveryChannelsStatus.push_back(value); return *this; } + inline DescribeDeliveryChannelStatusResult& AddDeliveryChannelsStatus(DeliveryChannelStatus&& value) { m_deliveryChannelsStatus.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeDeliveryChannelStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeDeliveryChannelStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeDeliveryChannelStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_deliveryChannelsStatus; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeDeliveryChannelsRequest.h b/include/aws/config/model/DescribeDeliveryChannelsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..b0462680e3846939867274aba129083489951040 --- /dev/null +++ b/include/aws/config/model/DescribeDeliveryChannelsRequest.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the DescribeDeliveryChannels action.

See + * Also:

AWS + * API Reference

+ */ + class DescribeDeliveryChannelsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeDeliveryChannelsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeDeliveryChannels"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of delivery channel names.

+ */ + inline const Aws::Vector& GetDeliveryChannelNames() const{ return m_deliveryChannelNames; } + inline bool DeliveryChannelNamesHasBeenSet() const { return m_deliveryChannelNamesHasBeenSet; } + inline void SetDeliveryChannelNames(const Aws::Vector& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames = value; } + inline void SetDeliveryChannelNames(Aws::Vector&& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames = std::move(value); } + inline DescribeDeliveryChannelsRequest& WithDeliveryChannelNames(const Aws::Vector& value) { SetDeliveryChannelNames(value); return *this;} + inline DescribeDeliveryChannelsRequest& WithDeliveryChannelNames(Aws::Vector&& value) { SetDeliveryChannelNames(std::move(value)); return *this;} + inline DescribeDeliveryChannelsRequest& AddDeliveryChannelNames(const Aws::String& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames.push_back(value); return *this; } + inline DescribeDeliveryChannelsRequest& AddDeliveryChannelNames(Aws::String&& value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames.push_back(std::move(value)); return *this; } + inline DescribeDeliveryChannelsRequest& AddDeliveryChannelNames(const char* value) { m_deliveryChannelNamesHasBeenSet = true; m_deliveryChannelNames.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_deliveryChannelNames; + bool m_deliveryChannelNamesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeDeliveryChannelsResult.h b/include/aws/config/model/DescribeDeliveryChannelsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..71f1595e354e339ece0a303b03028fab0a844d14 --- /dev/null +++ b/include/aws/config/model/DescribeDeliveryChannelsResult.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output for the DescribeDeliveryChannels action.

See + * Also:

AWS + * API Reference

+ */ + class DescribeDeliveryChannelsResult + { + public: + AWS_CONFIGSERVICE_API DescribeDeliveryChannelsResult(); + AWS_CONFIGSERVICE_API DescribeDeliveryChannelsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeDeliveryChannelsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list that contains the descriptions of the specified delivery channel.

+ */ + inline const Aws::Vector& GetDeliveryChannels() const{ return m_deliveryChannels; } + inline void SetDeliveryChannels(const Aws::Vector& value) { m_deliveryChannels = value; } + inline void SetDeliveryChannels(Aws::Vector&& value) { m_deliveryChannels = std::move(value); } + inline DescribeDeliveryChannelsResult& WithDeliveryChannels(const Aws::Vector& value) { SetDeliveryChannels(value); return *this;} + inline DescribeDeliveryChannelsResult& WithDeliveryChannels(Aws::Vector&& value) { SetDeliveryChannels(std::move(value)); return *this;} + inline DescribeDeliveryChannelsResult& AddDeliveryChannels(const DeliveryChannel& value) { m_deliveryChannels.push_back(value); return *this; } + inline DescribeDeliveryChannelsResult& AddDeliveryChannels(DeliveryChannel&& value) { m_deliveryChannels.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeDeliveryChannelsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeDeliveryChannelsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeDeliveryChannelsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_deliveryChannels; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConfigRuleStatusesRequest.h b/include/aws/config/model/DescribeOrganizationConfigRuleStatusesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2d0a12f93b1ffad316fa705882465daad8f7b490 --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConfigRuleStatusesRequest.h @@ -0,0 +1,95 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeOrganizationConfigRuleStatusesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRuleStatusesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeOrganizationConfigRuleStatuses"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The names of organization Config rules for which you want status details. If + * you do not specify any names, Config returns details for all your organization + * Config rules.

+ */ + inline const Aws::Vector& GetOrganizationConfigRuleNames() const{ return m_organizationConfigRuleNames; } + inline bool OrganizationConfigRuleNamesHasBeenSet() const { return m_organizationConfigRuleNamesHasBeenSet; } + inline void SetOrganizationConfigRuleNames(const Aws::Vector& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames = value; } + inline void SetOrganizationConfigRuleNames(Aws::Vector&& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames = std::move(value); } + inline DescribeOrganizationConfigRuleStatusesRequest& WithOrganizationConfigRuleNames(const Aws::Vector& value) { SetOrganizationConfigRuleNames(value); return *this;} + inline DescribeOrganizationConfigRuleStatusesRequest& WithOrganizationConfigRuleNames(Aws::Vector&& value) { SetOrganizationConfigRuleNames(std::move(value)); return *this;} + inline DescribeOrganizationConfigRuleStatusesRequest& AddOrganizationConfigRuleNames(const Aws::String& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames.push_back(value); return *this; } + inline DescribeOrganizationConfigRuleStatusesRequest& AddOrganizationConfigRuleNames(Aws::String&& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames.push_back(std::move(value)); return *this; } + inline DescribeOrganizationConfigRuleStatusesRequest& AddOrganizationConfigRuleNames(const char* value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of OrganizationConfigRuleStatuses returned on + * each page. If you do no specify a number, Config uses the default. The default + * is 100.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeOrganizationConfigRuleStatusesRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeOrganizationConfigRuleStatusesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConfigRuleStatusesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConfigRuleStatusesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConfigRuleNames; + bool m_organizationConfigRuleNamesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConfigRuleStatusesResult.h b/include/aws/config/model/DescribeOrganizationConfigRuleStatusesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..5169fb5314869246bf34c4ed05e3e09c30811112 --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConfigRuleStatusesResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeOrganizationConfigRuleStatusesResult + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRuleStatusesResult(); + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRuleStatusesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRuleStatusesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of OrganizationConfigRuleStatus objects.

+ */ + inline const Aws::Vector& GetOrganizationConfigRuleStatuses() const{ return m_organizationConfigRuleStatuses; } + inline void SetOrganizationConfigRuleStatuses(const Aws::Vector& value) { m_organizationConfigRuleStatuses = value; } + inline void SetOrganizationConfigRuleStatuses(Aws::Vector&& value) { m_organizationConfigRuleStatuses = std::move(value); } + inline DescribeOrganizationConfigRuleStatusesResult& WithOrganizationConfigRuleStatuses(const Aws::Vector& value) { SetOrganizationConfigRuleStatuses(value); return *this;} + inline DescribeOrganizationConfigRuleStatusesResult& WithOrganizationConfigRuleStatuses(Aws::Vector&& value) { SetOrganizationConfigRuleStatuses(std::move(value)); return *this;} + inline DescribeOrganizationConfigRuleStatusesResult& AddOrganizationConfigRuleStatuses(const OrganizationConfigRuleStatus& value) { m_organizationConfigRuleStatuses.push_back(value); return *this; } + inline DescribeOrganizationConfigRuleStatusesResult& AddOrganizationConfigRuleStatuses(OrganizationConfigRuleStatus&& value) { m_organizationConfigRuleStatuses.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeOrganizationConfigRuleStatusesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConfigRuleStatusesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConfigRuleStatusesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeOrganizationConfigRuleStatusesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeOrganizationConfigRuleStatusesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeOrganizationConfigRuleStatusesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConfigRuleStatuses; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConfigRulesRequest.h b/include/aws/config/model/DescribeOrganizationConfigRulesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..b865ce67bfcbdfc77df58c58a82862a73ef7c4cb --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConfigRulesRequest.h @@ -0,0 +1,94 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeOrganizationConfigRulesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRulesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeOrganizationConfigRules"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The names of organization Config rules for which you want details. If you do + * not specify any names, Config returns details for all your organization Config + * rules.

+ */ + inline const Aws::Vector& GetOrganizationConfigRuleNames() const{ return m_organizationConfigRuleNames; } + inline bool OrganizationConfigRuleNamesHasBeenSet() const { return m_organizationConfigRuleNamesHasBeenSet; } + inline void SetOrganizationConfigRuleNames(const Aws::Vector& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames = value; } + inline void SetOrganizationConfigRuleNames(Aws::Vector&& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames = std::move(value); } + inline DescribeOrganizationConfigRulesRequest& WithOrganizationConfigRuleNames(const Aws::Vector& value) { SetOrganizationConfigRuleNames(value); return *this;} + inline DescribeOrganizationConfigRulesRequest& WithOrganizationConfigRuleNames(Aws::Vector&& value) { SetOrganizationConfigRuleNames(std::move(value)); return *this;} + inline DescribeOrganizationConfigRulesRequest& AddOrganizationConfigRuleNames(const Aws::String& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames.push_back(value); return *this; } + inline DescribeOrganizationConfigRulesRequest& AddOrganizationConfigRuleNames(Aws::String&& value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames.push_back(std::move(value)); return *this; } + inline DescribeOrganizationConfigRulesRequest& AddOrganizationConfigRuleNames(const char* value) { m_organizationConfigRuleNamesHasBeenSet = true; m_organizationConfigRuleNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of organization Config rules returned on each page. If you + * do no specify a number, Config uses the default. The default is 100.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeOrganizationConfigRulesRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeOrganizationConfigRulesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConfigRulesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConfigRulesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConfigRuleNames; + bool m_organizationConfigRuleNamesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConfigRulesResult.h b/include/aws/config/model/DescribeOrganizationConfigRulesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0dccb38dfbdcc766746572fe5549b92cfb58b4b3 --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConfigRulesResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeOrganizationConfigRulesResult + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRulesResult(); + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRulesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeOrganizationConfigRulesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of OrganizationConfigRule objects.

+ */ + inline const Aws::Vector& GetOrganizationConfigRules() const{ return m_organizationConfigRules; } + inline void SetOrganizationConfigRules(const Aws::Vector& value) { m_organizationConfigRules = value; } + inline void SetOrganizationConfigRules(Aws::Vector&& value) { m_organizationConfigRules = std::move(value); } + inline DescribeOrganizationConfigRulesResult& WithOrganizationConfigRules(const Aws::Vector& value) { SetOrganizationConfigRules(value); return *this;} + inline DescribeOrganizationConfigRulesResult& WithOrganizationConfigRules(Aws::Vector&& value) { SetOrganizationConfigRules(std::move(value)); return *this;} + inline DescribeOrganizationConfigRulesResult& AddOrganizationConfigRules(const OrganizationConfigRule& value) { m_organizationConfigRules.push_back(value); return *this; } + inline DescribeOrganizationConfigRulesResult& AddOrganizationConfigRules(OrganizationConfigRule&& value) { m_organizationConfigRules.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeOrganizationConfigRulesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConfigRulesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConfigRulesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeOrganizationConfigRulesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeOrganizationConfigRulesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeOrganizationConfigRulesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConfigRules; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConformancePackStatusesRequest.h b/include/aws/config/model/DescribeOrganizationConformancePackStatusesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5e2d84b1da5ce9a52fbddf4a31b7d1cb90c0b34e --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConformancePackStatusesRequest.h @@ -0,0 +1,95 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeOrganizationConformancePackStatusesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePackStatusesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeOrganizationConformancePackStatuses"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The names of organization conformance packs for which you want status + * details. If you do not specify any names, Config returns details for all your + * organization conformance packs.

+ */ + inline const Aws::Vector& GetOrganizationConformancePackNames() const{ return m_organizationConformancePackNames; } + inline bool OrganizationConformancePackNamesHasBeenSet() const { return m_organizationConformancePackNamesHasBeenSet; } + inline void SetOrganizationConformancePackNames(const Aws::Vector& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames = value; } + inline void SetOrganizationConformancePackNames(Aws::Vector&& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames = std::move(value); } + inline DescribeOrganizationConformancePackStatusesRequest& WithOrganizationConformancePackNames(const Aws::Vector& value) { SetOrganizationConformancePackNames(value); return *this;} + inline DescribeOrganizationConformancePackStatusesRequest& WithOrganizationConformancePackNames(Aws::Vector&& value) { SetOrganizationConformancePackNames(std::move(value)); return *this;} + inline DescribeOrganizationConformancePackStatusesRequest& AddOrganizationConformancePackNames(const Aws::String& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames.push_back(value); return *this; } + inline DescribeOrganizationConformancePackStatusesRequest& AddOrganizationConformancePackNames(Aws::String&& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames.push_back(std::move(value)); return *this; } + inline DescribeOrganizationConformancePackStatusesRequest& AddOrganizationConformancePackNames(const char* value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of OrganizationConformancePackStatuses returned on each + * page. If you do no specify a number, Config uses the default. The default is + * 100.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeOrganizationConformancePackStatusesRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeOrganizationConformancePackStatusesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConformancePackStatusesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConformancePackStatusesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConformancePackNames; + bool m_organizationConformancePackNamesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConformancePackStatusesResult.h b/include/aws/config/model/DescribeOrganizationConformancePackStatusesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..16b205fccbe5a2c2a6eadc65935a1243bfccd2cb --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConformancePackStatusesResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeOrganizationConformancePackStatusesResult + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePackStatusesResult(); + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePackStatusesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePackStatusesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of OrganizationConformancePackStatus objects.

+ */ + inline const Aws::Vector& GetOrganizationConformancePackStatuses() const{ return m_organizationConformancePackStatuses; } + inline void SetOrganizationConformancePackStatuses(const Aws::Vector& value) { m_organizationConformancePackStatuses = value; } + inline void SetOrganizationConformancePackStatuses(Aws::Vector&& value) { m_organizationConformancePackStatuses = std::move(value); } + inline DescribeOrganizationConformancePackStatusesResult& WithOrganizationConformancePackStatuses(const Aws::Vector& value) { SetOrganizationConformancePackStatuses(value); return *this;} + inline DescribeOrganizationConformancePackStatusesResult& WithOrganizationConformancePackStatuses(Aws::Vector&& value) { SetOrganizationConformancePackStatuses(std::move(value)); return *this;} + inline DescribeOrganizationConformancePackStatusesResult& AddOrganizationConformancePackStatuses(const OrganizationConformancePackStatus& value) { m_organizationConformancePackStatuses.push_back(value); return *this; } + inline DescribeOrganizationConformancePackStatusesResult& AddOrganizationConformancePackStatuses(OrganizationConformancePackStatus&& value) { m_organizationConformancePackStatuses.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeOrganizationConformancePackStatusesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConformancePackStatusesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConformancePackStatusesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeOrganizationConformancePackStatusesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeOrganizationConformancePackStatusesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeOrganizationConformancePackStatusesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConformancePackStatuses; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConformancePacksRequest.h b/include/aws/config/model/DescribeOrganizationConformancePacksRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..3d5d2df6201b3d2e0cb0cf763be4923e272ad481 --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConformancePacksRequest.h @@ -0,0 +1,92 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeOrganizationConformancePacksRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePacksRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeOrganizationConformancePacks"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name that you assign to an organization conformance pack.

+ */ + inline const Aws::Vector& GetOrganizationConformancePackNames() const{ return m_organizationConformancePackNames; } + inline bool OrganizationConformancePackNamesHasBeenSet() const { return m_organizationConformancePackNamesHasBeenSet; } + inline void SetOrganizationConformancePackNames(const Aws::Vector& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames = value; } + inline void SetOrganizationConformancePackNames(Aws::Vector&& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames = std::move(value); } + inline DescribeOrganizationConformancePacksRequest& WithOrganizationConformancePackNames(const Aws::Vector& value) { SetOrganizationConformancePackNames(value); return *this;} + inline DescribeOrganizationConformancePacksRequest& WithOrganizationConformancePackNames(Aws::Vector&& value) { SetOrganizationConformancePackNames(std::move(value)); return *this;} + inline DescribeOrganizationConformancePacksRequest& AddOrganizationConformancePackNames(const Aws::String& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames.push_back(value); return *this; } + inline DescribeOrganizationConformancePacksRequest& AddOrganizationConformancePackNames(Aws::String&& value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames.push_back(std::move(value)); return *this; } + inline DescribeOrganizationConformancePacksRequest& AddOrganizationConformancePackNames(const char* value) { m_organizationConformancePackNamesHasBeenSet = true; m_organizationConformancePackNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of organization config packs returned on each page. If you + * do no specify a number, Config uses the default. The default is 100.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeOrganizationConformancePacksRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeOrganizationConformancePacksRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConformancePacksRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConformancePacksRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConformancePackNames; + bool m_organizationConformancePackNamesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeOrganizationConformancePacksResult.h b/include/aws/config/model/DescribeOrganizationConformancePacksResult.h new file mode 100644 index 0000000000000000000000000000000000000000..4910af1434edd0503bf7775c012c969b58053d1c --- /dev/null +++ b/include/aws/config/model/DescribeOrganizationConformancePacksResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeOrganizationConformancePacksResult + { + public: + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePacksResult(); + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePacksResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeOrganizationConformancePacksResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of OrganizationConformancePacks objects.

+ */ + inline const Aws::Vector& GetOrganizationConformancePacks() const{ return m_organizationConformancePacks; } + inline void SetOrganizationConformancePacks(const Aws::Vector& value) { m_organizationConformancePacks = value; } + inline void SetOrganizationConformancePacks(Aws::Vector&& value) { m_organizationConformancePacks = std::move(value); } + inline DescribeOrganizationConformancePacksResult& WithOrganizationConformancePacks(const Aws::Vector& value) { SetOrganizationConformancePacks(value); return *this;} + inline DescribeOrganizationConformancePacksResult& WithOrganizationConformancePacks(Aws::Vector&& value) { SetOrganizationConformancePacks(std::move(value)); return *this;} + inline DescribeOrganizationConformancePacksResult& AddOrganizationConformancePacks(const OrganizationConformancePack& value) { m_organizationConformancePacks.push_back(value); return *this; } + inline DescribeOrganizationConformancePacksResult& AddOrganizationConformancePacks(OrganizationConformancePack&& value) { m_organizationConformancePacks.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeOrganizationConformancePacksResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeOrganizationConformancePacksResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeOrganizationConformancePacksResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeOrganizationConformancePacksResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeOrganizationConformancePacksResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeOrganizationConformancePacksResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConformancePacks; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribePendingAggregationRequestsRequest.h b/include/aws/config/model/DescribePendingAggregationRequestsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2187e38f7dab0cf711a21d6576ab205f20487d58 --- /dev/null +++ b/include/aws/config/model/DescribePendingAggregationRequestsRequest.h @@ -0,0 +1,73 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribePendingAggregationRequestsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribePendingAggregationRequestsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribePendingAggregationRequests"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The maximum number of evaluation results returned on each page. The default + * is maximum. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribePendingAggregationRequestsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribePendingAggregationRequestsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribePendingAggregationRequestsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribePendingAggregationRequestsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribePendingAggregationRequestsResult.h b/include/aws/config/model/DescribePendingAggregationRequestsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f2402439566e33d4ba1d89609611527f2b7793d5 --- /dev/null +++ b/include/aws/config/model/DescribePendingAggregationRequestsResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribePendingAggregationRequestsResult + { + public: + AWS_CONFIGSERVICE_API DescribePendingAggregationRequestsResult(); + AWS_CONFIGSERVICE_API DescribePendingAggregationRequestsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribePendingAggregationRequestsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a PendingAggregationRequests object.

+ */ + inline const Aws::Vector& GetPendingAggregationRequests() const{ return m_pendingAggregationRequests; } + inline void SetPendingAggregationRequests(const Aws::Vector& value) { m_pendingAggregationRequests = value; } + inline void SetPendingAggregationRequests(Aws::Vector&& value) { m_pendingAggregationRequests = std::move(value); } + inline DescribePendingAggregationRequestsResult& WithPendingAggregationRequests(const Aws::Vector& value) { SetPendingAggregationRequests(value); return *this;} + inline DescribePendingAggregationRequestsResult& WithPendingAggregationRequests(Aws::Vector&& value) { SetPendingAggregationRequests(std::move(value)); return *this;} + inline DescribePendingAggregationRequestsResult& AddPendingAggregationRequests(const PendingAggregationRequest& value) { m_pendingAggregationRequests.push_back(value); return *this; } + inline DescribePendingAggregationRequestsResult& AddPendingAggregationRequests(PendingAggregationRequest&& value) { m_pendingAggregationRequests.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribePendingAggregationRequestsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribePendingAggregationRequestsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribePendingAggregationRequestsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribePendingAggregationRequestsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribePendingAggregationRequestsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribePendingAggregationRequestsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_pendingAggregationRequests; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRemediationConfigurationsRequest.h b/include/aws/config/model/DescribeRemediationConfigurationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..277465c44271c79cb566b356b16795dd8738f2f2 --- /dev/null +++ b/include/aws/config/model/DescribeRemediationConfigurationsRequest.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeRemediationConfigurationsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeRemediationConfigurationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeRemediationConfigurations"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of Config rule names of remediation configurations for which you want + * details.

+ */ + inline const Aws::Vector& GetConfigRuleNames() const{ return m_configRuleNames; } + inline bool ConfigRuleNamesHasBeenSet() const { return m_configRuleNamesHasBeenSet; } + inline void SetConfigRuleNames(const Aws::Vector& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = value; } + inline void SetConfigRuleNames(Aws::Vector&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = std::move(value); } + inline DescribeRemediationConfigurationsRequest& WithConfigRuleNames(const Aws::Vector& value) { SetConfigRuleNames(value); return *this;} + inline DescribeRemediationConfigurationsRequest& WithConfigRuleNames(Aws::Vector&& value) { SetConfigRuleNames(std::move(value)); return *this;} + inline DescribeRemediationConfigurationsRequest& AddConfigRuleNames(const Aws::String& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + inline DescribeRemediationConfigurationsRequest& AddConfigRuleNames(Aws::String&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(std::move(value)); return *this; } + inline DescribeRemediationConfigurationsRequest& AddConfigRuleNames(const char* value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_configRuleNames; + bool m_configRuleNamesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRemediationConfigurationsResult.h b/include/aws/config/model/DescribeRemediationConfigurationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..919c82f871abca98479976a3185944839fe8009d --- /dev/null +++ b/include/aws/config/model/DescribeRemediationConfigurationsResult.h @@ -0,0 +1,69 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeRemediationConfigurationsResult + { + public: + AWS_CONFIGSERVICE_API DescribeRemediationConfigurationsResult(); + AWS_CONFIGSERVICE_API DescribeRemediationConfigurationsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeRemediationConfigurationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a remediation configuration object.

+ */ + inline const Aws::Vector& GetRemediationConfigurations() const{ return m_remediationConfigurations; } + inline void SetRemediationConfigurations(const Aws::Vector& value) { m_remediationConfigurations = value; } + inline void SetRemediationConfigurations(Aws::Vector&& value) { m_remediationConfigurations = std::move(value); } + inline DescribeRemediationConfigurationsResult& WithRemediationConfigurations(const Aws::Vector& value) { SetRemediationConfigurations(value); return *this;} + inline DescribeRemediationConfigurationsResult& WithRemediationConfigurations(Aws::Vector&& value) { SetRemediationConfigurations(std::move(value)); return *this;} + inline DescribeRemediationConfigurationsResult& AddRemediationConfigurations(const RemediationConfiguration& value) { m_remediationConfigurations.push_back(value); return *this; } + inline DescribeRemediationConfigurationsResult& AddRemediationConfigurations(RemediationConfiguration&& value) { m_remediationConfigurations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeRemediationConfigurationsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeRemediationConfigurationsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeRemediationConfigurationsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_remediationConfigurations; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRemediationExceptionsRequest.h b/include/aws/config/model/DescribeRemediationExceptionsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..cdcbdd80923c6b6b71659f6fdba2f5421645ca51 --- /dev/null +++ b/include/aws/config/model/DescribeRemediationExceptionsRequest.h @@ -0,0 +1,111 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeRemediationExceptionsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeRemediationExceptionsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeRemediationExceptions"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline DescribeRemediationExceptionsRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline DescribeRemediationExceptionsRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline DescribeRemediationExceptionsRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

An exception list of resource exception keys to be processed with the current + * request. Config adds exception for each resource key. For example, Config adds 3 + * exceptions for 3 resource keys.

+ */ + inline const Aws::Vector& GetResourceKeys() const{ return m_resourceKeys; } + inline bool ResourceKeysHasBeenSet() const { return m_resourceKeysHasBeenSet; } + inline void SetResourceKeys(const Aws::Vector& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = value; } + inline void SetResourceKeys(Aws::Vector&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = std::move(value); } + inline DescribeRemediationExceptionsRequest& WithResourceKeys(const Aws::Vector& value) { SetResourceKeys(value); return *this;} + inline DescribeRemediationExceptionsRequest& WithResourceKeys(Aws::Vector&& value) { SetResourceKeys(std::move(value)); return *this;} + inline DescribeRemediationExceptionsRequest& AddResourceKeys(const RemediationExceptionResourceKey& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(value); return *this; } + inline DescribeRemediationExceptionsRequest& AddResourceKeys(RemediationExceptionResourceKey&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of RemediationExceptionResourceKey returned on each page. + * The default is 25. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeRemediationExceptionsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeRemediationExceptionsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeRemediationExceptionsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeRemediationExceptionsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::Vector m_resourceKeys; + bool m_resourceKeysHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRemediationExceptionsResult.h b/include/aws/config/model/DescribeRemediationExceptionsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..fff4d99071b92f370d9dad4889e9e48e05849be9 --- /dev/null +++ b/include/aws/config/model/DescribeRemediationExceptionsResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeRemediationExceptionsResult + { + public: + AWS_CONFIGSERVICE_API DescribeRemediationExceptionsResult(); + AWS_CONFIGSERVICE_API DescribeRemediationExceptionsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeRemediationExceptionsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of remediation exception objects.

+ */ + inline const Aws::Vector& GetRemediationExceptions() const{ return m_remediationExceptions; } + inline void SetRemediationExceptions(const Aws::Vector& value) { m_remediationExceptions = value; } + inline void SetRemediationExceptions(Aws::Vector&& value) { m_remediationExceptions = std::move(value); } + inline DescribeRemediationExceptionsResult& WithRemediationExceptions(const Aws::Vector& value) { SetRemediationExceptions(value); return *this;} + inline DescribeRemediationExceptionsResult& WithRemediationExceptions(Aws::Vector&& value) { SetRemediationExceptions(std::move(value)); return *this;} + inline DescribeRemediationExceptionsResult& AddRemediationExceptions(const RemediationException& value) { m_remediationExceptions.push_back(value); return *this; } + inline DescribeRemediationExceptionsResult& AddRemediationExceptions(RemediationException&& value) { m_remediationExceptions.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeRemediationExceptionsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeRemediationExceptionsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeRemediationExceptionsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeRemediationExceptionsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeRemediationExceptionsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeRemediationExceptionsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_remediationExceptions; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRemediationExecutionStatusRequest.h b/include/aws/config/model/DescribeRemediationExecutionStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..31b4fa4608e90b962b94e928bdba3cb50deadffe --- /dev/null +++ b/include/aws/config/model/DescribeRemediationExecutionStatusRequest.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeRemediationExecutionStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeRemediationExecutionStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeRemediationExecutionStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline DescribeRemediationExecutionStatusRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline DescribeRemediationExecutionStatusRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline DescribeRemediationExecutionStatusRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

A list of resource keys to be processed with the current request. Each + * element in the list consists of the resource type and resource ID.

+ */ + inline const Aws::Vector& GetResourceKeys() const{ return m_resourceKeys; } + inline bool ResourceKeysHasBeenSet() const { return m_resourceKeysHasBeenSet; } + inline void SetResourceKeys(const Aws::Vector& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = value; } + inline void SetResourceKeys(Aws::Vector&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = std::move(value); } + inline DescribeRemediationExecutionStatusRequest& WithResourceKeys(const Aws::Vector& value) { SetResourceKeys(value); return *this;} + inline DescribeRemediationExecutionStatusRequest& WithResourceKeys(Aws::Vector&& value) { SetResourceKeys(std::move(value)); return *this;} + inline DescribeRemediationExecutionStatusRequest& AddResourceKeys(const ResourceKey& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(value); return *this; } + inline DescribeRemediationExecutionStatusRequest& AddResourceKeys(ResourceKey&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of RemediationExecutionStatuses returned on each page. The + * default is maximum. If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline DescribeRemediationExecutionStatusRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeRemediationExecutionStatusRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeRemediationExecutionStatusRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeRemediationExecutionStatusRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::Vector m_resourceKeys; + bool m_resourceKeysHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRemediationExecutionStatusResult.h b/include/aws/config/model/DescribeRemediationExecutionStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..610c43711928dd92b71ede71b7cd2c1475ab1d41 --- /dev/null +++ b/include/aws/config/model/DescribeRemediationExecutionStatusResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeRemediationExecutionStatusResult + { + public: + AWS_CONFIGSERVICE_API DescribeRemediationExecutionStatusResult(); + AWS_CONFIGSERVICE_API DescribeRemediationExecutionStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeRemediationExecutionStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of remediation execution statuses objects.

+ */ + inline const Aws::Vector& GetRemediationExecutionStatuses() const{ return m_remediationExecutionStatuses; } + inline void SetRemediationExecutionStatuses(const Aws::Vector& value) { m_remediationExecutionStatuses = value; } + inline void SetRemediationExecutionStatuses(Aws::Vector&& value) { m_remediationExecutionStatuses = std::move(value); } + inline DescribeRemediationExecutionStatusResult& WithRemediationExecutionStatuses(const Aws::Vector& value) { SetRemediationExecutionStatuses(value); return *this;} + inline DescribeRemediationExecutionStatusResult& WithRemediationExecutionStatuses(Aws::Vector&& value) { SetRemediationExecutionStatuses(std::move(value)); return *this;} + inline DescribeRemediationExecutionStatusResult& AddRemediationExecutionStatuses(const RemediationExecutionStatus& value) { m_remediationExecutionStatuses.push_back(value); return *this; } + inline DescribeRemediationExecutionStatusResult& AddRemediationExecutionStatuses(RemediationExecutionStatus&& value) { m_remediationExecutionStatuses.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeRemediationExecutionStatusResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeRemediationExecutionStatusResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeRemediationExecutionStatusResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeRemediationExecutionStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeRemediationExecutionStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeRemediationExecutionStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_remediationExecutionStatuses; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRetentionConfigurationsRequest.h b/include/aws/config/model/DescribeRetentionConfigurationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..db47f47da8c2e23a89279942b028b0841355fd84 --- /dev/null +++ b/include/aws/config/model/DescribeRetentionConfigurationsRequest.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DescribeRetentionConfigurationsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DescribeRetentionConfigurationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DescribeRetentionConfigurations"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of names of retention configurations for which you want details. If + * you do not specify a name, Config returns details for all the retention + * configurations for that account.

Currently, Config supports only + * one retention configuration per region in your account.

+ */ + inline const Aws::Vector& GetRetentionConfigurationNames() const{ return m_retentionConfigurationNames; } + inline bool RetentionConfigurationNamesHasBeenSet() const { return m_retentionConfigurationNamesHasBeenSet; } + inline void SetRetentionConfigurationNames(const Aws::Vector& value) { m_retentionConfigurationNamesHasBeenSet = true; m_retentionConfigurationNames = value; } + inline void SetRetentionConfigurationNames(Aws::Vector&& value) { m_retentionConfigurationNamesHasBeenSet = true; m_retentionConfigurationNames = std::move(value); } + inline DescribeRetentionConfigurationsRequest& WithRetentionConfigurationNames(const Aws::Vector& value) { SetRetentionConfigurationNames(value); return *this;} + inline DescribeRetentionConfigurationsRequest& WithRetentionConfigurationNames(Aws::Vector&& value) { SetRetentionConfigurationNames(std::move(value)); return *this;} + inline DescribeRetentionConfigurationsRequest& AddRetentionConfigurationNames(const Aws::String& value) { m_retentionConfigurationNamesHasBeenSet = true; m_retentionConfigurationNames.push_back(value); return *this; } + inline DescribeRetentionConfigurationsRequest& AddRetentionConfigurationNames(Aws::String&& value) { m_retentionConfigurationNamesHasBeenSet = true; m_retentionConfigurationNames.push_back(std::move(value)); return *this; } + inline DescribeRetentionConfigurationsRequest& AddRetentionConfigurationNames(const char* value) { m_retentionConfigurationNamesHasBeenSet = true; m_retentionConfigurationNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline DescribeRetentionConfigurationsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeRetentionConfigurationsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeRetentionConfigurationsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_retentionConfigurationNames; + bool m_retentionConfigurationNamesHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DescribeRetentionConfigurationsResult.h b/include/aws/config/model/DescribeRetentionConfigurationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..bca3fc5022c0028503b528f4517857d69d38a357 --- /dev/null +++ b/include/aws/config/model/DescribeRetentionConfigurationsResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DescribeRetentionConfigurationsResult + { + public: + AWS_CONFIGSERVICE_API DescribeRetentionConfigurationsResult(); + AWS_CONFIGSERVICE_API DescribeRetentionConfigurationsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DescribeRetentionConfigurationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a retention configuration object.

+ */ + inline const Aws::Vector& GetRetentionConfigurations() const{ return m_retentionConfigurations; } + inline void SetRetentionConfigurations(const Aws::Vector& value) { m_retentionConfigurations = value; } + inline void SetRetentionConfigurations(Aws::Vector&& value) { m_retentionConfigurations = std::move(value); } + inline DescribeRetentionConfigurationsResult& WithRetentionConfigurations(const Aws::Vector& value) { SetRetentionConfigurations(value); return *this;} + inline DescribeRetentionConfigurationsResult& WithRetentionConfigurations(Aws::Vector&& value) { SetRetentionConfigurations(std::move(value)); return *this;} + inline DescribeRetentionConfigurationsResult& AddRetentionConfigurations(const RetentionConfiguration& value) { m_retentionConfigurations.push_back(value); return *this; } + inline DescribeRetentionConfigurationsResult& AddRetentionConfigurations(RetentionConfiguration&& value) { m_retentionConfigurations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline DescribeRetentionConfigurationsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline DescribeRetentionConfigurationsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline DescribeRetentionConfigurationsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DescribeRetentionConfigurationsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DescribeRetentionConfigurationsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DescribeRetentionConfigurationsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_retentionConfigurations; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DisassociateResourceTypesRequest.h b/include/aws/config/model/DisassociateResourceTypesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..13202b1784fc5d9dc573aac9dc5d71874b448fe5 --- /dev/null +++ b/include/aws/config/model/DisassociateResourceTypesRequest.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class DisassociateResourceTypesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API DisassociateResourceTypesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DisassociateResourceTypes"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the specified configuration recorder.

+ */ + inline const Aws::String& GetConfigurationRecorderArn() const{ return m_configurationRecorderArn; } + inline bool ConfigurationRecorderArnHasBeenSet() const { return m_configurationRecorderArnHasBeenSet; } + inline void SetConfigurationRecorderArn(const Aws::String& value) { m_configurationRecorderArnHasBeenSet = true; m_configurationRecorderArn = value; } + inline void SetConfigurationRecorderArn(Aws::String&& value) { m_configurationRecorderArnHasBeenSet = true; m_configurationRecorderArn = std::move(value); } + inline void SetConfigurationRecorderArn(const char* value) { m_configurationRecorderArnHasBeenSet = true; m_configurationRecorderArn.assign(value); } + inline DisassociateResourceTypesRequest& WithConfigurationRecorderArn(const Aws::String& value) { SetConfigurationRecorderArn(value); return *this;} + inline DisassociateResourceTypesRequest& WithConfigurationRecorderArn(Aws::String&& value) { SetConfigurationRecorderArn(std::move(value)); return *this;} + inline DisassociateResourceTypesRequest& WithConfigurationRecorderArn(const char* value) { SetConfigurationRecorderArn(value); return *this;} + ///@} + + ///@{ + /** + *

The list of resource types you want to remove from the recording group of the + * specified configuration recorder.

+ */ + inline const Aws::Vector& GetResourceTypes() const{ return m_resourceTypes; } + inline bool ResourceTypesHasBeenSet() const { return m_resourceTypesHasBeenSet; } + inline void SetResourceTypes(const Aws::Vector& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = value; } + inline void SetResourceTypes(Aws::Vector&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = std::move(value); } + inline DisassociateResourceTypesRequest& WithResourceTypes(const Aws::Vector& value) { SetResourceTypes(value); return *this;} + inline DisassociateResourceTypesRequest& WithResourceTypes(Aws::Vector&& value) { SetResourceTypes(std::move(value)); return *this;} + inline DisassociateResourceTypesRequest& AddResourceTypes(const ResourceType& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + inline DisassociateResourceTypesRequest& AddResourceTypes(ResourceType&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_configurationRecorderArn; + bool m_configurationRecorderArnHasBeenSet = false; + + Aws::Vector m_resourceTypes; + bool m_resourceTypesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/DisassociateResourceTypesResult.h b/include/aws/config/model/DisassociateResourceTypesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f6290a84e04d4edefa3c967fcb4b21bed5095bff --- /dev/null +++ b/include/aws/config/model/DisassociateResourceTypesResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class DisassociateResourceTypesResult + { + public: + AWS_CONFIGSERVICE_API DisassociateResourceTypesResult(); + AWS_CONFIGSERVICE_API DisassociateResourceTypesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API DisassociateResourceTypesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ConfigurationRecorder& GetConfigurationRecorder() const{ return m_configurationRecorder; } + inline void SetConfigurationRecorder(const ConfigurationRecorder& value) { m_configurationRecorder = value; } + inline void SetConfigurationRecorder(ConfigurationRecorder&& value) { m_configurationRecorder = std::move(value); } + inline DisassociateResourceTypesResult& WithConfigurationRecorder(const ConfigurationRecorder& value) { SetConfigurationRecorder(value); return *this;} + inline DisassociateResourceTypesResult& WithConfigurationRecorder(ConfigurationRecorder&& value) { SetConfigurationRecorder(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DisassociateResourceTypesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DisassociateResourceTypesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DisassociateResourceTypesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ConfigurationRecorder m_configurationRecorder; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/Evaluation.h b/include/aws/config/model/Evaluation.h new file mode 100644 index 0000000000000000000000000000000000000000..f58ecf6f0ad548a14e36b4380dd16ffb9ed749c7 --- /dev/null +++ b/include/aws/config/model/Evaluation.h @@ -0,0 +1,142 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Identifies an Amazon Web Services resource and indicates whether it complies + * with the Config rule that it was evaluated against.

See Also:

+ * AWS + * API Reference

+ */ + class Evaluation + { + public: + AWS_CONFIGSERVICE_API Evaluation(); + AWS_CONFIGSERVICE_API Evaluation(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Evaluation& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetComplianceResourceType() const{ return m_complianceResourceType; } + inline bool ComplianceResourceTypeHasBeenSet() const { return m_complianceResourceTypeHasBeenSet; } + inline void SetComplianceResourceType(const Aws::String& value) { m_complianceResourceTypeHasBeenSet = true; m_complianceResourceType = value; } + inline void SetComplianceResourceType(Aws::String&& value) { m_complianceResourceTypeHasBeenSet = true; m_complianceResourceType = std::move(value); } + inline void SetComplianceResourceType(const char* value) { m_complianceResourceTypeHasBeenSet = true; m_complianceResourceType.assign(value); } + inline Evaluation& WithComplianceResourceType(const Aws::String& value) { SetComplianceResourceType(value); return *this;} + inline Evaluation& WithComplianceResourceType(Aws::String&& value) { SetComplianceResourceType(std::move(value)); return *this;} + inline Evaluation& WithComplianceResourceType(const char* value) { SetComplianceResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetComplianceResourceId() const{ return m_complianceResourceId; } + inline bool ComplianceResourceIdHasBeenSet() const { return m_complianceResourceIdHasBeenSet; } + inline void SetComplianceResourceId(const Aws::String& value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId = value; } + inline void SetComplianceResourceId(Aws::String&& value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId = std::move(value); } + inline void SetComplianceResourceId(const char* value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId.assign(value); } + inline Evaluation& WithComplianceResourceId(const Aws::String& value) { SetComplianceResourceId(value); return *this;} + inline Evaluation& WithComplianceResourceId(Aws::String&& value) { SetComplianceResourceId(std::move(value)); return *this;} + inline Evaluation& WithComplianceResourceId(const char* value) { SetComplianceResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the Amazon Web Services resource complies with the Config + * rule that it was evaluated against.

For the Evaluation data + * type, Config supports only the COMPLIANT, + * NON_COMPLIANT, and NOT_APPLICABLE values. Config does + * not support the INSUFFICIENT_DATA value for this data type.

+ *

Similarly, Config does not accept INSUFFICIENT_DATA as the value + * for ComplianceType from a PutEvaluations request. For + * example, an Lambda function for a custom Config rule cannot pass an + * INSUFFICIENT_DATA value to Config.

+ */ + inline const ComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline Evaluation& WithComplianceType(const ComplianceType& value) { SetComplianceType(value); return *this;} + inline Evaluation& WithComplianceType(ComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Supplementary information about how the evaluation determined the + * compliance.

+ */ + inline const Aws::String& GetAnnotation() const{ return m_annotation; } + inline bool AnnotationHasBeenSet() const { return m_annotationHasBeenSet; } + inline void SetAnnotation(const Aws::String& value) { m_annotationHasBeenSet = true; m_annotation = value; } + inline void SetAnnotation(Aws::String&& value) { m_annotationHasBeenSet = true; m_annotation = std::move(value); } + inline void SetAnnotation(const char* value) { m_annotationHasBeenSet = true; m_annotation.assign(value); } + inline Evaluation& WithAnnotation(const Aws::String& value) { SetAnnotation(value); return *this;} + inline Evaluation& WithAnnotation(Aws::String&& value) { SetAnnotation(std::move(value)); return *this;} + inline Evaluation& WithAnnotation(const char* value) { SetAnnotation(value); return *this;} + ///@} + + ///@{ + /** + *

The time of the event in Config that triggered the evaluation. For + * event-based evaluations, the time indicates when Config created the + * configuration item that triggered the evaluation. For periodic evaluations, the + * time indicates when Config triggered the evaluation at the frequency that you + * specified (for example, every 24 hours).

+ */ + inline const Aws::Utils::DateTime& GetOrderingTimestamp() const{ return m_orderingTimestamp; } + inline bool OrderingTimestampHasBeenSet() const { return m_orderingTimestampHasBeenSet; } + inline void SetOrderingTimestamp(const Aws::Utils::DateTime& value) { m_orderingTimestampHasBeenSet = true; m_orderingTimestamp = value; } + inline void SetOrderingTimestamp(Aws::Utils::DateTime&& value) { m_orderingTimestampHasBeenSet = true; m_orderingTimestamp = std::move(value); } + inline Evaluation& WithOrderingTimestamp(const Aws::Utils::DateTime& value) { SetOrderingTimestamp(value); return *this;} + inline Evaluation& WithOrderingTimestamp(Aws::Utils::DateTime&& value) { SetOrderingTimestamp(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_complianceResourceType; + bool m_complianceResourceTypeHasBeenSet = false; + + Aws::String m_complianceResourceId; + bool m_complianceResourceIdHasBeenSet = false; + + ComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::String m_annotation; + bool m_annotationHasBeenSet = false; + + Aws::Utils::DateTime m_orderingTimestamp; + bool m_orderingTimestampHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EvaluationContext.h b/include/aws/config/model/EvaluationContext.h new file mode 100644 index 0000000000000000000000000000000000000000..8435251b21cc644415c2c7dffcba86a7a486e750 --- /dev/null +++ b/include/aws/config/model/EvaluationContext.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Use EvaluationContext to group independently initiated proactive resource + * evaluations. For example, CFN Stack. If you want to check just a resource + * definition, you do not need to provide evaluation context.

See + * Also:

AWS + * API Reference

+ */ + class EvaluationContext + { + public: + AWS_CONFIGSERVICE_API EvaluationContext(); + AWS_CONFIGSERVICE_API EvaluationContext(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API EvaluationContext& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

A unique EvaluationContextIdentifier ID for an EvaluationContext.

+ */ + inline const Aws::String& GetEvaluationContextIdentifier() const{ return m_evaluationContextIdentifier; } + inline bool EvaluationContextIdentifierHasBeenSet() const { return m_evaluationContextIdentifierHasBeenSet; } + inline void SetEvaluationContextIdentifier(const Aws::String& value) { m_evaluationContextIdentifierHasBeenSet = true; m_evaluationContextIdentifier = value; } + inline void SetEvaluationContextIdentifier(Aws::String&& value) { m_evaluationContextIdentifierHasBeenSet = true; m_evaluationContextIdentifier = std::move(value); } + inline void SetEvaluationContextIdentifier(const char* value) { m_evaluationContextIdentifierHasBeenSet = true; m_evaluationContextIdentifier.assign(value); } + inline EvaluationContext& WithEvaluationContextIdentifier(const Aws::String& value) { SetEvaluationContextIdentifier(value); return *this;} + inline EvaluationContext& WithEvaluationContextIdentifier(Aws::String&& value) { SetEvaluationContextIdentifier(std::move(value)); return *this;} + inline EvaluationContext& WithEvaluationContextIdentifier(const char* value) { SetEvaluationContextIdentifier(value); return *this;} + ///@} + private: + + Aws::String m_evaluationContextIdentifier; + bool m_evaluationContextIdentifierHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EvaluationMode.h b/include/aws/config/model/EvaluationMode.h new file mode 100644 index 0000000000000000000000000000000000000000..49361e8297d49f56398f3e88685a7792165c4ba8 --- /dev/null +++ b/include/aws/config/model/EvaluationMode.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class EvaluationMode + { + NOT_SET, + DETECTIVE, + PROACTIVE + }; + +namespace EvaluationModeMapper +{ +AWS_CONFIGSERVICE_API EvaluationMode GetEvaluationModeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForEvaluationMode(EvaluationMode value); +} // namespace EvaluationModeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EvaluationModeConfiguration.h b/include/aws/config/model/EvaluationModeConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..0097bcc1e841fb0cb1271fd60b7d19c911dc7cac --- /dev/null +++ b/include/aws/config/model/EvaluationModeConfiguration.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The configuration object for Config rule evaluation mode. The supported valid + * values are Detective or Proactive.

See Also:

AWS + * API Reference

+ */ + class EvaluationModeConfiguration + { + public: + AWS_CONFIGSERVICE_API EvaluationModeConfiguration(); + AWS_CONFIGSERVICE_API EvaluationModeConfiguration(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API EvaluationModeConfiguration& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The mode of an evaluation. The valid values are Detective or Proactive.

+ */ + inline const EvaluationMode& GetMode() const{ return m_mode; } + inline bool ModeHasBeenSet() const { return m_modeHasBeenSet; } + inline void SetMode(const EvaluationMode& value) { m_modeHasBeenSet = true; m_mode = value; } + inline void SetMode(EvaluationMode&& value) { m_modeHasBeenSet = true; m_mode = std::move(value); } + inline EvaluationModeConfiguration& WithMode(const EvaluationMode& value) { SetMode(value); return *this;} + inline EvaluationModeConfiguration& WithMode(EvaluationMode&& value) { SetMode(std::move(value)); return *this;} + ///@} + private: + + EvaluationMode m_mode; + bool m_modeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EvaluationResult.h b/include/aws/config/model/EvaluationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..bdb94aeaba0c16073fd42590c728ad4f633e3097 --- /dev/null +++ b/include/aws/config/model/EvaluationResult.h @@ -0,0 +1,151 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details of an Config evaluation. Provides the Amazon Web Services + * resource that was evaluated, the compliance of the resource, related time + * stamps, and supplementary information.

See Also:

AWS + * API Reference

+ */ + class EvaluationResult + { + public: + AWS_CONFIGSERVICE_API EvaluationResult(); + AWS_CONFIGSERVICE_API EvaluationResult(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API EvaluationResult& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Uniquely identifies the evaluation result.

+ */ + inline const EvaluationResultIdentifier& GetEvaluationResultIdentifier() const{ return m_evaluationResultIdentifier; } + inline bool EvaluationResultIdentifierHasBeenSet() const { return m_evaluationResultIdentifierHasBeenSet; } + inline void SetEvaluationResultIdentifier(const EvaluationResultIdentifier& value) { m_evaluationResultIdentifierHasBeenSet = true; m_evaluationResultIdentifier = value; } + inline void SetEvaluationResultIdentifier(EvaluationResultIdentifier&& value) { m_evaluationResultIdentifierHasBeenSet = true; m_evaluationResultIdentifier = std::move(value); } + inline EvaluationResult& WithEvaluationResultIdentifier(const EvaluationResultIdentifier& value) { SetEvaluationResultIdentifier(value); return *this;} + inline EvaluationResult& WithEvaluationResultIdentifier(EvaluationResultIdentifier&& value) { SetEvaluationResultIdentifier(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the Amazon Web Services resource complies with the Config + * rule that evaluated it.

For the EvaluationResult data type, + * Config supports only the COMPLIANT, NON_COMPLIANT, and + * NOT_APPLICABLE values. Config does not support the + * INSUFFICIENT_DATA value for the EvaluationResult data + * type.

+ */ + inline const ComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline EvaluationResult& WithComplianceType(const ComplianceType& value) { SetComplianceType(value); return *this;} + inline EvaluationResult& WithComplianceType(ComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when Config recorded the evaluation result.

+ */ + inline const Aws::Utils::DateTime& GetResultRecordedTime() const{ return m_resultRecordedTime; } + inline bool ResultRecordedTimeHasBeenSet() const { return m_resultRecordedTimeHasBeenSet; } + inline void SetResultRecordedTime(const Aws::Utils::DateTime& value) { m_resultRecordedTimeHasBeenSet = true; m_resultRecordedTime = value; } + inline void SetResultRecordedTime(Aws::Utils::DateTime&& value) { m_resultRecordedTimeHasBeenSet = true; m_resultRecordedTime = std::move(value); } + inline EvaluationResult& WithResultRecordedTime(const Aws::Utils::DateTime& value) { SetResultRecordedTime(value); return *this;} + inline EvaluationResult& WithResultRecordedTime(Aws::Utils::DateTime&& value) { SetResultRecordedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when the Config rule evaluated the Amazon Web Services resource.

+ */ + inline const Aws::Utils::DateTime& GetConfigRuleInvokedTime() const{ return m_configRuleInvokedTime; } + inline bool ConfigRuleInvokedTimeHasBeenSet() const { return m_configRuleInvokedTimeHasBeenSet; } + inline void SetConfigRuleInvokedTime(const Aws::Utils::DateTime& value) { m_configRuleInvokedTimeHasBeenSet = true; m_configRuleInvokedTime = value; } + inline void SetConfigRuleInvokedTime(Aws::Utils::DateTime&& value) { m_configRuleInvokedTimeHasBeenSet = true; m_configRuleInvokedTime = std::move(value); } + inline EvaluationResult& WithConfigRuleInvokedTime(const Aws::Utils::DateTime& value) { SetConfigRuleInvokedTime(value); return *this;} + inline EvaluationResult& WithConfigRuleInvokedTime(Aws::Utils::DateTime&& value) { SetConfigRuleInvokedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Supplementary information about how the evaluation determined the + * compliance.

+ */ + inline const Aws::String& GetAnnotation() const{ return m_annotation; } + inline bool AnnotationHasBeenSet() const { return m_annotationHasBeenSet; } + inline void SetAnnotation(const Aws::String& value) { m_annotationHasBeenSet = true; m_annotation = value; } + inline void SetAnnotation(Aws::String&& value) { m_annotationHasBeenSet = true; m_annotation = std::move(value); } + inline void SetAnnotation(const char* value) { m_annotationHasBeenSet = true; m_annotation.assign(value); } + inline EvaluationResult& WithAnnotation(const Aws::String& value) { SetAnnotation(value); return *this;} + inline EvaluationResult& WithAnnotation(Aws::String&& value) { SetAnnotation(std::move(value)); return *this;} + inline EvaluationResult& WithAnnotation(const char* value) { SetAnnotation(value); return *this;} + ///@} + + ///@{ + /** + *

An encrypted token that associates an evaluation with an Config rule. The + * token identifies the rule, the Amazon Web Services resource being evaluated, and + * the event that triggered the evaluation.

+ */ + inline const Aws::String& GetResultToken() const{ return m_resultToken; } + inline bool ResultTokenHasBeenSet() const { return m_resultTokenHasBeenSet; } + inline void SetResultToken(const Aws::String& value) { m_resultTokenHasBeenSet = true; m_resultToken = value; } + inline void SetResultToken(Aws::String&& value) { m_resultTokenHasBeenSet = true; m_resultToken = std::move(value); } + inline void SetResultToken(const char* value) { m_resultTokenHasBeenSet = true; m_resultToken.assign(value); } + inline EvaluationResult& WithResultToken(const Aws::String& value) { SetResultToken(value); return *this;} + inline EvaluationResult& WithResultToken(Aws::String&& value) { SetResultToken(std::move(value)); return *this;} + inline EvaluationResult& WithResultToken(const char* value) { SetResultToken(value); return *this;} + ///@} + private: + + EvaluationResultIdentifier m_evaluationResultIdentifier; + bool m_evaluationResultIdentifierHasBeenSet = false; + + ComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::Utils::DateTime m_resultRecordedTime; + bool m_resultRecordedTimeHasBeenSet = false; + + Aws::Utils::DateTime m_configRuleInvokedTime; + bool m_configRuleInvokedTimeHasBeenSet = false; + + Aws::String m_annotation; + bool m_annotationHasBeenSet = false; + + Aws::String m_resultToken; + bool m_resultTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EvaluationResultIdentifier.h b/include/aws/config/model/EvaluationResultIdentifier.h new file mode 100644 index 0000000000000000000000000000000000000000..9269eb06243d5d2f6d090d39736b218be515e9e2 --- /dev/null +++ b/include/aws/config/model/EvaluationResultIdentifier.h @@ -0,0 +1,97 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Uniquely identifies an evaluation result.

See Also:

AWS + * API Reference

+ */ + class EvaluationResultIdentifier + { + public: + AWS_CONFIGSERVICE_API EvaluationResultIdentifier(); + AWS_CONFIGSERVICE_API EvaluationResultIdentifier(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API EvaluationResultIdentifier& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Identifies an Config rule used to evaluate an Amazon Web Services resource, + * and provides the type and ID of the evaluated resource.

+ */ + inline const EvaluationResultQualifier& GetEvaluationResultQualifier() const{ return m_evaluationResultQualifier; } + inline bool EvaluationResultQualifierHasBeenSet() const { return m_evaluationResultQualifierHasBeenSet; } + inline void SetEvaluationResultQualifier(const EvaluationResultQualifier& value) { m_evaluationResultQualifierHasBeenSet = true; m_evaluationResultQualifier = value; } + inline void SetEvaluationResultQualifier(EvaluationResultQualifier&& value) { m_evaluationResultQualifierHasBeenSet = true; m_evaluationResultQualifier = std::move(value); } + inline EvaluationResultIdentifier& WithEvaluationResultQualifier(const EvaluationResultQualifier& value) { SetEvaluationResultQualifier(value); return *this;} + inline EvaluationResultIdentifier& WithEvaluationResultQualifier(EvaluationResultQualifier&& value) { SetEvaluationResultQualifier(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time of the event that triggered the evaluation of your Amazon Web + * Services resources. The time can indicate when Config delivered a configuration + * item change notification, or it can indicate when Config delivered the + * configuration snapshot, depending on which event triggered the evaluation.

+ */ + inline const Aws::Utils::DateTime& GetOrderingTimestamp() const{ return m_orderingTimestamp; } + inline bool OrderingTimestampHasBeenSet() const { return m_orderingTimestampHasBeenSet; } + inline void SetOrderingTimestamp(const Aws::Utils::DateTime& value) { m_orderingTimestampHasBeenSet = true; m_orderingTimestamp = value; } + inline void SetOrderingTimestamp(Aws::Utils::DateTime&& value) { m_orderingTimestampHasBeenSet = true; m_orderingTimestamp = std::move(value); } + inline EvaluationResultIdentifier& WithOrderingTimestamp(const Aws::Utils::DateTime& value) { SetOrderingTimestamp(value); return *this;} + inline EvaluationResultIdentifier& WithOrderingTimestamp(Aws::Utils::DateTime&& value) { SetOrderingTimestamp(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A Unique ID for an evaluation result.

+ */ + inline const Aws::String& GetResourceEvaluationId() const{ return m_resourceEvaluationId; } + inline bool ResourceEvaluationIdHasBeenSet() const { return m_resourceEvaluationIdHasBeenSet; } + inline void SetResourceEvaluationId(const Aws::String& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = value; } + inline void SetResourceEvaluationId(Aws::String&& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = std::move(value); } + inline void SetResourceEvaluationId(const char* value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId.assign(value); } + inline EvaluationResultIdentifier& WithResourceEvaluationId(const Aws::String& value) { SetResourceEvaluationId(value); return *this;} + inline EvaluationResultIdentifier& WithResourceEvaluationId(Aws::String&& value) { SetResourceEvaluationId(std::move(value)); return *this;} + inline EvaluationResultIdentifier& WithResourceEvaluationId(const char* value) { SetResourceEvaluationId(value); return *this;} + ///@} + private: + + EvaluationResultQualifier m_evaluationResultQualifier; + bool m_evaluationResultQualifierHasBeenSet = false; + + Aws::Utils::DateTime m_orderingTimestamp; + bool m_orderingTimestampHasBeenSet = false; + + Aws::String m_resourceEvaluationId; + bool m_resourceEvaluationIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EvaluationResultQualifier.h b/include/aws/config/model/EvaluationResultQualifier.h new file mode 100644 index 0000000000000000000000000000000000000000..96687cdf50b5b1d9daeba625b520ca4d6f4b4cf3 --- /dev/null +++ b/include/aws/config/model/EvaluationResultQualifier.h @@ -0,0 +1,113 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Identifies an Config rule that evaluated an Amazon Web Services resource, and + * provides the type and ID of the resource that the rule evaluated.

See + * Also:

AWS + * API Reference

+ */ + class EvaluationResultQualifier + { + public: + AWS_CONFIGSERVICE_API EvaluationResultQualifier(); + AWS_CONFIGSERVICE_API EvaluationResultQualifier(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API EvaluationResultQualifier& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the Config rule that was used in the evaluation.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline EvaluationResultQualifier& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline EvaluationResultQualifier& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline EvaluationResultQualifier& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The type of Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline EvaluationResultQualifier& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline EvaluationResultQualifier& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline EvaluationResultQualifier& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the evaluated Amazon Web Services resource.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline EvaluationResultQualifier& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline EvaluationResultQualifier& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline EvaluationResultQualifier& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The mode of an evaluation. The valid values are Detective or Proactive.

+ */ + inline const EvaluationMode& GetEvaluationMode() const{ return m_evaluationMode; } + inline bool EvaluationModeHasBeenSet() const { return m_evaluationModeHasBeenSet; } + inline void SetEvaluationMode(const EvaluationMode& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = value; } + inline void SetEvaluationMode(EvaluationMode&& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = std::move(value); } + inline EvaluationResultQualifier& WithEvaluationMode(const EvaluationMode& value) { SetEvaluationMode(value); return *this;} + inline EvaluationResultQualifier& WithEvaluationMode(EvaluationMode&& value) { SetEvaluationMode(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + EvaluationMode m_evaluationMode; + bool m_evaluationModeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EvaluationStatus.h b/include/aws/config/model/EvaluationStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..fbc94b259bb802431d641e071f14b1937a5ca895 --- /dev/null +++ b/include/aws/config/model/EvaluationStatus.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns status details of an evaluation.

See Also:

AWS + * API Reference

+ */ + class EvaluationStatus + { + public: + AWS_CONFIGSERVICE_API EvaluationStatus(); + AWS_CONFIGSERVICE_API EvaluationStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API EvaluationStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The status of an execution. The valid values are In_Progress, Succeeded or + * Failed.

+ */ + inline const ResourceEvaluationStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const ResourceEvaluationStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(ResourceEvaluationStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline EvaluationStatus& WithStatus(const ResourceEvaluationStatus& value) { SetStatus(value); return *this;} + inline EvaluationStatus& WithStatus(ResourceEvaluationStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An explanation for failed execution status.

+ */ + inline const Aws::String& GetFailureReason() const{ return m_failureReason; } + inline bool FailureReasonHasBeenSet() const { return m_failureReasonHasBeenSet; } + inline void SetFailureReason(const Aws::String& value) { m_failureReasonHasBeenSet = true; m_failureReason = value; } + inline void SetFailureReason(Aws::String&& value) { m_failureReasonHasBeenSet = true; m_failureReason = std::move(value); } + inline void SetFailureReason(const char* value) { m_failureReasonHasBeenSet = true; m_failureReason.assign(value); } + inline EvaluationStatus& WithFailureReason(const Aws::String& value) { SetFailureReason(value); return *this;} + inline EvaluationStatus& WithFailureReason(Aws::String&& value) { SetFailureReason(std::move(value)); return *this;} + inline EvaluationStatus& WithFailureReason(const char* value) { SetFailureReason(value); return *this;} + ///@} + private: + + ResourceEvaluationStatus m_status; + bool m_statusHasBeenSet = false; + + Aws::String m_failureReason; + bool m_failureReasonHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/EventSource.h b/include/aws/config/model/EventSource.h new file mode 100644 index 0000000000000000000000000000000000000000..409d43246283734782bb64d834be6c532e55bd1d --- /dev/null +++ b/include/aws/config/model/EventSource.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class EventSource + { + NOT_SET, + aws_config + }; + +namespace EventSourceMapper +{ +AWS_CONFIGSERVICE_API EventSource GetEventSourceForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForEventSource(EventSource value); +} // namespace EventSourceMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ExclusionByResourceTypes.h b/include/aws/config/model/ExclusionByResourceTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..5e49cc877552aeed9a96a52dc4c910b92dfa7a60 --- /dev/null +++ b/include/aws/config/model/ExclusionByResourceTypes.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Specifies whether the configuration recorder excludes certain resource types + * from being recorded. Use the resourceTypes field to enter a + * comma-separated list of resource types you want to exclude from recording.

+ *

By default, when Config adds support for a new resource type in the Region + * where you set up the configuration recorder, including global resource types, + * Config starts recording resources of that type automatically.

+ * How to use the exclusion recording strategy

To use this option, + * you must set the useOnly field of RecordingStrategy + * to EXCLUSION_BY_RESOURCE_TYPES.

Config will then record + * configuration changes for all supported resource types, except the resource + * types that you specify to exclude from being recorded.

Global + * resource types and the exclusion recording strategy

Unless + * specifically listed as exclusions, AWS::RDS::GlobalCluster will be + * recorded automatically in all supported Config Regions were the configuration + * recorder is enabled.

IAM users, groups, roles, and customer managed + * policies will be recorded in the Region where you set up the configuration + * recorder if that is a Region where Config was available before February 2022. + * You cannot be record the global IAM resouce types in Regions supported by Config + * after February 2022. For a list of those Regions, see Recording + * Amazon Web Services Resources | Global Resources.

See + * Also:

AWS + * API Reference

+ */ + class ExclusionByResourceTypes + { + public: + AWS_CONFIGSERVICE_API ExclusionByResourceTypes(); + AWS_CONFIGSERVICE_API ExclusionByResourceTypes(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ExclusionByResourceTypes& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

A comma-separated list of resource types to exclude from recording by the + * configuration recorder.

+ */ + inline const Aws::Vector& GetResourceTypes() const{ return m_resourceTypes; } + inline bool ResourceTypesHasBeenSet() const { return m_resourceTypesHasBeenSet; } + inline void SetResourceTypes(const Aws::Vector& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = value; } + inline void SetResourceTypes(Aws::Vector&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = std::move(value); } + inline ExclusionByResourceTypes& WithResourceTypes(const Aws::Vector& value) { SetResourceTypes(value); return *this;} + inline ExclusionByResourceTypes& WithResourceTypes(Aws::Vector&& value) { SetResourceTypes(std::move(value)); return *this;} + inline ExclusionByResourceTypes& AddResourceTypes(const ResourceType& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + inline ExclusionByResourceTypes& AddResourceTypes(ResourceType&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_resourceTypes; + bool m_resourceTypesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ExecutionControls.h b/include/aws/config/model/ExecutionControls.h new file mode 100644 index 0000000000000000000000000000000000000000..60213a3be2291077a8b3d026de88e4ddee4b2fae --- /dev/null +++ b/include/aws/config/model/ExecutionControls.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The controls that Config uses for executing remediations.

See + * Also:

AWS + * API Reference

+ */ + class ExecutionControls + { + public: + AWS_CONFIGSERVICE_API ExecutionControls(); + AWS_CONFIGSERVICE_API ExecutionControls(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ExecutionControls& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

A SsmControls object.

+ */ + inline const SsmControls& GetSsmControls() const{ return m_ssmControls; } + inline bool SsmControlsHasBeenSet() const { return m_ssmControlsHasBeenSet; } + inline void SetSsmControls(const SsmControls& value) { m_ssmControlsHasBeenSet = true; m_ssmControls = value; } + inline void SetSsmControls(SsmControls&& value) { m_ssmControlsHasBeenSet = true; m_ssmControls = std::move(value); } + inline ExecutionControls& WithSsmControls(const SsmControls& value) { SetSsmControls(value); return *this;} + inline ExecutionControls& WithSsmControls(SsmControls&& value) { SetSsmControls(std::move(value)); return *this;} + ///@} + private: + + SsmControls m_ssmControls; + bool m_ssmControlsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ExternalEvaluation.h b/include/aws/config/model/ExternalEvaluation.h new file mode 100644 index 0000000000000000000000000000000000000000..0a2f1190d35cba6d35fa3b49dab833eb3e371904 --- /dev/null +++ b/include/aws/config/model/ExternalEvaluation.h @@ -0,0 +1,133 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Identifies an Amazon Web Services resource and indicates whether it complies + * with the Config rule that it was evaluated against.

See Also:

+ * AWS + * API Reference

+ */ + class ExternalEvaluation + { + public: + AWS_CONFIGSERVICE_API ExternalEvaluation(); + AWS_CONFIGSERVICE_API ExternalEvaluation(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ExternalEvaluation& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The evaluated compliance resource type. Config accepts + * AWS::::Account resource type.

+ */ + inline const Aws::String& GetComplianceResourceType() const{ return m_complianceResourceType; } + inline bool ComplianceResourceTypeHasBeenSet() const { return m_complianceResourceTypeHasBeenSet; } + inline void SetComplianceResourceType(const Aws::String& value) { m_complianceResourceTypeHasBeenSet = true; m_complianceResourceType = value; } + inline void SetComplianceResourceType(Aws::String&& value) { m_complianceResourceTypeHasBeenSet = true; m_complianceResourceType = std::move(value); } + inline void SetComplianceResourceType(const char* value) { m_complianceResourceTypeHasBeenSet = true; m_complianceResourceType.assign(value); } + inline ExternalEvaluation& WithComplianceResourceType(const Aws::String& value) { SetComplianceResourceType(value); return *this;} + inline ExternalEvaluation& WithComplianceResourceType(Aws::String&& value) { SetComplianceResourceType(std::move(value)); return *this;} + inline ExternalEvaluation& WithComplianceResourceType(const char* value) { SetComplianceResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The evaluated compliance resource ID. Config accepts only Amazon Web Services + * account ID.

+ */ + inline const Aws::String& GetComplianceResourceId() const{ return m_complianceResourceId; } + inline bool ComplianceResourceIdHasBeenSet() const { return m_complianceResourceIdHasBeenSet; } + inline void SetComplianceResourceId(const Aws::String& value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId = value; } + inline void SetComplianceResourceId(Aws::String&& value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId = std::move(value); } + inline void SetComplianceResourceId(const char* value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId.assign(value); } + inline ExternalEvaluation& WithComplianceResourceId(const Aws::String& value) { SetComplianceResourceId(value); return *this;} + inline ExternalEvaluation& WithComplianceResourceId(Aws::String&& value) { SetComplianceResourceId(std::move(value)); return *this;} + inline ExternalEvaluation& WithComplianceResourceId(const char* value) { SetComplianceResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The compliance of the Amazon Web Services resource. The valid values are + * COMPLIANT, NON_COMPLIANT, and NOT_APPLICABLE.

+ */ + inline const ComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline ExternalEvaluation& WithComplianceType(const ComplianceType& value) { SetComplianceType(value); return *this;} + inline ExternalEvaluation& WithComplianceType(ComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Supplementary information about the reason of compliance. For example, this + * task was completed on a specific date.

+ */ + inline const Aws::String& GetAnnotation() const{ return m_annotation; } + inline bool AnnotationHasBeenSet() const { return m_annotationHasBeenSet; } + inline void SetAnnotation(const Aws::String& value) { m_annotationHasBeenSet = true; m_annotation = value; } + inline void SetAnnotation(Aws::String&& value) { m_annotationHasBeenSet = true; m_annotation = std::move(value); } + inline void SetAnnotation(const char* value) { m_annotationHasBeenSet = true; m_annotation.assign(value); } + inline ExternalEvaluation& WithAnnotation(const Aws::String& value) { SetAnnotation(value); return *this;} + inline ExternalEvaluation& WithAnnotation(Aws::String&& value) { SetAnnotation(std::move(value)); return *this;} + inline ExternalEvaluation& WithAnnotation(const char* value) { SetAnnotation(value); return *this;} + ///@} + + ///@{ + /** + *

The time when the compliance was recorded.

+ */ + inline const Aws::Utils::DateTime& GetOrderingTimestamp() const{ return m_orderingTimestamp; } + inline bool OrderingTimestampHasBeenSet() const { return m_orderingTimestampHasBeenSet; } + inline void SetOrderingTimestamp(const Aws::Utils::DateTime& value) { m_orderingTimestampHasBeenSet = true; m_orderingTimestamp = value; } + inline void SetOrderingTimestamp(Aws::Utils::DateTime&& value) { m_orderingTimestampHasBeenSet = true; m_orderingTimestamp = std::move(value); } + inline ExternalEvaluation& WithOrderingTimestamp(const Aws::Utils::DateTime& value) { SetOrderingTimestamp(value); return *this;} + inline ExternalEvaluation& WithOrderingTimestamp(Aws::Utils::DateTime&& value) { SetOrderingTimestamp(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_complianceResourceType; + bool m_complianceResourceTypeHasBeenSet = false; + + Aws::String m_complianceResourceId; + bool m_complianceResourceIdHasBeenSet = false; + + ComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + Aws::String m_annotation; + bool m_annotationHasBeenSet = false; + + Aws::Utils::DateTime m_orderingTimestamp; + bool m_orderingTimestampHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/FailedDeleteRemediationExceptionsBatch.h b/include/aws/config/model/FailedDeleteRemediationExceptionsBatch.h new file mode 100644 index 0000000000000000000000000000000000000000..cbeb405e0f0efccd9740bc6f59c482e9c4568ad7 --- /dev/null +++ b/include/aws/config/model/FailedDeleteRemediationExceptionsBatch.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

List of each of the failed delete remediation exceptions with specific + * reasons.

See Also:

AWS + * API Reference

+ */ + class FailedDeleteRemediationExceptionsBatch + { + public: + AWS_CONFIGSERVICE_API FailedDeleteRemediationExceptionsBatch(); + AWS_CONFIGSERVICE_API FailedDeleteRemediationExceptionsBatch(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API FailedDeleteRemediationExceptionsBatch& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Returns a failure message for delete remediation exception. For example, + * Config creates an exception due to an internal error.

+ */ + inline const Aws::String& GetFailureMessage() const{ return m_failureMessage; } + inline bool FailureMessageHasBeenSet() const { return m_failureMessageHasBeenSet; } + inline void SetFailureMessage(const Aws::String& value) { m_failureMessageHasBeenSet = true; m_failureMessage = value; } + inline void SetFailureMessage(Aws::String&& value) { m_failureMessageHasBeenSet = true; m_failureMessage = std::move(value); } + inline void SetFailureMessage(const char* value) { m_failureMessageHasBeenSet = true; m_failureMessage.assign(value); } + inline FailedDeleteRemediationExceptionsBatch& WithFailureMessage(const Aws::String& value) { SetFailureMessage(value); return *this;} + inline FailedDeleteRemediationExceptionsBatch& WithFailureMessage(Aws::String&& value) { SetFailureMessage(std::move(value)); return *this;} + inline FailedDeleteRemediationExceptionsBatch& WithFailureMessage(const char* value) { SetFailureMessage(value); return *this;} + ///@} + + ///@{ + /** + *

Returns remediation exception resource key object of the failed items.

+ */ + inline const Aws::Vector& GetFailedItems() const{ return m_failedItems; } + inline bool FailedItemsHasBeenSet() const { return m_failedItemsHasBeenSet; } + inline void SetFailedItems(const Aws::Vector& value) { m_failedItemsHasBeenSet = true; m_failedItems = value; } + inline void SetFailedItems(Aws::Vector&& value) { m_failedItemsHasBeenSet = true; m_failedItems = std::move(value); } + inline FailedDeleteRemediationExceptionsBatch& WithFailedItems(const Aws::Vector& value) { SetFailedItems(value); return *this;} + inline FailedDeleteRemediationExceptionsBatch& WithFailedItems(Aws::Vector&& value) { SetFailedItems(std::move(value)); return *this;} + inline FailedDeleteRemediationExceptionsBatch& AddFailedItems(const RemediationExceptionResourceKey& value) { m_failedItemsHasBeenSet = true; m_failedItems.push_back(value); return *this; } + inline FailedDeleteRemediationExceptionsBatch& AddFailedItems(RemediationExceptionResourceKey&& value) { m_failedItemsHasBeenSet = true; m_failedItems.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_failureMessage; + bool m_failureMessageHasBeenSet = false; + + Aws::Vector m_failedItems; + bool m_failedItemsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/FailedRemediationBatch.h b/include/aws/config/model/FailedRemediationBatch.h new file mode 100644 index 0000000000000000000000000000000000000000..85060ce06b1a78e2e4f6dc1e851be06d6c5f3df5 --- /dev/null +++ b/include/aws/config/model/FailedRemediationBatch.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

List of each of the failed remediations with specific reasons.

See + * Also:

AWS + * API Reference

+ */ + class FailedRemediationBatch + { + public: + AWS_CONFIGSERVICE_API FailedRemediationBatch(); + AWS_CONFIGSERVICE_API FailedRemediationBatch(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API FailedRemediationBatch& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Returns a failure message. For example, the resource is already + * compliant.

+ */ + inline const Aws::String& GetFailureMessage() const{ return m_failureMessage; } + inline bool FailureMessageHasBeenSet() const { return m_failureMessageHasBeenSet; } + inline void SetFailureMessage(const Aws::String& value) { m_failureMessageHasBeenSet = true; m_failureMessage = value; } + inline void SetFailureMessage(Aws::String&& value) { m_failureMessageHasBeenSet = true; m_failureMessage = std::move(value); } + inline void SetFailureMessage(const char* value) { m_failureMessageHasBeenSet = true; m_failureMessage.assign(value); } + inline FailedRemediationBatch& WithFailureMessage(const Aws::String& value) { SetFailureMessage(value); return *this;} + inline FailedRemediationBatch& WithFailureMessage(Aws::String&& value) { SetFailureMessage(std::move(value)); return *this;} + inline FailedRemediationBatch& WithFailureMessage(const char* value) { SetFailureMessage(value); return *this;} + ///@} + + ///@{ + /** + *

Returns remediation configurations of the failed items.

+ */ + inline const Aws::Vector& GetFailedItems() const{ return m_failedItems; } + inline bool FailedItemsHasBeenSet() const { return m_failedItemsHasBeenSet; } + inline void SetFailedItems(const Aws::Vector& value) { m_failedItemsHasBeenSet = true; m_failedItems = value; } + inline void SetFailedItems(Aws::Vector&& value) { m_failedItemsHasBeenSet = true; m_failedItems = std::move(value); } + inline FailedRemediationBatch& WithFailedItems(const Aws::Vector& value) { SetFailedItems(value); return *this;} + inline FailedRemediationBatch& WithFailedItems(Aws::Vector&& value) { SetFailedItems(std::move(value)); return *this;} + inline FailedRemediationBatch& AddFailedItems(const RemediationConfiguration& value) { m_failedItemsHasBeenSet = true; m_failedItems.push_back(value); return *this; } + inline FailedRemediationBatch& AddFailedItems(RemediationConfiguration&& value) { m_failedItemsHasBeenSet = true; m_failedItems.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_failureMessage; + bool m_failureMessageHasBeenSet = false; + + Aws::Vector m_failedItems; + bool m_failedItemsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/FailedRemediationExceptionBatch.h b/include/aws/config/model/FailedRemediationExceptionBatch.h new file mode 100644 index 0000000000000000000000000000000000000000..1ab23f800699cff446536b8f985957ef154e5786 --- /dev/null +++ b/include/aws/config/model/FailedRemediationExceptionBatch.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

List of each of the failed remediation exceptions with specific + * reasons.

See Also:

AWS + * API Reference

+ */ + class FailedRemediationExceptionBatch + { + public: + AWS_CONFIGSERVICE_API FailedRemediationExceptionBatch(); + AWS_CONFIGSERVICE_API FailedRemediationExceptionBatch(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API FailedRemediationExceptionBatch& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Returns a failure message. For example, the auto-remediation has failed.

+ */ + inline const Aws::String& GetFailureMessage() const{ return m_failureMessage; } + inline bool FailureMessageHasBeenSet() const { return m_failureMessageHasBeenSet; } + inline void SetFailureMessage(const Aws::String& value) { m_failureMessageHasBeenSet = true; m_failureMessage = value; } + inline void SetFailureMessage(Aws::String&& value) { m_failureMessageHasBeenSet = true; m_failureMessage = std::move(value); } + inline void SetFailureMessage(const char* value) { m_failureMessageHasBeenSet = true; m_failureMessage.assign(value); } + inline FailedRemediationExceptionBatch& WithFailureMessage(const Aws::String& value) { SetFailureMessage(value); return *this;} + inline FailedRemediationExceptionBatch& WithFailureMessage(Aws::String&& value) { SetFailureMessage(std::move(value)); return *this;} + inline FailedRemediationExceptionBatch& WithFailureMessage(const char* value) { SetFailureMessage(value); return *this;} + ///@} + + ///@{ + /** + *

Returns remediation exception resource key object of the failed items.

+ */ + inline const Aws::Vector& GetFailedItems() const{ return m_failedItems; } + inline bool FailedItemsHasBeenSet() const { return m_failedItemsHasBeenSet; } + inline void SetFailedItems(const Aws::Vector& value) { m_failedItemsHasBeenSet = true; m_failedItems = value; } + inline void SetFailedItems(Aws::Vector&& value) { m_failedItemsHasBeenSet = true; m_failedItems = std::move(value); } + inline FailedRemediationExceptionBatch& WithFailedItems(const Aws::Vector& value) { SetFailedItems(value); return *this;} + inline FailedRemediationExceptionBatch& WithFailedItems(Aws::Vector&& value) { SetFailedItems(std::move(value)); return *this;} + inline FailedRemediationExceptionBatch& AddFailedItems(const RemediationException& value) { m_failedItemsHasBeenSet = true; m_failedItems.push_back(value); return *this; } + inline FailedRemediationExceptionBatch& AddFailedItems(RemediationException&& value) { m_failedItemsHasBeenSet = true; m_failedItems.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_failureMessage; + bool m_failureMessageHasBeenSet = false; + + Aws::Vector m_failedItems; + bool m_failedItemsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/FieldInfo.h b/include/aws/config/model/FieldInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..6a03e2bd4adf92db3384b055eb7ff1dba9931f56 --- /dev/null +++ b/include/aws/config/model/FieldInfo.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Details about the fields such as name of the field.

See Also:

+ * AWS + * API Reference

+ */ + class FieldInfo + { + public: + AWS_CONFIGSERVICE_API FieldInfo(); + AWS_CONFIGSERVICE_API FieldInfo(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API FieldInfo& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Name of the field.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline FieldInfo& WithName(const Aws::String& value) { SetName(value); return *this;} + inline FieldInfo& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline FieldInfo& WithName(const char* value) { SetName(value); return *this;} + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateComplianceDetailsByConfigRuleRequest.h b/include/aws/config/model/GetAggregateComplianceDetailsByConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c1cb5b9c1b77f0ab4708d7b34dc6a5ccd306a9fb --- /dev/null +++ b/include/aws/config/model/GetAggregateComplianceDetailsByConfigRuleRequest.h @@ -0,0 +1,162 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetAggregateComplianceDetailsByConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetAggregateComplianceDetailsByConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetAggregateComplianceDetailsByConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the Config rule for which you want compliance information.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit account ID of the source account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The source region from where the data is aggregated.

+ */ + inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; } + inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; } + inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; } + inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); } + inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); } + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;} + ///@} + + ///@{ + /** + *

The resource compliance status.

For the + * GetAggregateComplianceDetailsByConfigRuleRequest data type, Config + * supports only the COMPLIANT and NON_COMPLIANT. Config + * does not support the NOT_APPLICABLE and + * INSUFFICIENT_DATA values.

+ */ + inline const ComplianceType& GetComplianceType() const{ return m_complianceType; } + inline bool ComplianceTypeHasBeenSet() const { return m_complianceTypeHasBeenSet; } + inline void SetComplianceType(const ComplianceType& value) { m_complianceTypeHasBeenSet = true; m_complianceType = value; } + inline void SetComplianceType(ComplianceType&& value) { m_complianceTypeHasBeenSet = true; m_complianceType = std::move(value); } + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithComplianceType(const ComplianceType& value) { SetComplianceType(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithComplianceType(ComplianceType&& value) { SetComplianceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of evaluation results returned on each page. The default + * is 50. You cannot specify a number greater than 100. If you specify 0, Config + * uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_awsRegion; + bool m_awsRegionHasBeenSet = false; + + ComplianceType m_complianceType; + bool m_complianceTypeHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateComplianceDetailsByConfigRuleResult.h b/include/aws/config/model/GetAggregateComplianceDetailsByConfigRuleResult.h new file mode 100644 index 0000000000000000000000000000000000000000..577e0546c90e932df0ef24f43a5f1af2d46d95a9 --- /dev/null +++ b/include/aws/config/model/GetAggregateComplianceDetailsByConfigRuleResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetAggregateComplianceDetailsByConfigRuleResult + { + public: + AWS_CONFIGSERVICE_API GetAggregateComplianceDetailsByConfigRuleResult(); + AWS_CONFIGSERVICE_API GetAggregateComplianceDetailsByConfigRuleResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetAggregateComplianceDetailsByConfigRuleResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns an AggregateEvaluationResults object.

+ */ + inline const Aws::Vector& GetAggregateEvaluationResults() const{ return m_aggregateEvaluationResults; } + inline void SetAggregateEvaluationResults(const Aws::Vector& value) { m_aggregateEvaluationResults = value; } + inline void SetAggregateEvaluationResults(Aws::Vector&& value) { m_aggregateEvaluationResults = std::move(value); } + inline GetAggregateComplianceDetailsByConfigRuleResult& WithAggregateEvaluationResults(const Aws::Vector& value) { SetAggregateEvaluationResults(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleResult& WithAggregateEvaluationResults(Aws::Vector&& value) { SetAggregateEvaluationResults(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleResult& AddAggregateEvaluationResults(const AggregateEvaluationResult& value) { m_aggregateEvaluationResults.push_back(value); return *this; } + inline GetAggregateComplianceDetailsByConfigRuleResult& AddAggregateEvaluationResults(AggregateEvaluationResult&& value) { m_aggregateEvaluationResults.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetAggregateComplianceDetailsByConfigRuleResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetAggregateComplianceDetailsByConfigRuleResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetAggregateComplianceDetailsByConfigRuleResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_aggregateEvaluationResults; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateConfigRuleComplianceSummaryRequest.h b/include/aws/config/model/GetAggregateConfigRuleComplianceSummaryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..980e77be7b24740bd77e12b5ba39528137f0cd8c --- /dev/null +++ b/include/aws/config/model/GetAggregateConfigRuleComplianceSummaryRequest.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetAggregateConfigRuleComplianceSummaryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetAggregateConfigRuleComplianceSummaryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetAggregateConfigRuleComplianceSummary"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline GetAggregateConfigRuleComplianceSummaryRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline GetAggregateConfigRuleComplianceSummaryRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results based on the ConfigRuleComplianceSummaryFilters + * object.

+ */ + inline const ConfigRuleComplianceSummaryFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ConfigRuleComplianceSummaryFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ConfigRuleComplianceSummaryFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline GetAggregateConfigRuleComplianceSummaryRequest& WithFilters(const ConfigRuleComplianceSummaryFilters& value) { SetFilters(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryRequest& WithFilters(ConfigRuleComplianceSummaryFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Groups the result based on ACCOUNT_ID or AWS_REGION.

+ */ + inline const ConfigRuleComplianceSummaryGroupKey& GetGroupByKey() const{ return m_groupByKey; } + inline bool GroupByKeyHasBeenSet() const { return m_groupByKeyHasBeenSet; } + inline void SetGroupByKey(const ConfigRuleComplianceSummaryGroupKey& value) { m_groupByKeyHasBeenSet = true; m_groupByKey = value; } + inline void SetGroupByKey(ConfigRuleComplianceSummaryGroupKey&& value) { m_groupByKeyHasBeenSet = true; m_groupByKey = std::move(value); } + inline GetAggregateConfigRuleComplianceSummaryRequest& WithGroupByKey(const ConfigRuleComplianceSummaryGroupKey& value) { SetGroupByKey(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryRequest& WithGroupByKey(ConfigRuleComplianceSummaryGroupKey&& value) { SetGroupByKey(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of evaluation results returned on each page. The default + * is 1000. You cannot specify a number greater than 1000. If you specify 0, Config + * uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetAggregateConfigRuleComplianceSummaryRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetAggregateConfigRuleComplianceSummaryRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateConfigRuleComplianceSummaryRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + ConfigRuleComplianceSummaryFilters m_filters; + bool m_filtersHasBeenSet = false; + + ConfigRuleComplianceSummaryGroupKey m_groupByKey; + bool m_groupByKeyHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateConfigRuleComplianceSummaryResult.h b/include/aws/config/model/GetAggregateConfigRuleComplianceSummaryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f0b90d7477780b1249d504ffdb57c035a681e7a2 --- /dev/null +++ b/include/aws/config/model/GetAggregateConfigRuleComplianceSummaryResult.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetAggregateConfigRuleComplianceSummaryResult + { + public: + AWS_CONFIGSERVICE_API GetAggregateConfigRuleComplianceSummaryResult(); + AWS_CONFIGSERVICE_API GetAggregateConfigRuleComplianceSummaryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetAggregateConfigRuleComplianceSummaryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Groups the result based on ACCOUNT_ID or AWS_REGION.

+ */ + inline const Aws::String& GetGroupByKey() const{ return m_groupByKey; } + inline void SetGroupByKey(const Aws::String& value) { m_groupByKey = value; } + inline void SetGroupByKey(Aws::String&& value) { m_groupByKey = std::move(value); } + inline void SetGroupByKey(const char* value) { m_groupByKey.assign(value); } + inline GetAggregateConfigRuleComplianceSummaryResult& WithGroupByKey(const Aws::String& value) { SetGroupByKey(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& WithGroupByKey(Aws::String&& value) { SetGroupByKey(std::move(value)); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& WithGroupByKey(const char* value) { SetGroupByKey(value); return *this;} + ///@} + + ///@{ + /** + *

Returns a list of AggregateComplianceCounts object.

+ */ + inline const Aws::Vector& GetAggregateComplianceCounts() const{ return m_aggregateComplianceCounts; } + inline void SetAggregateComplianceCounts(const Aws::Vector& value) { m_aggregateComplianceCounts = value; } + inline void SetAggregateComplianceCounts(Aws::Vector&& value) { m_aggregateComplianceCounts = std::move(value); } + inline GetAggregateConfigRuleComplianceSummaryResult& WithAggregateComplianceCounts(const Aws::Vector& value) { SetAggregateComplianceCounts(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& WithAggregateComplianceCounts(Aws::Vector&& value) { SetAggregateComplianceCounts(std::move(value)); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& AddAggregateComplianceCounts(const AggregateComplianceCount& value) { m_aggregateComplianceCounts.push_back(value); return *this; } + inline GetAggregateConfigRuleComplianceSummaryResult& AddAggregateComplianceCounts(AggregateComplianceCount&& value) { m_aggregateComplianceCounts.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetAggregateConfigRuleComplianceSummaryResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetAggregateConfigRuleComplianceSummaryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetAggregateConfigRuleComplianceSummaryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_groupByKey; + + Aws::Vector m_aggregateComplianceCounts; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateConformancePackComplianceSummaryRequest.h b/include/aws/config/model/GetAggregateConformancePackComplianceSummaryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d9141829ba38e3cb715b818a7180d9919aa0dec7 --- /dev/null +++ b/include/aws/config/model/GetAggregateConformancePackComplianceSummaryRequest.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetAggregateConformancePackComplianceSummaryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetAggregateConformancePackComplianceSummaryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetAggregateConformancePackComplianceSummary"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline GetAggregateConformancePackComplianceSummaryRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline GetAggregateConformancePackComplianceSummaryRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results based on the + * AggregateConformancePackComplianceSummaryFilters object.

+ */ + inline const AggregateConformancePackComplianceSummaryFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const AggregateConformancePackComplianceSummaryFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(AggregateConformancePackComplianceSummaryFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline GetAggregateConformancePackComplianceSummaryRequest& WithFilters(const AggregateConformancePackComplianceSummaryFilters& value) { SetFilters(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryRequest& WithFilters(AggregateConformancePackComplianceSummaryFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Groups the result based on Amazon Web Services account ID or Amazon Web + * Services Region.

+ */ + inline const AggregateConformancePackComplianceSummaryGroupKey& GetGroupByKey() const{ return m_groupByKey; } + inline bool GroupByKeyHasBeenSet() const { return m_groupByKeyHasBeenSet; } + inline void SetGroupByKey(const AggregateConformancePackComplianceSummaryGroupKey& value) { m_groupByKeyHasBeenSet = true; m_groupByKey = value; } + inline void SetGroupByKey(AggregateConformancePackComplianceSummaryGroupKey&& value) { m_groupByKeyHasBeenSet = true; m_groupByKey = std::move(value); } + inline GetAggregateConformancePackComplianceSummaryRequest& WithGroupByKey(const AggregateConformancePackComplianceSummaryGroupKey& value) { SetGroupByKey(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryRequest& WithGroupByKey(AggregateConformancePackComplianceSummaryGroupKey&& value) { SetGroupByKey(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of results returned on each page. The default is maximum. + * If you specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetAggregateConformancePackComplianceSummaryRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetAggregateConformancePackComplianceSummaryRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateConformancePackComplianceSummaryRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + AggregateConformancePackComplianceSummaryFilters m_filters; + bool m_filtersHasBeenSet = false; + + AggregateConformancePackComplianceSummaryGroupKey m_groupByKey; + bool m_groupByKeyHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateConformancePackComplianceSummaryResult.h b/include/aws/config/model/GetAggregateConformancePackComplianceSummaryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..3a5b6c3a4ec4ffd272124954ab065554e4a76425 --- /dev/null +++ b/include/aws/config/model/GetAggregateConformancePackComplianceSummaryResult.h @@ -0,0 +1,102 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetAggregateConformancePackComplianceSummaryResult + { + public: + AWS_CONFIGSERVICE_API GetAggregateConformancePackComplianceSummaryResult(); + AWS_CONFIGSERVICE_API GetAggregateConformancePackComplianceSummaryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetAggregateConformancePackComplianceSummaryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of AggregateConformancePackComplianceSummary + * object.

+ */ + inline const Aws::Vector& GetAggregateConformancePackComplianceSummaries() const{ return m_aggregateConformancePackComplianceSummaries; } + inline void SetAggregateConformancePackComplianceSummaries(const Aws::Vector& value) { m_aggregateConformancePackComplianceSummaries = value; } + inline void SetAggregateConformancePackComplianceSummaries(Aws::Vector&& value) { m_aggregateConformancePackComplianceSummaries = std::move(value); } + inline GetAggregateConformancePackComplianceSummaryResult& WithAggregateConformancePackComplianceSummaries(const Aws::Vector& value) { SetAggregateConformancePackComplianceSummaries(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& WithAggregateConformancePackComplianceSummaries(Aws::Vector&& value) { SetAggregateConformancePackComplianceSummaries(std::move(value)); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& AddAggregateConformancePackComplianceSummaries(const AggregateConformancePackComplianceSummary& value) { m_aggregateConformancePackComplianceSummaries.push_back(value); return *this; } + inline GetAggregateConformancePackComplianceSummaryResult& AddAggregateConformancePackComplianceSummaries(AggregateConformancePackComplianceSummary&& value) { m_aggregateConformancePackComplianceSummaries.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Groups the result based on Amazon Web Services account ID or Amazon Web + * Services Region.

+ */ + inline const Aws::String& GetGroupByKey() const{ return m_groupByKey; } + inline void SetGroupByKey(const Aws::String& value) { m_groupByKey = value; } + inline void SetGroupByKey(Aws::String&& value) { m_groupByKey = std::move(value); } + inline void SetGroupByKey(const char* value) { m_groupByKey.assign(value); } + inline GetAggregateConformancePackComplianceSummaryResult& WithGroupByKey(const Aws::String& value) { SetGroupByKey(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& WithGroupByKey(Aws::String&& value) { SetGroupByKey(std::move(value)); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& WithGroupByKey(const char* value) { SetGroupByKey(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetAggregateConformancePackComplianceSummaryResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetAggregateConformancePackComplianceSummaryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetAggregateConformancePackComplianceSummaryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_aggregateConformancePackComplianceSummaries; + + Aws::String m_groupByKey; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateDiscoveredResourceCountsRequest.h b/include/aws/config/model/GetAggregateDiscoveredResourceCountsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..16f81fa431d544423e060b51a251dbd2bbbbe96f --- /dev/null +++ b/include/aws/config/model/GetAggregateDiscoveredResourceCountsRequest.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetAggregateDiscoveredResourceCountsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetAggregateDiscoveredResourceCountsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetAggregateDiscoveredResourceCounts"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline GetAggregateDiscoveredResourceCountsRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline GetAggregateDiscoveredResourceCountsRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline GetAggregateDiscoveredResourceCountsRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results based on the ResourceCountFilters + * object.

+ */ + inline const ResourceCountFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ResourceCountFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ResourceCountFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline GetAggregateDiscoveredResourceCountsRequest& WithFilters(const ResourceCountFilters& value) { SetFilters(value); return *this;} + inline GetAggregateDiscoveredResourceCountsRequest& WithFilters(ResourceCountFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The key to group the resource counts.

+ */ + inline const ResourceCountGroupKey& GetGroupByKey() const{ return m_groupByKey; } + inline bool GroupByKeyHasBeenSet() const { return m_groupByKeyHasBeenSet; } + inline void SetGroupByKey(const ResourceCountGroupKey& value) { m_groupByKeyHasBeenSet = true; m_groupByKey = value; } + inline void SetGroupByKey(ResourceCountGroupKey&& value) { m_groupByKeyHasBeenSet = true; m_groupByKey = std::move(value); } + inline GetAggregateDiscoveredResourceCountsRequest& WithGroupByKey(const ResourceCountGroupKey& value) { SetGroupByKey(value); return *this;} + inline GetAggregateDiscoveredResourceCountsRequest& WithGroupByKey(ResourceCountGroupKey&& value) { SetGroupByKey(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of GroupedResourceCount objects returned on each + * page. The default is 1000. You cannot specify a number greater than 1000. If you + * specify 0, Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetAggregateDiscoveredResourceCountsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetAggregateDiscoveredResourceCountsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateDiscoveredResourceCountsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateDiscoveredResourceCountsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + ResourceCountFilters m_filters; + bool m_filtersHasBeenSet = false; + + ResourceCountGroupKey m_groupByKey; + bool m_groupByKeyHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateDiscoveredResourceCountsResult.h b/include/aws/config/model/GetAggregateDiscoveredResourceCountsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..05147ecf6fc955c48219a6332e332acd1c589508 --- /dev/null +++ b/include/aws/config/model/GetAggregateDiscoveredResourceCountsResult.h @@ -0,0 +1,113 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetAggregateDiscoveredResourceCountsResult + { + public: + AWS_CONFIGSERVICE_API GetAggregateDiscoveredResourceCountsResult(); + AWS_CONFIGSERVICE_API GetAggregateDiscoveredResourceCountsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetAggregateDiscoveredResourceCountsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The total number of resources that are present in an aggregator with the + * filters that you provide.

+ */ + inline long long GetTotalDiscoveredResources() const{ return m_totalDiscoveredResources; } + inline void SetTotalDiscoveredResources(long long value) { m_totalDiscoveredResources = value; } + inline GetAggregateDiscoveredResourceCountsResult& WithTotalDiscoveredResources(long long value) { SetTotalDiscoveredResources(value); return *this;} + ///@} + + ///@{ + /** + *

The key passed into the request object. If GroupByKey is not + * provided, the result will be empty.

+ */ + inline const Aws::String& GetGroupByKey() const{ return m_groupByKey; } + inline void SetGroupByKey(const Aws::String& value) { m_groupByKey = value; } + inline void SetGroupByKey(Aws::String&& value) { m_groupByKey = std::move(value); } + inline void SetGroupByKey(const char* value) { m_groupByKey.assign(value); } + inline GetAggregateDiscoveredResourceCountsResult& WithGroupByKey(const Aws::String& value) { SetGroupByKey(value); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& WithGroupByKey(Aws::String&& value) { SetGroupByKey(std::move(value)); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& WithGroupByKey(const char* value) { SetGroupByKey(value); return *this;} + ///@} + + ///@{ + /** + *

Returns a list of GroupedResourceCount objects.

+ */ + inline const Aws::Vector& GetGroupedResourceCounts() const{ return m_groupedResourceCounts; } + inline void SetGroupedResourceCounts(const Aws::Vector& value) { m_groupedResourceCounts = value; } + inline void SetGroupedResourceCounts(Aws::Vector&& value) { m_groupedResourceCounts = std::move(value); } + inline GetAggregateDiscoveredResourceCountsResult& WithGroupedResourceCounts(const Aws::Vector& value) { SetGroupedResourceCounts(value); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& WithGroupedResourceCounts(Aws::Vector&& value) { SetGroupedResourceCounts(std::move(value)); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& AddGroupedResourceCounts(const GroupedResourceCount& value) { m_groupedResourceCounts.push_back(value); return *this; } + inline GetAggregateDiscoveredResourceCountsResult& AddGroupedResourceCounts(GroupedResourceCount&& value) { m_groupedResourceCounts.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetAggregateDiscoveredResourceCountsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetAggregateDiscoveredResourceCountsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetAggregateDiscoveredResourceCountsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + long long m_totalDiscoveredResources; + + Aws::String m_groupByKey; + + Aws::Vector m_groupedResourceCounts; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateResourceConfigRequest.h b/include/aws/config/model/GetAggregateResourceConfigRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..37411be9774ef110757580c0a7350c3cdb16d373 --- /dev/null +++ b/include/aws/config/model/GetAggregateResourceConfigRequest.h @@ -0,0 +1,74 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetAggregateResourceConfigRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetAggregateResourceConfigRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetAggregateResourceConfig"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline GetAggregateResourceConfigRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline GetAggregateResourceConfigRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline GetAggregateResourceConfigRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

An object that identifies aggregate resource.

+ */ + inline const AggregateResourceIdentifier& GetResourceIdentifier() const{ return m_resourceIdentifier; } + inline bool ResourceIdentifierHasBeenSet() const { return m_resourceIdentifierHasBeenSet; } + inline void SetResourceIdentifier(const AggregateResourceIdentifier& value) { m_resourceIdentifierHasBeenSet = true; m_resourceIdentifier = value; } + inline void SetResourceIdentifier(AggregateResourceIdentifier&& value) { m_resourceIdentifierHasBeenSet = true; m_resourceIdentifier = std::move(value); } + inline GetAggregateResourceConfigRequest& WithResourceIdentifier(const AggregateResourceIdentifier& value) { SetResourceIdentifier(value); return *this;} + inline GetAggregateResourceConfigRequest& WithResourceIdentifier(AggregateResourceIdentifier&& value) { SetResourceIdentifier(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + AggregateResourceIdentifier m_resourceIdentifier; + bool m_resourceIdentifierHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetAggregateResourceConfigResult.h b/include/aws/config/model/GetAggregateResourceConfigResult.h new file mode 100644 index 0000000000000000000000000000000000000000..d7423706d36e0d7d2fb15d6b36ada1a4ed8f4c7c --- /dev/null +++ b/include/aws/config/model/GetAggregateResourceConfigResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetAggregateResourceConfigResult + { + public: + AWS_CONFIGSERVICE_API GetAggregateResourceConfigResult(); + AWS_CONFIGSERVICE_API GetAggregateResourceConfigResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetAggregateResourceConfigResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a ConfigurationItem object.

+ */ + inline const ConfigurationItem& GetConfigurationItem() const{ return m_configurationItem; } + inline void SetConfigurationItem(const ConfigurationItem& value) { m_configurationItem = value; } + inline void SetConfigurationItem(ConfigurationItem&& value) { m_configurationItem = std::move(value); } + inline GetAggregateResourceConfigResult& WithConfigurationItem(const ConfigurationItem& value) { SetConfigurationItem(value); return *this;} + inline GetAggregateResourceConfigResult& WithConfigurationItem(ConfigurationItem&& value) { SetConfigurationItem(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetAggregateResourceConfigResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetAggregateResourceConfigResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetAggregateResourceConfigResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ConfigurationItem m_configurationItem; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceDetailsByConfigRuleRequest.h b/include/aws/config/model/GetComplianceDetailsByConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..7ac8cb37a4a2c12fb3e8ed09ba5e2091e1ff71be --- /dev/null +++ b/include/aws/config/model/GetComplianceDetailsByConfigRuleRequest.h @@ -0,0 +1,116 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class GetComplianceDetailsByConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetComplianceDetailsByConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetComplianceDetailsByConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule for which you want compliance information.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline GetComplianceDetailsByConfigRuleRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline GetComplianceDetailsByConfigRuleRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline GetComplianceDetailsByConfigRuleRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results by compliance.

INSUFFICIENT_DATA is + * a valid ComplianceType that is returned when an Config rule cannot + * be evaluated. However, INSUFFICIENT_DATA cannot be used as a + * ComplianceType for filtering results.

+ */ + inline const Aws::Vector& GetComplianceTypes() const{ return m_complianceTypes; } + inline bool ComplianceTypesHasBeenSet() const { return m_complianceTypesHasBeenSet; } + inline void SetComplianceTypes(const Aws::Vector& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = value; } + inline void SetComplianceTypes(Aws::Vector&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = std::move(value); } + inline GetComplianceDetailsByConfigRuleRequest& WithComplianceTypes(const Aws::Vector& value) { SetComplianceTypes(value); return *this;} + inline GetComplianceDetailsByConfigRuleRequest& WithComplianceTypes(Aws::Vector&& value) { SetComplianceTypes(std::move(value)); return *this;} + inline GetComplianceDetailsByConfigRuleRequest& AddComplianceTypes(const ComplianceType& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(value); return *this; } + inline GetComplianceDetailsByConfigRuleRequest& AddComplianceTypes(ComplianceType&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of evaluation results returned on each page. The default + * is 10. You cannot specify a number greater than 100. If you specify 0, Config + * uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetComplianceDetailsByConfigRuleRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetComplianceDetailsByConfigRuleRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetComplianceDetailsByConfigRuleRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetComplianceDetailsByConfigRuleRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::Vector m_complianceTypes; + bool m_complianceTypesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceDetailsByConfigRuleResult.h b/include/aws/config/model/GetComplianceDetailsByConfigRuleResult.h new file mode 100644 index 0000000000000000000000000000000000000000..108dcd2ea7ec5fb573d282d7f63468c713ba473d --- /dev/null +++ b/include/aws/config/model/GetComplianceDetailsByConfigRuleResult.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class GetComplianceDetailsByConfigRuleResult + { + public: + AWS_CONFIGSERVICE_API GetComplianceDetailsByConfigRuleResult(); + AWS_CONFIGSERVICE_API GetComplianceDetailsByConfigRuleResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetComplianceDetailsByConfigRuleResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether the Amazon Web Services resource complies with the + * specified Config rule.

+ */ + inline const Aws::Vector& GetEvaluationResults() const{ return m_evaluationResults; } + inline void SetEvaluationResults(const Aws::Vector& value) { m_evaluationResults = value; } + inline void SetEvaluationResults(Aws::Vector&& value) { m_evaluationResults = std::move(value); } + inline GetComplianceDetailsByConfigRuleResult& WithEvaluationResults(const Aws::Vector& value) { SetEvaluationResults(value); return *this;} + inline GetComplianceDetailsByConfigRuleResult& WithEvaluationResults(Aws::Vector&& value) { SetEvaluationResults(std::move(value)); return *this;} + inline GetComplianceDetailsByConfigRuleResult& AddEvaluationResults(const EvaluationResult& value) { m_evaluationResults.push_back(value); return *this; } + inline GetComplianceDetailsByConfigRuleResult& AddEvaluationResults(EvaluationResult&& value) { m_evaluationResults.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetComplianceDetailsByConfigRuleResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetComplianceDetailsByConfigRuleResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetComplianceDetailsByConfigRuleResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetComplianceDetailsByConfigRuleResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetComplianceDetailsByConfigRuleResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetComplianceDetailsByConfigRuleResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_evaluationResults; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceDetailsByResourceRequest.h b/include/aws/config/model/GetComplianceDetailsByResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..78d79968be0f2570f3d1720dc771cdd30396c67d --- /dev/null +++ b/include/aws/config/model/GetComplianceDetailsByResourceRequest.h @@ -0,0 +1,140 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class GetComplianceDetailsByResourceRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetComplianceDetailsByResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetComplianceDetailsByResource"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The type of the Amazon Web Services resource for which you want compliance + * information.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline GetComplianceDetailsByResourceRequest& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline GetComplianceDetailsByResourceRequest& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceRequest& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource for which you want compliance + * information.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline GetComplianceDetailsByResourceRequest& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline GetComplianceDetailsByResourceRequest& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceRequest& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

Filters the results by compliance.

INSUFFICIENT_DATA is + * a valid ComplianceType that is returned when an Config rule cannot + * be evaluated. However, INSUFFICIENT_DATA cannot be used as a + * ComplianceType for filtering results.

+ */ + inline const Aws::Vector& GetComplianceTypes() const{ return m_complianceTypes; } + inline bool ComplianceTypesHasBeenSet() const { return m_complianceTypesHasBeenSet; } + inline void SetComplianceTypes(const Aws::Vector& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = value; } + inline void SetComplianceTypes(Aws::Vector&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes = std::move(value); } + inline GetComplianceDetailsByResourceRequest& WithComplianceTypes(const Aws::Vector& value) { SetComplianceTypes(value); return *this;} + inline GetComplianceDetailsByResourceRequest& WithComplianceTypes(Aws::Vector&& value) { SetComplianceTypes(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceRequest& AddComplianceTypes(const ComplianceType& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(value); return *this; } + inline GetComplianceDetailsByResourceRequest& AddComplianceTypes(ComplianceType&& value) { m_complianceTypesHasBeenSet = true; m_complianceTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetComplianceDetailsByResourceRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetComplianceDetailsByResourceRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

The unique ID of Amazon Web Services resource execution for which you want to + * retrieve evaluation results.

You need to only provide either a + * ResourceEvaluationID or a ResourceID and + * ResourceType.

+ */ + inline const Aws::String& GetResourceEvaluationId() const{ return m_resourceEvaluationId; } + inline bool ResourceEvaluationIdHasBeenSet() const { return m_resourceEvaluationIdHasBeenSet; } + inline void SetResourceEvaluationId(const Aws::String& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = value; } + inline void SetResourceEvaluationId(Aws::String&& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = std::move(value); } + inline void SetResourceEvaluationId(const char* value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId.assign(value); } + inline GetComplianceDetailsByResourceRequest& WithResourceEvaluationId(const Aws::String& value) { SetResourceEvaluationId(value); return *this;} + inline GetComplianceDetailsByResourceRequest& WithResourceEvaluationId(Aws::String&& value) { SetResourceEvaluationId(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceRequest& WithResourceEvaluationId(const char* value) { SetResourceEvaluationId(value); return *this;} + ///@} + private: + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::Vector m_complianceTypes; + bool m_complianceTypesHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + Aws::String m_resourceEvaluationId; + bool m_resourceEvaluationIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceDetailsByResourceResult.h b/include/aws/config/model/GetComplianceDetailsByResourceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..97a5d8482eb713b18e304c4c31fb89340ad0826c --- /dev/null +++ b/include/aws/config/model/GetComplianceDetailsByResourceResult.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class GetComplianceDetailsByResourceResult + { + public: + AWS_CONFIGSERVICE_API GetComplianceDetailsByResourceResult(); + AWS_CONFIGSERVICE_API GetComplianceDetailsByResourceResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetComplianceDetailsByResourceResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether the specified Amazon Web Services resource complies each + * Config rule.

+ */ + inline const Aws::Vector& GetEvaluationResults() const{ return m_evaluationResults; } + inline void SetEvaluationResults(const Aws::Vector& value) { m_evaluationResults = value; } + inline void SetEvaluationResults(Aws::Vector&& value) { m_evaluationResults = std::move(value); } + inline GetComplianceDetailsByResourceResult& WithEvaluationResults(const Aws::Vector& value) { SetEvaluationResults(value); return *this;} + inline GetComplianceDetailsByResourceResult& WithEvaluationResults(Aws::Vector&& value) { SetEvaluationResults(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceResult& AddEvaluationResults(const EvaluationResult& value) { m_evaluationResults.push_back(value); return *this; } + inline GetComplianceDetailsByResourceResult& AddEvaluationResults(EvaluationResult&& value) { m_evaluationResults.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetComplianceDetailsByResourceResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetComplianceDetailsByResourceResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetComplianceDetailsByResourceResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetComplianceDetailsByResourceResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetComplianceDetailsByResourceResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_evaluationResults; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceSummaryByConfigRuleRequest.h b/include/aws/config/model/GetComplianceSummaryByConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..48070f535dcf2117bf29fa2b0b5dab5a18e180bb --- /dev/null +++ b/include/aws/config/model/GetComplianceSummaryByConfigRuleRequest.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetComplianceSummaryByConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetComplianceSummaryByConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetComplianceSummaryByConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceSummaryByConfigRuleResult.h b/include/aws/config/model/GetComplianceSummaryByConfigRuleResult.h new file mode 100644 index 0000000000000000000000000000000000000000..1cca21762561c644699cab1e920a48e8ffad048c --- /dev/null +++ b/include/aws/config/model/GetComplianceSummaryByConfigRuleResult.h @@ -0,0 +1,72 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class GetComplianceSummaryByConfigRuleResult + { + public: + AWS_CONFIGSERVICE_API GetComplianceSummaryByConfigRuleResult(); + AWS_CONFIGSERVICE_API GetComplianceSummaryByConfigRuleResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetComplianceSummaryByConfigRuleResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The number of Config rules that are compliant and the number that are + * noncompliant, up to a maximum of 25 for each.

+ */ + inline const ComplianceSummary& GetComplianceSummary() const{ return m_complianceSummary; } + inline void SetComplianceSummary(const ComplianceSummary& value) { m_complianceSummary = value; } + inline void SetComplianceSummary(ComplianceSummary&& value) { m_complianceSummary = std::move(value); } + inline GetComplianceSummaryByConfigRuleResult& WithComplianceSummary(const ComplianceSummary& value) { SetComplianceSummary(value); return *this;} + inline GetComplianceSummaryByConfigRuleResult& WithComplianceSummary(ComplianceSummary&& value) { SetComplianceSummary(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetComplianceSummaryByConfigRuleResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetComplianceSummaryByConfigRuleResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetComplianceSummaryByConfigRuleResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ComplianceSummary m_complianceSummary; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceSummaryByResourceTypeRequest.h b/include/aws/config/model/GetComplianceSummaryByResourceTypeRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c90808d05aa26f6fea55886199c919c2e158e1f3 --- /dev/null +++ b/include/aws/config/model/GetComplianceSummaryByResourceTypeRequest.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class GetComplianceSummaryByResourceTypeRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetComplianceSummaryByResourceTypeRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetComplianceSummaryByResourceType"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Specify one or more resource types to get the number of resources that are + * compliant and the number that are noncompliant for each resource type.

+ *

For this request, you can specify an Amazon Web Services resource type such + * as AWS::EC2::Instance. You can specify that the resource type is an + * Amazon Web Services account by specifying AWS::::Account.

+ */ + inline const Aws::Vector& GetResourceTypes() const{ return m_resourceTypes; } + inline bool ResourceTypesHasBeenSet() const { return m_resourceTypesHasBeenSet; } + inline void SetResourceTypes(const Aws::Vector& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = value; } + inline void SetResourceTypes(Aws::Vector&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = std::move(value); } + inline GetComplianceSummaryByResourceTypeRequest& WithResourceTypes(const Aws::Vector& value) { SetResourceTypes(value); return *this;} + inline GetComplianceSummaryByResourceTypeRequest& WithResourceTypes(Aws::Vector&& value) { SetResourceTypes(std::move(value)); return *this;} + inline GetComplianceSummaryByResourceTypeRequest& AddResourceTypes(const Aws::String& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + inline GetComplianceSummaryByResourceTypeRequest& AddResourceTypes(Aws::String&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(std::move(value)); return *this; } + inline GetComplianceSummaryByResourceTypeRequest& AddResourceTypes(const char* value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_resourceTypes; + bool m_resourceTypesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetComplianceSummaryByResourceTypeResult.h b/include/aws/config/model/GetComplianceSummaryByResourceTypeResult.h new file mode 100644 index 0000000000000000000000000000000000000000..be91b42d556ff5f685bba04f349a55bf77c6a7f1 --- /dev/null +++ b/include/aws/config/model/GetComplianceSummaryByResourceTypeResult.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class GetComplianceSummaryByResourceTypeResult + { + public: + AWS_CONFIGSERVICE_API GetComplianceSummaryByResourceTypeResult(); + AWS_CONFIGSERVICE_API GetComplianceSummaryByResourceTypeResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetComplianceSummaryByResourceTypeResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The number of resources that are compliant and the number that are + * noncompliant. If one or more resource types were provided with the request, the + * numbers are returned for each resource type. The maximum number returned is + * 100.

+ */ + inline const Aws::Vector& GetComplianceSummariesByResourceType() const{ return m_complianceSummariesByResourceType; } + inline void SetComplianceSummariesByResourceType(const Aws::Vector& value) { m_complianceSummariesByResourceType = value; } + inline void SetComplianceSummariesByResourceType(Aws::Vector&& value) { m_complianceSummariesByResourceType = std::move(value); } + inline GetComplianceSummaryByResourceTypeResult& WithComplianceSummariesByResourceType(const Aws::Vector& value) { SetComplianceSummariesByResourceType(value); return *this;} + inline GetComplianceSummaryByResourceTypeResult& WithComplianceSummariesByResourceType(Aws::Vector&& value) { SetComplianceSummariesByResourceType(std::move(value)); return *this;} + inline GetComplianceSummaryByResourceTypeResult& AddComplianceSummariesByResourceType(const ComplianceSummaryByResourceType& value) { m_complianceSummariesByResourceType.push_back(value); return *this; } + inline GetComplianceSummaryByResourceTypeResult& AddComplianceSummariesByResourceType(ComplianceSummaryByResourceType&& value) { m_complianceSummariesByResourceType.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetComplianceSummaryByResourceTypeResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetComplianceSummaryByResourceTypeResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetComplianceSummaryByResourceTypeResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_complianceSummariesByResourceType; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetConformancePackComplianceDetailsRequest.h b/include/aws/config/model/GetConformancePackComplianceDetailsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..34eb7d0a36fd19ec2ad571a288be9af3e735b5fd --- /dev/null +++ b/include/aws/config/model/GetConformancePackComplianceDetailsRequest.h @@ -0,0 +1,106 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetConformancePackComplianceDetailsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetConformancePackComplianceDetailsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetConformancePackComplianceDetails"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline GetConformancePackComplianceDetailsRequest& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline GetConformancePackComplianceDetailsRequest& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline GetConformancePackComplianceDetailsRequest& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

A ConformancePackEvaluationFilters object.

+ */ + inline const ConformancePackEvaluationFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ConformancePackEvaluationFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ConformancePackEvaluationFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline GetConformancePackComplianceDetailsRequest& WithFilters(const ConformancePackEvaluationFilters& value) { SetFilters(value); return *this;} + inline GetConformancePackComplianceDetailsRequest& WithFilters(ConformancePackEvaluationFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of evaluation results returned on each page. If you do no + * specify a number, Config uses the default. The default is 100.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetConformancePackComplianceDetailsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetConformancePackComplianceDetailsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetConformancePackComplianceDetailsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetConformancePackComplianceDetailsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + ConformancePackEvaluationFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetConformancePackComplianceDetailsResult.h b/include/aws/config/model/GetConformancePackComplianceDetailsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..966ff02defd4ad97fd01c5bdbcc10d11c375cf8b --- /dev/null +++ b/include/aws/config/model/GetConformancePackComplianceDetailsResult.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetConformancePackComplianceDetailsResult + { + public: + AWS_CONFIGSERVICE_API GetConformancePackComplianceDetailsResult(); + AWS_CONFIGSERVICE_API GetConformancePackComplianceDetailsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetConformancePackComplianceDetailsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Name of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackName.assign(value); } + inline GetConformancePackComplianceDetailsResult& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline GetConformancePackComplianceDetailsResult& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline GetConformancePackComplianceDetailsResult& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

Returns a list of ConformancePackEvaluationResult objects.

+ */ + inline const Aws::Vector& GetConformancePackRuleEvaluationResults() const{ return m_conformancePackRuleEvaluationResults; } + inline void SetConformancePackRuleEvaluationResults(const Aws::Vector& value) { m_conformancePackRuleEvaluationResults = value; } + inline void SetConformancePackRuleEvaluationResults(Aws::Vector&& value) { m_conformancePackRuleEvaluationResults = std::move(value); } + inline GetConformancePackComplianceDetailsResult& WithConformancePackRuleEvaluationResults(const Aws::Vector& value) { SetConformancePackRuleEvaluationResults(value); return *this;} + inline GetConformancePackComplianceDetailsResult& WithConformancePackRuleEvaluationResults(Aws::Vector&& value) { SetConformancePackRuleEvaluationResults(std::move(value)); return *this;} + inline GetConformancePackComplianceDetailsResult& AddConformancePackRuleEvaluationResults(const ConformancePackEvaluationResult& value) { m_conformancePackRuleEvaluationResults.push_back(value); return *this; } + inline GetConformancePackComplianceDetailsResult& AddConformancePackRuleEvaluationResults(ConformancePackEvaluationResult&& value) { m_conformancePackRuleEvaluationResults.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetConformancePackComplianceDetailsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetConformancePackComplianceDetailsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetConformancePackComplianceDetailsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetConformancePackComplianceDetailsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetConformancePackComplianceDetailsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetConformancePackComplianceDetailsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + + Aws::Vector m_conformancePackRuleEvaluationResults; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetConformancePackComplianceSummaryRequest.h b/include/aws/config/model/GetConformancePackComplianceSummaryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a7f05ce21da3f77d8a49de10e462383795e50b73 --- /dev/null +++ b/include/aws/config/model/GetConformancePackComplianceSummaryRequest.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetConformancePackComplianceSummaryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetConformancePackComplianceSummaryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetConformancePackComplianceSummary"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Names of conformance packs.

+ */ + inline const Aws::Vector& GetConformancePackNames() const{ return m_conformancePackNames; } + inline bool ConformancePackNamesHasBeenSet() const { return m_conformancePackNamesHasBeenSet; } + inline void SetConformancePackNames(const Aws::Vector& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = value; } + inline void SetConformancePackNames(Aws::Vector&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames = std::move(value); } + inline GetConformancePackComplianceSummaryRequest& WithConformancePackNames(const Aws::Vector& value) { SetConformancePackNames(value); return *this;} + inline GetConformancePackComplianceSummaryRequest& WithConformancePackNames(Aws::Vector&& value) { SetConformancePackNames(std::move(value)); return *this;} + inline GetConformancePackComplianceSummaryRequest& AddConformancePackNames(const Aws::String& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + inline GetConformancePackComplianceSummaryRequest& AddConformancePackNames(Aws::String&& value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(std::move(value)); return *this; } + inline GetConformancePackComplianceSummaryRequest& AddConformancePackNames(const char* value) { m_conformancePackNamesHasBeenSet = true; m_conformancePackNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of conformance packs returned on each page.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetConformancePackComplianceSummaryRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetConformancePackComplianceSummaryRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetConformancePackComplianceSummaryRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetConformancePackComplianceSummaryRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_conformancePackNames; + bool m_conformancePackNamesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetConformancePackComplianceSummaryResult.h b/include/aws/config/model/GetConformancePackComplianceSummaryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..62a5762e99bb3863fa593589b684eacef22bcd03 --- /dev/null +++ b/include/aws/config/model/GetConformancePackComplianceSummaryResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetConformancePackComplianceSummaryResult + { + public: + AWS_CONFIGSERVICE_API GetConformancePackComplianceSummaryResult(); + AWS_CONFIGSERVICE_API GetConformancePackComplianceSummaryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetConformancePackComplianceSummaryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of ConformancePackComplianceSummary objects.

+ */ + inline const Aws::Vector& GetConformancePackComplianceSummaryList() const{ return m_conformancePackComplianceSummaryList; } + inline void SetConformancePackComplianceSummaryList(const Aws::Vector& value) { m_conformancePackComplianceSummaryList = value; } + inline void SetConformancePackComplianceSummaryList(Aws::Vector&& value) { m_conformancePackComplianceSummaryList = std::move(value); } + inline GetConformancePackComplianceSummaryResult& WithConformancePackComplianceSummaryList(const Aws::Vector& value) { SetConformancePackComplianceSummaryList(value); return *this;} + inline GetConformancePackComplianceSummaryResult& WithConformancePackComplianceSummaryList(Aws::Vector&& value) { SetConformancePackComplianceSummaryList(std::move(value)); return *this;} + inline GetConformancePackComplianceSummaryResult& AddConformancePackComplianceSummaryList(const ConformancePackComplianceSummary& value) { m_conformancePackComplianceSummaryList.push_back(value); return *this; } + inline GetConformancePackComplianceSummaryResult& AddConformancePackComplianceSummaryList(ConformancePackComplianceSummary&& value) { m_conformancePackComplianceSummaryList.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetConformancePackComplianceSummaryResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetConformancePackComplianceSummaryResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetConformancePackComplianceSummaryResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetConformancePackComplianceSummaryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetConformancePackComplianceSummaryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetConformancePackComplianceSummaryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_conformancePackComplianceSummaryList; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetCustomRulePolicyRequest.h b/include/aws/config/model/GetCustomRulePolicyRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..7faa3321a603fd480c053ebf9fed32e5c701f262 --- /dev/null +++ b/include/aws/config/model/GetCustomRulePolicyRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetCustomRulePolicyRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetCustomRulePolicyRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetCustomRulePolicy"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of your Config Custom Policy rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline GetCustomRulePolicyRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline GetCustomRulePolicyRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline GetCustomRulePolicyRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetCustomRulePolicyResult.h b/include/aws/config/model/GetCustomRulePolicyResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0a58a871343d443f9660e33bdd52cbc5bb93d78f --- /dev/null +++ b/include/aws/config/model/GetCustomRulePolicyResult.h @@ -0,0 +1,68 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetCustomRulePolicyResult + { + public: + AWS_CONFIGSERVICE_API GetCustomRulePolicyResult(); + AWS_CONFIGSERVICE_API GetCustomRulePolicyResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetCustomRulePolicyResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The policy definition containing the logic for your Config Custom Policy + * rule.

+ */ + inline const Aws::String& GetPolicyText() const{ return m_policyText; } + inline void SetPolicyText(const Aws::String& value) { m_policyText = value; } + inline void SetPolicyText(Aws::String&& value) { m_policyText = std::move(value); } + inline void SetPolicyText(const char* value) { m_policyText.assign(value); } + inline GetCustomRulePolicyResult& WithPolicyText(const Aws::String& value) { SetPolicyText(value); return *this;} + inline GetCustomRulePolicyResult& WithPolicyText(Aws::String&& value) { SetPolicyText(std::move(value)); return *this;} + inline GetCustomRulePolicyResult& WithPolicyText(const char* value) { SetPolicyText(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetCustomRulePolicyResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetCustomRulePolicyResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetCustomRulePolicyResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_policyText; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetDiscoveredResourceCountsRequest.h b/include/aws/config/model/GetDiscoveredResourceCountsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..bdeedb43dfbe75f78cd4b07afc315f78b4170980 --- /dev/null +++ b/include/aws/config/model/GetDiscoveredResourceCountsRequest.h @@ -0,0 +1,101 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetDiscoveredResourceCountsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetDiscoveredResourceCountsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetDiscoveredResourceCounts"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The comma-separated list that specifies the resource types that you want + * Config to return (for example, "AWS::EC2::Instance", + * "AWS::IAM::User").

If a value for resourceTypes + * is not specified, Config returns all resource types that Config is recording in + * the region for your account.

If the configuration recorder is + * turned off, Config returns an empty list of ResourceCount objects. If the + * configuration recorder is not recording a specific resource type (for example, + * S3 buckets), that resource type is not returned in the list of + * ResourceCount objects.

+ */ + inline const Aws::Vector& GetResourceTypes() const{ return m_resourceTypes; } + inline bool ResourceTypesHasBeenSet() const { return m_resourceTypesHasBeenSet; } + inline void SetResourceTypes(const Aws::Vector& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = value; } + inline void SetResourceTypes(Aws::Vector&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = std::move(value); } + inline GetDiscoveredResourceCountsRequest& WithResourceTypes(const Aws::Vector& value) { SetResourceTypes(value); return *this;} + inline GetDiscoveredResourceCountsRequest& WithResourceTypes(Aws::Vector&& value) { SetResourceTypes(std::move(value)); return *this;} + inline GetDiscoveredResourceCountsRequest& AddResourceTypes(const Aws::String& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + inline GetDiscoveredResourceCountsRequest& AddResourceTypes(Aws::String&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(std::move(value)); return *this; } + inline GetDiscoveredResourceCountsRequest& AddResourceTypes(const char* value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of ResourceCount objects returned on each page. The + * default is 100. You cannot specify a number greater than 100. If you specify 0, + * Config uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetDiscoveredResourceCountsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetDiscoveredResourceCountsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetDiscoveredResourceCountsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetDiscoveredResourceCountsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_resourceTypes; + bool m_resourceTypesHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetDiscoveredResourceCountsResult.h b/include/aws/config/model/GetDiscoveredResourceCountsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f1efd581cfe1cae4281b502f763c53b6018b3168 --- /dev/null +++ b/include/aws/config/model/GetDiscoveredResourceCountsResult.h @@ -0,0 +1,105 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetDiscoveredResourceCountsResult + { + public: + AWS_CONFIGSERVICE_API GetDiscoveredResourceCountsResult(); + AWS_CONFIGSERVICE_API GetDiscoveredResourceCountsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetDiscoveredResourceCountsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The total number of resources that Config is recording in the region for your + * account. If you specify resource types in the request, Config returns only the + * total number of resources for those resource types.

+ * Example

  1. Config is recording three resource types in the + * US East (Ohio) Region for your account: 25 EC2 instances, 20 IAM users, and 15 + * S3 buckets, for a total of 60 resources.

  2. You make a call to + * the GetDiscoveredResourceCounts action and specify the resource + * type, "AWS::EC2::Instances", in the request.

  3. + *

    Config returns 25 for totalDiscoveredResources.

+ */ + inline long long GetTotalDiscoveredResources() const{ return m_totalDiscoveredResources; } + inline void SetTotalDiscoveredResources(long long value) { m_totalDiscoveredResources = value; } + inline GetDiscoveredResourceCountsResult& WithTotalDiscoveredResources(long long value) { SetTotalDiscoveredResources(value); return *this;} + ///@} + + ///@{ + /** + *

The list of ResourceCount objects. Each object is listed in + * descending order by the number of resources.

+ */ + inline const Aws::Vector& GetResourceCounts() const{ return m_resourceCounts; } + inline void SetResourceCounts(const Aws::Vector& value) { m_resourceCounts = value; } + inline void SetResourceCounts(Aws::Vector&& value) { m_resourceCounts = std::move(value); } + inline GetDiscoveredResourceCountsResult& WithResourceCounts(const Aws::Vector& value) { SetResourceCounts(value); return *this;} + inline GetDiscoveredResourceCountsResult& WithResourceCounts(Aws::Vector&& value) { SetResourceCounts(std::move(value)); return *this;} + inline GetDiscoveredResourceCountsResult& AddResourceCounts(const ResourceCount& value) { m_resourceCounts.push_back(value); return *this; } + inline GetDiscoveredResourceCountsResult& AddResourceCounts(ResourceCount&& value) { m_resourceCounts.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetDiscoveredResourceCountsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetDiscoveredResourceCountsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetDiscoveredResourceCountsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetDiscoveredResourceCountsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetDiscoveredResourceCountsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetDiscoveredResourceCountsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + long long m_totalDiscoveredResources; + + Aws::Vector m_resourceCounts; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetOrganizationConfigRuleDetailedStatusRequest.h b/include/aws/config/model/GetOrganizationConfigRuleDetailedStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..42f3fd624b90caf55bcd7930bab637c87707b46e --- /dev/null +++ b/include/aws/config/model/GetOrganizationConfigRuleDetailedStatusRequest.h @@ -0,0 +1,108 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetOrganizationConfigRuleDetailedStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetOrganizationConfigRuleDetailedStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetOrganizationConfigRuleDetailedStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of your organization Config rule for which you want status details + * for member accounts.

+ */ + inline const Aws::String& GetOrganizationConfigRuleName() const{ return m_organizationConfigRuleName; } + inline bool OrganizationConfigRuleNameHasBeenSet() const { return m_organizationConfigRuleNameHasBeenSet; } + inline void SetOrganizationConfigRuleName(const Aws::String& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = value; } + inline void SetOrganizationConfigRuleName(Aws::String&& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = std::move(value); } + inline void SetOrganizationConfigRuleName(const char* value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName.assign(value); } + inline GetOrganizationConfigRuleDetailedStatusRequest& WithOrganizationConfigRuleName(const Aws::String& value) { SetOrganizationConfigRuleName(value); return *this;} + inline GetOrganizationConfigRuleDetailedStatusRequest& WithOrganizationConfigRuleName(Aws::String&& value) { SetOrganizationConfigRuleName(std::move(value)); return *this;} + inline GetOrganizationConfigRuleDetailedStatusRequest& WithOrganizationConfigRuleName(const char* value) { SetOrganizationConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

A StatusDetailFilters object.

+ */ + inline const StatusDetailFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const StatusDetailFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(StatusDetailFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline GetOrganizationConfigRuleDetailedStatusRequest& WithFilters(const StatusDetailFilters& value) { SetFilters(value); return *this;} + inline GetOrganizationConfigRuleDetailedStatusRequest& WithFilters(StatusDetailFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of OrganizationConfigRuleDetailedStatus + * returned on each page. If you do not specify a number, Config uses the default. + * The default is 100.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetOrganizationConfigRuleDetailedStatusRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetOrganizationConfigRuleDetailedStatusRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetOrganizationConfigRuleDetailedStatusRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetOrganizationConfigRuleDetailedStatusRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_organizationConfigRuleName; + bool m_organizationConfigRuleNameHasBeenSet = false; + + StatusDetailFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetOrganizationConfigRuleDetailedStatusResult.h b/include/aws/config/model/GetOrganizationConfigRuleDetailedStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..6273f492b4e6f959393b61bc9c981df35de1bc3f --- /dev/null +++ b/include/aws/config/model/GetOrganizationConfigRuleDetailedStatusResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetOrganizationConfigRuleDetailedStatusResult + { + public: + AWS_CONFIGSERVICE_API GetOrganizationConfigRuleDetailedStatusResult(); + AWS_CONFIGSERVICE_API GetOrganizationConfigRuleDetailedStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetOrganizationConfigRuleDetailedStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of MemberAccountStatus objects.

+ */ + inline const Aws::Vector& GetOrganizationConfigRuleDetailedStatus() const{ return m_organizationConfigRuleDetailedStatus; } + inline void SetOrganizationConfigRuleDetailedStatus(const Aws::Vector& value) { m_organizationConfigRuleDetailedStatus = value; } + inline void SetOrganizationConfigRuleDetailedStatus(Aws::Vector&& value) { m_organizationConfigRuleDetailedStatus = std::move(value); } + inline GetOrganizationConfigRuleDetailedStatusResult& WithOrganizationConfigRuleDetailedStatus(const Aws::Vector& value) { SetOrganizationConfigRuleDetailedStatus(value); return *this;} + inline GetOrganizationConfigRuleDetailedStatusResult& WithOrganizationConfigRuleDetailedStatus(Aws::Vector&& value) { SetOrganizationConfigRuleDetailedStatus(std::move(value)); return *this;} + inline GetOrganizationConfigRuleDetailedStatusResult& AddOrganizationConfigRuleDetailedStatus(const MemberAccountStatus& value) { m_organizationConfigRuleDetailedStatus.push_back(value); return *this; } + inline GetOrganizationConfigRuleDetailedStatusResult& AddOrganizationConfigRuleDetailedStatus(MemberAccountStatus&& value) { m_organizationConfigRuleDetailedStatus.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetOrganizationConfigRuleDetailedStatusResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetOrganizationConfigRuleDetailedStatusResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetOrganizationConfigRuleDetailedStatusResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetOrganizationConfigRuleDetailedStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetOrganizationConfigRuleDetailedStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetOrganizationConfigRuleDetailedStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConfigRuleDetailedStatus; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetOrganizationConformancePackDetailedStatusRequest.h b/include/aws/config/model/GetOrganizationConformancePackDetailedStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1ae30153613122c4c43e301dfe5a3ff0074773a2 --- /dev/null +++ b/include/aws/config/model/GetOrganizationConformancePackDetailedStatusRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetOrganizationConformancePackDetailedStatusRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetOrganizationConformancePackDetailedStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetOrganizationConformancePackDetailedStatus"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of organization conformance pack for which you want status details + * for member accounts.

+ */ + inline const Aws::String& GetOrganizationConformancePackName() const{ return m_organizationConformancePackName; } + inline bool OrganizationConformancePackNameHasBeenSet() const { return m_organizationConformancePackNameHasBeenSet; } + inline void SetOrganizationConformancePackName(const Aws::String& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = value; } + inline void SetOrganizationConformancePackName(Aws::String&& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = std::move(value); } + inline void SetOrganizationConformancePackName(const char* value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName.assign(value); } + inline GetOrganizationConformancePackDetailedStatusRequest& WithOrganizationConformancePackName(const Aws::String& value) { SetOrganizationConformancePackName(value); return *this;} + inline GetOrganizationConformancePackDetailedStatusRequest& WithOrganizationConformancePackName(Aws::String&& value) { SetOrganizationConformancePackName(std::move(value)); return *this;} + inline GetOrganizationConformancePackDetailedStatusRequest& WithOrganizationConformancePackName(const char* value) { SetOrganizationConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

An OrganizationResourceDetailedStatusFilters object.

+ */ + inline const OrganizationResourceDetailedStatusFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const OrganizationResourceDetailedStatusFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(OrganizationResourceDetailedStatusFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline GetOrganizationConformancePackDetailedStatusRequest& WithFilters(const OrganizationResourceDetailedStatusFilters& value) { SetFilters(value); return *this;} + inline GetOrganizationConformancePackDetailedStatusRequest& WithFilters(OrganizationResourceDetailedStatusFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of + * OrganizationConformancePackDetailedStatuses returned on each page. + * If you do not specify a number, Config uses the default. The default is 100. + *

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetOrganizationConformancePackDetailedStatusRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetOrganizationConformancePackDetailedStatusRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetOrganizationConformancePackDetailedStatusRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetOrganizationConformancePackDetailedStatusRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_organizationConformancePackName; + bool m_organizationConformancePackNameHasBeenSet = false; + + OrganizationResourceDetailedStatusFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetOrganizationConformancePackDetailedStatusResult.h b/include/aws/config/model/GetOrganizationConformancePackDetailedStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0e930060466cd7606790563294ac4c7686581d04 --- /dev/null +++ b/include/aws/config/model/GetOrganizationConformancePackDetailedStatusResult.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetOrganizationConformancePackDetailedStatusResult + { + public: + AWS_CONFIGSERVICE_API GetOrganizationConformancePackDetailedStatusResult(); + AWS_CONFIGSERVICE_API GetOrganizationConformancePackDetailedStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetOrganizationConformancePackDetailedStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of OrganizationConformancePackDetailedStatus objects. + *

+ */ + inline const Aws::Vector& GetOrganizationConformancePackDetailedStatuses() const{ return m_organizationConformancePackDetailedStatuses; } + inline void SetOrganizationConformancePackDetailedStatuses(const Aws::Vector& value) { m_organizationConformancePackDetailedStatuses = value; } + inline void SetOrganizationConformancePackDetailedStatuses(Aws::Vector&& value) { m_organizationConformancePackDetailedStatuses = std::move(value); } + inline GetOrganizationConformancePackDetailedStatusResult& WithOrganizationConformancePackDetailedStatuses(const Aws::Vector& value) { SetOrganizationConformancePackDetailedStatuses(value); return *this;} + inline GetOrganizationConformancePackDetailedStatusResult& WithOrganizationConformancePackDetailedStatuses(Aws::Vector&& value) { SetOrganizationConformancePackDetailedStatuses(std::move(value)); return *this;} + inline GetOrganizationConformancePackDetailedStatusResult& AddOrganizationConformancePackDetailedStatuses(const OrganizationConformancePackDetailedStatus& value) { m_organizationConformancePackDetailedStatuses.push_back(value); return *this; } + inline GetOrganizationConformancePackDetailedStatusResult& AddOrganizationConformancePackDetailedStatuses(OrganizationConformancePackDetailedStatus&& value) { m_organizationConformancePackDetailedStatuses.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to get the next + * page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetOrganizationConformancePackDetailedStatusResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetOrganizationConformancePackDetailedStatusResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetOrganizationConformancePackDetailedStatusResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetOrganizationConformancePackDetailedStatusResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetOrganizationConformancePackDetailedStatusResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetOrganizationConformancePackDetailedStatusResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_organizationConformancePackDetailedStatuses; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetOrganizationCustomRulePolicyRequest.h b/include/aws/config/model/GetOrganizationCustomRulePolicyRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..8a9f6a8bdff22a117994f638f649da4bb149f899 --- /dev/null +++ b/include/aws/config/model/GetOrganizationCustomRulePolicyRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetOrganizationCustomRulePolicyRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetOrganizationCustomRulePolicyRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetOrganizationCustomRulePolicy"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of your organization Config Custom Policy rule.

+ */ + inline const Aws::String& GetOrganizationConfigRuleName() const{ return m_organizationConfigRuleName; } + inline bool OrganizationConfigRuleNameHasBeenSet() const { return m_organizationConfigRuleNameHasBeenSet; } + inline void SetOrganizationConfigRuleName(const Aws::String& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = value; } + inline void SetOrganizationConfigRuleName(Aws::String&& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = std::move(value); } + inline void SetOrganizationConfigRuleName(const char* value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName.assign(value); } + inline GetOrganizationCustomRulePolicyRequest& WithOrganizationConfigRuleName(const Aws::String& value) { SetOrganizationConfigRuleName(value); return *this;} + inline GetOrganizationCustomRulePolicyRequest& WithOrganizationConfigRuleName(Aws::String&& value) { SetOrganizationConfigRuleName(std::move(value)); return *this;} + inline GetOrganizationCustomRulePolicyRequest& WithOrganizationConfigRuleName(const char* value) { SetOrganizationConfigRuleName(value); return *this;} + ///@} + private: + + Aws::String m_organizationConfigRuleName; + bool m_organizationConfigRuleNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetOrganizationCustomRulePolicyResult.h b/include/aws/config/model/GetOrganizationCustomRulePolicyResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c5b07a7ad2d159bfed79e630d14bb931fa3147dd --- /dev/null +++ b/include/aws/config/model/GetOrganizationCustomRulePolicyResult.h @@ -0,0 +1,68 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetOrganizationCustomRulePolicyResult + { + public: + AWS_CONFIGSERVICE_API GetOrganizationCustomRulePolicyResult(); + AWS_CONFIGSERVICE_API GetOrganizationCustomRulePolicyResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetOrganizationCustomRulePolicyResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The policy definition containing the logic for your organization Config + * Custom Policy rule.

+ */ + inline const Aws::String& GetPolicyText() const{ return m_policyText; } + inline void SetPolicyText(const Aws::String& value) { m_policyText = value; } + inline void SetPolicyText(Aws::String&& value) { m_policyText = std::move(value); } + inline void SetPolicyText(const char* value) { m_policyText.assign(value); } + inline GetOrganizationCustomRulePolicyResult& WithPolicyText(const Aws::String& value) { SetPolicyText(value); return *this;} + inline GetOrganizationCustomRulePolicyResult& WithPolicyText(Aws::String&& value) { SetPolicyText(std::move(value)); return *this;} + inline GetOrganizationCustomRulePolicyResult& WithPolicyText(const char* value) { SetPolicyText(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetOrganizationCustomRulePolicyResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetOrganizationCustomRulePolicyResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetOrganizationCustomRulePolicyResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_policyText; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetResourceConfigHistoryRequest.h b/include/aws/config/model/GetResourceConfigHistoryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a726cded93fd0eca843620b2436d36ff186d5d6a --- /dev/null +++ b/include/aws/config/model/GetResourceConfigHistoryRequest.h @@ -0,0 +1,163 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the GetResourceConfigHistory action.

See + * Also:

AWS + * API Reference

+ */ + class GetResourceConfigHistoryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetResourceConfigHistoryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetResourceConfigHistory"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The resource type.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline GetResourceConfigHistoryRequest& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline GetResourceConfigHistoryRequest& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource (for example., sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline GetResourceConfigHistoryRequest& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline GetResourceConfigHistoryRequest& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline GetResourceConfigHistoryRequest& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The chronologically latest time in the time range for which the history + * requested. If not specified, current time is taken.

+ */ + inline const Aws::Utils::DateTime& GetLaterTime() const{ return m_laterTime; } + inline bool LaterTimeHasBeenSet() const { return m_laterTimeHasBeenSet; } + inline void SetLaterTime(const Aws::Utils::DateTime& value) { m_laterTimeHasBeenSet = true; m_laterTime = value; } + inline void SetLaterTime(Aws::Utils::DateTime&& value) { m_laterTimeHasBeenSet = true; m_laterTime = std::move(value); } + inline GetResourceConfigHistoryRequest& WithLaterTime(const Aws::Utils::DateTime& value) { SetLaterTime(value); return *this;} + inline GetResourceConfigHistoryRequest& WithLaterTime(Aws::Utils::DateTime&& value) { SetLaterTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The chronologically earliest time in the time range for which the history + * requested. If not specified, the action returns paginated results that contain + * configuration items that start when the first configuration item was + * recorded.

+ */ + inline const Aws::Utils::DateTime& GetEarlierTime() const{ return m_earlierTime; } + inline bool EarlierTimeHasBeenSet() const { return m_earlierTimeHasBeenSet; } + inline void SetEarlierTime(const Aws::Utils::DateTime& value) { m_earlierTimeHasBeenSet = true; m_earlierTime = value; } + inline void SetEarlierTime(Aws::Utils::DateTime&& value) { m_earlierTimeHasBeenSet = true; m_earlierTime = std::move(value); } + inline GetResourceConfigHistoryRequest& WithEarlierTime(const Aws::Utils::DateTime& value) { SetEarlierTime(value); return *this;} + inline GetResourceConfigHistoryRequest& WithEarlierTime(Aws::Utils::DateTime&& value) { SetEarlierTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The chronological order for configuration items listed. By default, the + * results are listed in reverse chronological order.

+ */ + inline const ChronologicalOrder& GetChronologicalOrder() const{ return m_chronologicalOrder; } + inline bool ChronologicalOrderHasBeenSet() const { return m_chronologicalOrderHasBeenSet; } + inline void SetChronologicalOrder(const ChronologicalOrder& value) { m_chronologicalOrderHasBeenSet = true; m_chronologicalOrder = value; } + inline void SetChronologicalOrder(ChronologicalOrder&& value) { m_chronologicalOrderHasBeenSet = true; m_chronologicalOrder = std::move(value); } + inline GetResourceConfigHistoryRequest& WithChronologicalOrder(const ChronologicalOrder& value) { SetChronologicalOrder(value); return *this;} + inline GetResourceConfigHistoryRequest& WithChronologicalOrder(ChronologicalOrder&& value) { SetChronologicalOrder(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of configuration items returned on each page. The default + * is 10. You cannot specify a number greater than 100. If you specify 0, Config + * uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline GetResourceConfigHistoryRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline GetResourceConfigHistoryRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetResourceConfigHistoryRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetResourceConfigHistoryRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::Utils::DateTime m_laterTime; + bool m_laterTimeHasBeenSet = false; + + Aws::Utils::DateTime m_earlierTime; + bool m_earlierTimeHasBeenSet = false; + + ChronologicalOrder m_chronologicalOrder; + bool m_chronologicalOrderHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetResourceConfigHistoryResult.h b/include/aws/config/model/GetResourceConfigHistoryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f04f066d259ab0385069717a686f48c2e271fc8f --- /dev/null +++ b/include/aws/config/model/GetResourceConfigHistoryResult.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output for the GetResourceConfigHistory action.

See + * Also:

AWS + * API Reference

+ */ + class GetResourceConfigHistoryResult + { + public: + AWS_CONFIGSERVICE_API GetResourceConfigHistoryResult(); + AWS_CONFIGSERVICE_API GetResourceConfigHistoryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetResourceConfigHistoryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list that contains the configuration history of one or more resources.

+ */ + inline const Aws::Vector& GetConfigurationItems() const{ return m_configurationItems; } + inline void SetConfigurationItems(const Aws::Vector& value) { m_configurationItems = value; } + inline void SetConfigurationItems(Aws::Vector&& value) { m_configurationItems = std::move(value); } + inline GetResourceConfigHistoryResult& WithConfigurationItems(const Aws::Vector& value) { SetConfigurationItems(value); return *this;} + inline GetResourceConfigHistoryResult& WithConfigurationItems(Aws::Vector&& value) { SetConfigurationItems(std::move(value)); return *this;} + inline GetResourceConfigHistoryResult& AddConfigurationItems(const ConfigurationItem& value) { m_configurationItems.push_back(value); return *this; } + inline GetResourceConfigHistoryResult& AddConfigurationItems(ConfigurationItem&& value) { m_configurationItems.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline GetResourceConfigHistoryResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline GetResourceConfigHistoryResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline GetResourceConfigHistoryResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetResourceConfigHistoryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetResourceConfigHistoryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetResourceConfigHistoryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationItems; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetResourceEvaluationSummaryRequest.h b/include/aws/config/model/GetResourceEvaluationSummaryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e0e181d44174cbca855c949e6d86717502546331 --- /dev/null +++ b/include/aws/config/model/GetResourceEvaluationSummaryRequest.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetResourceEvaluationSummaryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetResourceEvaluationSummaryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetResourceEvaluationSummary"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The unique ResourceEvaluationId of Amazon Web Services resource + * execution for which you want to retrieve the evaluation summary.

+ */ + inline const Aws::String& GetResourceEvaluationId() const{ return m_resourceEvaluationId; } + inline bool ResourceEvaluationIdHasBeenSet() const { return m_resourceEvaluationIdHasBeenSet; } + inline void SetResourceEvaluationId(const Aws::String& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = value; } + inline void SetResourceEvaluationId(Aws::String&& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = std::move(value); } + inline void SetResourceEvaluationId(const char* value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId.assign(value); } + inline GetResourceEvaluationSummaryRequest& WithResourceEvaluationId(const Aws::String& value) { SetResourceEvaluationId(value); return *this;} + inline GetResourceEvaluationSummaryRequest& WithResourceEvaluationId(Aws::String&& value) { SetResourceEvaluationId(std::move(value)); return *this;} + inline GetResourceEvaluationSummaryRequest& WithResourceEvaluationId(const char* value) { SetResourceEvaluationId(value); return *this;} + ///@} + private: + + Aws::String m_resourceEvaluationId; + bool m_resourceEvaluationIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetResourceEvaluationSummaryResult.h b/include/aws/config/model/GetResourceEvaluationSummaryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..257ada5d8e09f91706232253a538f10576f19373 --- /dev/null +++ b/include/aws/config/model/GetResourceEvaluationSummaryResult.h @@ -0,0 +1,154 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetResourceEvaluationSummaryResult + { + public: + AWS_CONFIGSERVICE_API GetResourceEvaluationSummaryResult(); + AWS_CONFIGSERVICE_API GetResourceEvaluationSummaryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetResourceEvaluationSummaryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The unique ResourceEvaluationId of Amazon Web Services resource + * execution for which you want to retrieve the evaluation summary.

+ */ + inline const Aws::String& GetResourceEvaluationId() const{ return m_resourceEvaluationId; } + inline void SetResourceEvaluationId(const Aws::String& value) { m_resourceEvaluationId = value; } + inline void SetResourceEvaluationId(Aws::String&& value) { m_resourceEvaluationId = std::move(value); } + inline void SetResourceEvaluationId(const char* value) { m_resourceEvaluationId.assign(value); } + inline GetResourceEvaluationSummaryResult& WithResourceEvaluationId(const Aws::String& value) { SetResourceEvaluationId(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithResourceEvaluationId(Aws::String&& value) { SetResourceEvaluationId(std::move(value)); return *this;} + inline GetResourceEvaluationSummaryResult& WithResourceEvaluationId(const char* value) { SetResourceEvaluationId(value); return *this;} + ///@} + + ///@{ + /** + *

Lists results of the mode that you requested to retrieve the resource + * evaluation summary. The valid values are Detective or Proactive.

+ */ + inline const EvaluationMode& GetEvaluationMode() const{ return m_evaluationMode; } + inline void SetEvaluationMode(const EvaluationMode& value) { m_evaluationMode = value; } + inline void SetEvaluationMode(EvaluationMode&& value) { m_evaluationMode = std::move(value); } + inline GetResourceEvaluationSummaryResult& WithEvaluationMode(const EvaluationMode& value) { SetEvaluationMode(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithEvaluationMode(EvaluationMode&& value) { SetEvaluationMode(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Returns an EvaluationStatus object.

+ */ + inline const EvaluationStatus& GetEvaluationStatus() const{ return m_evaluationStatus; } + inline void SetEvaluationStatus(const EvaluationStatus& value) { m_evaluationStatus = value; } + inline void SetEvaluationStatus(EvaluationStatus&& value) { m_evaluationStatus = std::move(value); } + inline GetResourceEvaluationSummaryResult& WithEvaluationStatus(const EvaluationStatus& value) { SetEvaluationStatus(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithEvaluationStatus(EvaluationStatus&& value) { SetEvaluationStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The start timestamp when Config rule starts evaluating compliance for the + * provided resource details.

+ */ + inline const Aws::Utils::DateTime& GetEvaluationStartTimestamp() const{ return m_evaluationStartTimestamp; } + inline void SetEvaluationStartTimestamp(const Aws::Utils::DateTime& value) { m_evaluationStartTimestamp = value; } + inline void SetEvaluationStartTimestamp(Aws::Utils::DateTime&& value) { m_evaluationStartTimestamp = std::move(value); } + inline GetResourceEvaluationSummaryResult& WithEvaluationStartTimestamp(const Aws::Utils::DateTime& value) { SetEvaluationStartTimestamp(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithEvaluationStartTimestamp(Aws::Utils::DateTime&& value) { SetEvaluationStartTimestamp(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The compliance status of the resource evaluation summary.

+ */ + inline const ComplianceType& GetCompliance() const{ return m_compliance; } + inline void SetCompliance(const ComplianceType& value) { m_compliance = value; } + inline void SetCompliance(ComplianceType&& value) { m_compliance = std::move(value); } + inline GetResourceEvaluationSummaryResult& WithCompliance(const ComplianceType& value) { SetCompliance(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithCompliance(ComplianceType&& value) { SetCompliance(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Returns an EvaluationContext object.

+ */ + inline const EvaluationContext& GetEvaluationContext() const{ return m_evaluationContext; } + inline void SetEvaluationContext(const EvaluationContext& value) { m_evaluationContext = value; } + inline void SetEvaluationContext(EvaluationContext&& value) { m_evaluationContext = std::move(value); } + inline GetResourceEvaluationSummaryResult& WithEvaluationContext(const EvaluationContext& value) { SetEvaluationContext(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithEvaluationContext(EvaluationContext&& value) { SetEvaluationContext(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Returns a ResourceDetails object.

+ */ + inline const ResourceDetails& GetResourceDetails() const{ return m_resourceDetails; } + inline void SetResourceDetails(const ResourceDetails& value) { m_resourceDetails = value; } + inline void SetResourceDetails(ResourceDetails&& value) { m_resourceDetails = std::move(value); } + inline GetResourceEvaluationSummaryResult& WithResourceDetails(const ResourceDetails& value) { SetResourceDetails(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithResourceDetails(ResourceDetails&& value) { SetResourceDetails(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetResourceEvaluationSummaryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetResourceEvaluationSummaryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetResourceEvaluationSummaryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_resourceEvaluationId; + + EvaluationMode m_evaluationMode; + + EvaluationStatus m_evaluationStatus; + + Aws::Utils::DateTime m_evaluationStartTimestamp; + + ComplianceType m_compliance; + + EvaluationContext m_evaluationContext; + + ResourceDetails m_resourceDetails; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetStoredQueryRequest.h b/include/aws/config/model/GetStoredQueryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..7c927297ccd9d100550de7a7a6b001b9299e11ec --- /dev/null +++ b/include/aws/config/model/GetStoredQueryRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class GetStoredQueryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API GetStoredQueryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetStoredQuery"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the query.

+ */ + inline const Aws::String& GetQueryName() const{ return m_queryName; } + inline bool QueryNameHasBeenSet() const { return m_queryNameHasBeenSet; } + inline void SetQueryName(const Aws::String& value) { m_queryNameHasBeenSet = true; m_queryName = value; } + inline void SetQueryName(Aws::String&& value) { m_queryNameHasBeenSet = true; m_queryName = std::move(value); } + inline void SetQueryName(const char* value) { m_queryNameHasBeenSet = true; m_queryName.assign(value); } + inline GetStoredQueryRequest& WithQueryName(const Aws::String& value) { SetQueryName(value); return *this;} + inline GetStoredQueryRequest& WithQueryName(Aws::String&& value) { SetQueryName(std::move(value)); return *this;} + inline GetStoredQueryRequest& WithQueryName(const char* value) { SetQueryName(value); return *this;} + ///@} + private: + + Aws::String m_queryName; + bool m_queryNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GetStoredQueryResult.h b/include/aws/config/model/GetStoredQueryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..24c86d023cb0c6f47823145d44dc2bad12d9383b --- /dev/null +++ b/include/aws/config/model/GetStoredQueryResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class GetStoredQueryResult + { + public: + AWS_CONFIGSERVICE_API GetStoredQueryResult(); + AWS_CONFIGSERVICE_API GetStoredQueryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API GetStoredQueryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a StoredQuery object.

+ */ + inline const StoredQuery& GetStoredQuery() const{ return m_storedQuery; } + inline void SetStoredQuery(const StoredQuery& value) { m_storedQuery = value; } + inline void SetStoredQuery(StoredQuery&& value) { m_storedQuery = std::move(value); } + inline GetStoredQueryResult& WithStoredQuery(const StoredQuery& value) { SetStoredQuery(value); return *this;} + inline GetStoredQueryResult& WithStoredQuery(StoredQuery&& value) { SetStoredQuery(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetStoredQueryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetStoredQueryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetStoredQueryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + StoredQuery m_storedQuery; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/GroupedResourceCount.h b/include/aws/config/model/GroupedResourceCount.h new file mode 100644 index 0000000000000000000000000000000000000000..de80550fd5df869ca7730d4bcb642823e45fe7f2 --- /dev/null +++ b/include/aws/config/model/GroupedResourceCount.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The count of resources that are grouped by the group name.

See + * Also:

AWS + * API Reference

+ */ + class GroupedResourceCount + { + public: + AWS_CONFIGSERVICE_API GroupedResourceCount(); + AWS_CONFIGSERVICE_API GroupedResourceCount(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API GroupedResourceCount& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the group that can be region, account ID, or resource type. For + * example, region1, region2 if the region was chosen as + * GroupByKey.

+ */ + inline const Aws::String& GetGroupName() const{ return m_groupName; } + inline bool GroupNameHasBeenSet() const { return m_groupNameHasBeenSet; } + inline void SetGroupName(const Aws::String& value) { m_groupNameHasBeenSet = true; m_groupName = value; } + inline void SetGroupName(Aws::String&& value) { m_groupNameHasBeenSet = true; m_groupName = std::move(value); } + inline void SetGroupName(const char* value) { m_groupNameHasBeenSet = true; m_groupName.assign(value); } + inline GroupedResourceCount& WithGroupName(const Aws::String& value) { SetGroupName(value); return *this;} + inline GroupedResourceCount& WithGroupName(Aws::String&& value) { SetGroupName(std::move(value)); return *this;} + inline GroupedResourceCount& WithGroupName(const char* value) { SetGroupName(value); return *this;} + ///@} + + ///@{ + /** + *

The number of resources in the group.

+ */ + inline long long GetResourceCount() const{ return m_resourceCount; } + inline bool ResourceCountHasBeenSet() const { return m_resourceCountHasBeenSet; } + inline void SetResourceCount(long long value) { m_resourceCountHasBeenSet = true; m_resourceCount = value; } + inline GroupedResourceCount& WithResourceCount(long long value) { SetResourceCount(value); return *this;} + ///@} + private: + + Aws::String m_groupName; + bool m_groupNameHasBeenSet = false; + + long long m_resourceCount; + bool m_resourceCountHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListAggregateDiscoveredResourcesRequest.h b/include/aws/config/model/ListAggregateDiscoveredResourcesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d3fb1ee6dc06a33853ca8a6ce644e134776a5b93 --- /dev/null +++ b/include/aws/config/model/ListAggregateDiscoveredResourcesRequest.h @@ -0,0 +1,123 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class ListAggregateDiscoveredResourcesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API ListAggregateDiscoveredResourcesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListAggregateDiscoveredResources"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline ListAggregateDiscoveredResourcesRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline ListAggregateDiscoveredResourcesRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline ListAggregateDiscoveredResourcesRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

The type of resources that you want Config to list in the response.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline ListAggregateDiscoveredResourcesRequest& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline ListAggregateDiscoveredResourcesRequest& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Filters the results based on the ResourceFilters object.

+ */ + inline const ResourceFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ResourceFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ResourceFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline ListAggregateDiscoveredResourcesRequest& WithFilters(const ResourceFilters& value) { SetFilters(value); return *this;} + inline ListAggregateDiscoveredResourcesRequest& WithFilters(ResourceFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of resource identifiers returned on each page. You cannot + * specify a number greater than 100. If you specify 0, Config uses the + * default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline ListAggregateDiscoveredResourcesRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListAggregateDiscoveredResourcesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListAggregateDiscoveredResourcesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListAggregateDiscoveredResourcesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + ResourceFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListAggregateDiscoveredResourcesResult.h b/include/aws/config/model/ListAggregateDiscoveredResourcesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0a2b5c4412275531ebdd58cb2c49334fd8958296 --- /dev/null +++ b/include/aws/config/model/ListAggregateDiscoveredResourcesResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class ListAggregateDiscoveredResourcesResult + { + public: + AWS_CONFIGSERVICE_API ListAggregateDiscoveredResourcesResult(); + AWS_CONFIGSERVICE_API ListAggregateDiscoveredResourcesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API ListAggregateDiscoveredResourcesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of ResourceIdentifiers objects.

+ */ + inline const Aws::Vector& GetResourceIdentifiers() const{ return m_resourceIdentifiers; } + inline void SetResourceIdentifiers(const Aws::Vector& value) { m_resourceIdentifiers = value; } + inline void SetResourceIdentifiers(Aws::Vector&& value) { m_resourceIdentifiers = std::move(value); } + inline ListAggregateDiscoveredResourcesResult& WithResourceIdentifiers(const Aws::Vector& value) { SetResourceIdentifiers(value); return *this;} + inline ListAggregateDiscoveredResourcesResult& WithResourceIdentifiers(Aws::Vector&& value) { SetResourceIdentifiers(std::move(value)); return *this;} + inline ListAggregateDiscoveredResourcesResult& AddResourceIdentifiers(const AggregateResourceIdentifier& value) { m_resourceIdentifiers.push_back(value); return *this; } + inline ListAggregateDiscoveredResourcesResult& AddResourceIdentifiers(AggregateResourceIdentifier&& value) { m_resourceIdentifiers.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListAggregateDiscoveredResourcesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListAggregateDiscoveredResourcesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListAggregateDiscoveredResourcesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListAggregateDiscoveredResourcesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListAggregateDiscoveredResourcesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListAggregateDiscoveredResourcesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_resourceIdentifiers; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListConfigurationRecordersRequest.h b/include/aws/config/model/ListConfigurationRecordersRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..83038f437d6aaf213f2703ddc2436bff6fdc20a3 --- /dev/null +++ b/include/aws/config/model/ListConfigurationRecordersRequest.h @@ -0,0 +1,92 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class ListConfigurationRecordersRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API ListConfigurationRecordersRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListConfigurationRecorders"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Filters the results based on a list of + * ConfigurationRecorderFilter objects that you specify.

+ */ + inline const Aws::Vector& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const Aws::Vector& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(Aws::Vector&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline ListConfigurationRecordersRequest& WithFilters(const Aws::Vector& value) { SetFilters(value); return *this;} + inline ListConfigurationRecordersRequest& WithFilters(Aws::Vector&& value) { SetFilters(std::move(value)); return *this;} + inline ListConfigurationRecordersRequest& AddFilters(const ConfigurationRecorderFilter& value) { m_filtersHasBeenSet = true; m_filters.push_back(value); return *this; } + inline ListConfigurationRecordersRequest& AddFilters(ConfigurationRecorderFilter&& value) { m_filtersHasBeenSet = true; m_filters.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of results to include in the response.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline ListConfigurationRecordersRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + + ///@{ + /** + *

The NextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListConfigurationRecordersRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListConfigurationRecordersRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListConfigurationRecordersRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::Vector m_filters; + bool m_filtersHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListConfigurationRecordersResult.h b/include/aws/config/model/ListConfigurationRecordersResult.h new file mode 100644 index 0000000000000000000000000000000000000000..be312cb4fed90770623fbe494f207c3945422918 --- /dev/null +++ b/include/aws/config/model/ListConfigurationRecordersResult.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class ListConfigurationRecordersResult + { + public: + AWS_CONFIGSERVICE_API ListConfigurationRecordersResult(); + AWS_CONFIGSERVICE_API ListConfigurationRecordersResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API ListConfigurationRecordersResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of ConfigurationRecorderSummary objects that + * includes.

+ */ + inline const Aws::Vector& GetConfigurationRecorderSummaries() const{ return m_configurationRecorderSummaries; } + inline void SetConfigurationRecorderSummaries(const Aws::Vector& value) { m_configurationRecorderSummaries = value; } + inline void SetConfigurationRecorderSummaries(Aws::Vector&& value) { m_configurationRecorderSummaries = std::move(value); } + inline ListConfigurationRecordersResult& WithConfigurationRecorderSummaries(const Aws::Vector& value) { SetConfigurationRecorderSummaries(value); return *this;} + inline ListConfigurationRecordersResult& WithConfigurationRecorderSummaries(Aws::Vector&& value) { SetConfigurationRecorderSummaries(std::move(value)); return *this;} + inline ListConfigurationRecordersResult& AddConfigurationRecorderSummaries(const ConfigurationRecorderSummary& value) { m_configurationRecorderSummaries.push_back(value); return *this; } + inline ListConfigurationRecordersResult& AddConfigurationRecorderSummaries(ConfigurationRecorderSummary&& value) { m_configurationRecorderSummaries.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The NextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListConfigurationRecordersResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListConfigurationRecordersResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListConfigurationRecordersResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListConfigurationRecordersResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListConfigurationRecordersResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListConfigurationRecordersResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_configurationRecorderSummaries; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListConformancePackComplianceScoresRequest.h b/include/aws/config/model/ListConformancePackComplianceScoresRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f10aa9744a6f4218dfbbf484c29b57e708ce3c21 --- /dev/null +++ b/include/aws/config/model/ListConformancePackComplianceScoresRequest.h @@ -0,0 +1,136 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class ListConformancePackComplianceScoresRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API ListConformancePackComplianceScoresRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListConformancePackComplianceScores"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Filters the results based on the + * ConformancePackComplianceScoresFilters.

+ */ + inline const ConformancePackComplianceScoresFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ConformancePackComplianceScoresFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ConformancePackComplianceScoresFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline ListConformancePackComplianceScoresRequest& WithFilters(const ConformancePackComplianceScoresFilters& value) { SetFilters(value); return *this;} + inline ListConformancePackComplianceScoresRequest& WithFilters(ConformancePackComplianceScoresFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Determines the order in which conformance pack compliance scores are sorted. + * Either in ascending or descending order.

By default, conformance pack + * compliance scores are sorted in alphabetical order by name of the conformance + * pack. Conformance pack compliance scores are sorted in reverse alphabetical + * order if you enter DESCENDING.

You can sort conformance pack + * compliance scores by the numerical value of the compliance score by entering + * SCORE in the SortBy action. When compliance scores are + * sorted by SCORE, conformance packs with a compliance score of + * INSUFFICIENT_DATA will be last when sorting by ascending order and + * first when sorting by descending order.

+ */ + inline const SortOrder& GetSortOrder() const{ return m_sortOrder; } + inline bool SortOrderHasBeenSet() const { return m_sortOrderHasBeenSet; } + inline void SetSortOrder(const SortOrder& value) { m_sortOrderHasBeenSet = true; m_sortOrder = value; } + inline void SetSortOrder(SortOrder&& value) { m_sortOrderHasBeenSet = true; m_sortOrder = std::move(value); } + inline ListConformancePackComplianceScoresRequest& WithSortOrder(const SortOrder& value) { SetSortOrder(value); return *this;} + inline ListConformancePackComplianceScoresRequest& WithSortOrder(SortOrder&& value) { SetSortOrder(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Sorts your conformance pack compliance scores in either ascending or + * descending order, depending on SortOrder.

By default, + * conformance pack compliance scores are sorted in alphabetical order by name of + * the conformance pack. Enter SCORE, to sort conformance pack + * compliance scores by the numerical value of the compliance score.

+ */ + inline const SortBy& GetSortBy() const{ return m_sortBy; } + inline bool SortByHasBeenSet() const { return m_sortByHasBeenSet; } + inline void SetSortBy(const SortBy& value) { m_sortByHasBeenSet = true; m_sortBy = value; } + inline void SetSortBy(SortBy&& value) { m_sortByHasBeenSet = true; m_sortBy = std::move(value); } + inline ListConformancePackComplianceScoresRequest& WithSortBy(const SortBy& value) { SetSortBy(value); return *this;} + inline ListConformancePackComplianceScoresRequest& WithSortBy(SortBy&& value) { SetSortBy(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of conformance pack compliance scores returned on each + * page.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline ListConformancePackComplianceScoresRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string in a prior request that you can use to get + * the paginated response for the next set of conformance pack compliance + * scores.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListConformancePackComplianceScoresRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListConformancePackComplianceScoresRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListConformancePackComplianceScoresRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + ConformancePackComplianceScoresFilters m_filters; + bool m_filtersHasBeenSet = false; + + SortOrder m_sortOrder; + bool m_sortOrderHasBeenSet = false; + + SortBy m_sortBy; + bool m_sortByHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListConformancePackComplianceScoresResult.h b/include/aws/config/model/ListConformancePackComplianceScoresResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0722effdffddab0b79ec4a2c8fb33aea8aabbafb --- /dev/null +++ b/include/aws/config/model/ListConformancePackComplianceScoresResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class ListConformancePackComplianceScoresResult + { + public: + AWS_CONFIGSERVICE_API ListConformancePackComplianceScoresResult(); + AWS_CONFIGSERVICE_API ListConformancePackComplianceScoresResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API ListConformancePackComplianceScoresResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The nextToken string that you can use to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListConformancePackComplianceScoresResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListConformancePackComplianceScoresResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListConformancePackComplianceScoresResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

A list of ConformancePackComplianceScore objects.

+ */ + inline const Aws::Vector& GetConformancePackComplianceScores() const{ return m_conformancePackComplianceScores; } + inline void SetConformancePackComplianceScores(const Aws::Vector& value) { m_conformancePackComplianceScores = value; } + inline void SetConformancePackComplianceScores(Aws::Vector&& value) { m_conformancePackComplianceScores = std::move(value); } + inline ListConformancePackComplianceScoresResult& WithConformancePackComplianceScores(const Aws::Vector& value) { SetConformancePackComplianceScores(value); return *this;} + inline ListConformancePackComplianceScoresResult& WithConformancePackComplianceScores(Aws::Vector&& value) { SetConformancePackComplianceScores(std::move(value)); return *this;} + inline ListConformancePackComplianceScoresResult& AddConformancePackComplianceScores(const ConformancePackComplianceScore& value) { m_conformancePackComplianceScores.push_back(value); return *this; } + inline ListConformancePackComplianceScoresResult& AddConformancePackComplianceScores(ConformancePackComplianceScore&& value) { m_conformancePackComplianceScores.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListConformancePackComplianceScoresResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListConformancePackComplianceScoresResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListConformancePackComplianceScoresResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + + Aws::Vector m_conformancePackComplianceScores; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListDiscoveredResourcesRequest.h b/include/aws/config/model/ListDiscoveredResourcesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d58772eff0a7274cbdeb00f62326c3fba6238dd4 --- /dev/null +++ b/include/aws/config/model/ListDiscoveredResourcesRequest.h @@ -0,0 +1,148 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class ListDiscoveredResourcesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API ListDiscoveredResourcesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListDiscoveredResources"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The type of resources that you want Config to list in the response.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline ListDiscoveredResourcesRequest& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline ListDiscoveredResourcesRequest& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The IDs of only those resources that you want Config to list in the response. + * If you do not specify this parameter, Config lists all resources of the + * specified type that it has discovered. You can list a minimum of 1 resourceID + * and a maximum of 20 resourceIds.

+ */ + inline const Aws::Vector& GetResourceIds() const{ return m_resourceIds; } + inline bool ResourceIdsHasBeenSet() const { return m_resourceIdsHasBeenSet; } + inline void SetResourceIds(const Aws::Vector& value) { m_resourceIdsHasBeenSet = true; m_resourceIds = value; } + inline void SetResourceIds(Aws::Vector&& value) { m_resourceIdsHasBeenSet = true; m_resourceIds = std::move(value); } + inline ListDiscoveredResourcesRequest& WithResourceIds(const Aws::Vector& value) { SetResourceIds(value); return *this;} + inline ListDiscoveredResourcesRequest& WithResourceIds(Aws::Vector&& value) { SetResourceIds(std::move(value)); return *this;} + inline ListDiscoveredResourcesRequest& AddResourceIds(const Aws::String& value) { m_resourceIdsHasBeenSet = true; m_resourceIds.push_back(value); return *this; } + inline ListDiscoveredResourcesRequest& AddResourceIds(Aws::String&& value) { m_resourceIdsHasBeenSet = true; m_resourceIds.push_back(std::move(value)); return *this; } + inline ListDiscoveredResourcesRequest& AddResourceIds(const char* value) { m_resourceIdsHasBeenSet = true; m_resourceIds.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The custom name of only those resources that you want Config to list in the + * response. If you do not specify this parameter, Config lists all resources of + * the specified type that it has discovered.

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline ListDiscoveredResourcesRequest& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline ListDiscoveredResourcesRequest& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline ListDiscoveredResourcesRequest& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of resource identifiers returned on each page. The default + * is 100. You cannot specify a number greater than 100. If you specify 0, Config + * uses the default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline ListDiscoveredResourcesRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether Config includes deleted resources in the results. By + * default, deleted resources are not included.

+ */ + inline bool GetIncludeDeletedResources() const{ return m_includeDeletedResources; } + inline bool IncludeDeletedResourcesHasBeenSet() const { return m_includeDeletedResourcesHasBeenSet; } + inline void SetIncludeDeletedResources(bool value) { m_includeDeletedResourcesHasBeenSet = true; m_includeDeletedResources = value; } + inline ListDiscoveredResourcesRequest& WithIncludeDeletedResources(bool value) { SetIncludeDeletedResources(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListDiscoveredResourcesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListDiscoveredResourcesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListDiscoveredResourcesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::Vector m_resourceIds; + bool m_resourceIdsHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + bool m_includeDeletedResources; + bool m_includeDeletedResourcesHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListDiscoveredResourcesResult.h b/include/aws/config/model/ListDiscoveredResourcesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..34d74a6372ca5d33f03dfaa286c53ab65aa20a1e --- /dev/null +++ b/include/aws/config/model/ListDiscoveredResourcesResult.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class ListDiscoveredResourcesResult + { + public: + AWS_CONFIGSERVICE_API ListDiscoveredResourcesResult(); + AWS_CONFIGSERVICE_API ListDiscoveredResourcesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API ListDiscoveredResourcesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The details that identify a resource that is discovered by Config, including + * the resource type, ID, and (if available) the custom resource name.

+ */ + inline const Aws::Vector& GetResourceIdentifiers() const{ return m_resourceIdentifiers; } + inline void SetResourceIdentifiers(const Aws::Vector& value) { m_resourceIdentifiers = value; } + inline void SetResourceIdentifiers(Aws::Vector&& value) { m_resourceIdentifiers = std::move(value); } + inline ListDiscoveredResourcesResult& WithResourceIdentifiers(const Aws::Vector& value) { SetResourceIdentifiers(value); return *this;} + inline ListDiscoveredResourcesResult& WithResourceIdentifiers(Aws::Vector&& value) { SetResourceIdentifiers(std::move(value)); return *this;} + inline ListDiscoveredResourcesResult& AddResourceIdentifiers(const ResourceIdentifier& value) { m_resourceIdentifiers.push_back(value); return *this; } + inline ListDiscoveredResourcesResult& AddResourceIdentifiers(ResourceIdentifier&& value) { m_resourceIdentifiers.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The string that you use in a subsequent request to get the next page of + * results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListDiscoveredResourcesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListDiscoveredResourcesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListDiscoveredResourcesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListDiscoveredResourcesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListDiscoveredResourcesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListDiscoveredResourcesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_resourceIdentifiers; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListResourceEvaluationsRequest.h b/include/aws/config/model/ListResourceEvaluationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..68e268f0bb78f29a706dfac348a41dee5aa78ebc --- /dev/null +++ b/include/aws/config/model/ListResourceEvaluationsRequest.h @@ -0,0 +1,90 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class ListResourceEvaluationsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API ListResourceEvaluationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListResourceEvaluations"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Returns a ResourceEvaluationFilters object.

+ */ + inline const ResourceEvaluationFilters& GetFilters() const{ return m_filters; } + inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; } + inline void SetFilters(const ResourceEvaluationFilters& value) { m_filtersHasBeenSet = true; m_filters = value; } + inline void SetFilters(ResourceEvaluationFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); } + inline ListResourceEvaluationsRequest& WithFilters(const ResourceEvaluationFilters& value) { SetFilters(value); return *this;} + inline ListResourceEvaluationsRequest& WithFilters(ResourceEvaluationFilters&& value) { SetFilters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of evaluations returned on each page. The default is 10. + * You cannot specify a number greater than 100. If you specify 0, Config uses the + * default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline ListResourceEvaluationsRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListResourceEvaluationsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListResourceEvaluationsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListResourceEvaluationsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + ResourceEvaluationFilters m_filters; + bool m_filtersHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListResourceEvaluationsResult.h b/include/aws/config/model/ListResourceEvaluationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..86f9fc3e5162f0eaf0a3220141c44d1dc272a3ba --- /dev/null +++ b/include/aws/config/model/ListResourceEvaluationsResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class ListResourceEvaluationsResult + { + public: + AWS_CONFIGSERVICE_API ListResourceEvaluationsResult(); + AWS_CONFIGSERVICE_API ListResourceEvaluationsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API ListResourceEvaluationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a ResourceEvaluations object.

+ */ + inline const Aws::Vector& GetResourceEvaluations() const{ return m_resourceEvaluations; } + inline void SetResourceEvaluations(const Aws::Vector& value) { m_resourceEvaluations = value; } + inline void SetResourceEvaluations(Aws::Vector&& value) { m_resourceEvaluations = std::move(value); } + inline ListResourceEvaluationsResult& WithResourceEvaluations(const Aws::Vector& value) { SetResourceEvaluations(value); return *this;} + inline ListResourceEvaluationsResult& WithResourceEvaluations(Aws::Vector&& value) { SetResourceEvaluations(std::move(value)); return *this;} + inline ListResourceEvaluationsResult& AddResourceEvaluations(const ResourceEvaluation& value) { m_resourceEvaluations.push_back(value); return *this; } + inline ListResourceEvaluationsResult& AddResourceEvaluations(ResourceEvaluation&& value) { m_resourceEvaluations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListResourceEvaluationsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListResourceEvaluationsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListResourceEvaluationsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListResourceEvaluationsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListResourceEvaluationsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListResourceEvaluationsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_resourceEvaluations; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListStoredQueriesRequest.h b/include/aws/config/model/ListStoredQueriesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..035354460e9460d26ae27b6ee574ecac25c0d3b7 --- /dev/null +++ b/include/aws/config/model/ListStoredQueriesRequest.h @@ -0,0 +1,72 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class ListStoredQueriesRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API ListStoredQueriesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListStoredQueries"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The nextToken string returned in a previous request that you use to request + * the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListStoredQueriesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListStoredQueriesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListStoredQueriesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of results to be returned with a single call.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline ListStoredQueriesRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListStoredQueriesResult.h b/include/aws/config/model/ListStoredQueriesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..b2689e30276a39a9fbc32b17a945d1c3da9bca15 --- /dev/null +++ b/include/aws/config/model/ListStoredQueriesResult.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class ListStoredQueriesResult + { + public: + AWS_CONFIGSERVICE_API ListStoredQueriesResult(); + AWS_CONFIGSERVICE_API ListStoredQueriesResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API ListStoredQueriesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of StoredQueryMetadata objects.

+ */ + inline const Aws::Vector& GetStoredQueryMetadata() const{ return m_storedQueryMetadata; } + inline void SetStoredQueryMetadata(const Aws::Vector& value) { m_storedQueryMetadata = value; } + inline void SetStoredQueryMetadata(Aws::Vector&& value) { m_storedQueryMetadata = std::move(value); } + inline ListStoredQueriesResult& WithStoredQueryMetadata(const Aws::Vector& value) { SetStoredQueryMetadata(value); return *this;} + inline ListStoredQueriesResult& WithStoredQueryMetadata(Aws::Vector&& value) { SetStoredQueryMetadata(std::move(value)); return *this;} + inline ListStoredQueriesResult& AddStoredQueryMetadata(const StoredQueryMetadata& value) { m_storedQueryMetadata.push_back(value); return *this; } + inline ListStoredQueriesResult& AddStoredQueryMetadata(StoredQueryMetadata&& value) { m_storedQueryMetadata.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

If the previous paginated request didn't return all of the remaining results, + * the response object's NextToken parameter value is set to a token. + * To retrieve the next set of results, call this operation again and assign that + * token to the request object's NextToken parameter. If there are no + * remaining results, the previous response object's NextToken + * parameter is set to null.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListStoredQueriesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListStoredQueriesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListStoredQueriesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListStoredQueriesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListStoredQueriesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListStoredQueriesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_storedQueryMetadata; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListTagsForResourceRequest.h b/include/aws/config/model/ListTagsForResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..040a3e5531a32ecaafd43f2e56d8b351bf0fc834 --- /dev/null +++ b/include/aws/config/model/ListTagsForResourceRequest.h @@ -0,0 +1,99 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class ListTagsForResourceRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API ListTagsForResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListTagsForResource"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) that identifies the resource for which to list + * the tags. The following resources are supported:

  • + * ConfigurationRecorder

  • ConfigRule + *

  • OrganizationConfigRule

  • + * ConformancePack

  • + * OrganizationConformancePack

  • + * ConfigurationAggregator

  • + * AggregationAuthorization

  • + * StoredQuery

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline ListTagsForResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline ListTagsForResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline ListTagsForResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of tags returned on each page. The limit maximum is 50. + * You cannot specify a number greater than 50. If you specify 0, Config uses the + * default.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline ListTagsForResourceRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListTagsForResourceRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListTagsForResourceRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListTagsForResourceRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ListTagsForResourceResult.h b/include/aws/config/model/ListTagsForResourceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..d9b7a6a85890010726a4a5f587a220652913950b --- /dev/null +++ b/include/aws/config/model/ListTagsForResourceResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class ListTagsForResourceResult + { + public: + AWS_CONFIGSERVICE_API ListTagsForResourceResult(); + AWS_CONFIGSERVICE_API ListTagsForResourceResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API ListTagsForResourceResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The tags for the resource.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline void SetTags(const Aws::Vector& value) { m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tags = std::move(value); } + inline ListTagsForResourceResult& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline ListTagsForResourceResult& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline ListTagsForResourceResult& AddTags(const Tag& value) { m_tags.push_back(value); return *this; } + inline ListTagsForResourceResult& AddTags(Tag&& value) { m_tags.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The nextToken string returned on a previous page that you use to + * get the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListTagsForResourceResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListTagsForResourceResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListTagsForResourceResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListTagsForResourceResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListTagsForResourceResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListTagsForResourceResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_tags; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/MaximumExecutionFrequency.h b/include/aws/config/model/MaximumExecutionFrequency.h new file mode 100644 index 0000000000000000000000000000000000000000..b80dea35a493da6fd9ea842b7ec862d2a31ec141 --- /dev/null +++ b/include/aws/config/model/MaximumExecutionFrequency.h @@ -0,0 +1,34 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class MaximumExecutionFrequency + { + NOT_SET, + One_Hour, + Three_Hours, + Six_Hours, + Twelve_Hours, + TwentyFour_Hours + }; + +namespace MaximumExecutionFrequencyMapper +{ +AWS_CONFIGSERVICE_API MaximumExecutionFrequency GetMaximumExecutionFrequencyForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForMaximumExecutionFrequency(MaximumExecutionFrequency value); +} // namespace MaximumExecutionFrequencyMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/MemberAccountRuleStatus.h b/include/aws/config/model/MemberAccountRuleStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..b617cf70b078502472c22776f347aa3ecdf542b9 --- /dev/null +++ b/include/aws/config/model/MemberAccountRuleStatus.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class MemberAccountRuleStatus + { + NOT_SET, + CREATE_SUCCESSFUL, + CREATE_IN_PROGRESS, + CREATE_FAILED, + DELETE_SUCCESSFUL, + DELETE_FAILED, + DELETE_IN_PROGRESS, + UPDATE_SUCCESSFUL, + UPDATE_IN_PROGRESS, + UPDATE_FAILED + }; + +namespace MemberAccountRuleStatusMapper +{ +AWS_CONFIGSERVICE_API MemberAccountRuleStatus GetMemberAccountRuleStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForMemberAccountRuleStatus(MemberAccountRuleStatus value); +} // namespace MemberAccountRuleStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/MemberAccountStatus.h b/include/aws/config/model/MemberAccountStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..fbb32a95afefeb09cb2cde0860959f9099f274ef --- /dev/null +++ b/include/aws/config/model/MemberAccountStatus.h @@ -0,0 +1,169 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Organization Config rule creation or deletion status in each member account. + * This includes the name of the rule, the status, error code and error message + * when the rule creation or deletion failed.

See Also:

AWS + * API Reference

+ */ + class MemberAccountStatus + { + public: + AWS_CONFIGSERVICE_API MemberAccountStatus(); + AWS_CONFIGSERVICE_API MemberAccountStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API MemberAccountStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of a member account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline MemberAccountStatus& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline MemberAccountStatus& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline MemberAccountStatus& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The name of Config rule deployed in the member account.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline MemberAccountStatus& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline MemberAccountStatus& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline MemberAccountStatus& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates deployment status for Config rule in the member account. When + * management account calls PutOrganizationConfigRule action for the + * first time, Config rule status is created in the member account. When management + * account calls PutOrganizationConfigRule action for the second time, + * Config rule status is updated in the member account. Config rule status is + * deleted when the management account deletes OrganizationConfigRule + * and disables service access for + * config-multiaccountsetup.amazonaws.com.

Config sets the + * state of the rule to:

  • CREATE_SUCCESSFUL when + * Config rule has been created in the member account.

  • + * CREATE_IN_PROGRESS when Config rule is being created in the member + * account.

  • CREATE_FAILED when Config rule creation + * has failed in the member account.

  • DELETE_FAILED + * when Config rule deletion has failed in the member account.

  • + * DELETE_IN_PROGRESS when Config rule is being deleted in the member + * account.

  • DELETE_SUCCESSFUL when Config rule has + * been deleted in the member account.

  • + * UPDATE_SUCCESSFUL when Config rule has been updated in the member + * account.

  • UPDATE_IN_PROGRESS when Config rule is + * being updated in the member account.

  • + * UPDATE_FAILED when Config rule deletion has failed in the member + * account.

+ */ + inline const MemberAccountRuleStatus& GetMemberAccountRuleStatus() const{ return m_memberAccountRuleStatus; } + inline bool MemberAccountRuleStatusHasBeenSet() const { return m_memberAccountRuleStatusHasBeenSet; } + inline void SetMemberAccountRuleStatus(const MemberAccountRuleStatus& value) { m_memberAccountRuleStatusHasBeenSet = true; m_memberAccountRuleStatus = value; } + inline void SetMemberAccountRuleStatus(MemberAccountRuleStatus&& value) { m_memberAccountRuleStatusHasBeenSet = true; m_memberAccountRuleStatus = std::move(value); } + inline MemberAccountStatus& WithMemberAccountRuleStatus(const MemberAccountRuleStatus& value) { SetMemberAccountRuleStatus(value); return *this;} + inline MemberAccountStatus& WithMemberAccountRuleStatus(MemberAccountRuleStatus&& value) { SetMemberAccountRuleStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An error code that is returned when Config rule creation or deletion failed + * in the member account.

+ */ + inline const Aws::String& GetErrorCode() const{ return m_errorCode; } + inline bool ErrorCodeHasBeenSet() const { return m_errorCodeHasBeenSet; } + inline void SetErrorCode(const Aws::String& value) { m_errorCodeHasBeenSet = true; m_errorCode = value; } + inline void SetErrorCode(Aws::String&& value) { m_errorCodeHasBeenSet = true; m_errorCode = std::move(value); } + inline void SetErrorCode(const char* value) { m_errorCodeHasBeenSet = true; m_errorCode.assign(value); } + inline MemberAccountStatus& WithErrorCode(const Aws::String& value) { SetErrorCode(value); return *this;} + inline MemberAccountStatus& WithErrorCode(Aws::String&& value) { SetErrorCode(std::move(value)); return *this;} + inline MemberAccountStatus& WithErrorCode(const char* value) { SetErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

An error message indicating that Config rule account creation or deletion has + * failed due to an error in the member account.

+ */ + inline const Aws::String& GetErrorMessage() const{ return m_errorMessage; } + inline bool ErrorMessageHasBeenSet() const { return m_errorMessageHasBeenSet; } + inline void SetErrorMessage(const Aws::String& value) { m_errorMessageHasBeenSet = true; m_errorMessage = value; } + inline void SetErrorMessage(Aws::String&& value) { m_errorMessageHasBeenSet = true; m_errorMessage = std::move(value); } + inline void SetErrorMessage(const char* value) { m_errorMessageHasBeenSet = true; m_errorMessage.assign(value); } + inline MemberAccountStatus& WithErrorMessage(const Aws::String& value) { SetErrorMessage(value); return *this;} + inline MemberAccountStatus& WithErrorMessage(Aws::String&& value) { SetErrorMessage(std::move(value)); return *this;} + inline MemberAccountStatus& WithErrorMessage(const char* value) { SetErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The timestamp of the last status update.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; } + inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; } + inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; } + inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); } + inline MemberAccountStatus& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;} + inline MemberAccountStatus& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + MemberAccountRuleStatus m_memberAccountRuleStatus; + bool m_memberAccountRuleStatusHasBeenSet = false; + + Aws::String m_errorCode; + bool m_errorCodeHasBeenSet = false; + + Aws::String m_errorMessage; + bool m_errorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateTime; + bool m_lastUpdateTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/MessageType.h b/include/aws/config/model/MessageType.h new file mode 100644 index 0000000000000000000000000000000000000000..5ef40517e8ba97fa1656df8fb6123f73097bc20f --- /dev/null +++ b/include/aws/config/model/MessageType.h @@ -0,0 +1,33 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class MessageType + { + NOT_SET, + ConfigurationItemChangeNotification, + ConfigurationSnapshotDeliveryCompleted, + ScheduledNotification, + OversizedConfigurationItemChangeNotification + }; + +namespace MessageTypeMapper +{ +AWS_CONFIGSERVICE_API MessageType GetMessageTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForMessageType(MessageType value); +} // namespace MessageTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationAggregationSource.h b/include/aws/config/model/OrganizationAggregationSource.h new file mode 100644 index 0000000000000000000000000000000000000000..954ab1c13f4901a2cc44569ab43a2d2576d4d258 --- /dev/null +++ b/include/aws/config/model/OrganizationAggregationSource.h @@ -0,0 +1,95 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

This object contains regions to set up the aggregator and an IAM role to + * retrieve organization details.

See Also:

AWS + * API Reference

+ */ + class OrganizationAggregationSource + { + public: + AWS_CONFIGSERVICE_API OrganizationAggregationSource(); + AWS_CONFIGSERVICE_API OrganizationAggregationSource(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationAggregationSource& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

ARN of the IAM role used to retrieve Amazon Web Services Organization details + * associated with the aggregator account.

+ */ + inline const Aws::String& GetRoleArn() const{ return m_roleArn; } + inline bool RoleArnHasBeenSet() const { return m_roleArnHasBeenSet; } + inline void SetRoleArn(const Aws::String& value) { m_roleArnHasBeenSet = true; m_roleArn = value; } + inline void SetRoleArn(Aws::String&& value) { m_roleArnHasBeenSet = true; m_roleArn = std::move(value); } + inline void SetRoleArn(const char* value) { m_roleArnHasBeenSet = true; m_roleArn.assign(value); } + inline OrganizationAggregationSource& WithRoleArn(const Aws::String& value) { SetRoleArn(value); return *this;} + inline OrganizationAggregationSource& WithRoleArn(Aws::String&& value) { SetRoleArn(std::move(value)); return *this;} + inline OrganizationAggregationSource& WithRoleArn(const char* value) { SetRoleArn(value); return *this;} + ///@} + + ///@{ + /** + *

The source regions being aggregated.

+ */ + inline const Aws::Vector& GetAwsRegions() const{ return m_awsRegions; } + inline bool AwsRegionsHasBeenSet() const { return m_awsRegionsHasBeenSet; } + inline void SetAwsRegions(const Aws::Vector& value) { m_awsRegionsHasBeenSet = true; m_awsRegions = value; } + inline void SetAwsRegions(Aws::Vector&& value) { m_awsRegionsHasBeenSet = true; m_awsRegions = std::move(value); } + inline OrganizationAggregationSource& WithAwsRegions(const Aws::Vector& value) { SetAwsRegions(value); return *this;} + inline OrganizationAggregationSource& WithAwsRegions(Aws::Vector&& value) { SetAwsRegions(std::move(value)); return *this;} + inline OrganizationAggregationSource& AddAwsRegions(const Aws::String& value) { m_awsRegionsHasBeenSet = true; m_awsRegions.push_back(value); return *this; } + inline OrganizationAggregationSource& AddAwsRegions(Aws::String&& value) { m_awsRegionsHasBeenSet = true; m_awsRegions.push_back(std::move(value)); return *this; } + inline OrganizationAggregationSource& AddAwsRegions(const char* value) { m_awsRegionsHasBeenSet = true; m_awsRegions.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

If true, aggregate existing Config regions and future regions.

+ */ + inline bool GetAllAwsRegions() const{ return m_allAwsRegions; } + inline bool AllAwsRegionsHasBeenSet() const { return m_allAwsRegionsHasBeenSet; } + inline void SetAllAwsRegions(bool value) { m_allAwsRegionsHasBeenSet = true; m_allAwsRegions = value; } + inline OrganizationAggregationSource& WithAllAwsRegions(bool value) { SetAllAwsRegions(value); return *this;} + ///@} + private: + + Aws::String m_roleArn; + bool m_roleArnHasBeenSet = false; + + Aws::Vector m_awsRegions; + bool m_awsRegionsHasBeenSet = false; + + bool m_allAwsRegions; + bool m_allAwsRegionsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationConfigRule.h b/include/aws/config/model/OrganizationConfigRule.h new file mode 100644 index 0000000000000000000000000000000000000000..008130722dd80f3a8b19aa3a6875f5934b16ed91 --- /dev/null +++ b/include/aws/config/model/OrganizationConfigRule.h @@ -0,0 +1,168 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An organization Config rule that has information about Config rules that + * Config creates in member accounts.

See Also:

AWS + * API Reference

+ */ + class OrganizationConfigRule + { + public: + AWS_CONFIGSERVICE_API OrganizationConfigRule(); + AWS_CONFIGSERVICE_API OrganizationConfigRule(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationConfigRule& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name that you assign to organization Config rule.

+ */ + inline const Aws::String& GetOrganizationConfigRuleName() const{ return m_organizationConfigRuleName; } + inline bool OrganizationConfigRuleNameHasBeenSet() const { return m_organizationConfigRuleNameHasBeenSet; } + inline void SetOrganizationConfigRuleName(const Aws::String& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = value; } + inline void SetOrganizationConfigRuleName(Aws::String&& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = std::move(value); } + inline void SetOrganizationConfigRuleName(const char* value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName.assign(value); } + inline OrganizationConfigRule& WithOrganizationConfigRuleName(const Aws::String& value) { SetOrganizationConfigRuleName(value); return *this;} + inline OrganizationConfigRule& WithOrganizationConfigRuleName(Aws::String&& value) { SetOrganizationConfigRuleName(std::move(value)); return *this;} + inline OrganizationConfigRule& WithOrganizationConfigRuleName(const char* value) { SetOrganizationConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of organization Config rule.

+ */ + inline const Aws::String& GetOrganizationConfigRuleArn() const{ return m_organizationConfigRuleArn; } + inline bool OrganizationConfigRuleArnHasBeenSet() const { return m_organizationConfigRuleArnHasBeenSet; } + inline void SetOrganizationConfigRuleArn(const Aws::String& value) { m_organizationConfigRuleArnHasBeenSet = true; m_organizationConfigRuleArn = value; } + inline void SetOrganizationConfigRuleArn(Aws::String&& value) { m_organizationConfigRuleArnHasBeenSet = true; m_organizationConfigRuleArn = std::move(value); } + inline void SetOrganizationConfigRuleArn(const char* value) { m_organizationConfigRuleArnHasBeenSet = true; m_organizationConfigRuleArn.assign(value); } + inline OrganizationConfigRule& WithOrganizationConfigRuleArn(const Aws::String& value) { SetOrganizationConfigRuleArn(value); return *this;} + inline OrganizationConfigRule& WithOrganizationConfigRuleArn(Aws::String&& value) { SetOrganizationConfigRuleArn(std::move(value)); return *this;} + inline OrganizationConfigRule& WithOrganizationConfigRuleArn(const char* value) { SetOrganizationConfigRuleArn(value); return *this;} + ///@} + + ///@{ + /** + *

An OrganizationManagedRuleMetadata object.

+ */ + inline const OrganizationManagedRuleMetadata& GetOrganizationManagedRuleMetadata() const{ return m_organizationManagedRuleMetadata; } + inline bool OrganizationManagedRuleMetadataHasBeenSet() const { return m_organizationManagedRuleMetadataHasBeenSet; } + inline void SetOrganizationManagedRuleMetadata(const OrganizationManagedRuleMetadata& value) { m_organizationManagedRuleMetadataHasBeenSet = true; m_organizationManagedRuleMetadata = value; } + inline void SetOrganizationManagedRuleMetadata(OrganizationManagedRuleMetadata&& value) { m_organizationManagedRuleMetadataHasBeenSet = true; m_organizationManagedRuleMetadata = std::move(value); } + inline OrganizationConfigRule& WithOrganizationManagedRuleMetadata(const OrganizationManagedRuleMetadata& value) { SetOrganizationManagedRuleMetadata(value); return *this;} + inline OrganizationConfigRule& WithOrganizationManagedRuleMetadata(OrganizationManagedRuleMetadata&& value) { SetOrganizationManagedRuleMetadata(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An OrganizationCustomRuleMetadata object.

+ */ + inline const OrganizationCustomRuleMetadata& GetOrganizationCustomRuleMetadata() const{ return m_organizationCustomRuleMetadata; } + inline bool OrganizationCustomRuleMetadataHasBeenSet() const { return m_organizationCustomRuleMetadataHasBeenSet; } + inline void SetOrganizationCustomRuleMetadata(const OrganizationCustomRuleMetadata& value) { m_organizationCustomRuleMetadataHasBeenSet = true; m_organizationCustomRuleMetadata = value; } + inline void SetOrganizationCustomRuleMetadata(OrganizationCustomRuleMetadata&& value) { m_organizationCustomRuleMetadataHasBeenSet = true; m_organizationCustomRuleMetadata = std::move(value); } + inline OrganizationConfigRule& WithOrganizationCustomRuleMetadata(const OrganizationCustomRuleMetadata& value) { SetOrganizationCustomRuleMetadata(value); return *this;} + inline OrganizationConfigRule& WithOrganizationCustomRuleMetadata(OrganizationCustomRuleMetadata&& value) { SetOrganizationCustomRuleMetadata(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A comma-separated list of accounts excluded from organization Config + * rule.

+ */ + inline const Aws::Vector& GetExcludedAccounts() const{ return m_excludedAccounts; } + inline bool ExcludedAccountsHasBeenSet() const { return m_excludedAccountsHasBeenSet; } + inline void SetExcludedAccounts(const Aws::Vector& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = value; } + inline void SetExcludedAccounts(Aws::Vector&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = std::move(value); } + inline OrganizationConfigRule& WithExcludedAccounts(const Aws::Vector& value) { SetExcludedAccounts(value); return *this;} + inline OrganizationConfigRule& WithExcludedAccounts(Aws::Vector&& value) { SetExcludedAccounts(std::move(value)); return *this;} + inline OrganizationConfigRule& AddExcludedAccounts(const Aws::String& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + inline OrganizationConfigRule& AddExcludedAccounts(Aws::String&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(std::move(value)); return *this; } + inline OrganizationConfigRule& AddExcludedAccounts(const char* value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The timestamp of the last update.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; } + inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; } + inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; } + inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); } + inline OrganizationConfigRule& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;} + inline OrganizationConfigRule& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An object that specifies metadata for your organization's Config Custom + * Policy rule. The metadata includes the runtime system in use, which accounts + * have debug logging enabled, and other custom rule metadata, such as resource + * type, resource ID of Amazon Web Services resource, and organization trigger + * types that initiate Config to evaluate Amazon Web Services resources against a + * rule.

+ */ + inline const OrganizationCustomPolicyRuleMetadataNoPolicy& GetOrganizationCustomPolicyRuleMetadata() const{ return m_organizationCustomPolicyRuleMetadata; } + inline bool OrganizationCustomPolicyRuleMetadataHasBeenSet() const { return m_organizationCustomPolicyRuleMetadataHasBeenSet; } + inline void SetOrganizationCustomPolicyRuleMetadata(const OrganizationCustomPolicyRuleMetadataNoPolicy& value) { m_organizationCustomPolicyRuleMetadataHasBeenSet = true; m_organizationCustomPolicyRuleMetadata = value; } + inline void SetOrganizationCustomPolicyRuleMetadata(OrganizationCustomPolicyRuleMetadataNoPolicy&& value) { m_organizationCustomPolicyRuleMetadataHasBeenSet = true; m_organizationCustomPolicyRuleMetadata = std::move(value); } + inline OrganizationConfigRule& WithOrganizationCustomPolicyRuleMetadata(const OrganizationCustomPolicyRuleMetadataNoPolicy& value) { SetOrganizationCustomPolicyRuleMetadata(value); return *this;} + inline OrganizationConfigRule& WithOrganizationCustomPolicyRuleMetadata(OrganizationCustomPolicyRuleMetadataNoPolicy&& value) { SetOrganizationCustomPolicyRuleMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_organizationConfigRuleName; + bool m_organizationConfigRuleNameHasBeenSet = false; + + Aws::String m_organizationConfigRuleArn; + bool m_organizationConfigRuleArnHasBeenSet = false; + + OrganizationManagedRuleMetadata m_organizationManagedRuleMetadata; + bool m_organizationManagedRuleMetadataHasBeenSet = false; + + OrganizationCustomRuleMetadata m_organizationCustomRuleMetadata; + bool m_organizationCustomRuleMetadataHasBeenSet = false; + + Aws::Vector m_excludedAccounts; + bool m_excludedAccountsHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateTime; + bool m_lastUpdateTimeHasBeenSet = false; + + OrganizationCustomPolicyRuleMetadataNoPolicy m_organizationCustomPolicyRuleMetadata; + bool m_organizationCustomPolicyRuleMetadataHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationConfigRuleStatus.h b/include/aws/config/model/OrganizationConfigRuleStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..52ffd553b8028a8ba853967e640efd30683b2fbe --- /dev/null +++ b/include/aws/config/model/OrganizationConfigRuleStatus.h @@ -0,0 +1,155 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns the status for an organization Config rule in an + * organization.

See Also:

AWS + * API Reference

+ */ + class OrganizationConfigRuleStatus + { + public: + AWS_CONFIGSERVICE_API OrganizationConfigRuleStatus(); + AWS_CONFIGSERVICE_API OrganizationConfigRuleStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationConfigRuleStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name that you assign to organization Config rule.

+ */ + inline const Aws::String& GetOrganizationConfigRuleName() const{ return m_organizationConfigRuleName; } + inline bool OrganizationConfigRuleNameHasBeenSet() const { return m_organizationConfigRuleNameHasBeenSet; } + inline void SetOrganizationConfigRuleName(const Aws::String& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = value; } + inline void SetOrganizationConfigRuleName(Aws::String&& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = std::move(value); } + inline void SetOrganizationConfigRuleName(const char* value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName.assign(value); } + inline OrganizationConfigRuleStatus& WithOrganizationConfigRuleName(const Aws::String& value) { SetOrganizationConfigRuleName(value); return *this;} + inline OrganizationConfigRuleStatus& WithOrganizationConfigRuleName(Aws::String&& value) { SetOrganizationConfigRuleName(std::move(value)); return *this;} + inline OrganizationConfigRuleStatus& WithOrganizationConfigRuleName(const char* value) { SetOrganizationConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates deployment status of an organization Config rule. When management + * account calls PutOrganizationConfigRule action for the first time, Config rule + * status is created in all the member accounts. When management account calls + * PutOrganizationConfigRule action for the second time, Config rule status is + * updated in all the member accounts. Additionally, Config rule status is updated + * when one or more member accounts join or leave an organization. Config rule + * status is deleted when the management account deletes OrganizationConfigRule in + * all the member accounts and disables service access for + * config-multiaccountsetup.amazonaws.com.

Config sets the + * state of the rule to:

  • CREATE_SUCCESSFUL when an + * organization Config rule has been successfully created in all the member + * accounts.

  • CREATE_IN_PROGRESS when an + * organization Config rule creation is in progress.

  • + * CREATE_FAILED when an organization Config rule creation failed in + * one or more member accounts within that organization.

  • + * DELETE_FAILED when an organization Config rule deletion failed in + * one or more member accounts within that organization.

  • + * DELETE_IN_PROGRESS when an organization Config rule deletion is in + * progress.

  • DELETE_SUCCESSFUL when an organization + * Config rule has been successfully deleted from all the member accounts.

    + *
  • UPDATE_SUCCESSFUL when an organization Config rule + * has been successfully updated in all the member accounts.

  • + * UPDATE_IN_PROGRESS when an organization Config rule update is in + * progress.

  • UPDATE_FAILED when an organization + * Config rule update failed in one or more member accounts within that + * organization.

+ */ + inline const OrganizationRuleStatus& GetOrganizationRuleStatus() const{ return m_organizationRuleStatus; } + inline bool OrganizationRuleStatusHasBeenSet() const { return m_organizationRuleStatusHasBeenSet; } + inline void SetOrganizationRuleStatus(const OrganizationRuleStatus& value) { m_organizationRuleStatusHasBeenSet = true; m_organizationRuleStatus = value; } + inline void SetOrganizationRuleStatus(OrganizationRuleStatus&& value) { m_organizationRuleStatusHasBeenSet = true; m_organizationRuleStatus = std::move(value); } + inline OrganizationConfigRuleStatus& WithOrganizationRuleStatus(const OrganizationRuleStatus& value) { SetOrganizationRuleStatus(value); return *this;} + inline OrganizationConfigRuleStatus& WithOrganizationRuleStatus(OrganizationRuleStatus&& value) { SetOrganizationRuleStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An error code that is returned when organization Config rule creation or + * deletion has failed.

+ */ + inline const Aws::String& GetErrorCode() const{ return m_errorCode; } + inline bool ErrorCodeHasBeenSet() const { return m_errorCodeHasBeenSet; } + inline void SetErrorCode(const Aws::String& value) { m_errorCodeHasBeenSet = true; m_errorCode = value; } + inline void SetErrorCode(Aws::String&& value) { m_errorCodeHasBeenSet = true; m_errorCode = std::move(value); } + inline void SetErrorCode(const char* value) { m_errorCodeHasBeenSet = true; m_errorCode.assign(value); } + inline OrganizationConfigRuleStatus& WithErrorCode(const Aws::String& value) { SetErrorCode(value); return *this;} + inline OrganizationConfigRuleStatus& WithErrorCode(Aws::String&& value) { SetErrorCode(std::move(value)); return *this;} + inline OrganizationConfigRuleStatus& WithErrorCode(const char* value) { SetErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

An error message indicating that organization Config rule creation or + * deletion failed due to an error.

+ */ + inline const Aws::String& GetErrorMessage() const{ return m_errorMessage; } + inline bool ErrorMessageHasBeenSet() const { return m_errorMessageHasBeenSet; } + inline void SetErrorMessage(const Aws::String& value) { m_errorMessageHasBeenSet = true; m_errorMessage = value; } + inline void SetErrorMessage(Aws::String&& value) { m_errorMessageHasBeenSet = true; m_errorMessage = std::move(value); } + inline void SetErrorMessage(const char* value) { m_errorMessageHasBeenSet = true; m_errorMessage.assign(value); } + inline OrganizationConfigRuleStatus& WithErrorMessage(const Aws::String& value) { SetErrorMessage(value); return *this;} + inline OrganizationConfigRuleStatus& WithErrorMessage(Aws::String&& value) { SetErrorMessage(std::move(value)); return *this;} + inline OrganizationConfigRuleStatus& WithErrorMessage(const char* value) { SetErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The timestamp of the last update.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; } + inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; } + inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; } + inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); } + inline OrganizationConfigRuleStatus& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;} + inline OrganizationConfigRuleStatus& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_organizationConfigRuleName; + bool m_organizationConfigRuleNameHasBeenSet = false; + + OrganizationRuleStatus m_organizationRuleStatus; + bool m_organizationRuleStatusHasBeenSet = false; + + Aws::String m_errorCode; + bool m_errorCodeHasBeenSet = false; + + Aws::String m_errorMessage; + bool m_errorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateTime; + bool m_lastUpdateTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationConfigRuleTriggerType.h b/include/aws/config/model/OrganizationConfigRuleTriggerType.h new file mode 100644 index 0000000000000000000000000000000000000000..3605f576f83f70c9208ecca8f93c3938cd66b1a3 --- /dev/null +++ b/include/aws/config/model/OrganizationConfigRuleTriggerType.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class OrganizationConfigRuleTriggerType + { + NOT_SET, + ConfigurationItemChangeNotification, + OversizedConfigurationItemChangeNotification, + ScheduledNotification + }; + +namespace OrganizationConfigRuleTriggerTypeMapper +{ +AWS_CONFIGSERVICE_API OrganizationConfigRuleTriggerType GetOrganizationConfigRuleTriggerTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForOrganizationConfigRuleTriggerType(OrganizationConfigRuleTriggerType value); +} // namespace OrganizationConfigRuleTriggerTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationConfigRuleTriggerTypeNoSN.h b/include/aws/config/model/OrganizationConfigRuleTriggerTypeNoSN.h new file mode 100644 index 0000000000000000000000000000000000000000..95cacd17a90cd1028d4a409609f26276593fdf6a --- /dev/null +++ b/include/aws/config/model/OrganizationConfigRuleTriggerTypeNoSN.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class OrganizationConfigRuleTriggerTypeNoSN + { + NOT_SET, + ConfigurationItemChangeNotification, + OversizedConfigurationItemChangeNotification + }; + +namespace OrganizationConfigRuleTriggerTypeNoSNMapper +{ +AWS_CONFIGSERVICE_API OrganizationConfigRuleTriggerTypeNoSN GetOrganizationConfigRuleTriggerTypeNoSNForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForOrganizationConfigRuleTriggerTypeNoSN(OrganizationConfigRuleTriggerTypeNoSN value); +} // namespace OrganizationConfigRuleTriggerTypeNoSNMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationConformancePack.h b/include/aws/config/model/OrganizationConformancePack.h new file mode 100644 index 0000000000000000000000000000000000000000..a59335bb9a3ae136ea8c7126962cfc5698eb3cb3 --- /dev/null +++ b/include/aws/config/model/OrganizationConformancePack.h @@ -0,0 +1,169 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An organization conformance pack that has information about conformance packs + * that Config creates in member accounts.

See Also:

AWS + * API Reference

+ */ + class OrganizationConformancePack + { + public: + AWS_CONFIGSERVICE_API OrganizationConformancePack(); + AWS_CONFIGSERVICE_API OrganizationConformancePack(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationConformancePack& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name you assign to an organization conformance pack.

+ */ + inline const Aws::String& GetOrganizationConformancePackName() const{ return m_organizationConformancePackName; } + inline bool OrganizationConformancePackNameHasBeenSet() const { return m_organizationConformancePackNameHasBeenSet; } + inline void SetOrganizationConformancePackName(const Aws::String& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = value; } + inline void SetOrganizationConformancePackName(Aws::String&& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = std::move(value); } + inline void SetOrganizationConformancePackName(const char* value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName.assign(value); } + inline OrganizationConformancePack& WithOrganizationConformancePackName(const Aws::String& value) { SetOrganizationConformancePackName(value); return *this;} + inline OrganizationConformancePack& WithOrganizationConformancePackName(Aws::String&& value) { SetOrganizationConformancePackName(std::move(value)); return *this;} + inline OrganizationConformancePack& WithOrganizationConformancePackName(const char* value) { SetOrganizationConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of organization conformance pack.

+ */ + inline const Aws::String& GetOrganizationConformancePackArn() const{ return m_organizationConformancePackArn; } + inline bool OrganizationConformancePackArnHasBeenSet() const { return m_organizationConformancePackArnHasBeenSet; } + inline void SetOrganizationConformancePackArn(const Aws::String& value) { m_organizationConformancePackArnHasBeenSet = true; m_organizationConformancePackArn = value; } + inline void SetOrganizationConformancePackArn(Aws::String&& value) { m_organizationConformancePackArnHasBeenSet = true; m_organizationConformancePackArn = std::move(value); } + inline void SetOrganizationConformancePackArn(const char* value) { m_organizationConformancePackArnHasBeenSet = true; m_organizationConformancePackArn.assign(value); } + inline OrganizationConformancePack& WithOrganizationConformancePackArn(const Aws::String& value) { SetOrganizationConformancePackArn(value); return *this;} + inline OrganizationConformancePack& WithOrganizationConformancePackArn(Aws::String&& value) { SetOrganizationConformancePackArn(std::move(value)); return *this;} + inline OrganizationConformancePack& WithOrganizationConformancePackArn(const char* value) { SetOrganizationConformancePackArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the Amazon S3 bucket where Config stores conformance pack + * templates.

This field is optional.

+ */ + inline const Aws::String& GetDeliveryS3Bucket() const{ return m_deliveryS3Bucket; } + inline bool DeliveryS3BucketHasBeenSet() const { return m_deliveryS3BucketHasBeenSet; } + inline void SetDeliveryS3Bucket(const Aws::String& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = value; } + inline void SetDeliveryS3Bucket(Aws::String&& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = std::move(value); } + inline void SetDeliveryS3Bucket(const char* value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket.assign(value); } + inline OrganizationConformancePack& WithDeliveryS3Bucket(const Aws::String& value) { SetDeliveryS3Bucket(value); return *this;} + inline OrganizationConformancePack& WithDeliveryS3Bucket(Aws::String&& value) { SetDeliveryS3Bucket(std::move(value)); return *this;} + inline OrganizationConformancePack& WithDeliveryS3Bucket(const char* value) { SetDeliveryS3Bucket(value); return *this;} + ///@} + + ///@{ + /** + *

Any folder structure you want to add to an Amazon S3 bucket.

+ *

This field is optional.

+ */ + inline const Aws::String& GetDeliveryS3KeyPrefix() const{ return m_deliveryS3KeyPrefix; } + inline bool DeliveryS3KeyPrefixHasBeenSet() const { return m_deliveryS3KeyPrefixHasBeenSet; } + inline void SetDeliveryS3KeyPrefix(const Aws::String& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = value; } + inline void SetDeliveryS3KeyPrefix(Aws::String&& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = std::move(value); } + inline void SetDeliveryS3KeyPrefix(const char* value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix.assign(value); } + inline OrganizationConformancePack& WithDeliveryS3KeyPrefix(const Aws::String& value) { SetDeliveryS3KeyPrefix(value); return *this;} + inline OrganizationConformancePack& WithDeliveryS3KeyPrefix(Aws::String&& value) { SetDeliveryS3KeyPrefix(std::move(value)); return *this;} + inline OrganizationConformancePack& WithDeliveryS3KeyPrefix(const char* value) { SetDeliveryS3KeyPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

A list of ConformancePackInputParameter objects.

+ */ + inline const Aws::Vector& GetConformancePackInputParameters() const{ return m_conformancePackInputParameters; } + inline bool ConformancePackInputParametersHasBeenSet() const { return m_conformancePackInputParametersHasBeenSet; } + inline void SetConformancePackInputParameters(const Aws::Vector& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = value; } + inline void SetConformancePackInputParameters(Aws::Vector&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = std::move(value); } + inline OrganizationConformancePack& WithConformancePackInputParameters(const Aws::Vector& value) { SetConformancePackInputParameters(value); return *this;} + inline OrganizationConformancePack& WithConformancePackInputParameters(Aws::Vector&& value) { SetConformancePackInputParameters(std::move(value)); return *this;} + inline OrganizationConformancePack& AddConformancePackInputParameters(const ConformancePackInputParameter& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(value); return *this; } + inline OrganizationConformancePack& AddConformancePackInputParameters(ConformancePackInputParameter&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A comma-separated list of accounts excluded from organization conformance + * pack.

+ */ + inline const Aws::Vector& GetExcludedAccounts() const{ return m_excludedAccounts; } + inline bool ExcludedAccountsHasBeenSet() const { return m_excludedAccountsHasBeenSet; } + inline void SetExcludedAccounts(const Aws::Vector& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = value; } + inline void SetExcludedAccounts(Aws::Vector&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = std::move(value); } + inline OrganizationConformancePack& WithExcludedAccounts(const Aws::Vector& value) { SetExcludedAccounts(value); return *this;} + inline OrganizationConformancePack& WithExcludedAccounts(Aws::Vector&& value) { SetExcludedAccounts(std::move(value)); return *this;} + inline OrganizationConformancePack& AddExcludedAccounts(const Aws::String& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + inline OrganizationConformancePack& AddExcludedAccounts(Aws::String&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(std::move(value)); return *this; } + inline OrganizationConformancePack& AddExcludedAccounts(const char* value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Last time when organization conformation pack was updated.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; } + inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; } + inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; } + inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); } + inline OrganizationConformancePack& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;} + inline OrganizationConformancePack& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_organizationConformancePackName; + bool m_organizationConformancePackNameHasBeenSet = false; + + Aws::String m_organizationConformancePackArn; + bool m_organizationConformancePackArnHasBeenSet = false; + + Aws::String m_deliveryS3Bucket; + bool m_deliveryS3BucketHasBeenSet = false; + + Aws::String m_deliveryS3KeyPrefix; + bool m_deliveryS3KeyPrefixHasBeenSet = false; + + Aws::Vector m_conformancePackInputParameters; + bool m_conformancePackInputParametersHasBeenSet = false; + + Aws::Vector m_excludedAccounts; + bool m_excludedAccountsHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateTime; + bool m_lastUpdateTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationConformancePackDetailedStatus.h b/include/aws/config/model/OrganizationConformancePackDetailedStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..c277ef0c6c566d43623e3da1e6fc121598f10cb9 --- /dev/null +++ b/include/aws/config/model/OrganizationConformancePackDetailedStatus.h @@ -0,0 +1,171 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Organization conformance pack creation or deletion status in each member + * account. This includes the name of the conformance pack, the status, error code + * and error message when the conformance pack creation or deletion failed. + *

See Also:

AWS + * API Reference

+ */ + class OrganizationConformancePackDetailedStatus + { + public: + AWS_CONFIGSERVICE_API OrganizationConformancePackDetailedStatus(); + AWS_CONFIGSERVICE_API OrganizationConformancePackDetailedStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationConformancePackDetailedStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of a member account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline OrganizationConformancePackDetailedStatus& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline OrganizationConformancePackDetailedStatus& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline OrganizationConformancePackDetailedStatus& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The name of conformance pack deployed in the member account.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline OrganizationConformancePackDetailedStatus& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline OrganizationConformancePackDetailedStatus& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline OrganizationConformancePackDetailedStatus& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates deployment status for conformance pack in a member account. When + * management account calls PutOrganizationConformancePack action for + * the first time, conformance pack status is created in the member account. When + * management account calls PutOrganizationConformancePack action for + * the second time, conformance pack status is updated in the member account. + * Conformance pack status is deleted when the management account deletes + * OrganizationConformancePack and disables service access for + * config-multiaccountsetup.amazonaws.com.

Config sets the + * state of the conformance pack to:

  • + * CREATE_SUCCESSFUL when conformance pack has been created in the + * member account.

  • CREATE_IN_PROGRESS when + * conformance pack is being created in the member account.

  • + * CREATE_FAILED when conformance pack creation has failed in the + * member account.

  • DELETE_FAILED when conformance + * pack deletion has failed in the member account.

  • + * DELETE_IN_PROGRESS when conformance pack is being deleted in the + * member account.

  • DELETE_SUCCESSFUL when + * conformance pack has been deleted in the member account.

  • + * UPDATE_SUCCESSFUL when conformance pack has been updated in the + * member account.

  • UPDATE_IN_PROGRESS when + * conformance pack is being updated in the member account.

  • + * UPDATE_FAILED when conformance pack deletion has failed in the + * member account.

+ */ + inline const OrganizationResourceDetailedStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const OrganizationResourceDetailedStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(OrganizationResourceDetailedStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline OrganizationConformancePackDetailedStatus& WithStatus(const OrganizationResourceDetailedStatus& value) { SetStatus(value); return *this;} + inline OrganizationConformancePackDetailedStatus& WithStatus(OrganizationResourceDetailedStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An error code that is returned when conformance pack creation or deletion + * failed in the member account.

+ */ + inline const Aws::String& GetErrorCode() const{ return m_errorCode; } + inline bool ErrorCodeHasBeenSet() const { return m_errorCodeHasBeenSet; } + inline void SetErrorCode(const Aws::String& value) { m_errorCodeHasBeenSet = true; m_errorCode = value; } + inline void SetErrorCode(Aws::String&& value) { m_errorCodeHasBeenSet = true; m_errorCode = std::move(value); } + inline void SetErrorCode(const char* value) { m_errorCodeHasBeenSet = true; m_errorCode.assign(value); } + inline OrganizationConformancePackDetailedStatus& WithErrorCode(const Aws::String& value) { SetErrorCode(value); return *this;} + inline OrganizationConformancePackDetailedStatus& WithErrorCode(Aws::String&& value) { SetErrorCode(std::move(value)); return *this;} + inline OrganizationConformancePackDetailedStatus& WithErrorCode(const char* value) { SetErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

An error message indicating that conformance pack account creation or + * deletion has failed due to an error in the member account.

+ */ + inline const Aws::String& GetErrorMessage() const{ return m_errorMessage; } + inline bool ErrorMessageHasBeenSet() const { return m_errorMessageHasBeenSet; } + inline void SetErrorMessage(const Aws::String& value) { m_errorMessageHasBeenSet = true; m_errorMessage = value; } + inline void SetErrorMessage(Aws::String&& value) { m_errorMessageHasBeenSet = true; m_errorMessage = std::move(value); } + inline void SetErrorMessage(const char* value) { m_errorMessageHasBeenSet = true; m_errorMessage.assign(value); } + inline OrganizationConformancePackDetailedStatus& WithErrorMessage(const Aws::String& value) { SetErrorMessage(value); return *this;} + inline OrganizationConformancePackDetailedStatus& WithErrorMessage(Aws::String&& value) { SetErrorMessage(std::move(value)); return *this;} + inline OrganizationConformancePackDetailedStatus& WithErrorMessage(const char* value) { SetErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The timestamp of the last status update.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; } + inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; } + inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; } + inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); } + inline OrganizationConformancePackDetailedStatus& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;} + inline OrganizationConformancePackDetailedStatus& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + OrganizationResourceDetailedStatus m_status; + bool m_statusHasBeenSet = false; + + Aws::String m_errorCode; + bool m_errorCodeHasBeenSet = false; + + Aws::String m_errorMessage; + bool m_errorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateTime; + bool m_lastUpdateTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationConformancePackStatus.h b/include/aws/config/model/OrganizationConformancePackStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..acb98f8a30cdbb39e6e98e2543f4d5bfcf11b85c --- /dev/null +++ b/include/aws/config/model/OrganizationConformancePackStatus.h @@ -0,0 +1,156 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns the status for an organization conformance pack in an + * organization.

See Also:

AWS + * API Reference

+ */ + class OrganizationConformancePackStatus + { + public: + AWS_CONFIGSERVICE_API OrganizationConformancePackStatus(); + AWS_CONFIGSERVICE_API OrganizationConformancePackStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationConformancePackStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name that you assign to organization conformance pack.

+ */ + inline const Aws::String& GetOrganizationConformancePackName() const{ return m_organizationConformancePackName; } + inline bool OrganizationConformancePackNameHasBeenSet() const { return m_organizationConformancePackNameHasBeenSet; } + inline void SetOrganizationConformancePackName(const Aws::String& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = value; } + inline void SetOrganizationConformancePackName(Aws::String&& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = std::move(value); } + inline void SetOrganizationConformancePackName(const char* value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName.assign(value); } + inline OrganizationConformancePackStatus& WithOrganizationConformancePackName(const Aws::String& value) { SetOrganizationConformancePackName(value); return *this;} + inline OrganizationConformancePackStatus& WithOrganizationConformancePackName(Aws::String&& value) { SetOrganizationConformancePackName(std::move(value)); return *this;} + inline OrganizationConformancePackStatus& WithOrganizationConformancePackName(const char* value) { SetOrganizationConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates deployment status of an organization conformance pack. When + * management account calls PutOrganizationConformancePack for the first time, + * conformance pack status is created in all the member accounts. When management + * account calls PutOrganizationConformancePack for the second time, conformance + * pack status is updated in all the member accounts. Additionally, conformance + * pack status is updated when one or more member accounts join or leave an + * organization. Conformance pack status is deleted when the management account + * deletes OrganizationConformancePack in all the member accounts and disables + * service access for config-multiaccountsetup.amazonaws.com.

+ *

Config sets the state of the conformance pack to:

  • + * CREATE_SUCCESSFUL when an organization conformance pack has been + * successfully created in all the member accounts.

  • + * CREATE_IN_PROGRESS when an organization conformance pack creation + * is in progress.

  • CREATE_FAILED when an + * organization conformance pack creation failed in one or more member accounts + * within that organization.

  • DELETE_FAILED when an + * organization conformance pack deletion failed in one or more member accounts + * within that organization.

  • DELETE_IN_PROGRESS + * when an organization conformance pack deletion is in progress.

  • + *

    DELETE_SUCCESSFUL when an organization conformance pack has + * been successfully deleted from all the member accounts.

  • + * UPDATE_SUCCESSFUL when an organization conformance pack has been + * successfully updated in all the member accounts.

  • + * UPDATE_IN_PROGRESS when an organization conformance pack update is + * in progress.

  • UPDATE_FAILED when an organization + * conformance pack update failed in one or more member accounts within that + * organization.

+ */ + inline const OrganizationResourceStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const OrganizationResourceStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(OrganizationResourceStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline OrganizationConformancePackStatus& WithStatus(const OrganizationResourceStatus& value) { SetStatus(value); return *this;} + inline OrganizationConformancePackStatus& WithStatus(OrganizationResourceStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An error code that is returned when organization conformance pack creation or + * deletion has failed in a member account.

+ */ + inline const Aws::String& GetErrorCode() const{ return m_errorCode; } + inline bool ErrorCodeHasBeenSet() const { return m_errorCodeHasBeenSet; } + inline void SetErrorCode(const Aws::String& value) { m_errorCodeHasBeenSet = true; m_errorCode = value; } + inline void SetErrorCode(Aws::String&& value) { m_errorCodeHasBeenSet = true; m_errorCode = std::move(value); } + inline void SetErrorCode(const char* value) { m_errorCodeHasBeenSet = true; m_errorCode.assign(value); } + inline OrganizationConformancePackStatus& WithErrorCode(const Aws::String& value) { SetErrorCode(value); return *this;} + inline OrganizationConformancePackStatus& WithErrorCode(Aws::String&& value) { SetErrorCode(std::move(value)); return *this;} + inline OrganizationConformancePackStatus& WithErrorCode(const char* value) { SetErrorCode(value); return *this;} + ///@} + + ///@{ + /** + *

An error message indicating that organization conformance pack creation or + * deletion failed due to an error.

+ */ + inline const Aws::String& GetErrorMessage() const{ return m_errorMessage; } + inline bool ErrorMessageHasBeenSet() const { return m_errorMessageHasBeenSet; } + inline void SetErrorMessage(const Aws::String& value) { m_errorMessageHasBeenSet = true; m_errorMessage = value; } + inline void SetErrorMessage(Aws::String&& value) { m_errorMessageHasBeenSet = true; m_errorMessage = std::move(value); } + inline void SetErrorMessage(const char* value) { m_errorMessageHasBeenSet = true; m_errorMessage.assign(value); } + inline OrganizationConformancePackStatus& WithErrorMessage(const Aws::String& value) { SetErrorMessage(value); return *this;} + inline OrganizationConformancePackStatus& WithErrorMessage(Aws::String&& value) { SetErrorMessage(std::move(value)); return *this;} + inline OrganizationConformancePackStatus& WithErrorMessage(const char* value) { SetErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The timestamp of the last update.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; } + inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; } + inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; } + inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); } + inline OrganizationConformancePackStatus& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;} + inline OrganizationConformancePackStatus& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_organizationConformancePackName; + bool m_organizationConformancePackNameHasBeenSet = false; + + OrganizationResourceStatus m_status; + bool m_statusHasBeenSet = false; + + Aws::String m_errorCode; + bool m_errorCodeHasBeenSet = false; + + Aws::String m_errorMessage; + bool m_errorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdateTime; + bool m_lastUpdateTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationCustomPolicyRuleMetadata.h b/include/aws/config/model/OrganizationCustomPolicyRuleMetadata.h new file mode 100644 index 0000000000000000000000000000000000000000..0b2774e4fe549ea15070b0a670379592677f38f0 --- /dev/null +++ b/include/aws/config/model/OrganizationCustomPolicyRuleMetadata.h @@ -0,0 +1,260 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that specifies metadata for your organization's Config Custom + * Policy rule. The metadata includes the runtime system in use, which accounts + * have debug logging enabled, and other custom rule metadata, such as resource + * type, resource ID of Amazon Web Services resource, and organization trigger + * types that initiate Config to evaluate Amazon Web Services resources against a + * rule.

See Also:

AWS + * API Reference

+ */ + class OrganizationCustomPolicyRuleMetadata + { + public: + AWS_CONFIGSERVICE_API OrganizationCustomPolicyRuleMetadata(); + AWS_CONFIGSERVICE_API OrganizationCustomPolicyRuleMetadata(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationCustomPolicyRuleMetadata& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The description that you provide for your organization Config Custom Policy + * rule.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline OrganizationCustomPolicyRuleMetadata& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

The type of notification that initiates Config to run an evaluation for a + * rule. For Config Custom Policy rules, Config supports change-initiated + * notification types:

  • + * ConfigurationItemChangeNotification - Initiates an evaluation when + * Config delivers a configuration item as a result of a resource change.

  • + *
  • OversizedConfigurationItemChangeNotification - Initiates + * an evaluation when Config delivers an oversized configuration item. Config may + * generate this notification type when a resource changes and the notification + * exceeds the maximum size allowed by Amazon SNS.

+ */ + inline const Aws::Vector& GetOrganizationConfigRuleTriggerTypes() const{ return m_organizationConfigRuleTriggerTypes; } + inline bool OrganizationConfigRuleTriggerTypesHasBeenSet() const { return m_organizationConfigRuleTriggerTypesHasBeenSet; } + inline void SetOrganizationConfigRuleTriggerTypes(const Aws::Vector& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes = value; } + inline void SetOrganizationConfigRuleTriggerTypes(Aws::Vector&& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes = std::move(value); } + inline OrganizationCustomPolicyRuleMetadata& WithOrganizationConfigRuleTriggerTypes(const Aws::Vector& value) { SetOrganizationConfigRuleTriggerTypes(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithOrganizationConfigRuleTriggerTypes(Aws::Vector&& value) { SetOrganizationConfigRuleTriggerTypes(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& AddOrganizationConfigRuleTriggerTypes(const OrganizationConfigRuleTriggerTypeNoSN& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes.push_back(value); return *this; } + inline OrganizationCustomPolicyRuleMetadata& AddOrganizationConfigRuleTriggerTypes(OrganizationConfigRuleTriggerTypeNoSN&& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A string, in JSON format, that is passed to your organization Config Custom + * Policy rule.

+ */ + inline const Aws::String& GetInputParameters() const{ return m_inputParameters; } + inline bool InputParametersHasBeenSet() const { return m_inputParametersHasBeenSet; } + inline void SetInputParameters(const Aws::String& value) { m_inputParametersHasBeenSet = true; m_inputParameters = value; } + inline void SetInputParameters(Aws::String&& value) { m_inputParametersHasBeenSet = true; m_inputParameters = std::move(value); } + inline void SetInputParameters(const char* value) { m_inputParametersHasBeenSet = true; m_inputParameters.assign(value); } + inline OrganizationCustomPolicyRuleMetadata& WithInputParameters(const Aws::String& value) { SetInputParameters(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithInputParameters(Aws::String&& value) { SetInputParameters(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithInputParameters(const char* value) { SetInputParameters(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum frequency with which Config runs evaluations for a rule. Your + * Config Custom Policy rule is triggered when Config delivers the configuration + * snapshot. For more information, see ConfigSnapshotDeliveryProperties.

+ */ + inline const MaximumExecutionFrequency& GetMaximumExecutionFrequency() const{ return m_maximumExecutionFrequency; } + inline bool MaximumExecutionFrequencyHasBeenSet() const { return m_maximumExecutionFrequencyHasBeenSet; } + inline void SetMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = value; } + inline void SetMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = std::move(value); } + inline OrganizationCustomPolicyRuleMetadata& WithMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { SetMaximumExecutionFrequency(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { SetMaximumExecutionFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The type of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::Vector& GetResourceTypesScope() const{ return m_resourceTypesScope; } + inline bool ResourceTypesScopeHasBeenSet() const { return m_resourceTypesScopeHasBeenSet; } + inline void SetResourceTypesScope(const Aws::Vector& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = value; } + inline void SetResourceTypesScope(Aws::Vector&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = std::move(value); } + inline OrganizationCustomPolicyRuleMetadata& WithResourceTypesScope(const Aws::Vector& value) { SetResourceTypesScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithResourceTypesScope(Aws::Vector&& value) { SetResourceTypesScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& AddResourceTypesScope(const Aws::String& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + inline OrganizationCustomPolicyRuleMetadata& AddResourceTypesScope(Aws::String&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(std::move(value)); return *this; } + inline OrganizationCustomPolicyRuleMetadata& AddResourceTypesScope(const char* value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetResourceIdScope() const{ return m_resourceIdScope; } + inline bool ResourceIdScopeHasBeenSet() const { return m_resourceIdScopeHasBeenSet; } + inline void SetResourceIdScope(const Aws::String& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = value; } + inline void SetResourceIdScope(Aws::String&& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = std::move(value); } + inline void SetResourceIdScope(const char* value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope.assign(value); } + inline OrganizationCustomPolicyRuleMetadata& WithResourceIdScope(const Aws::String& value) { SetResourceIdScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithResourceIdScope(Aws::String&& value) { SetResourceIdScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithResourceIdScope(const char* value) { SetResourceIdScope(value); return *this;} + ///@} + + ///@{ + /** + *

One part of a key-value pair that make up a tag. A key is a general label + * that acts like a category for more specific tag values.

+ */ + inline const Aws::String& GetTagKeyScope() const{ return m_tagKeyScope; } + inline bool TagKeyScopeHasBeenSet() const { return m_tagKeyScopeHasBeenSet; } + inline void SetTagKeyScope(const Aws::String& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = value; } + inline void SetTagKeyScope(Aws::String&& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = std::move(value); } + inline void SetTagKeyScope(const char* value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope.assign(value); } + inline OrganizationCustomPolicyRuleMetadata& WithTagKeyScope(const Aws::String& value) { SetTagKeyScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithTagKeyScope(Aws::String&& value) { SetTagKeyScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithTagKeyScope(const char* value) { SetTagKeyScope(value); return *this;} + ///@} + + ///@{ + /** + *

The optional part of a key-value pair that make up a tag. A value acts as a + * descriptor within a tag category (key).

+ */ + inline const Aws::String& GetTagValueScope() const{ return m_tagValueScope; } + inline bool TagValueScopeHasBeenSet() const { return m_tagValueScopeHasBeenSet; } + inline void SetTagValueScope(const Aws::String& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = value; } + inline void SetTagValueScope(Aws::String&& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = std::move(value); } + inline void SetTagValueScope(const char* value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope.assign(value); } + inline OrganizationCustomPolicyRuleMetadata& WithTagValueScope(const Aws::String& value) { SetTagValueScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithTagValueScope(Aws::String&& value) { SetTagValueScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithTagValueScope(const char* value) { SetTagValueScope(value); return *this;} + ///@} + + ///@{ + /** + *

The runtime system for your organization Config Custom Policy rules. Guard is + * a policy-as-code language that allows you to write policies that are enforced by + * Config Custom Policy rules. For more information about Guard, see the Guard GitHub + * Repository.

+ */ + inline const Aws::String& GetPolicyRuntime() const{ return m_policyRuntime; } + inline bool PolicyRuntimeHasBeenSet() const { return m_policyRuntimeHasBeenSet; } + inline void SetPolicyRuntime(const Aws::String& value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime = value; } + inline void SetPolicyRuntime(Aws::String&& value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime = std::move(value); } + inline void SetPolicyRuntime(const char* value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime.assign(value); } + inline OrganizationCustomPolicyRuleMetadata& WithPolicyRuntime(const Aws::String& value) { SetPolicyRuntime(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithPolicyRuntime(Aws::String&& value) { SetPolicyRuntime(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithPolicyRuntime(const char* value) { SetPolicyRuntime(value); return *this;} + ///@} + + ///@{ + /** + *

The policy definition containing the logic for your organization Config + * Custom Policy rule.

+ */ + inline const Aws::String& GetPolicyText() const{ return m_policyText; } + inline bool PolicyTextHasBeenSet() const { return m_policyTextHasBeenSet; } + inline void SetPolicyText(const Aws::String& value) { m_policyTextHasBeenSet = true; m_policyText = value; } + inline void SetPolicyText(Aws::String&& value) { m_policyTextHasBeenSet = true; m_policyText = std::move(value); } + inline void SetPolicyText(const char* value) { m_policyTextHasBeenSet = true; m_policyText.assign(value); } + inline OrganizationCustomPolicyRuleMetadata& WithPolicyText(const Aws::String& value) { SetPolicyText(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithPolicyText(Aws::String&& value) { SetPolicyText(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithPolicyText(const char* value) { SetPolicyText(value); return *this;} + ///@} + + ///@{ + /** + *

A list of accounts that you can enable debug logging for your organization + * Config Custom Policy rule. List is null when debug logging is enabled for all + * accounts.

+ */ + inline const Aws::Vector& GetDebugLogDeliveryAccounts() const{ return m_debugLogDeliveryAccounts; } + inline bool DebugLogDeliveryAccountsHasBeenSet() const { return m_debugLogDeliveryAccountsHasBeenSet; } + inline void SetDebugLogDeliveryAccounts(const Aws::Vector& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts = value; } + inline void SetDebugLogDeliveryAccounts(Aws::Vector&& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts = std::move(value); } + inline OrganizationCustomPolicyRuleMetadata& WithDebugLogDeliveryAccounts(const Aws::Vector& value) { SetDebugLogDeliveryAccounts(value); return *this;} + inline OrganizationCustomPolicyRuleMetadata& WithDebugLogDeliveryAccounts(Aws::Vector&& value) { SetDebugLogDeliveryAccounts(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadata& AddDebugLogDeliveryAccounts(const Aws::String& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts.push_back(value); return *this; } + inline OrganizationCustomPolicyRuleMetadata& AddDebugLogDeliveryAccounts(Aws::String&& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts.push_back(std::move(value)); return *this; } + inline OrganizationCustomPolicyRuleMetadata& AddDebugLogDeliveryAccounts(const char* value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts.push_back(value); return *this; } + ///@} + private: + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + Aws::Vector m_organizationConfigRuleTriggerTypes; + bool m_organizationConfigRuleTriggerTypesHasBeenSet = false; + + Aws::String m_inputParameters; + bool m_inputParametersHasBeenSet = false; + + MaximumExecutionFrequency m_maximumExecutionFrequency; + bool m_maximumExecutionFrequencyHasBeenSet = false; + + Aws::Vector m_resourceTypesScope; + bool m_resourceTypesScopeHasBeenSet = false; + + Aws::String m_resourceIdScope; + bool m_resourceIdScopeHasBeenSet = false; + + Aws::String m_tagKeyScope; + bool m_tagKeyScopeHasBeenSet = false; + + Aws::String m_tagValueScope; + bool m_tagValueScopeHasBeenSet = false; + + Aws::String m_policyRuntime; + bool m_policyRuntimeHasBeenSet = false; + + Aws::String m_policyText; + bool m_policyTextHasBeenSet = false; + + Aws::Vector m_debugLogDeliveryAccounts; + bool m_debugLogDeliveryAccountsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationCustomPolicyRuleMetadataNoPolicy.h b/include/aws/config/model/OrganizationCustomPolicyRuleMetadataNoPolicy.h new file mode 100644 index 0000000000000000000000000000000000000000..412501d7875607c6bbe03cdb7e9b20cdc6e96fd6 --- /dev/null +++ b/include/aws/config/model/OrganizationCustomPolicyRuleMetadataNoPolicy.h @@ -0,0 +1,241 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

metadata for your organization Config Custom Policy rule including the + * runtime system in use, which accounts have debug logging enabled, and other + * custom rule metadata such as resource type, resource ID of Amazon Web Services + * resource, and organization trigger types that trigger Config to evaluate Amazon + * Web Services resources against a rule.

See Also:

AWS + * API Reference

+ */ + class OrganizationCustomPolicyRuleMetadataNoPolicy + { + public: + AWS_CONFIGSERVICE_API OrganizationCustomPolicyRuleMetadataNoPolicy(); + AWS_CONFIGSERVICE_API OrganizationCustomPolicyRuleMetadataNoPolicy(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationCustomPolicyRuleMetadataNoPolicy& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The description that you provide for your organization Config Custom Policy + * rule.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

The type of notification that triggers Config to run an evaluation for a + * rule. For Config Custom Policy rules, Config supports change triggered + * notification types:

  • + * ConfigurationItemChangeNotification - Triggers an evaluation when + * Config delivers a configuration item as a result of a resource change.

  • + *
  • OversizedConfigurationItemChangeNotification - Triggers an + * evaluation when Config delivers an oversized configuration item. Config may + * generate this notification type when a resource changes and the notification + * exceeds the maximum size allowed by Amazon SNS.

+ */ + inline const Aws::Vector& GetOrganizationConfigRuleTriggerTypes() const{ return m_organizationConfigRuleTriggerTypes; } + inline bool OrganizationConfigRuleTriggerTypesHasBeenSet() const { return m_organizationConfigRuleTriggerTypesHasBeenSet; } + inline void SetOrganizationConfigRuleTriggerTypes(const Aws::Vector& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes = value; } + inline void SetOrganizationConfigRuleTriggerTypes(Aws::Vector&& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes = std::move(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithOrganizationConfigRuleTriggerTypes(const Aws::Vector& value) { SetOrganizationConfigRuleTriggerTypes(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithOrganizationConfigRuleTriggerTypes(Aws::Vector&& value) { SetOrganizationConfigRuleTriggerTypes(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddOrganizationConfigRuleTriggerTypes(const OrganizationConfigRuleTriggerTypeNoSN& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes.push_back(value); return *this; } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddOrganizationConfigRuleTriggerTypes(OrganizationConfigRuleTriggerTypeNoSN&& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A string, in JSON format, that is passed to your organization Config Custom + * Policy rule.

+ */ + inline const Aws::String& GetInputParameters() const{ return m_inputParameters; } + inline bool InputParametersHasBeenSet() const { return m_inputParametersHasBeenSet; } + inline void SetInputParameters(const Aws::String& value) { m_inputParametersHasBeenSet = true; m_inputParameters = value; } + inline void SetInputParameters(Aws::String&& value) { m_inputParametersHasBeenSet = true; m_inputParameters = std::move(value); } + inline void SetInputParameters(const char* value) { m_inputParametersHasBeenSet = true; m_inputParameters.assign(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithInputParameters(const Aws::String& value) { SetInputParameters(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithInputParameters(Aws::String&& value) { SetInputParameters(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithInputParameters(const char* value) { SetInputParameters(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum frequency with which Config runs evaluations for a rule. Your + * Config Custom Policy rule is triggered when Config delivers the configuration + * snapshot. For more information, see ConfigSnapshotDeliveryProperties.

+ */ + inline const MaximumExecutionFrequency& GetMaximumExecutionFrequency() const{ return m_maximumExecutionFrequency; } + inline bool MaximumExecutionFrequencyHasBeenSet() const { return m_maximumExecutionFrequencyHasBeenSet; } + inline void SetMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = value; } + inline void SetMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = std::move(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { SetMaximumExecutionFrequency(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { SetMaximumExecutionFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The type of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::Vector& GetResourceTypesScope() const{ return m_resourceTypesScope; } + inline bool ResourceTypesScopeHasBeenSet() const { return m_resourceTypesScopeHasBeenSet; } + inline void SetResourceTypesScope(const Aws::Vector& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = value; } + inline void SetResourceTypesScope(Aws::Vector&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = std::move(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithResourceTypesScope(const Aws::Vector& value) { SetResourceTypesScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithResourceTypesScope(Aws::Vector&& value) { SetResourceTypesScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddResourceTypesScope(const Aws::String& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddResourceTypesScope(Aws::String&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(std::move(value)); return *this; } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddResourceTypesScope(const char* value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetResourceIdScope() const{ return m_resourceIdScope; } + inline bool ResourceIdScopeHasBeenSet() const { return m_resourceIdScopeHasBeenSet; } + inline void SetResourceIdScope(const Aws::String& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = value; } + inline void SetResourceIdScope(Aws::String&& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = std::move(value); } + inline void SetResourceIdScope(const char* value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope.assign(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithResourceIdScope(const Aws::String& value) { SetResourceIdScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithResourceIdScope(Aws::String&& value) { SetResourceIdScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithResourceIdScope(const char* value) { SetResourceIdScope(value); return *this;} + ///@} + + ///@{ + /** + *

One part of a key-value pair that make up a tag. A key is a general label + * that acts like a category for more specific tag values.

+ */ + inline const Aws::String& GetTagKeyScope() const{ return m_tagKeyScope; } + inline bool TagKeyScopeHasBeenSet() const { return m_tagKeyScopeHasBeenSet; } + inline void SetTagKeyScope(const Aws::String& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = value; } + inline void SetTagKeyScope(Aws::String&& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = std::move(value); } + inline void SetTagKeyScope(const char* value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope.assign(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithTagKeyScope(const Aws::String& value) { SetTagKeyScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithTagKeyScope(Aws::String&& value) { SetTagKeyScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithTagKeyScope(const char* value) { SetTagKeyScope(value); return *this;} + ///@} + + ///@{ + /** + *

The optional part of a key-value pair that make up a tag. A value acts as a + * descriptor within a tag category (key).

+ */ + inline const Aws::String& GetTagValueScope() const{ return m_tagValueScope; } + inline bool TagValueScopeHasBeenSet() const { return m_tagValueScopeHasBeenSet; } + inline void SetTagValueScope(const Aws::String& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = value; } + inline void SetTagValueScope(Aws::String&& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = std::move(value); } + inline void SetTagValueScope(const char* value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope.assign(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithTagValueScope(const Aws::String& value) { SetTagValueScope(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithTagValueScope(Aws::String&& value) { SetTagValueScope(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithTagValueScope(const char* value) { SetTagValueScope(value); return *this;} + ///@} + + ///@{ + /** + *

The runtime system for your organization Config Custom Policy rules. Guard is + * a policy-as-code language that allows you to write policies that are enforced by + * Config Custom Policy rules. For more information about Guard, see the Guard GitHub + * Repository.

+ */ + inline const Aws::String& GetPolicyRuntime() const{ return m_policyRuntime; } + inline bool PolicyRuntimeHasBeenSet() const { return m_policyRuntimeHasBeenSet; } + inline void SetPolicyRuntime(const Aws::String& value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime = value; } + inline void SetPolicyRuntime(Aws::String&& value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime = std::move(value); } + inline void SetPolicyRuntime(const char* value) { m_policyRuntimeHasBeenSet = true; m_policyRuntime.assign(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithPolicyRuntime(const Aws::String& value) { SetPolicyRuntime(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithPolicyRuntime(Aws::String&& value) { SetPolicyRuntime(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithPolicyRuntime(const char* value) { SetPolicyRuntime(value); return *this;} + ///@} + + ///@{ + /** + *

A list of accounts that you can enable debug logging for your organization + * Config Custom Policy rule. List is null when debug logging is enabled for all + * accounts.

+ */ + inline const Aws::Vector& GetDebugLogDeliveryAccounts() const{ return m_debugLogDeliveryAccounts; } + inline bool DebugLogDeliveryAccountsHasBeenSet() const { return m_debugLogDeliveryAccountsHasBeenSet; } + inline void SetDebugLogDeliveryAccounts(const Aws::Vector& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts = value; } + inline void SetDebugLogDeliveryAccounts(Aws::Vector&& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts = std::move(value); } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithDebugLogDeliveryAccounts(const Aws::Vector& value) { SetDebugLogDeliveryAccounts(value); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& WithDebugLogDeliveryAccounts(Aws::Vector&& value) { SetDebugLogDeliveryAccounts(std::move(value)); return *this;} + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddDebugLogDeliveryAccounts(const Aws::String& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts.push_back(value); return *this; } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddDebugLogDeliveryAccounts(Aws::String&& value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts.push_back(std::move(value)); return *this; } + inline OrganizationCustomPolicyRuleMetadataNoPolicy& AddDebugLogDeliveryAccounts(const char* value) { m_debugLogDeliveryAccountsHasBeenSet = true; m_debugLogDeliveryAccounts.push_back(value); return *this; } + ///@} + private: + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + Aws::Vector m_organizationConfigRuleTriggerTypes; + bool m_organizationConfigRuleTriggerTypesHasBeenSet = false; + + Aws::String m_inputParameters; + bool m_inputParametersHasBeenSet = false; + + MaximumExecutionFrequency m_maximumExecutionFrequency; + bool m_maximumExecutionFrequencyHasBeenSet = false; + + Aws::Vector m_resourceTypesScope; + bool m_resourceTypesScopeHasBeenSet = false; + + Aws::String m_resourceIdScope; + bool m_resourceIdScopeHasBeenSet = false; + + Aws::String m_tagKeyScope; + bool m_tagKeyScopeHasBeenSet = false; + + Aws::String m_tagValueScope; + bool m_tagValueScopeHasBeenSet = false; + + Aws::String m_policyRuntime; + bool m_policyRuntimeHasBeenSet = false; + + Aws::Vector m_debugLogDeliveryAccounts; + bool m_debugLogDeliveryAccountsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationCustomRuleMetadata.h b/include/aws/config/model/OrganizationCustomRuleMetadata.h new file mode 100644 index 0000000000000000000000000000000000000000..6f1908cd4c18fa6b2eafb76419ff54107e48511b --- /dev/null +++ b/include/aws/config/model/OrganizationCustomRuleMetadata.h @@ -0,0 +1,221 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that specifies organization custom rule metadata such as resource + * type, resource ID of Amazon Web Services resource, Lambda function ARN, and + * organization trigger types that trigger Config to evaluate your Amazon Web + * Services resources against a rule. It also provides the frequency with which you + * want Config to run evaluations for the rule if the trigger type is + * periodic.

See Also:

AWS + * API Reference

+ */ + class OrganizationCustomRuleMetadata + { + public: + AWS_CONFIGSERVICE_API OrganizationCustomRuleMetadata(); + AWS_CONFIGSERVICE_API OrganizationCustomRuleMetadata(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationCustomRuleMetadata& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The description that you provide for your organization Config rule.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline OrganizationCustomRuleMetadata& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline OrganizationCustomRuleMetadata& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

The lambda function ARN.

+ */ + inline const Aws::String& GetLambdaFunctionArn() const{ return m_lambdaFunctionArn; } + inline bool LambdaFunctionArnHasBeenSet() const { return m_lambdaFunctionArnHasBeenSet; } + inline void SetLambdaFunctionArn(const Aws::String& value) { m_lambdaFunctionArnHasBeenSet = true; m_lambdaFunctionArn = value; } + inline void SetLambdaFunctionArn(Aws::String&& value) { m_lambdaFunctionArnHasBeenSet = true; m_lambdaFunctionArn = std::move(value); } + inline void SetLambdaFunctionArn(const char* value) { m_lambdaFunctionArnHasBeenSet = true; m_lambdaFunctionArn.assign(value); } + inline OrganizationCustomRuleMetadata& WithLambdaFunctionArn(const Aws::String& value) { SetLambdaFunctionArn(value); return *this;} + inline OrganizationCustomRuleMetadata& WithLambdaFunctionArn(Aws::String&& value) { SetLambdaFunctionArn(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& WithLambdaFunctionArn(const char* value) { SetLambdaFunctionArn(value); return *this;} + ///@} + + ///@{ + /** + *

The type of notification that triggers Config to run an evaluation for a + * rule. You can specify the following notification types:

  • + * ConfigurationItemChangeNotification - Triggers an evaluation when + * Config delivers a configuration item as a result of a resource change.

  • + *
  • OversizedConfigurationItemChangeNotification - Triggers an + * evaluation when Config delivers an oversized configuration item. Config may + * generate this notification type when a resource changes and the notification + * exceeds the maximum size allowed by Amazon SNS.

  • + * ScheduledNotification - Triggers a periodic evaluation at the + * frequency specified for MaximumExecutionFrequency.

+ */ + inline const Aws::Vector& GetOrganizationConfigRuleTriggerTypes() const{ return m_organizationConfigRuleTriggerTypes; } + inline bool OrganizationConfigRuleTriggerTypesHasBeenSet() const { return m_organizationConfigRuleTriggerTypesHasBeenSet; } + inline void SetOrganizationConfigRuleTriggerTypes(const Aws::Vector& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes = value; } + inline void SetOrganizationConfigRuleTriggerTypes(Aws::Vector&& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes = std::move(value); } + inline OrganizationCustomRuleMetadata& WithOrganizationConfigRuleTriggerTypes(const Aws::Vector& value) { SetOrganizationConfigRuleTriggerTypes(value); return *this;} + inline OrganizationCustomRuleMetadata& WithOrganizationConfigRuleTriggerTypes(Aws::Vector&& value) { SetOrganizationConfigRuleTriggerTypes(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& AddOrganizationConfigRuleTriggerTypes(const OrganizationConfigRuleTriggerType& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes.push_back(value); return *this; } + inline OrganizationCustomRuleMetadata& AddOrganizationConfigRuleTriggerTypes(OrganizationConfigRuleTriggerType&& value) { m_organizationConfigRuleTriggerTypesHasBeenSet = true; m_organizationConfigRuleTriggerTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A string, in JSON format, that is passed to your organization Config rule + * Lambda function.

+ */ + inline const Aws::String& GetInputParameters() const{ return m_inputParameters; } + inline bool InputParametersHasBeenSet() const { return m_inputParametersHasBeenSet; } + inline void SetInputParameters(const Aws::String& value) { m_inputParametersHasBeenSet = true; m_inputParameters = value; } + inline void SetInputParameters(Aws::String&& value) { m_inputParametersHasBeenSet = true; m_inputParameters = std::move(value); } + inline void SetInputParameters(const char* value) { m_inputParametersHasBeenSet = true; m_inputParameters.assign(value); } + inline OrganizationCustomRuleMetadata& WithInputParameters(const Aws::String& value) { SetInputParameters(value); return *this;} + inline OrganizationCustomRuleMetadata& WithInputParameters(Aws::String&& value) { SetInputParameters(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& WithInputParameters(const char* value) { SetInputParameters(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum frequency with which Config runs evaluations for a rule. Your + * custom rule is triggered when Config delivers the configuration snapshot. For + * more information, see ConfigSnapshotDeliveryProperties.

By + * default, rules with a periodic trigger are evaluated every 24 hours. To change + * the frequency, specify a valid value for the + * MaximumExecutionFrequency parameter.

+ */ + inline const MaximumExecutionFrequency& GetMaximumExecutionFrequency() const{ return m_maximumExecutionFrequency; } + inline bool MaximumExecutionFrequencyHasBeenSet() const { return m_maximumExecutionFrequencyHasBeenSet; } + inline void SetMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = value; } + inline void SetMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = std::move(value); } + inline OrganizationCustomRuleMetadata& WithMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { SetMaximumExecutionFrequency(value); return *this;} + inline OrganizationCustomRuleMetadata& WithMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { SetMaximumExecutionFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The type of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::Vector& GetResourceTypesScope() const{ return m_resourceTypesScope; } + inline bool ResourceTypesScopeHasBeenSet() const { return m_resourceTypesScopeHasBeenSet; } + inline void SetResourceTypesScope(const Aws::Vector& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = value; } + inline void SetResourceTypesScope(Aws::Vector&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = std::move(value); } + inline OrganizationCustomRuleMetadata& WithResourceTypesScope(const Aws::Vector& value) { SetResourceTypesScope(value); return *this;} + inline OrganizationCustomRuleMetadata& WithResourceTypesScope(Aws::Vector&& value) { SetResourceTypesScope(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& AddResourceTypesScope(const Aws::String& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + inline OrganizationCustomRuleMetadata& AddResourceTypesScope(Aws::String&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(std::move(value)); return *this; } + inline OrganizationCustomRuleMetadata& AddResourceTypesScope(const char* value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetResourceIdScope() const{ return m_resourceIdScope; } + inline bool ResourceIdScopeHasBeenSet() const { return m_resourceIdScopeHasBeenSet; } + inline void SetResourceIdScope(const Aws::String& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = value; } + inline void SetResourceIdScope(Aws::String&& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = std::move(value); } + inline void SetResourceIdScope(const char* value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope.assign(value); } + inline OrganizationCustomRuleMetadata& WithResourceIdScope(const Aws::String& value) { SetResourceIdScope(value); return *this;} + inline OrganizationCustomRuleMetadata& WithResourceIdScope(Aws::String&& value) { SetResourceIdScope(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& WithResourceIdScope(const char* value) { SetResourceIdScope(value); return *this;} + ///@} + + ///@{ + /** + *

One part of a key-value pair that make up a tag. A key is a general label + * that acts like a category for more specific tag values.

+ */ + inline const Aws::String& GetTagKeyScope() const{ return m_tagKeyScope; } + inline bool TagKeyScopeHasBeenSet() const { return m_tagKeyScopeHasBeenSet; } + inline void SetTagKeyScope(const Aws::String& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = value; } + inline void SetTagKeyScope(Aws::String&& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = std::move(value); } + inline void SetTagKeyScope(const char* value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope.assign(value); } + inline OrganizationCustomRuleMetadata& WithTagKeyScope(const Aws::String& value) { SetTagKeyScope(value); return *this;} + inline OrganizationCustomRuleMetadata& WithTagKeyScope(Aws::String&& value) { SetTagKeyScope(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& WithTagKeyScope(const char* value) { SetTagKeyScope(value); return *this;} + ///@} + + ///@{ + /** + *

The optional part of a key-value pair that make up a tag. A value acts as a + * descriptor within a tag category (key).

+ */ + inline const Aws::String& GetTagValueScope() const{ return m_tagValueScope; } + inline bool TagValueScopeHasBeenSet() const { return m_tagValueScopeHasBeenSet; } + inline void SetTagValueScope(const Aws::String& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = value; } + inline void SetTagValueScope(Aws::String&& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = std::move(value); } + inline void SetTagValueScope(const char* value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope.assign(value); } + inline OrganizationCustomRuleMetadata& WithTagValueScope(const Aws::String& value) { SetTagValueScope(value); return *this;} + inline OrganizationCustomRuleMetadata& WithTagValueScope(Aws::String&& value) { SetTagValueScope(std::move(value)); return *this;} + inline OrganizationCustomRuleMetadata& WithTagValueScope(const char* value) { SetTagValueScope(value); return *this;} + ///@} + private: + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + Aws::String m_lambdaFunctionArn; + bool m_lambdaFunctionArnHasBeenSet = false; + + Aws::Vector m_organizationConfigRuleTriggerTypes; + bool m_organizationConfigRuleTriggerTypesHasBeenSet = false; + + Aws::String m_inputParameters; + bool m_inputParametersHasBeenSet = false; + + MaximumExecutionFrequency m_maximumExecutionFrequency; + bool m_maximumExecutionFrequencyHasBeenSet = false; + + Aws::Vector m_resourceTypesScope; + bool m_resourceTypesScopeHasBeenSet = false; + + Aws::String m_resourceIdScope; + bool m_resourceIdScopeHasBeenSet = false; + + Aws::String m_tagKeyScope; + bool m_tagKeyScopeHasBeenSet = false; + + Aws::String m_tagValueScope; + bool m_tagValueScopeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationManagedRuleMetadata.h b/include/aws/config/model/OrganizationManagedRuleMetadata.h new file mode 100644 index 0000000000000000000000000000000000000000..9e92605ef976bafa925bcf02ab182f17f43948c7 --- /dev/null +++ b/include/aws/config/model/OrganizationManagedRuleMetadata.h @@ -0,0 +1,195 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that specifies organization managed rule metadata such as resource + * type and ID of Amazon Web Services resource along with the rule identifier. It + * also provides the frequency with which you want Config to run evaluations for + * the rule if the trigger type is periodic.

See Also:

AWS + * API Reference

+ */ + class OrganizationManagedRuleMetadata + { + public: + AWS_CONFIGSERVICE_API OrganizationManagedRuleMetadata(); + AWS_CONFIGSERVICE_API OrganizationManagedRuleMetadata(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationManagedRuleMetadata& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The description that you provide for your organization Config rule.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline OrganizationManagedRuleMetadata& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline OrganizationManagedRuleMetadata& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline OrganizationManagedRuleMetadata& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

For organization config managed rules, a predefined identifier from a list. + * For example, IAM_PASSWORD_POLICY is a managed rule. To reference a + * managed rule, see Using + * Config managed rules.

+ */ + inline const Aws::String& GetRuleIdentifier() const{ return m_ruleIdentifier; } + inline bool RuleIdentifierHasBeenSet() const { return m_ruleIdentifierHasBeenSet; } + inline void SetRuleIdentifier(const Aws::String& value) { m_ruleIdentifierHasBeenSet = true; m_ruleIdentifier = value; } + inline void SetRuleIdentifier(Aws::String&& value) { m_ruleIdentifierHasBeenSet = true; m_ruleIdentifier = std::move(value); } + inline void SetRuleIdentifier(const char* value) { m_ruleIdentifierHasBeenSet = true; m_ruleIdentifier.assign(value); } + inline OrganizationManagedRuleMetadata& WithRuleIdentifier(const Aws::String& value) { SetRuleIdentifier(value); return *this;} + inline OrganizationManagedRuleMetadata& WithRuleIdentifier(Aws::String&& value) { SetRuleIdentifier(std::move(value)); return *this;} + inline OrganizationManagedRuleMetadata& WithRuleIdentifier(const char* value) { SetRuleIdentifier(value); return *this;} + ///@} + + ///@{ + /** + *

A string, in JSON format, that is passed to your organization Config rule + * Lambda function.

+ */ + inline const Aws::String& GetInputParameters() const{ return m_inputParameters; } + inline bool InputParametersHasBeenSet() const { return m_inputParametersHasBeenSet; } + inline void SetInputParameters(const Aws::String& value) { m_inputParametersHasBeenSet = true; m_inputParameters = value; } + inline void SetInputParameters(Aws::String&& value) { m_inputParametersHasBeenSet = true; m_inputParameters = std::move(value); } + inline void SetInputParameters(const char* value) { m_inputParametersHasBeenSet = true; m_inputParameters.assign(value); } + inline OrganizationManagedRuleMetadata& WithInputParameters(const Aws::String& value) { SetInputParameters(value); return *this;} + inline OrganizationManagedRuleMetadata& WithInputParameters(Aws::String&& value) { SetInputParameters(std::move(value)); return *this;} + inline OrganizationManagedRuleMetadata& WithInputParameters(const char* value) { SetInputParameters(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum frequency with which Config runs evaluations for a rule. This is + * for an Config managed rule that is triggered at a periodic frequency.

+ *

By default, rules with a periodic trigger are evaluated every 24 hours. To + * change the frequency, specify a valid value for the + * MaximumExecutionFrequency parameter.

+ */ + inline const MaximumExecutionFrequency& GetMaximumExecutionFrequency() const{ return m_maximumExecutionFrequency; } + inline bool MaximumExecutionFrequencyHasBeenSet() const { return m_maximumExecutionFrequencyHasBeenSet; } + inline void SetMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = value; } + inline void SetMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = std::move(value); } + inline OrganizationManagedRuleMetadata& WithMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { SetMaximumExecutionFrequency(value); return *this;} + inline OrganizationManagedRuleMetadata& WithMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { SetMaximumExecutionFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The type of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::Vector& GetResourceTypesScope() const{ return m_resourceTypesScope; } + inline bool ResourceTypesScopeHasBeenSet() const { return m_resourceTypesScopeHasBeenSet; } + inline void SetResourceTypesScope(const Aws::Vector& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = value; } + inline void SetResourceTypesScope(Aws::Vector&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope = std::move(value); } + inline OrganizationManagedRuleMetadata& WithResourceTypesScope(const Aws::Vector& value) { SetResourceTypesScope(value); return *this;} + inline OrganizationManagedRuleMetadata& WithResourceTypesScope(Aws::Vector&& value) { SetResourceTypesScope(std::move(value)); return *this;} + inline OrganizationManagedRuleMetadata& AddResourceTypesScope(const Aws::String& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + inline OrganizationManagedRuleMetadata& AddResourceTypesScope(Aws::String&& value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(std::move(value)); return *this; } + inline OrganizationManagedRuleMetadata& AddResourceTypesScope(const char* value) { m_resourceTypesScopeHasBeenSet = true; m_resourceTypesScope.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The ID of the Amazon Web Services resource that was evaluated.

+ */ + inline const Aws::String& GetResourceIdScope() const{ return m_resourceIdScope; } + inline bool ResourceIdScopeHasBeenSet() const { return m_resourceIdScopeHasBeenSet; } + inline void SetResourceIdScope(const Aws::String& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = value; } + inline void SetResourceIdScope(Aws::String&& value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope = std::move(value); } + inline void SetResourceIdScope(const char* value) { m_resourceIdScopeHasBeenSet = true; m_resourceIdScope.assign(value); } + inline OrganizationManagedRuleMetadata& WithResourceIdScope(const Aws::String& value) { SetResourceIdScope(value); return *this;} + inline OrganizationManagedRuleMetadata& WithResourceIdScope(Aws::String&& value) { SetResourceIdScope(std::move(value)); return *this;} + inline OrganizationManagedRuleMetadata& WithResourceIdScope(const char* value) { SetResourceIdScope(value); return *this;} + ///@} + + ///@{ + /** + *

One part of a key-value pair that make up a tag. A key is a general label + * that acts like a category for more specific tag values.

+ */ + inline const Aws::String& GetTagKeyScope() const{ return m_tagKeyScope; } + inline bool TagKeyScopeHasBeenSet() const { return m_tagKeyScopeHasBeenSet; } + inline void SetTagKeyScope(const Aws::String& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = value; } + inline void SetTagKeyScope(Aws::String&& value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope = std::move(value); } + inline void SetTagKeyScope(const char* value) { m_tagKeyScopeHasBeenSet = true; m_tagKeyScope.assign(value); } + inline OrganizationManagedRuleMetadata& WithTagKeyScope(const Aws::String& value) { SetTagKeyScope(value); return *this;} + inline OrganizationManagedRuleMetadata& WithTagKeyScope(Aws::String&& value) { SetTagKeyScope(std::move(value)); return *this;} + inline OrganizationManagedRuleMetadata& WithTagKeyScope(const char* value) { SetTagKeyScope(value); return *this;} + ///@} + + ///@{ + /** + *

The optional part of a key-value pair that make up a tag. A value acts as a + * descriptor within a tag category (key).

+ */ + inline const Aws::String& GetTagValueScope() const{ return m_tagValueScope; } + inline bool TagValueScopeHasBeenSet() const { return m_tagValueScopeHasBeenSet; } + inline void SetTagValueScope(const Aws::String& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = value; } + inline void SetTagValueScope(Aws::String&& value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope = std::move(value); } + inline void SetTagValueScope(const char* value) { m_tagValueScopeHasBeenSet = true; m_tagValueScope.assign(value); } + inline OrganizationManagedRuleMetadata& WithTagValueScope(const Aws::String& value) { SetTagValueScope(value); return *this;} + inline OrganizationManagedRuleMetadata& WithTagValueScope(Aws::String&& value) { SetTagValueScope(std::move(value)); return *this;} + inline OrganizationManagedRuleMetadata& WithTagValueScope(const char* value) { SetTagValueScope(value); return *this;} + ///@} + private: + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + Aws::String m_ruleIdentifier; + bool m_ruleIdentifierHasBeenSet = false; + + Aws::String m_inputParameters; + bool m_inputParametersHasBeenSet = false; + + MaximumExecutionFrequency m_maximumExecutionFrequency; + bool m_maximumExecutionFrequencyHasBeenSet = false; + + Aws::Vector m_resourceTypesScope; + bool m_resourceTypesScopeHasBeenSet = false; + + Aws::String m_resourceIdScope; + bool m_resourceIdScopeHasBeenSet = false; + + Aws::String m_tagKeyScope; + bool m_tagKeyScopeHasBeenSet = false; + + Aws::String m_tagValueScope; + bool m_tagValueScopeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationResourceDetailedStatus.h b/include/aws/config/model/OrganizationResourceDetailedStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..fa6a121fb06e44e568f012a025f9ed7f3356443d --- /dev/null +++ b/include/aws/config/model/OrganizationResourceDetailedStatus.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class OrganizationResourceDetailedStatus + { + NOT_SET, + CREATE_SUCCESSFUL, + CREATE_IN_PROGRESS, + CREATE_FAILED, + DELETE_SUCCESSFUL, + DELETE_FAILED, + DELETE_IN_PROGRESS, + UPDATE_SUCCESSFUL, + UPDATE_IN_PROGRESS, + UPDATE_FAILED + }; + +namespace OrganizationResourceDetailedStatusMapper +{ +AWS_CONFIGSERVICE_API OrganizationResourceDetailedStatus GetOrganizationResourceDetailedStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForOrganizationResourceDetailedStatus(OrganizationResourceDetailedStatus value); +} // namespace OrganizationResourceDetailedStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationResourceDetailedStatusFilters.h b/include/aws/config/model/OrganizationResourceDetailedStatusFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..adddb2a1b81ffda37071e3bc8c64cc32b871a6a7 --- /dev/null +++ b/include/aws/config/model/OrganizationResourceDetailedStatusFilters.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Status filter object to filter results based on specific member account ID or + * status type for an organization conformance pack.

See Also:

AWS + * API Reference

+ */ + class OrganizationResourceDetailedStatusFilters + { + public: + AWS_CONFIGSERVICE_API OrganizationResourceDetailedStatusFilters(); + AWS_CONFIGSERVICE_API OrganizationResourceDetailedStatusFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API OrganizationResourceDetailedStatusFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of the member account within an organization.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline OrganizationResourceDetailedStatusFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline OrganizationResourceDetailedStatusFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline OrganizationResourceDetailedStatusFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates deployment status for conformance pack in a member account. When + * management account calls PutOrganizationConformancePack action for + * the first time, conformance pack status is created in the member account. When + * management account calls PutOrganizationConformancePack action for + * the second time, conformance pack status is updated in the member account. + * Conformance pack status is deleted when the management account deletes + * OrganizationConformancePack and disables service access for + * config-multiaccountsetup.amazonaws.com.

Config sets the + * state of the conformance pack to:

  • + * CREATE_SUCCESSFUL when conformance pack has been created in the + * member account.

  • CREATE_IN_PROGRESS when + * conformance pack is being created in the member account.

  • + * CREATE_FAILED when conformance pack creation has failed in the + * member account.

  • DELETE_FAILED when conformance + * pack deletion has failed in the member account.

  • + * DELETE_IN_PROGRESS when conformance pack is being deleted in the + * member account.

  • DELETE_SUCCESSFUL when + * conformance pack has been deleted in the member account.

  • + * UPDATE_SUCCESSFUL when conformance pack has been updated in the + * member account.

  • UPDATE_IN_PROGRESS when + * conformance pack is being updated in the member account.

  • + * UPDATE_FAILED when conformance pack deletion has failed in the + * member account.

+ */ + inline const OrganizationResourceDetailedStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const OrganizationResourceDetailedStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(OrganizationResourceDetailedStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline OrganizationResourceDetailedStatusFilters& WithStatus(const OrganizationResourceDetailedStatus& value) { SetStatus(value); return *this;} + inline OrganizationResourceDetailedStatusFilters& WithStatus(OrganizationResourceDetailedStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + OrganizationResourceDetailedStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationResourceStatus.h b/include/aws/config/model/OrganizationResourceStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..afe620a0dbd57f1c4e4ccafc717b6008b84da228 --- /dev/null +++ b/include/aws/config/model/OrganizationResourceStatus.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class OrganizationResourceStatus + { + NOT_SET, + CREATE_SUCCESSFUL, + CREATE_IN_PROGRESS, + CREATE_FAILED, + DELETE_SUCCESSFUL, + DELETE_FAILED, + DELETE_IN_PROGRESS, + UPDATE_SUCCESSFUL, + UPDATE_IN_PROGRESS, + UPDATE_FAILED + }; + +namespace OrganizationResourceStatusMapper +{ +AWS_CONFIGSERVICE_API OrganizationResourceStatus GetOrganizationResourceStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForOrganizationResourceStatus(OrganizationResourceStatus value); +} // namespace OrganizationResourceStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/OrganizationRuleStatus.h b/include/aws/config/model/OrganizationRuleStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..6582f94129cc73924db6544ce3f43125147394a2 --- /dev/null +++ b/include/aws/config/model/OrganizationRuleStatus.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class OrganizationRuleStatus + { + NOT_SET, + CREATE_SUCCESSFUL, + CREATE_IN_PROGRESS, + CREATE_FAILED, + DELETE_SUCCESSFUL, + DELETE_FAILED, + DELETE_IN_PROGRESS, + UPDATE_SUCCESSFUL, + UPDATE_IN_PROGRESS, + UPDATE_FAILED + }; + +namespace OrganizationRuleStatusMapper +{ +AWS_CONFIGSERVICE_API OrganizationRuleStatus GetOrganizationRuleStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForOrganizationRuleStatus(OrganizationRuleStatus value); +} // namespace OrganizationRuleStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/Owner.h b/include/aws/config/model/Owner.h new file mode 100644 index 0000000000000000000000000000000000000000..d594531fac410104928778f0f607ed96c91098a4 --- /dev/null +++ b/include/aws/config/model/Owner.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class Owner + { + NOT_SET, + CUSTOM_LAMBDA, + AWS, + CUSTOM_POLICY + }; + +namespace OwnerMapper +{ +AWS_CONFIGSERVICE_API Owner GetOwnerForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForOwner(Owner value); +} // namespace OwnerMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PendingAggregationRequest.h b/include/aws/config/model/PendingAggregationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1e3503de0c090bea9334640bfa43c708e96d9a1a --- /dev/null +++ b/include/aws/config/model/PendingAggregationRequest.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that represents the account ID and region of an aggregator account + * that is requesting authorization but is not yet authorized.

See + * Also:

AWS + * API Reference

+ */ + class PendingAggregationRequest + { + public: + AWS_CONFIGSERVICE_API PendingAggregationRequest(); + AWS_CONFIGSERVICE_API PendingAggregationRequest(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API PendingAggregationRequest& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of the account requesting to aggregate data.

+ */ + inline const Aws::String& GetRequesterAccountId() const{ return m_requesterAccountId; } + inline bool RequesterAccountIdHasBeenSet() const { return m_requesterAccountIdHasBeenSet; } + inline void SetRequesterAccountId(const Aws::String& value) { m_requesterAccountIdHasBeenSet = true; m_requesterAccountId = value; } + inline void SetRequesterAccountId(Aws::String&& value) { m_requesterAccountIdHasBeenSet = true; m_requesterAccountId = std::move(value); } + inline void SetRequesterAccountId(const char* value) { m_requesterAccountIdHasBeenSet = true; m_requesterAccountId.assign(value); } + inline PendingAggregationRequest& WithRequesterAccountId(const Aws::String& value) { SetRequesterAccountId(value); return *this;} + inline PendingAggregationRequest& WithRequesterAccountId(Aws::String&& value) { SetRequesterAccountId(std::move(value)); return *this;} + inline PendingAggregationRequest& WithRequesterAccountId(const char* value) { SetRequesterAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The region requesting to aggregate data.

+ */ + inline const Aws::String& GetRequesterAwsRegion() const{ return m_requesterAwsRegion; } + inline bool RequesterAwsRegionHasBeenSet() const { return m_requesterAwsRegionHasBeenSet; } + inline void SetRequesterAwsRegion(const Aws::String& value) { m_requesterAwsRegionHasBeenSet = true; m_requesterAwsRegion = value; } + inline void SetRequesterAwsRegion(Aws::String&& value) { m_requesterAwsRegionHasBeenSet = true; m_requesterAwsRegion = std::move(value); } + inline void SetRequesterAwsRegion(const char* value) { m_requesterAwsRegionHasBeenSet = true; m_requesterAwsRegion.assign(value); } + inline PendingAggregationRequest& WithRequesterAwsRegion(const Aws::String& value) { SetRequesterAwsRegion(value); return *this;} + inline PendingAggregationRequest& WithRequesterAwsRegion(Aws::String&& value) { SetRequesterAwsRegion(std::move(value)); return *this;} + inline PendingAggregationRequest& WithRequesterAwsRegion(const char* value) { SetRequesterAwsRegion(value); return *this;} + ///@} + private: + + Aws::String m_requesterAccountId; + bool m_requesterAccountIdHasBeenSet = false; + + Aws::String m_requesterAwsRegion; + bool m_requesterAwsRegionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutAggregationAuthorizationRequest.h b/include/aws/config/model/PutAggregationAuthorizationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..857d0f435519ecfb6fd3b8cc95eea5a92964b6d7 --- /dev/null +++ b/include/aws/config/model/PutAggregationAuthorizationRequest.h @@ -0,0 +1,94 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutAggregationAuthorizationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutAggregationAuthorizationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutAggregationAuthorization"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The 12-digit account ID of the account authorized to aggregate data.

+ */ + inline const Aws::String& GetAuthorizedAccountId() const{ return m_authorizedAccountId; } + inline bool AuthorizedAccountIdHasBeenSet() const { return m_authorizedAccountIdHasBeenSet; } + inline void SetAuthorizedAccountId(const Aws::String& value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId = value; } + inline void SetAuthorizedAccountId(Aws::String&& value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId = std::move(value); } + inline void SetAuthorizedAccountId(const char* value) { m_authorizedAccountIdHasBeenSet = true; m_authorizedAccountId.assign(value); } + inline PutAggregationAuthorizationRequest& WithAuthorizedAccountId(const Aws::String& value) { SetAuthorizedAccountId(value); return *this;} + inline PutAggregationAuthorizationRequest& WithAuthorizedAccountId(Aws::String&& value) { SetAuthorizedAccountId(std::move(value)); return *this;} + inline PutAggregationAuthorizationRequest& WithAuthorizedAccountId(const char* value) { SetAuthorizedAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The region authorized to collect aggregated data.

+ */ + inline const Aws::String& GetAuthorizedAwsRegion() const{ return m_authorizedAwsRegion; } + inline bool AuthorizedAwsRegionHasBeenSet() const { return m_authorizedAwsRegionHasBeenSet; } + inline void SetAuthorizedAwsRegion(const Aws::String& value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion = value; } + inline void SetAuthorizedAwsRegion(Aws::String&& value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion = std::move(value); } + inline void SetAuthorizedAwsRegion(const char* value) { m_authorizedAwsRegionHasBeenSet = true; m_authorizedAwsRegion.assign(value); } + inline PutAggregationAuthorizationRequest& WithAuthorizedAwsRegion(const Aws::String& value) { SetAuthorizedAwsRegion(value); return *this;} + inline PutAggregationAuthorizationRequest& WithAuthorizedAwsRegion(Aws::String&& value) { SetAuthorizedAwsRegion(std::move(value)); return *this;} + inline PutAggregationAuthorizationRequest& WithAuthorizedAwsRegion(const char* value) { SetAuthorizedAwsRegion(value); return *this;} + ///@} + + ///@{ + /** + *

An array of tag object.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline PutAggregationAuthorizationRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline PutAggregationAuthorizationRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline PutAggregationAuthorizationRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline PutAggregationAuthorizationRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_authorizedAccountId; + bool m_authorizedAccountIdHasBeenSet = false; + + Aws::String m_authorizedAwsRegion; + bool m_authorizedAwsRegionHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutAggregationAuthorizationResult.h b/include/aws/config/model/PutAggregationAuthorizationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..2375e4269bc8b8bd63ac900040ece3094dafe47c --- /dev/null +++ b/include/aws/config/model/PutAggregationAuthorizationResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutAggregationAuthorizationResult + { + public: + AWS_CONFIGSERVICE_API PutAggregationAuthorizationResult(); + AWS_CONFIGSERVICE_API PutAggregationAuthorizationResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutAggregationAuthorizationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns an AggregationAuthorization object.

+ */ + inline const AggregationAuthorization& GetAggregationAuthorization() const{ return m_aggregationAuthorization; } + inline void SetAggregationAuthorization(const AggregationAuthorization& value) { m_aggregationAuthorization = value; } + inline void SetAggregationAuthorization(AggregationAuthorization&& value) { m_aggregationAuthorization = std::move(value); } + inline PutAggregationAuthorizationResult& WithAggregationAuthorization(const AggregationAuthorization& value) { SetAggregationAuthorization(value); return *this;} + inline PutAggregationAuthorizationResult& WithAggregationAuthorization(AggregationAuthorization&& value) { SetAggregationAuthorization(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutAggregationAuthorizationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutAggregationAuthorizationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutAggregationAuthorizationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + AggregationAuthorization m_aggregationAuthorization; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutConfigRuleRequest.h b/include/aws/config/model/PutConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..eb2a8d60b6fa405de27b513a5fc4e831d3c12638 --- /dev/null +++ b/include/aws/config/model/PutConfigRuleRequest.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The rule that you want to add to your account.

+ */ + inline const ConfigRule& GetConfigRule() const{ return m_configRule; } + inline bool ConfigRuleHasBeenSet() const { return m_configRuleHasBeenSet; } + inline void SetConfigRule(const ConfigRule& value) { m_configRuleHasBeenSet = true; m_configRule = value; } + inline void SetConfigRule(ConfigRule&& value) { m_configRuleHasBeenSet = true; m_configRule = std::move(value); } + inline PutConfigRuleRequest& WithConfigRule(const ConfigRule& value) { SetConfigRule(value); return *this;} + inline PutConfigRuleRequest& WithConfigRule(ConfigRule&& value) { SetConfigRule(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An array of tag object.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline PutConfigRuleRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline PutConfigRuleRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline PutConfigRuleRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline PutConfigRuleRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + ConfigRule m_configRule; + bool m_configRuleHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutConfigurationAggregatorRequest.h b/include/aws/config/model/PutConfigurationAggregatorRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..79df1434ca74b1cf7dc1a47d812d83e7ff0ee069 --- /dev/null +++ b/include/aws/config/model/PutConfigurationAggregatorRequest.h @@ -0,0 +1,128 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutConfigurationAggregatorRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutConfigurationAggregatorRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutConfigurationAggregator"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline PutConfigurationAggregatorRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline PutConfigurationAggregatorRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline PutConfigurationAggregatorRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

A list of AccountAggregationSource object.

+ */ + inline const Aws::Vector& GetAccountAggregationSources() const{ return m_accountAggregationSources; } + inline bool AccountAggregationSourcesHasBeenSet() const { return m_accountAggregationSourcesHasBeenSet; } + inline void SetAccountAggregationSources(const Aws::Vector& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources = value; } + inline void SetAccountAggregationSources(Aws::Vector&& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources = std::move(value); } + inline PutConfigurationAggregatorRequest& WithAccountAggregationSources(const Aws::Vector& value) { SetAccountAggregationSources(value); return *this;} + inline PutConfigurationAggregatorRequest& WithAccountAggregationSources(Aws::Vector&& value) { SetAccountAggregationSources(std::move(value)); return *this;} + inline PutConfigurationAggregatorRequest& AddAccountAggregationSources(const AccountAggregationSource& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources.push_back(value); return *this; } + inline PutConfigurationAggregatorRequest& AddAccountAggregationSources(AccountAggregationSource&& value) { m_accountAggregationSourcesHasBeenSet = true; m_accountAggregationSources.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

An OrganizationAggregationSource object.

+ */ + inline const OrganizationAggregationSource& GetOrganizationAggregationSource() const{ return m_organizationAggregationSource; } + inline bool OrganizationAggregationSourceHasBeenSet() const { return m_organizationAggregationSourceHasBeenSet; } + inline void SetOrganizationAggregationSource(const OrganizationAggregationSource& value) { m_organizationAggregationSourceHasBeenSet = true; m_organizationAggregationSource = value; } + inline void SetOrganizationAggregationSource(OrganizationAggregationSource&& value) { m_organizationAggregationSourceHasBeenSet = true; m_organizationAggregationSource = std::move(value); } + inline PutConfigurationAggregatorRequest& WithOrganizationAggregationSource(const OrganizationAggregationSource& value) { SetOrganizationAggregationSource(value); return *this;} + inline PutConfigurationAggregatorRequest& WithOrganizationAggregationSource(OrganizationAggregationSource&& value) { SetOrganizationAggregationSource(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An array of tag object.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline PutConfigurationAggregatorRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline PutConfigurationAggregatorRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline PutConfigurationAggregatorRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline PutConfigurationAggregatorRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

An object to filter configuration recorders in an aggregator. Either + * ResourceType or ServicePrincipal is required.

+ */ + inline const AggregatorFilters& GetAggregatorFilters() const{ return m_aggregatorFilters; } + inline bool AggregatorFiltersHasBeenSet() const { return m_aggregatorFiltersHasBeenSet; } + inline void SetAggregatorFilters(const AggregatorFilters& value) { m_aggregatorFiltersHasBeenSet = true; m_aggregatorFilters = value; } + inline void SetAggregatorFilters(AggregatorFilters&& value) { m_aggregatorFiltersHasBeenSet = true; m_aggregatorFilters = std::move(value); } + inline PutConfigurationAggregatorRequest& WithAggregatorFilters(const AggregatorFilters& value) { SetAggregatorFilters(value); return *this;} + inline PutConfigurationAggregatorRequest& WithAggregatorFilters(AggregatorFilters&& value) { SetAggregatorFilters(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + Aws::Vector m_accountAggregationSources; + bool m_accountAggregationSourcesHasBeenSet = false; + + OrganizationAggregationSource m_organizationAggregationSource; + bool m_organizationAggregationSourceHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + + AggregatorFilters m_aggregatorFilters; + bool m_aggregatorFiltersHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutConfigurationAggregatorResult.h b/include/aws/config/model/PutConfigurationAggregatorResult.h new file mode 100644 index 0000000000000000000000000000000000000000..9057e2707c0a857ccf6f5b9caa6d602bda3e49e8 --- /dev/null +++ b/include/aws/config/model/PutConfigurationAggregatorResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutConfigurationAggregatorResult + { + public: + AWS_CONFIGSERVICE_API PutConfigurationAggregatorResult(); + AWS_CONFIGSERVICE_API PutConfigurationAggregatorResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutConfigurationAggregatorResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a ConfigurationAggregator object.

+ */ + inline const ConfigurationAggregator& GetConfigurationAggregator() const{ return m_configurationAggregator; } + inline void SetConfigurationAggregator(const ConfigurationAggregator& value) { m_configurationAggregator = value; } + inline void SetConfigurationAggregator(ConfigurationAggregator&& value) { m_configurationAggregator = std::move(value); } + inline PutConfigurationAggregatorResult& WithConfigurationAggregator(const ConfigurationAggregator& value) { SetConfigurationAggregator(value); return *this;} + inline PutConfigurationAggregatorResult& WithConfigurationAggregator(ConfigurationAggregator&& value) { SetConfigurationAggregator(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutConfigurationAggregatorResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutConfigurationAggregatorResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutConfigurationAggregatorResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ConfigurationAggregator m_configurationAggregator; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutConfigurationRecorderRequest.h b/include/aws/config/model/PutConfigurationRecorderRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5ea0e05bbc8f286205b2ff4522461fe48757f611 --- /dev/null +++ b/include/aws/config/model/PutConfigurationRecorderRequest.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the PutConfigurationRecorder action.

See + * Also:

AWS + * API Reference

+ */ + class PutConfigurationRecorderRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutConfigurationRecorderRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutConfigurationRecorder"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

An object for the configuration recorder. A configuration recorder records + * configuration changes for the resource types in scope.

+ */ + inline const ConfigurationRecorder& GetConfigurationRecorder() const{ return m_configurationRecorder; } + inline bool ConfigurationRecorderHasBeenSet() const { return m_configurationRecorderHasBeenSet; } + inline void SetConfigurationRecorder(const ConfigurationRecorder& value) { m_configurationRecorderHasBeenSet = true; m_configurationRecorder = value; } + inline void SetConfigurationRecorder(ConfigurationRecorder&& value) { m_configurationRecorderHasBeenSet = true; m_configurationRecorder = std::move(value); } + inline PutConfigurationRecorderRequest& WithConfigurationRecorder(const ConfigurationRecorder& value) { SetConfigurationRecorder(value); return *this;} + inline PutConfigurationRecorderRequest& WithConfigurationRecorder(ConfigurationRecorder&& value) { SetConfigurationRecorder(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The tags for the customer managed configuration recorder. Each tag consists + * of a key and an optional value, both of which you define.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline PutConfigurationRecorderRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline PutConfigurationRecorderRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline PutConfigurationRecorderRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline PutConfigurationRecorderRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + ConfigurationRecorder m_configurationRecorder; + bool m_configurationRecorderHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutConformancePackRequest.h b/include/aws/config/model/PutConformancePackRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d3d77aab595b2a49244788f6c1001a563dd5de2f --- /dev/null +++ b/include/aws/config/model/PutConformancePackRequest.h @@ -0,0 +1,177 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutConformancePackRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutConformancePackRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutConformancePack"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The unique name of the conformance pack you want to deploy.

+ */ + inline const Aws::String& GetConformancePackName() const{ return m_conformancePackName; } + inline bool ConformancePackNameHasBeenSet() const { return m_conformancePackNameHasBeenSet; } + inline void SetConformancePackName(const Aws::String& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = value; } + inline void SetConformancePackName(Aws::String&& value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName = std::move(value); } + inline void SetConformancePackName(const char* value) { m_conformancePackNameHasBeenSet = true; m_conformancePackName.assign(value); } + inline PutConformancePackRequest& WithConformancePackName(const Aws::String& value) { SetConformancePackName(value); return *this;} + inline PutConformancePackRequest& WithConformancePackName(Aws::String&& value) { SetConformancePackName(std::move(value)); return *this;} + inline PutConformancePackRequest& WithConformancePackName(const char* value) { SetConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

The location of the file containing the template body + * (s3://bucketname/prefix). The uri must point to a conformance pack + * template (max size: 300 KB) that is located in an Amazon S3 bucket in the same + * Region as the conformance pack.

You must have access to read + * Amazon S3 bucket. In addition, in order to ensure a successful deployment, the + * template object must not be in an archived + * storage class if this parameter is passed.

+ */ + inline const Aws::String& GetTemplateS3Uri() const{ return m_templateS3Uri; } + inline bool TemplateS3UriHasBeenSet() const { return m_templateS3UriHasBeenSet; } + inline void SetTemplateS3Uri(const Aws::String& value) { m_templateS3UriHasBeenSet = true; m_templateS3Uri = value; } + inline void SetTemplateS3Uri(Aws::String&& value) { m_templateS3UriHasBeenSet = true; m_templateS3Uri = std::move(value); } + inline void SetTemplateS3Uri(const char* value) { m_templateS3UriHasBeenSet = true; m_templateS3Uri.assign(value); } + inline PutConformancePackRequest& WithTemplateS3Uri(const Aws::String& value) { SetTemplateS3Uri(value); return *this;} + inline PutConformancePackRequest& WithTemplateS3Uri(Aws::String&& value) { SetTemplateS3Uri(std::move(value)); return *this;} + inline PutConformancePackRequest& WithTemplateS3Uri(const char* value) { SetTemplateS3Uri(value); return *this;} + ///@} + + ///@{ + /** + *

A string containing the full conformance pack template body. The structure + * containing the template body has a minimum length of 1 byte and a maximum length + * of 51,200 bytes.

You can use a YAML template with two resource + * types: Config rule (AWS::Config::ConfigRule) and remediation action + * (AWS::Config::RemediationConfiguration).

+ */ + inline const Aws::String& GetTemplateBody() const{ return m_templateBody; } + inline bool TemplateBodyHasBeenSet() const { return m_templateBodyHasBeenSet; } + inline void SetTemplateBody(const Aws::String& value) { m_templateBodyHasBeenSet = true; m_templateBody = value; } + inline void SetTemplateBody(Aws::String&& value) { m_templateBodyHasBeenSet = true; m_templateBody = std::move(value); } + inline void SetTemplateBody(const char* value) { m_templateBodyHasBeenSet = true; m_templateBody.assign(value); } + inline PutConformancePackRequest& WithTemplateBody(const Aws::String& value) { SetTemplateBody(value); return *this;} + inline PutConformancePackRequest& WithTemplateBody(Aws::String&& value) { SetTemplateBody(std::move(value)); return *this;} + inline PutConformancePackRequest& WithTemplateBody(const char* value) { SetTemplateBody(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the Amazon S3 bucket where Config stores conformance pack + * templates.

This field is optional.

+ */ + inline const Aws::String& GetDeliveryS3Bucket() const{ return m_deliveryS3Bucket; } + inline bool DeliveryS3BucketHasBeenSet() const { return m_deliveryS3BucketHasBeenSet; } + inline void SetDeliveryS3Bucket(const Aws::String& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = value; } + inline void SetDeliveryS3Bucket(Aws::String&& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = std::move(value); } + inline void SetDeliveryS3Bucket(const char* value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket.assign(value); } + inline PutConformancePackRequest& WithDeliveryS3Bucket(const Aws::String& value) { SetDeliveryS3Bucket(value); return *this;} + inline PutConformancePackRequest& WithDeliveryS3Bucket(Aws::String&& value) { SetDeliveryS3Bucket(std::move(value)); return *this;} + inline PutConformancePackRequest& WithDeliveryS3Bucket(const char* value) { SetDeliveryS3Bucket(value); return *this;} + ///@} + + ///@{ + /** + *

The prefix for the Amazon S3 bucket.

This field is + * optional.

+ */ + inline const Aws::String& GetDeliveryS3KeyPrefix() const{ return m_deliveryS3KeyPrefix; } + inline bool DeliveryS3KeyPrefixHasBeenSet() const { return m_deliveryS3KeyPrefixHasBeenSet; } + inline void SetDeliveryS3KeyPrefix(const Aws::String& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = value; } + inline void SetDeliveryS3KeyPrefix(Aws::String&& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = std::move(value); } + inline void SetDeliveryS3KeyPrefix(const char* value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix.assign(value); } + inline PutConformancePackRequest& WithDeliveryS3KeyPrefix(const Aws::String& value) { SetDeliveryS3KeyPrefix(value); return *this;} + inline PutConformancePackRequest& WithDeliveryS3KeyPrefix(Aws::String&& value) { SetDeliveryS3KeyPrefix(std::move(value)); return *this;} + inline PutConformancePackRequest& WithDeliveryS3KeyPrefix(const char* value) { SetDeliveryS3KeyPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

A list of ConformancePackInputParameter objects.

+ */ + inline const Aws::Vector& GetConformancePackInputParameters() const{ return m_conformancePackInputParameters; } + inline bool ConformancePackInputParametersHasBeenSet() const { return m_conformancePackInputParametersHasBeenSet; } + inline void SetConformancePackInputParameters(const Aws::Vector& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = value; } + inline void SetConformancePackInputParameters(Aws::Vector&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = std::move(value); } + inline PutConformancePackRequest& WithConformancePackInputParameters(const Aws::Vector& value) { SetConformancePackInputParameters(value); return *this;} + inline PutConformancePackRequest& WithConformancePackInputParameters(Aws::Vector&& value) { SetConformancePackInputParameters(std::move(value)); return *this;} + inline PutConformancePackRequest& AddConformancePackInputParameters(const ConformancePackInputParameter& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(value); return *this; } + inline PutConformancePackRequest& AddConformancePackInputParameters(ConformancePackInputParameter&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

An object of type TemplateSSMDocumentDetails, which contains the + * name or the Amazon Resource Name (ARN) of the Amazon Web Services Systems + * Manager document (SSM document) and the version of the SSM document that is used + * to create a conformance pack.

+ */ + inline const TemplateSSMDocumentDetails& GetTemplateSSMDocumentDetails() const{ return m_templateSSMDocumentDetails; } + inline bool TemplateSSMDocumentDetailsHasBeenSet() const { return m_templateSSMDocumentDetailsHasBeenSet; } + inline void SetTemplateSSMDocumentDetails(const TemplateSSMDocumentDetails& value) { m_templateSSMDocumentDetailsHasBeenSet = true; m_templateSSMDocumentDetails = value; } + inline void SetTemplateSSMDocumentDetails(TemplateSSMDocumentDetails&& value) { m_templateSSMDocumentDetailsHasBeenSet = true; m_templateSSMDocumentDetails = std::move(value); } + inline PutConformancePackRequest& WithTemplateSSMDocumentDetails(const TemplateSSMDocumentDetails& value) { SetTemplateSSMDocumentDetails(value); return *this;} + inline PutConformancePackRequest& WithTemplateSSMDocumentDetails(TemplateSSMDocumentDetails&& value) { SetTemplateSSMDocumentDetails(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_conformancePackName; + bool m_conformancePackNameHasBeenSet = false; + + Aws::String m_templateS3Uri; + bool m_templateS3UriHasBeenSet = false; + + Aws::String m_templateBody; + bool m_templateBodyHasBeenSet = false; + + Aws::String m_deliveryS3Bucket; + bool m_deliveryS3BucketHasBeenSet = false; + + Aws::String m_deliveryS3KeyPrefix; + bool m_deliveryS3KeyPrefixHasBeenSet = false; + + Aws::Vector m_conformancePackInputParameters; + bool m_conformancePackInputParametersHasBeenSet = false; + + TemplateSSMDocumentDetails m_templateSSMDocumentDetails; + bool m_templateSSMDocumentDetailsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutConformancePackResult.h b/include/aws/config/model/PutConformancePackResult.h new file mode 100644 index 0000000000000000000000000000000000000000..9c782ffb2b3ba33621fa188f87d3c0b784e6ccea --- /dev/null +++ b/include/aws/config/model/PutConformancePackResult.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutConformancePackResult + { + public: + AWS_CONFIGSERVICE_API PutConformancePackResult(); + AWS_CONFIGSERVICE_API PutConformancePackResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutConformancePackResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

ARN of the conformance pack.

+ */ + inline const Aws::String& GetConformancePackArn() const{ return m_conformancePackArn; } + inline void SetConformancePackArn(const Aws::String& value) { m_conformancePackArn = value; } + inline void SetConformancePackArn(Aws::String&& value) { m_conformancePackArn = std::move(value); } + inline void SetConformancePackArn(const char* value) { m_conformancePackArn.assign(value); } + inline PutConformancePackResult& WithConformancePackArn(const Aws::String& value) { SetConformancePackArn(value); return *this;} + inline PutConformancePackResult& WithConformancePackArn(Aws::String&& value) { SetConformancePackArn(std::move(value)); return *this;} + inline PutConformancePackResult& WithConformancePackArn(const char* value) { SetConformancePackArn(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutConformancePackResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutConformancePackResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutConformancePackResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_conformancePackArn; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutDeliveryChannelRequest.h b/include/aws/config/model/PutDeliveryChannelRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..cd4d308a855cacec10af39ee2c5d5d39b8eea812 --- /dev/null +++ b/include/aws/config/model/PutDeliveryChannelRequest.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the PutDeliveryChannel action.

See Also:

+ * AWS + * API Reference

+ */ + class PutDeliveryChannelRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutDeliveryChannelRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutDeliveryChannel"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

An object for the delivery channel. A delivery channel sends notifications + * and updated configuration states.

+ */ + inline const DeliveryChannel& GetDeliveryChannel() const{ return m_deliveryChannel; } + inline bool DeliveryChannelHasBeenSet() const { return m_deliveryChannelHasBeenSet; } + inline void SetDeliveryChannel(const DeliveryChannel& value) { m_deliveryChannelHasBeenSet = true; m_deliveryChannel = value; } + inline void SetDeliveryChannel(DeliveryChannel&& value) { m_deliveryChannelHasBeenSet = true; m_deliveryChannel = std::move(value); } + inline PutDeliveryChannelRequest& WithDeliveryChannel(const DeliveryChannel& value) { SetDeliveryChannel(value); return *this;} + inline PutDeliveryChannelRequest& WithDeliveryChannel(DeliveryChannel&& value) { SetDeliveryChannel(std::move(value)); return *this;} + ///@} + private: + + DeliveryChannel m_deliveryChannel; + bool m_deliveryChannelHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutEvaluationsRequest.h b/include/aws/config/model/PutEvaluationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5ec558b448facc3d6fd78c90346f766507b244b6 --- /dev/null +++ b/include/aws/config/model/PutEvaluationsRequest.h @@ -0,0 +1,102 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class PutEvaluationsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutEvaluationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutEvaluations"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The assessments that the Lambda function performs. Each evaluation identifies + * an Amazon Web Services resource and indicates whether it complies with the + * Config rule that invokes the Lambda function.

+ */ + inline const Aws::Vector& GetEvaluations() const{ return m_evaluations; } + inline bool EvaluationsHasBeenSet() const { return m_evaluationsHasBeenSet; } + inline void SetEvaluations(const Aws::Vector& value) { m_evaluationsHasBeenSet = true; m_evaluations = value; } + inline void SetEvaluations(Aws::Vector&& value) { m_evaluationsHasBeenSet = true; m_evaluations = std::move(value); } + inline PutEvaluationsRequest& WithEvaluations(const Aws::Vector& value) { SetEvaluations(value); return *this;} + inline PutEvaluationsRequest& WithEvaluations(Aws::Vector&& value) { SetEvaluations(std::move(value)); return *this;} + inline PutEvaluationsRequest& AddEvaluations(const Evaluation& value) { m_evaluationsHasBeenSet = true; m_evaluations.push_back(value); return *this; } + inline PutEvaluationsRequest& AddEvaluations(Evaluation&& value) { m_evaluationsHasBeenSet = true; m_evaluations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

An encrypted token that associates an evaluation with an Config rule. + * Identifies the rule and the event that triggered the evaluation.

+ */ + inline const Aws::String& GetResultToken() const{ return m_resultToken; } + inline bool ResultTokenHasBeenSet() const { return m_resultTokenHasBeenSet; } + inline void SetResultToken(const Aws::String& value) { m_resultTokenHasBeenSet = true; m_resultToken = value; } + inline void SetResultToken(Aws::String&& value) { m_resultTokenHasBeenSet = true; m_resultToken = std::move(value); } + inline void SetResultToken(const char* value) { m_resultTokenHasBeenSet = true; m_resultToken.assign(value); } + inline PutEvaluationsRequest& WithResultToken(const Aws::String& value) { SetResultToken(value); return *this;} + inline PutEvaluationsRequest& WithResultToken(Aws::String&& value) { SetResultToken(std::move(value)); return *this;} + inline PutEvaluationsRequest& WithResultToken(const char* value) { SetResultToken(value); return *this;} + ///@} + + ///@{ + /** + *

Use this parameter to specify a test run for PutEvaluations. You + * can verify whether your Lambda function will deliver evaluation results to + * Config. No updates occur to your existing evaluations, and evaluation results + * are not sent to Config.

When TestMode is + * true, PutEvaluations doesn't require a valid value for + * the ResultToken parameter, but the value cannot be null.

+ * + */ + inline bool GetTestMode() const{ return m_testMode; } + inline bool TestModeHasBeenSet() const { return m_testModeHasBeenSet; } + inline void SetTestMode(bool value) { m_testModeHasBeenSet = true; m_testMode = value; } + inline PutEvaluationsRequest& WithTestMode(bool value) { SetTestMode(value); return *this;} + ///@} + private: + + Aws::Vector m_evaluations; + bool m_evaluationsHasBeenSet = false; + + Aws::String m_resultToken; + bool m_resultTokenHasBeenSet = false; + + bool m_testMode; + bool m_testModeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutEvaluationsResult.h b/include/aws/config/model/PutEvaluationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..dd5882de220e3ce84776a16b1bd419961659498f --- /dev/null +++ b/include/aws/config/model/PutEvaluationsResult.h @@ -0,0 +1,74 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

See Also:

AWS + * API Reference

+ */ + class PutEvaluationsResult + { + public: + AWS_CONFIGSERVICE_API PutEvaluationsResult(); + AWS_CONFIGSERVICE_API PutEvaluationsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutEvaluationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Requests that failed because of a client or server error.

+ */ + inline const Aws::Vector& GetFailedEvaluations() const{ return m_failedEvaluations; } + inline void SetFailedEvaluations(const Aws::Vector& value) { m_failedEvaluations = value; } + inline void SetFailedEvaluations(Aws::Vector&& value) { m_failedEvaluations = std::move(value); } + inline PutEvaluationsResult& WithFailedEvaluations(const Aws::Vector& value) { SetFailedEvaluations(value); return *this;} + inline PutEvaluationsResult& WithFailedEvaluations(Aws::Vector&& value) { SetFailedEvaluations(std::move(value)); return *this;} + inline PutEvaluationsResult& AddFailedEvaluations(const Evaluation& value) { m_failedEvaluations.push_back(value); return *this; } + inline PutEvaluationsResult& AddFailedEvaluations(Evaluation&& value) { m_failedEvaluations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutEvaluationsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutEvaluationsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutEvaluationsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_failedEvaluations; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutExternalEvaluationRequest.h b/include/aws/config/model/PutExternalEvaluationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d5e934d4ca26ae3f06bfb6f52989bc91e8204bca --- /dev/null +++ b/include/aws/config/model/PutExternalEvaluationRequest.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutExternalEvaluationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutExternalEvaluationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutExternalEvaluation"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline PutExternalEvaluationRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline PutExternalEvaluationRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline PutExternalEvaluationRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

An ExternalEvaluation object that provides details about + * compliance.

+ */ + inline const ExternalEvaluation& GetExternalEvaluation() const{ return m_externalEvaluation; } + inline bool ExternalEvaluationHasBeenSet() const { return m_externalEvaluationHasBeenSet; } + inline void SetExternalEvaluation(const ExternalEvaluation& value) { m_externalEvaluationHasBeenSet = true; m_externalEvaluation = value; } + inline void SetExternalEvaluation(ExternalEvaluation&& value) { m_externalEvaluationHasBeenSet = true; m_externalEvaluation = std::move(value); } + inline PutExternalEvaluationRequest& WithExternalEvaluation(const ExternalEvaluation& value) { SetExternalEvaluation(value); return *this;} + inline PutExternalEvaluationRequest& WithExternalEvaluation(ExternalEvaluation&& value) { SetExternalEvaluation(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + ExternalEvaluation m_externalEvaluation; + bool m_externalEvaluationHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutExternalEvaluationResult.h b/include/aws/config/model/PutExternalEvaluationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..80f65aca04457436ecd005c1dc67c813fcc649c3 --- /dev/null +++ b/include/aws/config/model/PutExternalEvaluationResult.h @@ -0,0 +1,52 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutExternalEvaluationResult + { + public: + AWS_CONFIGSERVICE_API PutExternalEvaluationResult(); + AWS_CONFIGSERVICE_API PutExternalEvaluationResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutExternalEvaluationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutExternalEvaluationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutExternalEvaluationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutExternalEvaluationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutOrganizationConfigRuleRequest.h b/include/aws/config/model/PutOrganizationConfigRuleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..89554ab57249042176196f1fd21ab0b2267468eb --- /dev/null +++ b/include/aws/config/model/PutOrganizationConfigRuleRequest.h @@ -0,0 +1,140 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutOrganizationConfigRuleRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutOrganizationConfigRuleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutOrganizationConfigRule"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name that you assign to an organization Config rule.

+ */ + inline const Aws::String& GetOrganizationConfigRuleName() const{ return m_organizationConfigRuleName; } + inline bool OrganizationConfigRuleNameHasBeenSet() const { return m_organizationConfigRuleNameHasBeenSet; } + inline void SetOrganizationConfigRuleName(const Aws::String& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = value; } + inline void SetOrganizationConfigRuleName(Aws::String&& value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName = std::move(value); } + inline void SetOrganizationConfigRuleName(const char* value) { m_organizationConfigRuleNameHasBeenSet = true; m_organizationConfigRuleName.assign(value); } + inline PutOrganizationConfigRuleRequest& WithOrganizationConfigRuleName(const Aws::String& value) { SetOrganizationConfigRuleName(value); return *this;} + inline PutOrganizationConfigRuleRequest& WithOrganizationConfigRuleName(Aws::String&& value) { SetOrganizationConfigRuleName(std::move(value)); return *this;} + inline PutOrganizationConfigRuleRequest& WithOrganizationConfigRuleName(const char* value) { SetOrganizationConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

An OrganizationManagedRuleMetadata object. This object specifies + * organization managed rule metadata such as resource type and ID of Amazon Web + * Services resource along with the rule identifier. It also provides the frequency + * with which you want Config to run evaluations for the rule if the trigger type + * is periodic.

+ */ + inline const OrganizationManagedRuleMetadata& GetOrganizationManagedRuleMetadata() const{ return m_organizationManagedRuleMetadata; } + inline bool OrganizationManagedRuleMetadataHasBeenSet() const { return m_organizationManagedRuleMetadataHasBeenSet; } + inline void SetOrganizationManagedRuleMetadata(const OrganizationManagedRuleMetadata& value) { m_organizationManagedRuleMetadataHasBeenSet = true; m_organizationManagedRuleMetadata = value; } + inline void SetOrganizationManagedRuleMetadata(OrganizationManagedRuleMetadata&& value) { m_organizationManagedRuleMetadataHasBeenSet = true; m_organizationManagedRuleMetadata = std::move(value); } + inline PutOrganizationConfigRuleRequest& WithOrganizationManagedRuleMetadata(const OrganizationManagedRuleMetadata& value) { SetOrganizationManagedRuleMetadata(value); return *this;} + inline PutOrganizationConfigRuleRequest& WithOrganizationManagedRuleMetadata(OrganizationManagedRuleMetadata&& value) { SetOrganizationManagedRuleMetadata(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An OrganizationCustomRuleMetadata object. This object specifies + * organization custom rule metadata such as resource type, resource ID of Amazon + * Web Services resource, Lambda function ARN, and organization trigger types that + * trigger Config to evaluate your Amazon Web Services resources against a rule. It + * also provides the frequency with which you want Config to run evaluations for + * the rule if the trigger type is periodic.

+ */ + inline const OrganizationCustomRuleMetadata& GetOrganizationCustomRuleMetadata() const{ return m_organizationCustomRuleMetadata; } + inline bool OrganizationCustomRuleMetadataHasBeenSet() const { return m_organizationCustomRuleMetadataHasBeenSet; } + inline void SetOrganizationCustomRuleMetadata(const OrganizationCustomRuleMetadata& value) { m_organizationCustomRuleMetadataHasBeenSet = true; m_organizationCustomRuleMetadata = value; } + inline void SetOrganizationCustomRuleMetadata(OrganizationCustomRuleMetadata&& value) { m_organizationCustomRuleMetadataHasBeenSet = true; m_organizationCustomRuleMetadata = std::move(value); } + inline PutOrganizationConfigRuleRequest& WithOrganizationCustomRuleMetadata(const OrganizationCustomRuleMetadata& value) { SetOrganizationCustomRuleMetadata(value); return *this;} + inline PutOrganizationConfigRuleRequest& WithOrganizationCustomRuleMetadata(OrganizationCustomRuleMetadata&& value) { SetOrganizationCustomRuleMetadata(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A comma-separated list of accounts that you want to exclude from an + * organization Config rule.

+ */ + inline const Aws::Vector& GetExcludedAccounts() const{ return m_excludedAccounts; } + inline bool ExcludedAccountsHasBeenSet() const { return m_excludedAccountsHasBeenSet; } + inline void SetExcludedAccounts(const Aws::Vector& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = value; } + inline void SetExcludedAccounts(Aws::Vector&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = std::move(value); } + inline PutOrganizationConfigRuleRequest& WithExcludedAccounts(const Aws::Vector& value) { SetExcludedAccounts(value); return *this;} + inline PutOrganizationConfigRuleRequest& WithExcludedAccounts(Aws::Vector&& value) { SetExcludedAccounts(std::move(value)); return *this;} + inline PutOrganizationConfigRuleRequest& AddExcludedAccounts(const Aws::String& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + inline PutOrganizationConfigRuleRequest& AddExcludedAccounts(Aws::String&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(std::move(value)); return *this; } + inline PutOrganizationConfigRuleRequest& AddExcludedAccounts(const char* value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

An OrganizationCustomPolicyRuleMetadata object. This object + * specifies metadata for your organization's Config Custom Policy rule. The + * metadata includes the runtime system in use, which accounts have debug logging + * enabled, and other custom rule metadata, such as resource type, resource ID of + * Amazon Web Services resource, and organization trigger types that initiate + * Config to evaluate Amazon Web Services resources against a rule.

+ */ + inline const OrganizationCustomPolicyRuleMetadata& GetOrganizationCustomPolicyRuleMetadata() const{ return m_organizationCustomPolicyRuleMetadata; } + inline bool OrganizationCustomPolicyRuleMetadataHasBeenSet() const { return m_organizationCustomPolicyRuleMetadataHasBeenSet; } + inline void SetOrganizationCustomPolicyRuleMetadata(const OrganizationCustomPolicyRuleMetadata& value) { m_organizationCustomPolicyRuleMetadataHasBeenSet = true; m_organizationCustomPolicyRuleMetadata = value; } + inline void SetOrganizationCustomPolicyRuleMetadata(OrganizationCustomPolicyRuleMetadata&& value) { m_organizationCustomPolicyRuleMetadataHasBeenSet = true; m_organizationCustomPolicyRuleMetadata = std::move(value); } + inline PutOrganizationConfigRuleRequest& WithOrganizationCustomPolicyRuleMetadata(const OrganizationCustomPolicyRuleMetadata& value) { SetOrganizationCustomPolicyRuleMetadata(value); return *this;} + inline PutOrganizationConfigRuleRequest& WithOrganizationCustomPolicyRuleMetadata(OrganizationCustomPolicyRuleMetadata&& value) { SetOrganizationCustomPolicyRuleMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_organizationConfigRuleName; + bool m_organizationConfigRuleNameHasBeenSet = false; + + OrganizationManagedRuleMetadata m_organizationManagedRuleMetadata; + bool m_organizationManagedRuleMetadataHasBeenSet = false; + + OrganizationCustomRuleMetadata m_organizationCustomRuleMetadata; + bool m_organizationCustomRuleMetadataHasBeenSet = false; + + Aws::Vector m_excludedAccounts; + bool m_excludedAccountsHasBeenSet = false; + + OrganizationCustomPolicyRuleMetadata m_organizationCustomPolicyRuleMetadata; + bool m_organizationCustomPolicyRuleMetadataHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutOrganizationConfigRuleResult.h b/include/aws/config/model/PutOrganizationConfigRuleResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0745329a69af736e396e909b72c80663ce07664d --- /dev/null +++ b/include/aws/config/model/PutOrganizationConfigRuleResult.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutOrganizationConfigRuleResult + { + public: + AWS_CONFIGSERVICE_API PutOrganizationConfigRuleResult(); + AWS_CONFIGSERVICE_API PutOrganizationConfigRuleResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutOrganizationConfigRuleResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of an organization Config rule.

+ */ + inline const Aws::String& GetOrganizationConfigRuleArn() const{ return m_organizationConfigRuleArn; } + inline void SetOrganizationConfigRuleArn(const Aws::String& value) { m_organizationConfigRuleArn = value; } + inline void SetOrganizationConfigRuleArn(Aws::String&& value) { m_organizationConfigRuleArn = std::move(value); } + inline void SetOrganizationConfigRuleArn(const char* value) { m_organizationConfigRuleArn.assign(value); } + inline PutOrganizationConfigRuleResult& WithOrganizationConfigRuleArn(const Aws::String& value) { SetOrganizationConfigRuleArn(value); return *this;} + inline PutOrganizationConfigRuleResult& WithOrganizationConfigRuleArn(Aws::String&& value) { SetOrganizationConfigRuleArn(std::move(value)); return *this;} + inline PutOrganizationConfigRuleResult& WithOrganizationConfigRuleArn(const char* value) { SetOrganizationConfigRuleArn(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutOrganizationConfigRuleResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutOrganizationConfigRuleResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutOrganizationConfigRuleResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_organizationConfigRuleArn; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutOrganizationConformancePackRequest.h b/include/aws/config/model/PutOrganizationConformancePackRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..aa7a8832c8ca784911bf0c9d866687547b1dc91b --- /dev/null +++ b/include/aws/config/model/PutOrganizationConformancePackRequest.h @@ -0,0 +1,174 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutOrganizationConformancePackRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutOrganizationConformancePackRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutOrganizationConformancePack"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Name of the organization conformance pack you want to create.

+ */ + inline const Aws::String& GetOrganizationConformancePackName() const{ return m_organizationConformancePackName; } + inline bool OrganizationConformancePackNameHasBeenSet() const { return m_organizationConformancePackNameHasBeenSet; } + inline void SetOrganizationConformancePackName(const Aws::String& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = value; } + inline void SetOrganizationConformancePackName(Aws::String&& value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName = std::move(value); } + inline void SetOrganizationConformancePackName(const char* value) { m_organizationConformancePackNameHasBeenSet = true; m_organizationConformancePackName.assign(value); } + inline PutOrganizationConformancePackRequest& WithOrganizationConformancePackName(const Aws::String& value) { SetOrganizationConformancePackName(value); return *this;} + inline PutOrganizationConformancePackRequest& WithOrganizationConformancePackName(Aws::String&& value) { SetOrganizationConformancePackName(std::move(value)); return *this;} + inline PutOrganizationConformancePackRequest& WithOrganizationConformancePackName(const char* value) { SetOrganizationConformancePackName(value); return *this;} + ///@} + + ///@{ + /** + *

Location of file containing the template body. The uri must point to the + * conformance pack template (max size: 300 KB).

You must have access + * to read Amazon S3 bucket. In addition, in order to ensure a successful + * deployment, the template object must not be in an archived + * storage class if this parameter is passed.

+ */ + inline const Aws::String& GetTemplateS3Uri() const{ return m_templateS3Uri; } + inline bool TemplateS3UriHasBeenSet() const { return m_templateS3UriHasBeenSet; } + inline void SetTemplateS3Uri(const Aws::String& value) { m_templateS3UriHasBeenSet = true; m_templateS3Uri = value; } + inline void SetTemplateS3Uri(Aws::String&& value) { m_templateS3UriHasBeenSet = true; m_templateS3Uri = std::move(value); } + inline void SetTemplateS3Uri(const char* value) { m_templateS3UriHasBeenSet = true; m_templateS3Uri.assign(value); } + inline PutOrganizationConformancePackRequest& WithTemplateS3Uri(const Aws::String& value) { SetTemplateS3Uri(value); return *this;} + inline PutOrganizationConformancePackRequest& WithTemplateS3Uri(Aws::String&& value) { SetTemplateS3Uri(std::move(value)); return *this;} + inline PutOrganizationConformancePackRequest& WithTemplateS3Uri(const char* value) { SetTemplateS3Uri(value); return *this;} + ///@} + + ///@{ + /** + *

A string containing full conformance pack template body. Structure containing + * the template body with a minimum length of 1 byte and a maximum length of 51,200 + * bytes.

+ */ + inline const Aws::String& GetTemplateBody() const{ return m_templateBody; } + inline bool TemplateBodyHasBeenSet() const { return m_templateBodyHasBeenSet; } + inline void SetTemplateBody(const Aws::String& value) { m_templateBodyHasBeenSet = true; m_templateBody = value; } + inline void SetTemplateBody(Aws::String&& value) { m_templateBodyHasBeenSet = true; m_templateBody = std::move(value); } + inline void SetTemplateBody(const char* value) { m_templateBodyHasBeenSet = true; m_templateBody.assign(value); } + inline PutOrganizationConformancePackRequest& WithTemplateBody(const Aws::String& value) { SetTemplateBody(value); return *this;} + inline PutOrganizationConformancePackRequest& WithTemplateBody(Aws::String&& value) { SetTemplateBody(std::move(value)); return *this;} + inline PutOrganizationConformancePackRequest& WithTemplateBody(const char* value) { SetTemplateBody(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the Amazon S3 bucket where Config stores conformance pack + * templates.

This field is optional. If used, it must be prefixed + * with awsconfigconforms.

+ */ + inline const Aws::String& GetDeliveryS3Bucket() const{ return m_deliveryS3Bucket; } + inline bool DeliveryS3BucketHasBeenSet() const { return m_deliveryS3BucketHasBeenSet; } + inline void SetDeliveryS3Bucket(const Aws::String& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = value; } + inline void SetDeliveryS3Bucket(Aws::String&& value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket = std::move(value); } + inline void SetDeliveryS3Bucket(const char* value) { m_deliveryS3BucketHasBeenSet = true; m_deliveryS3Bucket.assign(value); } + inline PutOrganizationConformancePackRequest& WithDeliveryS3Bucket(const Aws::String& value) { SetDeliveryS3Bucket(value); return *this;} + inline PutOrganizationConformancePackRequest& WithDeliveryS3Bucket(Aws::String&& value) { SetDeliveryS3Bucket(std::move(value)); return *this;} + inline PutOrganizationConformancePackRequest& WithDeliveryS3Bucket(const char* value) { SetDeliveryS3Bucket(value); return *this;} + ///@} + + ///@{ + /** + *

The prefix for the Amazon S3 bucket.

This field is + * optional.

+ */ + inline const Aws::String& GetDeliveryS3KeyPrefix() const{ return m_deliveryS3KeyPrefix; } + inline bool DeliveryS3KeyPrefixHasBeenSet() const { return m_deliveryS3KeyPrefixHasBeenSet; } + inline void SetDeliveryS3KeyPrefix(const Aws::String& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = value; } + inline void SetDeliveryS3KeyPrefix(Aws::String&& value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix = std::move(value); } + inline void SetDeliveryS3KeyPrefix(const char* value) { m_deliveryS3KeyPrefixHasBeenSet = true; m_deliveryS3KeyPrefix.assign(value); } + inline PutOrganizationConformancePackRequest& WithDeliveryS3KeyPrefix(const Aws::String& value) { SetDeliveryS3KeyPrefix(value); return *this;} + inline PutOrganizationConformancePackRequest& WithDeliveryS3KeyPrefix(Aws::String&& value) { SetDeliveryS3KeyPrefix(std::move(value)); return *this;} + inline PutOrganizationConformancePackRequest& WithDeliveryS3KeyPrefix(const char* value) { SetDeliveryS3KeyPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

A list of ConformancePackInputParameter objects.

+ */ + inline const Aws::Vector& GetConformancePackInputParameters() const{ return m_conformancePackInputParameters; } + inline bool ConformancePackInputParametersHasBeenSet() const { return m_conformancePackInputParametersHasBeenSet; } + inline void SetConformancePackInputParameters(const Aws::Vector& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = value; } + inline void SetConformancePackInputParameters(Aws::Vector&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters = std::move(value); } + inline PutOrganizationConformancePackRequest& WithConformancePackInputParameters(const Aws::Vector& value) { SetConformancePackInputParameters(value); return *this;} + inline PutOrganizationConformancePackRequest& WithConformancePackInputParameters(Aws::Vector&& value) { SetConformancePackInputParameters(std::move(value)); return *this;} + inline PutOrganizationConformancePackRequest& AddConformancePackInputParameters(const ConformancePackInputParameter& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(value); return *this; } + inline PutOrganizationConformancePackRequest& AddConformancePackInputParameters(ConformancePackInputParameter&& value) { m_conformancePackInputParametersHasBeenSet = true; m_conformancePackInputParameters.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A list of Amazon Web Services accounts to be excluded from an organization + * conformance pack while deploying a conformance pack.

+ */ + inline const Aws::Vector& GetExcludedAccounts() const{ return m_excludedAccounts; } + inline bool ExcludedAccountsHasBeenSet() const { return m_excludedAccountsHasBeenSet; } + inline void SetExcludedAccounts(const Aws::Vector& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = value; } + inline void SetExcludedAccounts(Aws::Vector&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts = std::move(value); } + inline PutOrganizationConformancePackRequest& WithExcludedAccounts(const Aws::Vector& value) { SetExcludedAccounts(value); return *this;} + inline PutOrganizationConformancePackRequest& WithExcludedAccounts(Aws::Vector&& value) { SetExcludedAccounts(std::move(value)); return *this;} + inline PutOrganizationConformancePackRequest& AddExcludedAccounts(const Aws::String& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + inline PutOrganizationConformancePackRequest& AddExcludedAccounts(Aws::String&& value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(std::move(value)); return *this; } + inline PutOrganizationConformancePackRequest& AddExcludedAccounts(const char* value) { m_excludedAccountsHasBeenSet = true; m_excludedAccounts.push_back(value); return *this; } + ///@} + private: + + Aws::String m_organizationConformancePackName; + bool m_organizationConformancePackNameHasBeenSet = false; + + Aws::String m_templateS3Uri; + bool m_templateS3UriHasBeenSet = false; + + Aws::String m_templateBody; + bool m_templateBodyHasBeenSet = false; + + Aws::String m_deliveryS3Bucket; + bool m_deliveryS3BucketHasBeenSet = false; + + Aws::String m_deliveryS3KeyPrefix; + bool m_deliveryS3KeyPrefixHasBeenSet = false; + + Aws::Vector m_conformancePackInputParameters; + bool m_conformancePackInputParametersHasBeenSet = false; + + Aws::Vector m_excludedAccounts; + bool m_excludedAccountsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutOrganizationConformancePackResult.h b/include/aws/config/model/PutOrganizationConformancePackResult.h new file mode 100644 index 0000000000000000000000000000000000000000..712af7ec53c305d6c6827de1d8fcef6ed19badcc --- /dev/null +++ b/include/aws/config/model/PutOrganizationConformancePackResult.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutOrganizationConformancePackResult + { + public: + AWS_CONFIGSERVICE_API PutOrganizationConformancePackResult(); + AWS_CONFIGSERVICE_API PutOrganizationConformancePackResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutOrganizationConformancePackResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

ARN of the organization conformance pack.

+ */ + inline const Aws::String& GetOrganizationConformancePackArn() const{ return m_organizationConformancePackArn; } + inline void SetOrganizationConformancePackArn(const Aws::String& value) { m_organizationConformancePackArn = value; } + inline void SetOrganizationConformancePackArn(Aws::String&& value) { m_organizationConformancePackArn = std::move(value); } + inline void SetOrganizationConformancePackArn(const char* value) { m_organizationConformancePackArn.assign(value); } + inline PutOrganizationConformancePackResult& WithOrganizationConformancePackArn(const Aws::String& value) { SetOrganizationConformancePackArn(value); return *this;} + inline PutOrganizationConformancePackResult& WithOrganizationConformancePackArn(Aws::String&& value) { SetOrganizationConformancePackArn(std::move(value)); return *this;} + inline PutOrganizationConformancePackResult& WithOrganizationConformancePackArn(const char* value) { SetOrganizationConformancePackArn(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutOrganizationConformancePackResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutOrganizationConformancePackResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutOrganizationConformancePackResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_organizationConformancePackArn; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutRemediationConfigurationsRequest.h b/include/aws/config/model/PutRemediationConfigurationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f68205c44feb04b008093ac09cf71560125c521f --- /dev/null +++ b/include/aws/config/model/PutRemediationConfigurationsRequest.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutRemediationConfigurationsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutRemediationConfigurationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutRemediationConfigurations"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of remediation configuration objects.

+ */ + inline const Aws::Vector& GetRemediationConfigurations() const{ return m_remediationConfigurations; } + inline bool RemediationConfigurationsHasBeenSet() const { return m_remediationConfigurationsHasBeenSet; } + inline void SetRemediationConfigurations(const Aws::Vector& value) { m_remediationConfigurationsHasBeenSet = true; m_remediationConfigurations = value; } + inline void SetRemediationConfigurations(Aws::Vector&& value) { m_remediationConfigurationsHasBeenSet = true; m_remediationConfigurations = std::move(value); } + inline PutRemediationConfigurationsRequest& WithRemediationConfigurations(const Aws::Vector& value) { SetRemediationConfigurations(value); return *this;} + inline PutRemediationConfigurationsRequest& WithRemediationConfigurations(Aws::Vector&& value) { SetRemediationConfigurations(std::move(value)); return *this;} + inline PutRemediationConfigurationsRequest& AddRemediationConfigurations(const RemediationConfiguration& value) { m_remediationConfigurationsHasBeenSet = true; m_remediationConfigurations.push_back(value); return *this; } + inline PutRemediationConfigurationsRequest& AddRemediationConfigurations(RemediationConfiguration&& value) { m_remediationConfigurationsHasBeenSet = true; m_remediationConfigurations.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_remediationConfigurations; + bool m_remediationConfigurationsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutRemediationConfigurationsResult.h b/include/aws/config/model/PutRemediationConfigurationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..2b9e51b93e28d1d1caa58a3736ddd5c66983085a --- /dev/null +++ b/include/aws/config/model/PutRemediationConfigurationsResult.h @@ -0,0 +1,69 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutRemediationConfigurationsResult + { + public: + AWS_CONFIGSERVICE_API PutRemediationConfigurationsResult(); + AWS_CONFIGSERVICE_API PutRemediationConfigurationsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutRemediationConfigurationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of failed remediation batch objects.

+ */ + inline const Aws::Vector& GetFailedBatches() const{ return m_failedBatches; } + inline void SetFailedBatches(const Aws::Vector& value) { m_failedBatches = value; } + inline void SetFailedBatches(Aws::Vector&& value) { m_failedBatches = std::move(value); } + inline PutRemediationConfigurationsResult& WithFailedBatches(const Aws::Vector& value) { SetFailedBatches(value); return *this;} + inline PutRemediationConfigurationsResult& WithFailedBatches(Aws::Vector&& value) { SetFailedBatches(std::move(value)); return *this;} + inline PutRemediationConfigurationsResult& AddFailedBatches(const FailedRemediationBatch& value) { m_failedBatches.push_back(value); return *this; } + inline PutRemediationConfigurationsResult& AddFailedBatches(FailedRemediationBatch&& value) { m_failedBatches.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutRemediationConfigurationsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutRemediationConfigurationsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutRemediationConfigurationsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_failedBatches; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutRemediationExceptionsRequest.h b/include/aws/config/model/PutRemediationExceptionsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5f5c3da7ce1a9e6cb3eee1bfdec73344e2c0c3f8 --- /dev/null +++ b/include/aws/config/model/PutRemediationExceptionsRequest.h @@ -0,0 +1,113 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutRemediationExceptionsRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutRemediationExceptionsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutRemediationExceptions"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the Config rule for which you want to create remediation + * exception.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline PutRemediationExceptionsRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline PutRemediationExceptionsRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline PutRemediationExceptionsRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

An exception list of resource exception keys to be processed with the current + * request. Config adds exception for each resource key. For example, Config adds 3 + * exceptions for 3 resource keys.

+ */ + inline const Aws::Vector& GetResourceKeys() const{ return m_resourceKeys; } + inline bool ResourceKeysHasBeenSet() const { return m_resourceKeysHasBeenSet; } + inline void SetResourceKeys(const Aws::Vector& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = value; } + inline void SetResourceKeys(Aws::Vector&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = std::move(value); } + inline PutRemediationExceptionsRequest& WithResourceKeys(const Aws::Vector& value) { SetResourceKeys(value); return *this;} + inline PutRemediationExceptionsRequest& WithResourceKeys(Aws::Vector&& value) { SetResourceKeys(std::move(value)); return *this;} + inline PutRemediationExceptionsRequest& AddResourceKeys(const RemediationExceptionResourceKey& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(value); return *this; } + inline PutRemediationExceptionsRequest& AddResourceKeys(RemediationExceptionResourceKey&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The message contains an explanation of the exception.

+ */ + inline const Aws::String& GetMessage() const{ return m_message; } + inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } + inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } + inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } + inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } + inline PutRemediationExceptionsRequest& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} + inline PutRemediationExceptionsRequest& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} + inline PutRemediationExceptionsRequest& WithMessage(const char* value) { SetMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The exception is automatically deleted after the expiration date.

+ */ + inline const Aws::Utils::DateTime& GetExpirationTime() const{ return m_expirationTime; } + inline bool ExpirationTimeHasBeenSet() const { return m_expirationTimeHasBeenSet; } + inline void SetExpirationTime(const Aws::Utils::DateTime& value) { m_expirationTimeHasBeenSet = true; m_expirationTime = value; } + inline void SetExpirationTime(Aws::Utils::DateTime&& value) { m_expirationTimeHasBeenSet = true; m_expirationTime = std::move(value); } + inline PutRemediationExceptionsRequest& WithExpirationTime(const Aws::Utils::DateTime& value) { SetExpirationTime(value); return *this;} + inline PutRemediationExceptionsRequest& WithExpirationTime(Aws::Utils::DateTime&& value) { SetExpirationTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::Vector m_resourceKeys; + bool m_resourceKeysHasBeenSet = false; + + Aws::String m_message; + bool m_messageHasBeenSet = false; + + Aws::Utils::DateTime m_expirationTime; + bool m_expirationTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutRemediationExceptionsResult.h b/include/aws/config/model/PutRemediationExceptionsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..5b18f3f201dee6f93079b6a677f529898db851cf --- /dev/null +++ b/include/aws/config/model/PutRemediationExceptionsResult.h @@ -0,0 +1,70 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutRemediationExceptionsResult + { + public: + AWS_CONFIGSERVICE_API PutRemediationExceptionsResult(); + AWS_CONFIGSERVICE_API PutRemediationExceptionsResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutRemediationExceptionsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a list of failed remediation exceptions batch objects. Each object in + * the batch consists of a list of failed items and failure messages.

+ */ + inline const Aws::Vector& GetFailedBatches() const{ return m_failedBatches; } + inline void SetFailedBatches(const Aws::Vector& value) { m_failedBatches = value; } + inline void SetFailedBatches(Aws::Vector&& value) { m_failedBatches = std::move(value); } + inline PutRemediationExceptionsResult& WithFailedBatches(const Aws::Vector& value) { SetFailedBatches(value); return *this;} + inline PutRemediationExceptionsResult& WithFailedBatches(Aws::Vector&& value) { SetFailedBatches(std::move(value)); return *this;} + inline PutRemediationExceptionsResult& AddFailedBatches(const FailedRemediationExceptionBatch& value) { m_failedBatches.push_back(value); return *this; } + inline PutRemediationExceptionsResult& AddFailedBatches(FailedRemediationExceptionBatch&& value) { m_failedBatches.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutRemediationExceptionsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutRemediationExceptionsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutRemediationExceptionsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_failedBatches; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutResourceConfigRequest.h b/include/aws/config/model/PutResourceConfigRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..58556c018f5f457f1eb7b0937283f12ad616b1bd --- /dev/null +++ b/include/aws/config/model/PutResourceConfigRequest.h @@ -0,0 +1,157 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutResourceConfigRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutResourceConfigRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutResourceConfig"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The type of the resource. The custom resource type must be registered with + * CloudFormation.

You cannot use the organization names “amzn”, + * “amazon”, “alexa”, “custom” with custom resource types. It is the first part of + * the ResourceType up to the first ::.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline PutResourceConfigRequest& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline PutResourceConfigRequest& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline PutResourceConfigRequest& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

Version of the schema registered for the ResourceType in CloudFormation.

+ */ + inline const Aws::String& GetSchemaVersionId() const{ return m_schemaVersionId; } + inline bool SchemaVersionIdHasBeenSet() const { return m_schemaVersionIdHasBeenSet; } + inline void SetSchemaVersionId(const Aws::String& value) { m_schemaVersionIdHasBeenSet = true; m_schemaVersionId = value; } + inline void SetSchemaVersionId(Aws::String&& value) { m_schemaVersionIdHasBeenSet = true; m_schemaVersionId = std::move(value); } + inline void SetSchemaVersionId(const char* value) { m_schemaVersionIdHasBeenSet = true; m_schemaVersionId.assign(value); } + inline PutResourceConfigRequest& WithSchemaVersionId(const Aws::String& value) { SetSchemaVersionId(value); return *this;} + inline PutResourceConfigRequest& WithSchemaVersionId(Aws::String&& value) { SetSchemaVersionId(std::move(value)); return *this;} + inline PutResourceConfigRequest& WithSchemaVersionId(const char* value) { SetSchemaVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Unique identifier of the resource.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline PutResourceConfigRequest& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline PutResourceConfigRequest& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline PutResourceConfigRequest& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

Name of the resource.

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline PutResourceConfigRequest& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline PutResourceConfigRequest& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline PutResourceConfigRequest& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + + ///@{ + /** + *

The configuration object of the resource in valid JSON format. It must match + * the schema registered with CloudFormation.

The configuration JSON + * must not exceed 64 KB.

+ */ + inline const Aws::String& GetConfiguration() const{ return m_configuration; } + inline bool ConfigurationHasBeenSet() const { return m_configurationHasBeenSet; } + inline void SetConfiguration(const Aws::String& value) { m_configurationHasBeenSet = true; m_configuration = value; } + inline void SetConfiguration(Aws::String&& value) { m_configurationHasBeenSet = true; m_configuration = std::move(value); } + inline void SetConfiguration(const char* value) { m_configurationHasBeenSet = true; m_configuration.assign(value); } + inline PutResourceConfigRequest& WithConfiguration(const Aws::String& value) { SetConfiguration(value); return *this;} + inline PutResourceConfigRequest& WithConfiguration(Aws::String&& value) { SetConfiguration(std::move(value)); return *this;} + inline PutResourceConfigRequest& WithConfiguration(const char* value) { SetConfiguration(value); return *this;} + ///@} + + ///@{ + /** + *

Tags associated with the resource.

This field is not to be + * confused with the Amazon Web Services-wide tag feature for Amazon Web Services + * resources. Tags for PutResourceConfig are tags that you supply for + * the configuration items of your custom resources.

+ */ + inline const Aws::Map& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Map& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Map&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline PutResourceConfigRequest& WithTags(const Aws::Map& value) { SetTags(value); return *this;} + inline PutResourceConfigRequest& WithTags(Aws::Map&& value) { SetTags(std::move(value)); return *this;} + inline PutResourceConfigRequest& AddTags(const Aws::String& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + inline PutResourceConfigRequest& AddTags(Aws::String&& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline PutResourceConfigRequest& AddTags(const Aws::String& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline PutResourceConfigRequest& AddTags(Aws::String&& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), std::move(value)); return *this; } + inline PutResourceConfigRequest& AddTags(const char* key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline PutResourceConfigRequest& AddTags(Aws::String&& key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline PutResourceConfigRequest& AddTags(const char* key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_schemaVersionId; + bool m_schemaVersionIdHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + + Aws::String m_configuration; + bool m_configurationHasBeenSet = false; + + Aws::Map m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutRetentionConfigurationRequest.h b/include/aws/config/model/PutRetentionConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5e1c252e026692d8b7e888c8e777e2e1ddab6628 --- /dev/null +++ b/include/aws/config/model/PutRetentionConfigurationRequest.h @@ -0,0 +1,53 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutRetentionConfigurationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutRetentionConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutRetentionConfiguration"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Number of days Config stores your historical information.

+ *

Currently, only applicable to the configuration item history.

+ */ + inline int GetRetentionPeriodInDays() const{ return m_retentionPeriodInDays; } + inline bool RetentionPeriodInDaysHasBeenSet() const { return m_retentionPeriodInDaysHasBeenSet; } + inline void SetRetentionPeriodInDays(int value) { m_retentionPeriodInDaysHasBeenSet = true; m_retentionPeriodInDays = value; } + inline PutRetentionConfigurationRequest& WithRetentionPeriodInDays(int value) { SetRetentionPeriodInDays(value); return *this;} + ///@} + private: + + int m_retentionPeriodInDays; + bool m_retentionPeriodInDaysHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutRetentionConfigurationResult.h b/include/aws/config/model/PutRetentionConfigurationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f63022c270516255d3b9dd359852c3241d1877d8 --- /dev/null +++ b/include/aws/config/model/PutRetentionConfigurationResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutRetentionConfigurationResult + { + public: + AWS_CONFIGSERVICE_API PutRetentionConfigurationResult(); + AWS_CONFIGSERVICE_API PutRetentionConfigurationResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutRetentionConfigurationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a retention configuration object.

+ */ + inline const RetentionConfiguration& GetRetentionConfiguration() const{ return m_retentionConfiguration; } + inline void SetRetentionConfiguration(const RetentionConfiguration& value) { m_retentionConfiguration = value; } + inline void SetRetentionConfiguration(RetentionConfiguration&& value) { m_retentionConfiguration = std::move(value); } + inline PutRetentionConfigurationResult& WithRetentionConfiguration(const RetentionConfiguration& value) { SetRetentionConfiguration(value); return *this;} + inline PutRetentionConfigurationResult& WithRetentionConfiguration(RetentionConfiguration&& value) { SetRetentionConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutRetentionConfigurationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutRetentionConfigurationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutRetentionConfigurationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RetentionConfiguration m_retentionConfiguration; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutServiceLinkedConfigurationRecorderRequest.h b/include/aws/config/model/PutServiceLinkedConfigurationRecorderRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c29cf47754d9e3612309ec1a75999fda595de243 --- /dev/null +++ b/include/aws/config/model/PutServiceLinkedConfigurationRecorderRequest.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutServiceLinkedConfigurationRecorderRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutServiceLinkedConfigurationRecorderRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutServiceLinkedConfigurationRecorder"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The service principal of the Amazon Web Services service for the + * service-linked configuration recorder that you want to create.

+ */ + inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; } + inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; } + inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; } + inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); } + inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); } + inline PutServiceLinkedConfigurationRecorderRequest& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;} + inline PutServiceLinkedConfigurationRecorderRequest& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;} + inline PutServiceLinkedConfigurationRecorderRequest& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;} + ///@} + + ///@{ + /** + *

The tags for a service-linked configuration recorder. Each tag consists of a + * key and an optional value, both of which you define.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline PutServiceLinkedConfigurationRecorderRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline PutServiceLinkedConfigurationRecorderRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline PutServiceLinkedConfigurationRecorderRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline PutServiceLinkedConfigurationRecorderRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_servicePrincipal; + bool m_servicePrincipalHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutServiceLinkedConfigurationRecorderResult.h b/include/aws/config/model/PutServiceLinkedConfigurationRecorderResult.h new file mode 100644 index 0000000000000000000000000000000000000000..911113a83aa155ce77bde575778b71e642def708 --- /dev/null +++ b/include/aws/config/model/PutServiceLinkedConfigurationRecorderResult.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutServiceLinkedConfigurationRecorderResult + { + public: + AWS_CONFIGSERVICE_API PutServiceLinkedConfigurationRecorderResult(); + AWS_CONFIGSERVICE_API PutServiceLinkedConfigurationRecorderResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutServiceLinkedConfigurationRecorderResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the specified configuration recorder.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline void SetArn(const Aws::String& value) { m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arn.assign(value); } + inline PutServiceLinkedConfigurationRecorderResult& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline PutServiceLinkedConfigurationRecorderResult& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline PutServiceLinkedConfigurationRecorderResult& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the specified configuration recorder.

For service-linked + * configuration recorders, Config automatically assigns a name that has the prefix + * "AWS" to the new service-linked configuration recorder.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline void SetName(const Aws::String& value) { m_name = value; } + inline void SetName(Aws::String&& value) { m_name = std::move(value); } + inline void SetName(const char* value) { m_name.assign(value); } + inline PutServiceLinkedConfigurationRecorderResult& WithName(const Aws::String& value) { SetName(value); return *this;} + inline PutServiceLinkedConfigurationRecorderResult& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline PutServiceLinkedConfigurationRecorderResult& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutServiceLinkedConfigurationRecorderResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutServiceLinkedConfigurationRecorderResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutServiceLinkedConfigurationRecorderResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_arn; + + Aws::String m_name; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutStoredQueryRequest.h b/include/aws/config/model/PutStoredQueryRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..971c13400708781a999a7f363d483fa5143bbb5c --- /dev/null +++ b/include/aws/config/model/PutStoredQueryRequest.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class PutStoredQueryRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API PutStoredQueryRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutStoredQuery"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A list of StoredQuery objects. The mandatory fields are + * QueryName and Expression.

When you are + * creating a query, you must provide a query name and an expression. When you are + * updating a query, you must provide a query name but updating the description is + * optional.

+ */ + inline const StoredQuery& GetStoredQuery() const{ return m_storedQuery; } + inline bool StoredQueryHasBeenSet() const { return m_storedQueryHasBeenSet; } + inline void SetStoredQuery(const StoredQuery& value) { m_storedQueryHasBeenSet = true; m_storedQuery = value; } + inline void SetStoredQuery(StoredQuery&& value) { m_storedQueryHasBeenSet = true; m_storedQuery = std::move(value); } + inline PutStoredQueryRequest& WithStoredQuery(const StoredQuery& value) { SetStoredQuery(value); return *this;} + inline PutStoredQueryRequest& WithStoredQuery(StoredQuery&& value) { SetStoredQuery(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A list of Tags object.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline PutStoredQueryRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline PutStoredQueryRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline PutStoredQueryRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline PutStoredQueryRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + StoredQuery m_storedQuery; + bool m_storedQueryHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/PutStoredQueryResult.h b/include/aws/config/model/PutStoredQueryResult.h new file mode 100644 index 0000000000000000000000000000000000000000..4fce1aed95a77785c9f5d6047f8f451f54492e24 --- /dev/null +++ b/include/aws/config/model/PutStoredQueryResult.h @@ -0,0 +1,68 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class PutStoredQueryResult + { + public: + AWS_CONFIGSERVICE_API PutStoredQueryResult(); + AWS_CONFIGSERVICE_API PutStoredQueryResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API PutStoredQueryResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Amazon Resource Name (ARN) of the query. For example, + * arn:partition:service:region:account-id:resource-type/resource-name/resource-id.

+ */ + inline const Aws::String& GetQueryArn() const{ return m_queryArn; } + inline void SetQueryArn(const Aws::String& value) { m_queryArn = value; } + inline void SetQueryArn(Aws::String&& value) { m_queryArn = std::move(value); } + inline void SetQueryArn(const char* value) { m_queryArn.assign(value); } + inline PutStoredQueryResult& WithQueryArn(const Aws::String& value) { SetQueryArn(value); return *this;} + inline PutStoredQueryResult& WithQueryArn(Aws::String&& value) { SetQueryArn(std::move(value)); return *this;} + inline PutStoredQueryResult& WithQueryArn(const char* value) { SetQueryArn(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutStoredQueryResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutStoredQueryResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutStoredQueryResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_queryArn; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/QueryInfo.h b/include/aws/config/model/QueryInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..5d7526cdc1f07519e5e20b3007eba615e81fafa1 --- /dev/null +++ b/include/aws/config/model/QueryInfo.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Details about the query.

See Also:

AWS + * API Reference

+ */ + class QueryInfo + { + public: + AWS_CONFIGSERVICE_API QueryInfo(); + AWS_CONFIGSERVICE_API QueryInfo(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API QueryInfo& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Returns a FieldInfo object.

+ */ + inline const Aws::Vector& GetSelectFields() const{ return m_selectFields; } + inline bool SelectFieldsHasBeenSet() const { return m_selectFieldsHasBeenSet; } + inline void SetSelectFields(const Aws::Vector& value) { m_selectFieldsHasBeenSet = true; m_selectFields = value; } + inline void SetSelectFields(Aws::Vector&& value) { m_selectFieldsHasBeenSet = true; m_selectFields = std::move(value); } + inline QueryInfo& WithSelectFields(const Aws::Vector& value) { SetSelectFields(value); return *this;} + inline QueryInfo& WithSelectFields(Aws::Vector&& value) { SetSelectFields(std::move(value)); return *this;} + inline QueryInfo& AddSelectFields(const FieldInfo& value) { m_selectFieldsHasBeenSet = true; m_selectFields.push_back(value); return *this; } + inline QueryInfo& AddSelectFields(FieldInfo&& value) { m_selectFieldsHasBeenSet = true; m_selectFields.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_selectFields; + bool m_selectFieldsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecorderStatus.h b/include/aws/config/model/RecorderStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..cb9dac882a9eb5dd4f03e7113ef80ae2c0324397 --- /dev/null +++ b/include/aws/config/model/RecorderStatus.h @@ -0,0 +1,33 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class RecorderStatus + { + NOT_SET, + Pending, + Success, + Failure, + NotApplicable + }; + +namespace RecorderStatusMapper +{ +AWS_CONFIGSERVICE_API RecorderStatus GetRecorderStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForRecorderStatus(RecorderStatus value); +} // namespace RecorderStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecordingFrequency.h b/include/aws/config/model/RecordingFrequency.h new file mode 100644 index 0000000000000000000000000000000000000000..e4dd511cca10ea6122409e935e19b543d0343a85 --- /dev/null +++ b/include/aws/config/model/RecordingFrequency.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class RecordingFrequency + { + NOT_SET, + CONTINUOUS, + DAILY + }; + +namespace RecordingFrequencyMapper +{ +AWS_CONFIGSERVICE_API RecordingFrequency GetRecordingFrequencyForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForRecordingFrequency(RecordingFrequency value); +} // namespace RecordingFrequencyMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecordingGroup.h b/include/aws/config/model/RecordingGroup.h new file mode 100644 index 0000000000000000000000000000000000000000..846122651259a9540bbf3c77d202d7cbb403bff8 --- /dev/null +++ b/include/aws/config/model/RecordingGroup.h @@ -0,0 +1,295 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Specifies which resource types Config records for configuration changes. By + * default, Config records configuration changes for all current and future + * supported resource types in the Amazon Web Services Region where you have + * enabled Config, excluding the global IAM resource types: IAM users, groups, + * roles, and customer managed policies.

In the recording group, you specify + * whether you want to record all supported current and future supported resource + * types or to include or exclude specific resources types. For a list of supported + * resource types, see Supported + * Resource Types in the Config developer guide.

If you don't + * want Config to record all current and future supported resource types (excluding + * the global IAM resource types), use one of the following recording + * strategies:

  1. Record all current and future resource types + * with exclusions (EXCLUSION_BY_RESOURCE_TYPES), or

  2. + *
  3. Record specific resource types + * (INCLUSION_BY_RESOURCE_TYPES).

If you use the + * recording strategy to Record all current and future resource types + * (ALL_SUPPORTED_RESOURCE_TYPES), you can use the flag + * includeGlobalResourceTypes to include the global IAM resource types + * in your recording.

Aurora global clusters are recorded in + * all enabled Regions

The AWS::RDS::GlobalCluster + * resource type will be recorded in all supported Config Regions where the + * configuration recorder is enabled.

If you do not want to record + * AWS::RDS::GlobalCluster in all enabled Regions, use the + * EXCLUSION_BY_RESOURCE_TYPES or + * INCLUSION_BY_RESOURCE_TYPES recording strategy.

+ *

See Also:

AWS + * API Reference

+ */ + class RecordingGroup + { + public: + AWS_CONFIGSERVICE_API RecordingGroup(); + AWS_CONFIGSERVICE_API RecordingGroup(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RecordingGroup& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Specifies whether Config records configuration changes for all supported + * resource types, excluding the global IAM resource types.

If you set this + * field to true, when Config adds support for a new resource type, + * Config starts recording resources of that type automatically.

If you set + * this field to true, you cannot enumerate specific resource types to + * record in the resourceTypes field of RecordingGroup, + * or to exclude in the resourceTypes field of ExclusionByResourceTypes.

+ *

Region availability

Check Resource + * Coverage by Region Availability to see if a resource type is supported in + * the Amazon Web Services Region where you set up Config.

+ */ + inline bool GetAllSupported() const{ return m_allSupported; } + inline bool AllSupportedHasBeenSet() const { return m_allSupportedHasBeenSet; } + inline void SetAllSupported(bool value) { m_allSupportedHasBeenSet = true; m_allSupported = value; } + inline RecordingGroup& WithAllSupported(bool value) { SetAllSupported(value); return *this;} + ///@} + + ///@{ + /** + *

This option is a bundle which only applies to the global IAM resource types: + * IAM users, groups, roles, and customer managed policies. These global IAM + * resource types can only be recorded by Config in Regions where Config was + * available before February 2022. You cannot be record the global IAM resouce + * types in Regions supported by Config after February 2022. For a list of those + * Regions, see Recording + * Amazon Web Services Resources | Global Resources.

+ * Aurora global clusters are recorded in all enabled Regions

The + * AWS::RDS::GlobalCluster resource type will be recorded in all + * supported Config Regions where the configuration recorder is enabled, even if + * includeGlobalResourceTypes is setfalse. The + * includeGlobalResourceTypes option is a bundle which only applies to + * IAM users, groups, roles, and customer managed policies.

If you do not + * want to record AWS::RDS::GlobalCluster in all enabled Regions, use + * one of the following recording strategies:

  1. Record all + * current and future resource types with exclusions + * (EXCLUSION_BY_RESOURCE_TYPES), or

  2. Record + * specific resource types (INCLUSION_BY_RESOURCE_TYPES).

    + *

For more information, see Selecting + * Which Resources are Recorded in the Config developer guide.

+ *

includeGlobalResourceTypes and the exclusion + * recording strategy

The includeGlobalResourceTypes field + * has no impact on the EXCLUSION_BY_RESOURCE_TYPES recording + * strategy. This means that the global IAM resource types (IAM users, groups, + * roles, and customer managed policies) will not be automatically added as + * exclusions for exclusionByResourceTypes when + * includeGlobalResourceTypes is set to false.

The + * includeGlobalResourceTypes field should only be used to modify the + * AllSupported field, as the default for the + * AllSupported field is to record configuration changes for all + * supported resource types excluding the global IAM resource types. To include the + * global IAM resource types when AllSupported is set to + * true, make sure to set includeGlobalResourceTypes to + * true.

To exclude the global IAM resource types for the + * EXCLUSION_BY_RESOURCE_TYPES recording strategy, you need to + * manually add them to the resourceTypes field of + * exclusionByResourceTypes.

Required + * and optional fields

Before you set this field to true, + * set the allSupported field of RecordingGroup + * to true. Optionally, you can set the useOnly field of + * RecordingStrategy + * to ALL_SUPPORTED_RESOURCE_TYPES.

+ * Overriding fields

If you set this field to false but + * list global IAM resource types in the resourceTypes field of RecordingGroup, + * Config will still record configuration changes for those specified resource + * types regardless of if you set the + * includeGlobalResourceTypes field to false.

If you do not + * want to record configuration changes to the global IAM resource types (IAM + * users, groups, roles, and customer managed policies), make sure to not list them + * in the resourceTypes field in addition to setting the + * includeGlobalResourceTypes field to false.

+ */ + inline bool GetIncludeGlobalResourceTypes() const{ return m_includeGlobalResourceTypes; } + inline bool IncludeGlobalResourceTypesHasBeenSet() const { return m_includeGlobalResourceTypesHasBeenSet; } + inline void SetIncludeGlobalResourceTypes(bool value) { m_includeGlobalResourceTypesHasBeenSet = true; m_includeGlobalResourceTypes = value; } + inline RecordingGroup& WithIncludeGlobalResourceTypes(bool value) { SetIncludeGlobalResourceTypes(value); return *this;} + ///@} + + ///@{ + /** + *

A comma-separated list that specifies which resource types Config + * records.

For a list of valid resourceTypes values, see the + * Resource Type Value column in Supported + * Amazon Web Services resource Types in the Config developer guide.

+ *

Required and optional fields

Optionally, you can set + * the useOnly field of RecordingStrategy + * to INCLUSION_BY_RESOURCE_TYPES.

To record all configuration + * changes, set the allSupported field of RecordingGroup + * to true, and either omit this field or don't specify any resource + * types in this field. If you set the allSupported field to + * false and specify values for resourceTypes, when + * Config adds support for a new type of resource, it will not record resources of + * that type unless you manually add that type to your recording group.

+ *

Region availability

Before specifying a resource type + * for Config to track, check Resource + * Coverage by Region Availability to see if the resource type is supported in + * the Amazon Web Services Region where you set up Config. If a resource type is + * supported by Config in at least one Region, you can enable the recording of that + * resource type in all Regions supported by Config, even if the specified resource + * type is not supported in the Amazon Web Services Region where you set up + * Config.

+ */ + inline const Aws::Vector& GetResourceTypes() const{ return m_resourceTypes; } + inline bool ResourceTypesHasBeenSet() const { return m_resourceTypesHasBeenSet; } + inline void SetResourceTypes(const Aws::Vector& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = value; } + inline void SetResourceTypes(Aws::Vector&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = std::move(value); } + inline RecordingGroup& WithResourceTypes(const Aws::Vector& value) { SetResourceTypes(value); return *this;} + inline RecordingGroup& WithResourceTypes(Aws::Vector&& value) { SetResourceTypes(std::move(value)); return *this;} + inline RecordingGroup& AddResourceTypes(const ResourceType& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + inline RecordingGroup& AddResourceTypes(ResourceType&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

An object that specifies how Config excludes resource types from being + * recorded by the configuration recorder.

Required fields + *

To use this option, you must set the useOnly field of RecordingStrategy + * to EXCLUSION_BY_RESOURCE_TYPES.

+ */ + inline const ExclusionByResourceTypes& GetExclusionByResourceTypes() const{ return m_exclusionByResourceTypes; } + inline bool ExclusionByResourceTypesHasBeenSet() const { return m_exclusionByResourceTypesHasBeenSet; } + inline void SetExclusionByResourceTypes(const ExclusionByResourceTypes& value) { m_exclusionByResourceTypesHasBeenSet = true; m_exclusionByResourceTypes = value; } + inline void SetExclusionByResourceTypes(ExclusionByResourceTypes&& value) { m_exclusionByResourceTypesHasBeenSet = true; m_exclusionByResourceTypes = std::move(value); } + inline RecordingGroup& WithExclusionByResourceTypes(const ExclusionByResourceTypes& value) { SetExclusionByResourceTypes(value); return *this;} + inline RecordingGroup& WithExclusionByResourceTypes(ExclusionByResourceTypes&& value) { SetExclusionByResourceTypes(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An object that specifies the recording strategy for the configuration + * recorder.

  • If you set the useOnly field of RecordingStrategy + * to ALL_SUPPORTED_RESOURCE_TYPES, Config records configuration + * changes for all supported resource types, excluding the global IAM resource + * types. You also must set the allSupported field of RecordingGroup + * to true. When Config adds support for a new resource type, Config + * automatically starts recording resources of that type.

  • If you + * set the useOnly field of RecordingStrategy + * to INCLUSION_BY_RESOURCE_TYPES, Config records configuration + * changes for only the resource types you specify in the + * resourceTypes field of RecordingGroup.

    + *
  • If you set the useOnly field of RecordingStrategy + * to EXCLUSION_BY_RESOURCE_TYPES, Config records configuration + * changes for all supported resource types except the resource types that you + * specify to exclude from being recorded in the resourceTypes field + * of ExclusionByResourceTypes.

    + *

Required and optional fields

The + * recordingStrategy field is optional when you set the + * allSupported field of RecordingGroup + * to true.

The recordingStrategy field is + * optional when you list resource types in the resourceTypes field of + * RecordingGroup.

+ *

The recordingStrategy field is required if you list resource + * types to exclude from recording in the resourceTypes field of ExclusionByResourceTypes.

+ *

Overriding fields

If you choose + * EXCLUSION_BY_RESOURCE_TYPES for the recording strategy, the + * exclusionByResourceTypes field will override other properties in + * the request.

For example, even if you set + * includeGlobalResourceTypes to false, global IAM resource types will + * still be automatically recorded in this option unless those resource types are + * specifically listed as exclusions in the resourceTypes field of + * exclusionByResourceTypes.

Global + * resources types and the resource exclusion recording strategy

By + * default, if you choose the EXCLUSION_BY_RESOURCE_TYPES recording + * strategy, when Config adds support for a new resource type in the Region where + * you set up the configuration recorder, including global resource types, Config + * starts recording resources of that type automatically.

Unless + * specifically listed as exclusions, AWS::RDS::GlobalCluster will be + * recorded automatically in all supported Config Regions were the configuration + * recorder is enabled.

IAM users, groups, roles, and customer managed + * policies will be recorded in the Region where you set up the configuration + * recorder if that is a Region where Config was available before February 2022. + * You cannot be record the global IAM resouce types in Regions supported by Config + * after February 2022. For a list of those Regions, see Recording + * Amazon Web Services Resources | Global Resources.

+ */ + inline const RecordingStrategy& GetRecordingStrategy() const{ return m_recordingStrategy; } + inline bool RecordingStrategyHasBeenSet() const { return m_recordingStrategyHasBeenSet; } + inline void SetRecordingStrategy(const RecordingStrategy& value) { m_recordingStrategyHasBeenSet = true; m_recordingStrategy = value; } + inline void SetRecordingStrategy(RecordingStrategy&& value) { m_recordingStrategyHasBeenSet = true; m_recordingStrategy = std::move(value); } + inline RecordingGroup& WithRecordingStrategy(const RecordingStrategy& value) { SetRecordingStrategy(value); return *this;} + inline RecordingGroup& WithRecordingStrategy(RecordingStrategy&& value) { SetRecordingStrategy(std::move(value)); return *this;} + ///@} + private: + + bool m_allSupported; + bool m_allSupportedHasBeenSet = false; + + bool m_includeGlobalResourceTypes; + bool m_includeGlobalResourceTypesHasBeenSet = false; + + Aws::Vector m_resourceTypes; + bool m_resourceTypesHasBeenSet = false; + + ExclusionByResourceTypes m_exclusionByResourceTypes; + bool m_exclusionByResourceTypesHasBeenSet = false; + + RecordingStrategy m_recordingStrategy; + bool m_recordingStrategyHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecordingMode.h b/include/aws/config/model/RecordingMode.h new file mode 100644 index 0000000000000000000000000000000000000000..74caf23e2dbc6c0380c714eadc76135aeadeeb5c --- /dev/null +++ b/include/aws/config/model/RecordingMode.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Specifies the default recording frequency that Config uses to record + * configuration changes. Config supports Continuous recording and Daily + * recording.

  • Continuous recording allows you to record + * configuration changes continuously whenever a change occurs.

  • + *

    Daily recording allows you to receive a configuration item (CI) representing + * the most recent state of your resources over the last 24-hour period, only if + * it’s different from the previous CI recorded.

+ *

Firewall Manager depends on continuous recording to monitor your resources. + * If you are using Firewall Manager, it is recommended that you set the recording + * frequency to Continuous.

You can also override the recording + * frequency for specific resource types.

See Also:

AWS + * API Reference

+ */ + class RecordingMode + { + public: + AWS_CONFIGSERVICE_API RecordingMode(); + AWS_CONFIGSERVICE_API RecordingMode(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RecordingMode& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The default recording frequency that Config uses to record configuration + * changes.

Daily recording cannot be specified for the + * following resource types:

  • + * AWS::Config::ResourceCompliance

  • + * AWS::Config::ConformancePackCompliance

  • + * AWS::Config::ConfigurationRecorder

For the + * allSupported (ALL_SUPPORTED_RESOURCE_TYPES) recording + * strategy, these resource types will be set to Continuous recording.

+ * + */ + inline const RecordingFrequency& GetRecordingFrequency() const{ return m_recordingFrequency; } + inline bool RecordingFrequencyHasBeenSet() const { return m_recordingFrequencyHasBeenSet; } + inline void SetRecordingFrequency(const RecordingFrequency& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = value; } + inline void SetRecordingFrequency(RecordingFrequency&& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = std::move(value); } + inline RecordingMode& WithRecordingFrequency(const RecordingFrequency& value) { SetRecordingFrequency(value); return *this;} + inline RecordingMode& WithRecordingFrequency(RecordingFrequency&& value) { SetRecordingFrequency(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An array of recordingModeOverride objects for you to specify + * your overrides for the recording mode. The recordingModeOverride + * object in the recordingModeOverrides array consists of three + * fields: a description, the new recordingFrequency, and + * an array of resourceTypes to override.

+ */ + inline const Aws::Vector& GetRecordingModeOverrides() const{ return m_recordingModeOverrides; } + inline bool RecordingModeOverridesHasBeenSet() const { return m_recordingModeOverridesHasBeenSet; } + inline void SetRecordingModeOverrides(const Aws::Vector& value) { m_recordingModeOverridesHasBeenSet = true; m_recordingModeOverrides = value; } + inline void SetRecordingModeOverrides(Aws::Vector&& value) { m_recordingModeOverridesHasBeenSet = true; m_recordingModeOverrides = std::move(value); } + inline RecordingMode& WithRecordingModeOverrides(const Aws::Vector& value) { SetRecordingModeOverrides(value); return *this;} + inline RecordingMode& WithRecordingModeOverrides(Aws::Vector&& value) { SetRecordingModeOverrides(std::move(value)); return *this;} + inline RecordingMode& AddRecordingModeOverrides(const RecordingModeOverride& value) { m_recordingModeOverridesHasBeenSet = true; m_recordingModeOverrides.push_back(value); return *this; } + inline RecordingMode& AddRecordingModeOverrides(RecordingModeOverride&& value) { m_recordingModeOverridesHasBeenSet = true; m_recordingModeOverrides.push_back(std::move(value)); return *this; } + ///@} + private: + + RecordingFrequency m_recordingFrequency; + bool m_recordingFrequencyHasBeenSet = false; + + Aws::Vector m_recordingModeOverrides; + bool m_recordingModeOverridesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecordingModeOverride.h b/include/aws/config/model/RecordingModeOverride.h new file mode 100644 index 0000000000000000000000000000000000000000..73e26d4020cd6bae8fc3459394d9b6e901cc4f56 --- /dev/null +++ b/include/aws/config/model/RecordingModeOverride.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object for you to specify your overrides for the recording + * mode.

See Also:

AWS + * API Reference

+ */ + class RecordingModeOverride + { + public: + AWS_CONFIGSERVICE_API RecordingModeOverride(); + AWS_CONFIGSERVICE_API RecordingModeOverride(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RecordingModeOverride& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

A description that you provide for the override.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline RecordingModeOverride& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline RecordingModeOverride& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline RecordingModeOverride& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

A comma-separated list that specifies which resource types Config includes in + * the override.

Daily recording cannot be specified for the + * following resource types:

  • + * AWS::Config::ResourceCompliance

  • + * AWS::Config::ConformancePackCompliance

  • + * AWS::Config::ConfigurationRecorder

+ */ + inline const Aws::Vector& GetResourceTypes() const{ return m_resourceTypes; } + inline bool ResourceTypesHasBeenSet() const { return m_resourceTypesHasBeenSet; } + inline void SetResourceTypes(const Aws::Vector& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = value; } + inline void SetResourceTypes(Aws::Vector&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes = std::move(value); } + inline RecordingModeOverride& WithResourceTypes(const Aws::Vector& value) { SetResourceTypes(value); return *this;} + inline RecordingModeOverride& WithResourceTypes(Aws::Vector&& value) { SetResourceTypes(std::move(value)); return *this;} + inline RecordingModeOverride& AddResourceTypes(const ResourceType& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(value); return *this; } + inline RecordingModeOverride& AddResourceTypes(ResourceType&& value) { m_resourceTypesHasBeenSet = true; m_resourceTypes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The recording frequency that will be applied to all the resource types + * specified in the override.

  • Continuous recording allows you to + * record configuration changes continuously whenever a change occurs.

  • + *
  • Daily recording allows you to receive a configuration item (CI) + * representing the most recent state of your resources over the last 24-hour + * period, only if it’s different from the previous CI recorded.

+ *

Firewall Manager depends on continuous recording to monitor your + * resources. If you are using Firewall Manager, it is recommended that you set the + * recording frequency to Continuous.

+ */ + inline const RecordingFrequency& GetRecordingFrequency() const{ return m_recordingFrequency; } + inline bool RecordingFrequencyHasBeenSet() const { return m_recordingFrequencyHasBeenSet; } + inline void SetRecordingFrequency(const RecordingFrequency& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = value; } + inline void SetRecordingFrequency(RecordingFrequency&& value) { m_recordingFrequencyHasBeenSet = true; m_recordingFrequency = std::move(value); } + inline RecordingModeOverride& WithRecordingFrequency(const RecordingFrequency& value) { SetRecordingFrequency(value); return *this;} + inline RecordingModeOverride& WithRecordingFrequency(RecordingFrequency&& value) { SetRecordingFrequency(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + Aws::Vector m_resourceTypes; + bool m_resourceTypesHasBeenSet = false; + + RecordingFrequency m_recordingFrequency; + bool m_recordingFrequencyHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecordingScope.h b/include/aws/config/model/RecordingScope.h new file mode 100644 index 0000000000000000000000000000000000000000..99bedc18882c43226f5ac393a51ca0ef0b182627 --- /dev/null +++ b/include/aws/config/model/RecordingScope.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class RecordingScope + { + NOT_SET, + INTERNAL, + PAID + }; + +namespace RecordingScopeMapper +{ +AWS_CONFIGSERVICE_API RecordingScope GetRecordingScopeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForRecordingScope(RecordingScope value); +} // namespace RecordingScopeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecordingStrategy.h b/include/aws/config/model/RecordingStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..15e248434fa01816e43080388c6471877cd48a79 --- /dev/null +++ b/include/aws/config/model/RecordingStrategy.h @@ -0,0 +1,113 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Specifies the recording strategy of the configuration recorder.

See + * Also:

AWS + * API Reference

+ */ + class RecordingStrategy + { + public: + AWS_CONFIGSERVICE_API RecordingStrategy(); + AWS_CONFIGSERVICE_API RecordingStrategy(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RecordingStrategy& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The recording strategy for the configuration recorder.

  • If + * you set this option to ALL_SUPPORTED_RESOURCE_TYPES, Config records + * configuration changes for all supported resource types, excluding the global IAM + * resource types. You also must set the allSupported field of RecordingGroup + * to true. When Config adds support for a new resource type, Config + * automatically starts recording resources of that type. For a list of supported + * resource types, see Supported + * Resource Types in the Config developer guide.

  • If + * you set this option to INCLUSION_BY_RESOURCE_TYPES, Config records + * configuration changes for only the resource types that you specify in the + * resourceTypes field of RecordingGroup.

    + *
  • If you set this option to + * EXCLUSION_BY_RESOURCE_TYPES, Config records configuration changes + * for all supported resource types, except the resource types that you specify to + * exclude from being recorded in the resourceTypes field of ExclusionByResourceTypes.

    + *

Required and optional fields

The + * recordingStrategy field is optional when you set the + * allSupported field of RecordingGroup + * to true.

The recordingStrategy field is + * optional when you list resource types in the resourceTypes field of + * RecordingGroup.

+ *

The recordingStrategy field is required if you list resource + * types to exclude from recording in the resourceTypes field of ExclusionByResourceTypes.

+ *

Overriding fields

If you choose + * EXCLUSION_BY_RESOURCE_TYPES for the recording strategy, the + * exclusionByResourceTypes field will override other properties in + * the request.

For example, even if you set + * includeGlobalResourceTypes to false, global IAM resource types will + * still be automatically recorded in this option unless those resource types are + * specifically listed as exclusions in the resourceTypes field of + * exclusionByResourceTypes.

Global resource + * types and the exclusion recording strategy

By default, if you choose + * the EXCLUSION_BY_RESOURCE_TYPES recording strategy, when Config + * adds support for a new resource type in the Region where you set up the + * configuration recorder, including global resource types, Config starts recording + * resources of that type automatically.

Unless specifically listed as + * exclusions, AWS::RDS::GlobalCluster will be recorded automatically + * in all supported Config Regions were the configuration recorder is enabled.

+ *

IAM users, groups, roles, and customer managed policies will be recorded in + * the Region where you set up the configuration recorder if that is a Region where + * Config was available before February 2022. You cannot be record the global IAM + * resouce types in Regions supported by Config after February 2022. This list + * where you cannot record the global IAM resource types includes the following + * Regions:

  • Asia Pacific (Hyderabad)

  • Asia + * Pacific (Melbourne)

  • Canada West (Calgary)

  • + *

    Europe (Spain)

  • Europe (Zurich)

  • Israel + * (Tel Aviv)

  • Middle East (UAE)

+ */ + inline const RecordingStrategyType& GetUseOnly() const{ return m_useOnly; } + inline bool UseOnlyHasBeenSet() const { return m_useOnlyHasBeenSet; } + inline void SetUseOnly(const RecordingStrategyType& value) { m_useOnlyHasBeenSet = true; m_useOnly = value; } + inline void SetUseOnly(RecordingStrategyType&& value) { m_useOnlyHasBeenSet = true; m_useOnly = std::move(value); } + inline RecordingStrategy& WithUseOnly(const RecordingStrategyType& value) { SetUseOnly(value); return *this;} + inline RecordingStrategy& WithUseOnly(RecordingStrategyType&& value) { SetUseOnly(std::move(value)); return *this;} + ///@} + private: + + RecordingStrategyType m_useOnly; + bool m_useOnlyHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RecordingStrategyType.h b/include/aws/config/model/RecordingStrategyType.h new file mode 100644 index 0000000000000000000000000000000000000000..aa595a8a380feb7d85a903c6e648d07159aa7674 --- /dev/null +++ b/include/aws/config/model/RecordingStrategyType.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class RecordingStrategyType + { + NOT_SET, + ALL_SUPPORTED_RESOURCE_TYPES, + INCLUSION_BY_RESOURCE_TYPES, + EXCLUSION_BY_RESOURCE_TYPES + }; + +namespace RecordingStrategyTypeMapper +{ +AWS_CONFIGSERVICE_API RecordingStrategyType GetRecordingStrategyTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForRecordingStrategyType(RecordingStrategyType value); +} // namespace RecordingStrategyTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/Relationship.h b/include/aws/config/model/Relationship.h new file mode 100644 index 0000000000000000000000000000000000000000..72c8e577a333ba01cc3a88a5726e48160ab1ece4 --- /dev/null +++ b/include/aws/config/model/Relationship.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The relationship of the related resource to the main resource.

See + * Also:

AWS + * API Reference

+ */ + class Relationship + { + public: + AWS_CONFIGSERVICE_API Relationship(); + AWS_CONFIGSERVICE_API Relationship(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Relationship& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The resource type of the related resource.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline Relationship& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline Relationship& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The ID of the related resource (for example, sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline Relationship& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline Relationship& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline Relationship& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The custom name of the related resource, if available.

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline Relationship& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline Relationship& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline Relationship& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + + ///@{ + /** + *

The type of relationship with the related resource.

+ */ + inline const Aws::String& GetRelationshipName() const{ return m_relationshipName; } + inline bool RelationshipNameHasBeenSet() const { return m_relationshipNameHasBeenSet; } + inline void SetRelationshipName(const Aws::String& value) { m_relationshipNameHasBeenSet = true; m_relationshipName = value; } + inline void SetRelationshipName(Aws::String&& value) { m_relationshipNameHasBeenSet = true; m_relationshipName = std::move(value); } + inline void SetRelationshipName(const char* value) { m_relationshipNameHasBeenSet = true; m_relationshipName.assign(value); } + inline Relationship& WithRelationshipName(const Aws::String& value) { SetRelationshipName(value); return *this;} + inline Relationship& WithRelationshipName(Aws::String&& value) { SetRelationshipName(std::move(value)); return *this;} + inline Relationship& WithRelationshipName(const char* value) { SetRelationshipName(value); return *this;} + ///@} + private: + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + + Aws::String m_relationshipName; + bool m_relationshipNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationConfiguration.h b/include/aws/config/model/RemediationConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..15bbbd94d4b7e4a4c01ad084e9554aa5a9933d54 --- /dev/null +++ b/include/aws/config/model/RemediationConfiguration.h @@ -0,0 +1,258 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that represents the details about the remediation configuration + * that includes the remediation action, parameters, and data to execute the + * action.

See Also:

AWS + * API Reference

+ */ + class RemediationConfiguration + { + public: + AWS_CONFIGSERVICE_API RemediationConfiguration(); + AWS_CONFIGSERVICE_API RemediationConfiguration(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RemediationConfiguration& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline RemediationConfiguration& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline RemediationConfiguration& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline RemediationConfiguration& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The type of the target. Target executes remediation. For example, SSM + * document.

+ */ + inline const RemediationTargetType& GetTargetType() const{ return m_targetType; } + inline bool TargetTypeHasBeenSet() const { return m_targetTypeHasBeenSet; } + inline void SetTargetType(const RemediationTargetType& value) { m_targetTypeHasBeenSet = true; m_targetType = value; } + inline void SetTargetType(RemediationTargetType&& value) { m_targetTypeHasBeenSet = true; m_targetType = std::move(value); } + inline RemediationConfiguration& WithTargetType(const RemediationTargetType& value) { SetTargetType(value); return *this;} + inline RemediationConfiguration& WithTargetType(RemediationTargetType&& value) { SetTargetType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Target ID is the name of the SSM document.

+ */ + inline const Aws::String& GetTargetId() const{ return m_targetId; } + inline bool TargetIdHasBeenSet() const { return m_targetIdHasBeenSet; } + inline void SetTargetId(const Aws::String& value) { m_targetIdHasBeenSet = true; m_targetId = value; } + inline void SetTargetId(Aws::String&& value) { m_targetIdHasBeenSet = true; m_targetId = std::move(value); } + inline void SetTargetId(const char* value) { m_targetIdHasBeenSet = true; m_targetId.assign(value); } + inline RemediationConfiguration& WithTargetId(const Aws::String& value) { SetTargetId(value); return *this;} + inline RemediationConfiguration& WithTargetId(Aws::String&& value) { SetTargetId(std::move(value)); return *this;} + inline RemediationConfiguration& WithTargetId(const char* value) { SetTargetId(value); return *this;} + ///@} + + ///@{ + /** + *

Version of the target. For example, version of the SSM document.

+ *

If you make backward incompatible changes to the SSM document, you must call + * PutRemediationConfiguration API again to ensure the remediations can run.

+ * + */ + inline const Aws::String& GetTargetVersion() const{ return m_targetVersion; } + inline bool TargetVersionHasBeenSet() const { return m_targetVersionHasBeenSet; } + inline void SetTargetVersion(const Aws::String& value) { m_targetVersionHasBeenSet = true; m_targetVersion = value; } + inline void SetTargetVersion(Aws::String&& value) { m_targetVersionHasBeenSet = true; m_targetVersion = std::move(value); } + inline void SetTargetVersion(const char* value) { m_targetVersionHasBeenSet = true; m_targetVersion.assign(value); } + inline RemediationConfiguration& WithTargetVersion(const Aws::String& value) { SetTargetVersion(value); return *this;} + inline RemediationConfiguration& WithTargetVersion(Aws::String&& value) { SetTargetVersion(std::move(value)); return *this;} + inline RemediationConfiguration& WithTargetVersion(const char* value) { SetTargetVersion(value); return *this;} + ///@} + + ///@{ + /** + *

An object of the RemediationParameterValue.

+ */ + inline const Aws::Map& GetParameters() const{ return m_parameters; } + inline bool ParametersHasBeenSet() const { return m_parametersHasBeenSet; } + inline void SetParameters(const Aws::Map& value) { m_parametersHasBeenSet = true; m_parameters = value; } + inline void SetParameters(Aws::Map&& value) { m_parametersHasBeenSet = true; m_parameters = std::move(value); } + inline RemediationConfiguration& WithParameters(const Aws::Map& value) { SetParameters(value); return *this;} + inline RemediationConfiguration& WithParameters(Aws::Map&& value) { SetParameters(std::move(value)); return *this;} + inline RemediationConfiguration& AddParameters(const Aws::String& key, const RemediationParameterValue& value) { m_parametersHasBeenSet = true; m_parameters.emplace(key, value); return *this; } + inline RemediationConfiguration& AddParameters(Aws::String&& key, const RemediationParameterValue& value) { m_parametersHasBeenSet = true; m_parameters.emplace(std::move(key), value); return *this; } + inline RemediationConfiguration& AddParameters(const Aws::String& key, RemediationParameterValue&& value) { m_parametersHasBeenSet = true; m_parameters.emplace(key, std::move(value)); return *this; } + inline RemediationConfiguration& AddParameters(Aws::String&& key, RemediationParameterValue&& value) { m_parametersHasBeenSet = true; m_parameters.emplace(std::move(key), std::move(value)); return *this; } + inline RemediationConfiguration& AddParameters(const char* key, RemediationParameterValue&& value) { m_parametersHasBeenSet = true; m_parameters.emplace(key, std::move(value)); return *this; } + inline RemediationConfiguration& AddParameters(const char* key, const RemediationParameterValue& value) { m_parametersHasBeenSet = true; m_parameters.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

The type of a resource.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline RemediationConfiguration& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline RemediationConfiguration& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline RemediationConfiguration& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The remediation is triggered automatically.

+ */ + inline bool GetAutomatic() const{ return m_automatic; } + inline bool AutomaticHasBeenSet() const { return m_automaticHasBeenSet; } + inline void SetAutomatic(bool value) { m_automaticHasBeenSet = true; m_automatic = value; } + inline RemediationConfiguration& WithAutomatic(bool value) { SetAutomatic(value); return *this;} + ///@} + + ///@{ + /** + *

An ExecutionControls object.

+ */ + inline const ExecutionControls& GetExecutionControls() const{ return m_executionControls; } + inline bool ExecutionControlsHasBeenSet() const { return m_executionControlsHasBeenSet; } + inline void SetExecutionControls(const ExecutionControls& value) { m_executionControlsHasBeenSet = true; m_executionControls = value; } + inline void SetExecutionControls(ExecutionControls&& value) { m_executionControlsHasBeenSet = true; m_executionControls = std::move(value); } + inline RemediationConfiguration& WithExecutionControls(const ExecutionControls& value) { SetExecutionControls(value); return *this;} + inline RemediationConfiguration& WithExecutionControls(ExecutionControls&& value) { SetExecutionControls(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of failed attempts for auto-remediation. If you do not + * select a number, the default is 5.

For example, if you specify + * MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config + * will put a RemediationException on your behalf for the failing resource after + * the 5th failed attempt within 50 seconds.

+ */ + inline int GetMaximumAutomaticAttempts() const{ return m_maximumAutomaticAttempts; } + inline bool MaximumAutomaticAttemptsHasBeenSet() const { return m_maximumAutomaticAttemptsHasBeenSet; } + inline void SetMaximumAutomaticAttempts(int value) { m_maximumAutomaticAttemptsHasBeenSet = true; m_maximumAutomaticAttempts = value; } + inline RemediationConfiguration& WithMaximumAutomaticAttempts(int value) { SetMaximumAutomaticAttempts(value); return *this;} + ///@} + + ///@{ + /** + *

Time window to determine whether or not to add a remediation exception to + * prevent infinite remediation attempts. If MaximumAutomaticAttempts + * remediation attempts have been made under RetryAttemptSeconds, a + * remediation exception will be added to the resource. If you do not select a + * number, the default is 60 seconds.

For example, if you specify + * RetryAttemptSeconds as 50 seconds and + * MaximumAutomaticAttempts as 5, Config will run auto-remediations 5 + * times within 50 seconds before adding a remediation exception to the + * resource.

+ */ + inline long long GetRetryAttemptSeconds() const{ return m_retryAttemptSeconds; } + inline bool RetryAttemptSecondsHasBeenSet() const { return m_retryAttemptSecondsHasBeenSet; } + inline void SetRetryAttemptSeconds(long long value) { m_retryAttemptSecondsHasBeenSet = true; m_retryAttemptSeconds = value; } + inline RemediationConfiguration& WithRetryAttemptSeconds(long long value) { SetRetryAttemptSeconds(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of remediation configuration.

+ */ + inline const Aws::String& GetArn() const{ return m_arn; } + inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } + inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } + inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } + inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } + inline RemediationConfiguration& WithArn(const Aws::String& value) { SetArn(value); return *this;} + inline RemediationConfiguration& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} + inline RemediationConfiguration& WithArn(const char* value) { SetArn(value); return *this;} + ///@} + + ///@{ + /** + *

Name of the service that owns the service-linked rule, if applicable.

+ */ + inline const Aws::String& GetCreatedByService() const{ return m_createdByService; } + inline bool CreatedByServiceHasBeenSet() const { return m_createdByServiceHasBeenSet; } + inline void SetCreatedByService(const Aws::String& value) { m_createdByServiceHasBeenSet = true; m_createdByService = value; } + inline void SetCreatedByService(Aws::String&& value) { m_createdByServiceHasBeenSet = true; m_createdByService = std::move(value); } + inline void SetCreatedByService(const char* value) { m_createdByServiceHasBeenSet = true; m_createdByService.assign(value); } + inline RemediationConfiguration& WithCreatedByService(const Aws::String& value) { SetCreatedByService(value); return *this;} + inline RemediationConfiguration& WithCreatedByService(Aws::String&& value) { SetCreatedByService(std::move(value)); return *this;} + inline RemediationConfiguration& WithCreatedByService(const char* value) { SetCreatedByService(value); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + RemediationTargetType m_targetType; + bool m_targetTypeHasBeenSet = false; + + Aws::String m_targetId; + bool m_targetIdHasBeenSet = false; + + Aws::String m_targetVersion; + bool m_targetVersionHasBeenSet = false; + + Aws::Map m_parameters; + bool m_parametersHasBeenSet = false; + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + bool m_automatic; + bool m_automaticHasBeenSet = false; + + ExecutionControls m_executionControls; + bool m_executionControlsHasBeenSet = false; + + int m_maximumAutomaticAttempts; + bool m_maximumAutomaticAttemptsHasBeenSet = false; + + long long m_retryAttemptSeconds; + bool m_retryAttemptSecondsHasBeenSet = false; + + Aws::String m_arn; + bool m_arnHasBeenSet = false; + + Aws::String m_createdByService; + bool m_createdByServiceHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationException.h b/include/aws/config/model/RemediationException.h new file mode 100644 index 0000000000000000000000000000000000000000..7c36976cce20851b783d14a507229d286db8acc6 --- /dev/null +++ b/include/aws/config/model/RemediationException.h @@ -0,0 +1,131 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that represents the details about the remediation exception. The + * details include the rule name, an explanation of an exception, the time when the + * exception will be deleted, the resource ID, and resource type.

See + * Also:

AWS + * API Reference

+ */ + class RemediationException + { + public: + AWS_CONFIGSERVICE_API RemediationException(); + AWS_CONFIGSERVICE_API RemediationException(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RemediationException& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the Config rule.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline RemediationException& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline RemediationException& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline RemediationException& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

The type of a resource.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline RemediationException& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline RemediationException& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline RemediationException& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource (for example., sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline RemediationException& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline RemediationException& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline RemediationException& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

An explanation of an remediation exception.

+ */ + inline const Aws::String& GetMessage() const{ return m_message; } + inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } + inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } + inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } + inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } + inline RemediationException& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} + inline RemediationException& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} + inline RemediationException& WithMessage(const char* value) { SetMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The time when the remediation exception will be deleted.

+ */ + inline const Aws::Utils::DateTime& GetExpirationTime() const{ return m_expirationTime; } + inline bool ExpirationTimeHasBeenSet() const { return m_expirationTimeHasBeenSet; } + inline void SetExpirationTime(const Aws::Utils::DateTime& value) { m_expirationTimeHasBeenSet = true; m_expirationTime = value; } + inline void SetExpirationTime(Aws::Utils::DateTime&& value) { m_expirationTimeHasBeenSet = true; m_expirationTime = std::move(value); } + inline RemediationException& WithExpirationTime(const Aws::Utils::DateTime& value) { SetExpirationTime(value); return *this;} + inline RemediationException& WithExpirationTime(Aws::Utils::DateTime&& value) { SetExpirationTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_message; + bool m_messageHasBeenSet = false; + + Aws::Utils::DateTime m_expirationTime; + bool m_expirationTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationExceptionResourceKey.h b/include/aws/config/model/RemediationExceptionResourceKey.h new file mode 100644 index 0000000000000000000000000000000000000000..1e404047dd65da3b6e115376c1833e7fe56e4570 --- /dev/null +++ b/include/aws/config/model/RemediationExceptionResourceKey.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details that identify a resource within Config, including the resource + * type and resource ID.

See Also:

AWS + * API Reference

+ */ + class RemediationExceptionResourceKey + { + public: + AWS_CONFIGSERVICE_API RemediationExceptionResourceKey(); + AWS_CONFIGSERVICE_API RemediationExceptionResourceKey(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RemediationExceptionResourceKey& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of a resource.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline RemediationExceptionResourceKey& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline RemediationExceptionResourceKey& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline RemediationExceptionResourceKey& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource (for example., sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline RemediationExceptionResourceKey& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline RemediationExceptionResourceKey& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline RemediationExceptionResourceKey& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + private: + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationExecutionState.h b/include/aws/config/model/RemediationExecutionState.h new file mode 100644 index 0000000000000000000000000000000000000000..65285bfb1a6934f892ab98916825016e0fcc5486 --- /dev/null +++ b/include/aws/config/model/RemediationExecutionState.h @@ -0,0 +1,33 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class RemediationExecutionState + { + NOT_SET, + QUEUED, + IN_PROGRESS, + SUCCEEDED, + FAILED + }; + +namespace RemediationExecutionStateMapper +{ +AWS_CONFIGSERVICE_API RemediationExecutionState GetRemediationExecutionStateForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForRemediationExecutionState(RemediationExecutionState value); +} // namespace RemediationExecutionStateMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationExecutionStatus.h b/include/aws/config/model/RemediationExecutionStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..ca0139f093b09c8b65eb1f9d976363191b3b6261 --- /dev/null +++ b/include/aws/config/model/RemediationExecutionStatus.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides details of the current status of the invoked remediation action for + * that resource.

See Also:

AWS + * API Reference

+ */ + class RemediationExecutionStatus + { + public: + AWS_CONFIGSERVICE_API RemediationExecutionStatus(); + AWS_CONFIGSERVICE_API RemediationExecutionStatus(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RemediationExecutionStatus& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + + inline const ResourceKey& GetResourceKey() const{ return m_resourceKey; } + inline bool ResourceKeyHasBeenSet() const { return m_resourceKeyHasBeenSet; } + inline void SetResourceKey(const ResourceKey& value) { m_resourceKeyHasBeenSet = true; m_resourceKey = value; } + inline void SetResourceKey(ResourceKey&& value) { m_resourceKeyHasBeenSet = true; m_resourceKey = std::move(value); } + inline RemediationExecutionStatus& WithResourceKey(const ResourceKey& value) { SetResourceKey(value); return *this;} + inline RemediationExecutionStatus& WithResourceKey(ResourceKey&& value) { SetResourceKey(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

ENUM of the values.

+ */ + inline const RemediationExecutionState& GetState() const{ return m_state; } + inline bool StateHasBeenSet() const { return m_stateHasBeenSet; } + inline void SetState(const RemediationExecutionState& value) { m_stateHasBeenSet = true; m_state = value; } + inline void SetState(RemediationExecutionState&& value) { m_stateHasBeenSet = true; m_state = std::move(value); } + inline RemediationExecutionStatus& WithState(const RemediationExecutionState& value) { SetState(value); return *this;} + inline RemediationExecutionStatus& WithState(RemediationExecutionState&& value) { SetState(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Details of every step.

+ */ + inline const Aws::Vector& GetStepDetails() const{ return m_stepDetails; } + inline bool StepDetailsHasBeenSet() const { return m_stepDetailsHasBeenSet; } + inline void SetStepDetails(const Aws::Vector& value) { m_stepDetailsHasBeenSet = true; m_stepDetails = value; } + inline void SetStepDetails(Aws::Vector&& value) { m_stepDetailsHasBeenSet = true; m_stepDetails = std::move(value); } + inline RemediationExecutionStatus& WithStepDetails(const Aws::Vector& value) { SetStepDetails(value); return *this;} + inline RemediationExecutionStatus& WithStepDetails(Aws::Vector&& value) { SetStepDetails(std::move(value)); return *this;} + inline RemediationExecutionStatus& AddStepDetails(const RemediationExecutionStep& value) { m_stepDetailsHasBeenSet = true; m_stepDetails.push_back(value); return *this; } + inline RemediationExecutionStatus& AddStepDetails(RemediationExecutionStep&& value) { m_stepDetailsHasBeenSet = true; m_stepDetails.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Start time when the remediation was executed.

+ */ + inline const Aws::Utils::DateTime& GetInvocationTime() const{ return m_invocationTime; } + inline bool InvocationTimeHasBeenSet() const { return m_invocationTimeHasBeenSet; } + inline void SetInvocationTime(const Aws::Utils::DateTime& value) { m_invocationTimeHasBeenSet = true; m_invocationTime = value; } + inline void SetInvocationTime(Aws::Utils::DateTime&& value) { m_invocationTimeHasBeenSet = true; m_invocationTime = std::move(value); } + inline RemediationExecutionStatus& WithInvocationTime(const Aws::Utils::DateTime& value) { SetInvocationTime(value); return *this;} + inline RemediationExecutionStatus& WithInvocationTime(Aws::Utils::DateTime&& value) { SetInvocationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when the remediation execution was last updated.

+ */ + inline const Aws::Utils::DateTime& GetLastUpdatedTime() const{ return m_lastUpdatedTime; } + inline bool LastUpdatedTimeHasBeenSet() const { return m_lastUpdatedTimeHasBeenSet; } + inline void SetLastUpdatedTime(const Aws::Utils::DateTime& value) { m_lastUpdatedTimeHasBeenSet = true; m_lastUpdatedTime = value; } + inline void SetLastUpdatedTime(Aws::Utils::DateTime&& value) { m_lastUpdatedTimeHasBeenSet = true; m_lastUpdatedTime = std::move(value); } + inline RemediationExecutionStatus& WithLastUpdatedTime(const Aws::Utils::DateTime& value) { SetLastUpdatedTime(value); return *this;} + inline RemediationExecutionStatus& WithLastUpdatedTime(Aws::Utils::DateTime&& value) { SetLastUpdatedTime(std::move(value)); return *this;} + ///@} + private: + + ResourceKey m_resourceKey; + bool m_resourceKeyHasBeenSet = false; + + RemediationExecutionState m_state; + bool m_stateHasBeenSet = false; + + Aws::Vector m_stepDetails; + bool m_stepDetailsHasBeenSet = false; + + Aws::Utils::DateTime m_invocationTime; + bool m_invocationTimeHasBeenSet = false; + + Aws::Utils::DateTime m_lastUpdatedTime; + bool m_lastUpdatedTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationExecutionStep.h b/include/aws/config/model/RemediationExecutionStep.h new file mode 100644 index 0000000000000000000000000000000000000000..7f201936068f11a7abab071ed2c1d20ea24b52d7 --- /dev/null +++ b/include/aws/config/model/RemediationExecutionStep.h @@ -0,0 +1,125 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Name of the step from the SSM document.

See Also:

AWS + * API Reference

+ */ + class RemediationExecutionStep + { + public: + AWS_CONFIGSERVICE_API RemediationExecutionStep(); + AWS_CONFIGSERVICE_API RemediationExecutionStep(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RemediationExecutionStep& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The details of the step.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline RemediationExecutionStep& WithName(const Aws::String& value) { SetName(value); return *this;} + inline RemediationExecutionStep& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline RemediationExecutionStep& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

The valid status of the step.

+ */ + inline const RemediationExecutionStepState& GetState() const{ return m_state; } + inline bool StateHasBeenSet() const { return m_stateHasBeenSet; } + inline void SetState(const RemediationExecutionStepState& value) { m_stateHasBeenSet = true; m_state = value; } + inline void SetState(RemediationExecutionStepState&& value) { m_stateHasBeenSet = true; m_state = std::move(value); } + inline RemediationExecutionStep& WithState(const RemediationExecutionStepState& value) { SetState(value); return *this;} + inline RemediationExecutionStep& WithState(RemediationExecutionStepState&& value) { SetState(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An error message if the step was interrupted during execution.

+ */ + inline const Aws::String& GetErrorMessage() const{ return m_errorMessage; } + inline bool ErrorMessageHasBeenSet() const { return m_errorMessageHasBeenSet; } + inline void SetErrorMessage(const Aws::String& value) { m_errorMessageHasBeenSet = true; m_errorMessage = value; } + inline void SetErrorMessage(Aws::String&& value) { m_errorMessageHasBeenSet = true; m_errorMessage = std::move(value); } + inline void SetErrorMessage(const char* value) { m_errorMessageHasBeenSet = true; m_errorMessage.assign(value); } + inline RemediationExecutionStep& WithErrorMessage(const Aws::String& value) { SetErrorMessage(value); return *this;} + inline RemediationExecutionStep& WithErrorMessage(Aws::String&& value) { SetErrorMessage(std::move(value)); return *this;} + inline RemediationExecutionStep& WithErrorMessage(const char* value) { SetErrorMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The time when the step started.

+ */ + inline const Aws::Utils::DateTime& GetStartTime() const{ return m_startTime; } + inline bool StartTimeHasBeenSet() const { return m_startTimeHasBeenSet; } + inline void SetStartTime(const Aws::Utils::DateTime& value) { m_startTimeHasBeenSet = true; m_startTime = value; } + inline void SetStartTime(Aws::Utils::DateTime&& value) { m_startTimeHasBeenSet = true; m_startTime = std::move(value); } + inline RemediationExecutionStep& WithStartTime(const Aws::Utils::DateTime& value) { SetStartTime(value); return *this;} + inline RemediationExecutionStep& WithStartTime(Aws::Utils::DateTime&& value) { SetStartTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The time when the step stopped.

+ */ + inline const Aws::Utils::DateTime& GetStopTime() const{ return m_stopTime; } + inline bool StopTimeHasBeenSet() const { return m_stopTimeHasBeenSet; } + inline void SetStopTime(const Aws::Utils::DateTime& value) { m_stopTimeHasBeenSet = true; m_stopTime = value; } + inline void SetStopTime(Aws::Utils::DateTime&& value) { m_stopTimeHasBeenSet = true; m_stopTime = std::move(value); } + inline RemediationExecutionStep& WithStopTime(const Aws::Utils::DateTime& value) { SetStopTime(value); return *this;} + inline RemediationExecutionStep& WithStopTime(Aws::Utils::DateTime&& value) { SetStopTime(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + RemediationExecutionStepState m_state; + bool m_stateHasBeenSet = false; + + Aws::String m_errorMessage; + bool m_errorMessageHasBeenSet = false; + + Aws::Utils::DateTime m_startTime; + bool m_startTimeHasBeenSet = false; + + Aws::Utils::DateTime m_stopTime; + bool m_stopTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationExecutionStepState.h b/include/aws/config/model/RemediationExecutionStepState.h new file mode 100644 index 0000000000000000000000000000000000000000..e27fabacc9452c2a2a7d94ac7047a55e22714591 --- /dev/null +++ b/include/aws/config/model/RemediationExecutionStepState.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class RemediationExecutionStepState + { + NOT_SET, + SUCCEEDED, + PENDING, + FAILED + }; + +namespace RemediationExecutionStepStateMapper +{ +AWS_CONFIGSERVICE_API RemediationExecutionStepState GetRemediationExecutionStepStateForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForRemediationExecutionStepState(RemediationExecutionStepState value); +} // namespace RemediationExecutionStepStateMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationParameterValue.h b/include/aws/config/model/RemediationParameterValue.h new file mode 100644 index 0000000000000000000000000000000000000000..22cce521c53d72f6eb78a1ace041747df42c9a6b --- /dev/null +++ b/include/aws/config/model/RemediationParameterValue.h @@ -0,0 +1,76 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The value is either a dynamic (resource) value or a static value. You must + * select either a dynamic value or a static value.

See Also:

AWS + * API Reference

+ */ + class RemediationParameterValue + { + public: + AWS_CONFIGSERVICE_API RemediationParameterValue(); + AWS_CONFIGSERVICE_API RemediationParameterValue(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RemediationParameterValue& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The value is dynamic and changes at run-time.

+ */ + inline const ResourceValue& GetResourceValue() const{ return m_resourceValue; } + inline bool ResourceValueHasBeenSet() const { return m_resourceValueHasBeenSet; } + inline void SetResourceValue(const ResourceValue& value) { m_resourceValueHasBeenSet = true; m_resourceValue = value; } + inline void SetResourceValue(ResourceValue&& value) { m_resourceValueHasBeenSet = true; m_resourceValue = std::move(value); } + inline RemediationParameterValue& WithResourceValue(const ResourceValue& value) { SetResourceValue(value); return *this;} + inline RemediationParameterValue& WithResourceValue(ResourceValue&& value) { SetResourceValue(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The value is static and does not change at run-time.

+ */ + inline const StaticValue& GetStaticValue() const{ return m_staticValue; } + inline bool StaticValueHasBeenSet() const { return m_staticValueHasBeenSet; } + inline void SetStaticValue(const StaticValue& value) { m_staticValueHasBeenSet = true; m_staticValue = value; } + inline void SetStaticValue(StaticValue&& value) { m_staticValueHasBeenSet = true; m_staticValue = std::move(value); } + inline RemediationParameterValue& WithStaticValue(const StaticValue& value) { SetStaticValue(value); return *this;} + inline RemediationParameterValue& WithStaticValue(StaticValue&& value) { SetStaticValue(std::move(value)); return *this;} + ///@} + private: + + ResourceValue m_resourceValue; + bool m_resourceValueHasBeenSet = false; + + StaticValue m_staticValue; + bool m_staticValueHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RemediationTargetType.h b/include/aws/config/model/RemediationTargetType.h new file mode 100644 index 0000000000000000000000000000000000000000..99226d4f342a40078ddb5bb7a1f752ab7808bdcb --- /dev/null +++ b/include/aws/config/model/RemediationTargetType.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class RemediationTargetType + { + NOT_SET, + SSM_DOCUMENT + }; + +namespace RemediationTargetTypeMapper +{ +AWS_CONFIGSERVICE_API RemediationTargetType GetRemediationTargetTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForRemediationTargetType(RemediationTargetType value); +} // namespace RemediationTargetTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceConfigurationSchemaType.h b/include/aws/config/model/ResourceConfigurationSchemaType.h new file mode 100644 index 0000000000000000000000000000000000000000..91d37f15e0a702f28a0137578e6df09a38e0a2a7 --- /dev/null +++ b/include/aws/config/model/ResourceConfigurationSchemaType.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ResourceConfigurationSchemaType + { + NOT_SET, + CFN_RESOURCE_SCHEMA + }; + +namespace ResourceConfigurationSchemaTypeMapper +{ +AWS_CONFIGSERVICE_API ResourceConfigurationSchemaType GetResourceConfigurationSchemaTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForResourceConfigurationSchemaType(ResourceConfigurationSchemaType value); +} // namespace ResourceConfigurationSchemaTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceCount.h b/include/aws/config/model/ResourceCount.h new file mode 100644 index 0000000000000000000000000000000000000000..1a290c4fefa4617faa2fb6beb478609165aa007d --- /dev/null +++ b/include/aws/config/model/ResourceCount.h @@ -0,0 +1,73 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object that contains the resource type and the number of + * resources.

See Also:

AWS + * API Reference

+ */ + class ResourceCount + { + public: + AWS_CONFIGSERVICE_API ResourceCount(); + AWS_CONFIGSERVICE_API ResourceCount(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceCount& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The resource type (for example, "AWS::EC2::Instance").

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline ResourceCount& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline ResourceCount& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The number of resources.

+ */ + inline long long GetCount() const{ return m_count; } + inline bool CountHasBeenSet() const { return m_countHasBeenSet; } + inline void SetCount(long long value) { m_countHasBeenSet = true; m_count = value; } + inline ResourceCount& WithCount(long long value) { SetCount(value); return *this;} + ///@} + private: + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + long long m_count; + bool m_countHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceCountFilters.h b/include/aws/config/model/ResourceCountFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..01b23d76c12c11586eea19a23613cea076efb317 --- /dev/null +++ b/include/aws/config/model/ResourceCountFilters.h @@ -0,0 +1,95 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters the resource count based on account ID, region, and resource + * type.

See Also:

AWS + * API Reference

+ */ + class ResourceCountFilters + { + public: + AWS_CONFIGSERVICE_API ResourceCountFilters(); + AWS_CONFIGSERVICE_API ResourceCountFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceCountFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of the Amazon Web Services resource.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline ResourceCountFilters& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline ResourceCountFilters& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The 12-digit ID of the account.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline ResourceCountFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline ResourceCountFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline ResourceCountFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The region where the account is located.

+ */ + inline const Aws::String& GetRegion() const{ return m_region; } + inline bool RegionHasBeenSet() const { return m_regionHasBeenSet; } + inline void SetRegion(const Aws::String& value) { m_regionHasBeenSet = true; m_region = value; } + inline void SetRegion(Aws::String&& value) { m_regionHasBeenSet = true; m_region = std::move(value); } + inline void SetRegion(const char* value) { m_regionHasBeenSet = true; m_region.assign(value); } + inline ResourceCountFilters& WithRegion(const Aws::String& value) { SetRegion(value); return *this;} + inline ResourceCountFilters& WithRegion(Aws::String&& value) { SetRegion(std::move(value)); return *this;} + inline ResourceCountFilters& WithRegion(const char* value) { SetRegion(value); return *this;} + ///@} + private: + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_region; + bool m_regionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceCountGroupKey.h b/include/aws/config/model/ResourceCountGroupKey.h new file mode 100644 index 0000000000000000000000000000000000000000..f17f6ce612d808ab119cd5811efc259b8a8c9e2b --- /dev/null +++ b/include/aws/config/model/ResourceCountGroupKey.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ResourceCountGroupKey + { + NOT_SET, + RESOURCE_TYPE, + ACCOUNT_ID, + AWS_REGION + }; + +namespace ResourceCountGroupKeyMapper +{ +AWS_CONFIGSERVICE_API ResourceCountGroupKey GetResourceCountGroupKeyForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForResourceCountGroupKey(ResourceCountGroupKey value); +} // namespace ResourceCountGroupKeyMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceDetails.h b/include/aws/config/model/ResourceDetails.h new file mode 100644 index 0000000000000000000000000000000000000000..b0ea1ddbef7423b5d73389c60e971bf580c0dd50 --- /dev/null +++ b/include/aws/config/model/ResourceDetails.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns information about the resource being evaluated.

See + * Also:

AWS + * API Reference

+ */ + class ResourceDetails + { + public: + AWS_CONFIGSERVICE_API ResourceDetails(); + AWS_CONFIGSERVICE_API ResourceDetails(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceDetails& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

A unique resource ID for an evaluation.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline ResourceDetails& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline ResourceDetails& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline ResourceDetails& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The type of resource being evaluated.

+ */ + inline const Aws::String& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); } + inline ResourceDetails& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;} + inline ResourceDetails& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;} + inline ResourceDetails& WithResourceType(const char* value) { SetResourceType(value); return *this;} + ///@} + + ///@{ + /** + *

The resource definition to be evaluated as per the resource configuration + * schema type.

+ */ + inline const Aws::String& GetResourceConfiguration() const{ return m_resourceConfiguration; } + inline bool ResourceConfigurationHasBeenSet() const { return m_resourceConfigurationHasBeenSet; } + inline void SetResourceConfiguration(const Aws::String& value) { m_resourceConfigurationHasBeenSet = true; m_resourceConfiguration = value; } + inline void SetResourceConfiguration(Aws::String&& value) { m_resourceConfigurationHasBeenSet = true; m_resourceConfiguration = std::move(value); } + inline void SetResourceConfiguration(const char* value) { m_resourceConfigurationHasBeenSet = true; m_resourceConfiguration.assign(value); } + inline ResourceDetails& WithResourceConfiguration(const Aws::String& value) { SetResourceConfiguration(value); return *this;} + inline ResourceDetails& WithResourceConfiguration(Aws::String&& value) { SetResourceConfiguration(std::move(value)); return *this;} + inline ResourceDetails& WithResourceConfiguration(const char* value) { SetResourceConfiguration(value); return *this;} + ///@} + + ///@{ + /** + *

The schema type of the resource configuration.

You can find the + * Resource + * type schema, or CFN_RESOURCE_SCHEMA, in "Amazon Web Services + * public extensions" within the CloudFormation registry or with the following + * CLI commmand: aws cloudformation describe-type --type-name + * "AWS::S3::Bucket" --type RESOURCE.

For more information, see Managing + * extensions through the CloudFormation registry and Amazon + * Web Services resource and property types reference in the CloudFormation + * User Guide.

+ */ + inline const ResourceConfigurationSchemaType& GetResourceConfigurationSchemaType() const{ return m_resourceConfigurationSchemaType; } + inline bool ResourceConfigurationSchemaTypeHasBeenSet() const { return m_resourceConfigurationSchemaTypeHasBeenSet; } + inline void SetResourceConfigurationSchemaType(const ResourceConfigurationSchemaType& value) { m_resourceConfigurationSchemaTypeHasBeenSet = true; m_resourceConfigurationSchemaType = value; } + inline void SetResourceConfigurationSchemaType(ResourceConfigurationSchemaType&& value) { m_resourceConfigurationSchemaTypeHasBeenSet = true; m_resourceConfigurationSchemaType = std::move(value); } + inline ResourceDetails& WithResourceConfigurationSchemaType(const ResourceConfigurationSchemaType& value) { SetResourceConfigurationSchemaType(value); return *this;} + inline ResourceDetails& WithResourceConfigurationSchemaType(ResourceConfigurationSchemaType&& value) { SetResourceConfigurationSchemaType(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceConfiguration; + bool m_resourceConfigurationHasBeenSet = false; + + ResourceConfigurationSchemaType m_resourceConfigurationSchemaType; + bool m_resourceConfigurationSchemaTypeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceEvaluation.h b/include/aws/config/model/ResourceEvaluation.h new file mode 100644 index 0000000000000000000000000000000000000000..3f46c1a694fd4836d83bc3a39a5b4723c91b568c --- /dev/null +++ b/include/aws/config/model/ResourceEvaluation.h @@ -0,0 +1,93 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns details of a resource evaluation.

See Also:

AWS + * API Reference

+ */ + class ResourceEvaluation + { + public: + AWS_CONFIGSERVICE_API ResourceEvaluation(); + AWS_CONFIGSERVICE_API ResourceEvaluation(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceEvaluation& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The ResourceEvaluationId of a evaluation.

+ */ + inline const Aws::String& GetResourceEvaluationId() const{ return m_resourceEvaluationId; } + inline bool ResourceEvaluationIdHasBeenSet() const { return m_resourceEvaluationIdHasBeenSet; } + inline void SetResourceEvaluationId(const Aws::String& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = value; } + inline void SetResourceEvaluationId(Aws::String&& value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId = std::move(value); } + inline void SetResourceEvaluationId(const char* value) { m_resourceEvaluationIdHasBeenSet = true; m_resourceEvaluationId.assign(value); } + inline ResourceEvaluation& WithResourceEvaluationId(const Aws::String& value) { SetResourceEvaluationId(value); return *this;} + inline ResourceEvaluation& WithResourceEvaluationId(Aws::String&& value) { SetResourceEvaluationId(std::move(value)); return *this;} + inline ResourceEvaluation& WithResourceEvaluationId(const char* value) { SetResourceEvaluationId(value); return *this;} + ///@} + + ///@{ + /** + *

The mode of an evaluation. The valid values are Detective or Proactive.

+ */ + inline const EvaluationMode& GetEvaluationMode() const{ return m_evaluationMode; } + inline bool EvaluationModeHasBeenSet() const { return m_evaluationModeHasBeenSet; } + inline void SetEvaluationMode(const EvaluationMode& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = value; } + inline void SetEvaluationMode(EvaluationMode&& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = std::move(value); } + inline ResourceEvaluation& WithEvaluationMode(const EvaluationMode& value) { SetEvaluationMode(value); return *this;} + inline ResourceEvaluation& WithEvaluationMode(EvaluationMode&& value) { SetEvaluationMode(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The starting time of an execution.

+ */ + inline const Aws::Utils::DateTime& GetEvaluationStartTimestamp() const{ return m_evaluationStartTimestamp; } + inline bool EvaluationStartTimestampHasBeenSet() const { return m_evaluationStartTimestampHasBeenSet; } + inline void SetEvaluationStartTimestamp(const Aws::Utils::DateTime& value) { m_evaluationStartTimestampHasBeenSet = true; m_evaluationStartTimestamp = value; } + inline void SetEvaluationStartTimestamp(Aws::Utils::DateTime&& value) { m_evaluationStartTimestampHasBeenSet = true; m_evaluationStartTimestamp = std::move(value); } + inline ResourceEvaluation& WithEvaluationStartTimestamp(const Aws::Utils::DateTime& value) { SetEvaluationStartTimestamp(value); return *this;} + inline ResourceEvaluation& WithEvaluationStartTimestamp(Aws::Utils::DateTime&& value) { SetEvaluationStartTimestamp(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_resourceEvaluationId; + bool m_resourceEvaluationIdHasBeenSet = false; + + EvaluationMode m_evaluationMode; + bool m_evaluationModeHasBeenSet = false; + + Aws::Utils::DateTime m_evaluationStartTimestamp; + bool m_evaluationStartTimestampHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceEvaluationFilters.h b/include/aws/config/model/ResourceEvaluationFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..afdf0a9fbc31101059dd08ebbd6a827302bab41d --- /dev/null +++ b/include/aws/config/model/ResourceEvaluationFilters.h @@ -0,0 +1,97 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns details of a resource evaluation based on the selected + * filter.

See Also:

AWS + * API Reference

+ */ + class ResourceEvaluationFilters + { + public: + AWS_CONFIGSERVICE_API ResourceEvaluationFilters(); + AWS_CONFIGSERVICE_API ResourceEvaluationFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceEvaluationFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Filters all resource evaluations results based on an evaluation mode.

+ *

Currently, DECTECTIVE is not supported as a valid + * value. Ignore other documentation stating otherwise.

+ */ + inline const EvaluationMode& GetEvaluationMode() const{ return m_evaluationMode; } + inline bool EvaluationModeHasBeenSet() const { return m_evaluationModeHasBeenSet; } + inline void SetEvaluationMode(const EvaluationMode& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = value; } + inline void SetEvaluationMode(EvaluationMode&& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = std::move(value); } + inline ResourceEvaluationFilters& WithEvaluationMode(const EvaluationMode& value) { SetEvaluationMode(value); return *this;} + inline ResourceEvaluationFilters& WithEvaluationMode(EvaluationMode&& value) { SetEvaluationMode(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Returns a TimeWindow object.

+ */ + inline const TimeWindow& GetTimeWindow() const{ return m_timeWindow; } + inline bool TimeWindowHasBeenSet() const { return m_timeWindowHasBeenSet; } + inline void SetTimeWindow(const TimeWindow& value) { m_timeWindowHasBeenSet = true; m_timeWindow = value; } + inline void SetTimeWindow(TimeWindow&& value) { m_timeWindowHasBeenSet = true; m_timeWindow = std::move(value); } + inline ResourceEvaluationFilters& WithTimeWindow(const TimeWindow& value) { SetTimeWindow(value); return *this;} + inline ResourceEvaluationFilters& WithTimeWindow(TimeWindow&& value) { SetTimeWindow(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Filters evaluations for a given infrastructure deployment. For example: CFN + * Stack.

+ */ + inline const Aws::String& GetEvaluationContextIdentifier() const{ return m_evaluationContextIdentifier; } + inline bool EvaluationContextIdentifierHasBeenSet() const { return m_evaluationContextIdentifierHasBeenSet; } + inline void SetEvaluationContextIdentifier(const Aws::String& value) { m_evaluationContextIdentifierHasBeenSet = true; m_evaluationContextIdentifier = value; } + inline void SetEvaluationContextIdentifier(Aws::String&& value) { m_evaluationContextIdentifierHasBeenSet = true; m_evaluationContextIdentifier = std::move(value); } + inline void SetEvaluationContextIdentifier(const char* value) { m_evaluationContextIdentifierHasBeenSet = true; m_evaluationContextIdentifier.assign(value); } + inline ResourceEvaluationFilters& WithEvaluationContextIdentifier(const Aws::String& value) { SetEvaluationContextIdentifier(value); return *this;} + inline ResourceEvaluationFilters& WithEvaluationContextIdentifier(Aws::String&& value) { SetEvaluationContextIdentifier(std::move(value)); return *this;} + inline ResourceEvaluationFilters& WithEvaluationContextIdentifier(const char* value) { SetEvaluationContextIdentifier(value); return *this;} + ///@} + private: + + EvaluationMode m_evaluationMode; + bool m_evaluationModeHasBeenSet = false; + + TimeWindow m_timeWindow; + bool m_timeWindowHasBeenSet = false; + + Aws::String m_evaluationContextIdentifier; + bool m_evaluationContextIdentifierHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceEvaluationStatus.h b/include/aws/config/model/ResourceEvaluationStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..30708ffae9e72b4ec6ed083b0b49de3f42676922 --- /dev/null +++ b/include/aws/config/model/ResourceEvaluationStatus.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ResourceEvaluationStatus + { + NOT_SET, + IN_PROGRESS, + FAILED, + SUCCEEDED + }; + +namespace ResourceEvaluationStatusMapper +{ +AWS_CONFIGSERVICE_API ResourceEvaluationStatus GetResourceEvaluationStatusForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForResourceEvaluationStatus(ResourceEvaluationStatus value); +} // namespace ResourceEvaluationStatusMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceFilters.h b/include/aws/config/model/ResourceFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..170f1ba3f5289494e8c508615982b837315a8440 --- /dev/null +++ b/include/aws/config/model/ResourceFilters.h @@ -0,0 +1,113 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters the results by resource account ID, region, resource ID, and resource + * name.

See Also:

AWS + * API Reference

+ */ + class ResourceFilters + { + public: + AWS_CONFIGSERVICE_API ResourceFilters(); + AWS_CONFIGSERVICE_API ResourceFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit source account ID.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline ResourceFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline ResourceFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline ResourceFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource.

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline ResourceFilters& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline ResourceFilters& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline ResourceFilters& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the resource.

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline ResourceFilters& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline ResourceFilters& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline ResourceFilters& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + + ///@{ + /** + *

The source region.

+ */ + inline const Aws::String& GetRegion() const{ return m_region; } + inline bool RegionHasBeenSet() const { return m_regionHasBeenSet; } + inline void SetRegion(const Aws::String& value) { m_regionHasBeenSet = true; m_region = value; } + inline void SetRegion(Aws::String&& value) { m_regionHasBeenSet = true; m_region = std::move(value); } + inline void SetRegion(const char* value) { m_regionHasBeenSet = true; m_region.assign(value); } + inline ResourceFilters& WithRegion(const Aws::String& value) { SetRegion(value); return *this;} + inline ResourceFilters& WithRegion(Aws::String&& value) { SetRegion(std::move(value)); return *this;} + inline ResourceFilters& WithRegion(const char* value) { SetRegion(value); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + + Aws::String m_region; + bool m_regionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceIdentifier.h b/include/aws/config/model/ResourceIdentifier.h new file mode 100644 index 0000000000000000000000000000000000000000..4cf360f89b49054ba10d620e99be318e0cd5e6fd --- /dev/null +++ b/include/aws/config/model/ResourceIdentifier.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details that identify a resource that is discovered by Config, including + * the resource type, ID, and (if available) the custom resource + * name.

See Also:

AWS + * API Reference

+ */ + class ResourceIdentifier + { + public: + AWS_CONFIGSERVICE_API ResourceIdentifier(); + AWS_CONFIGSERVICE_API ResourceIdentifier(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceIdentifier& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The type of resource.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline ResourceIdentifier& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline ResourceIdentifier& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource (for example, sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline ResourceIdentifier& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline ResourceIdentifier& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline ResourceIdentifier& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + + ///@{ + /** + *

The custom name of the resource (if available).

+ */ + inline const Aws::String& GetResourceName() const{ return m_resourceName; } + inline bool ResourceNameHasBeenSet() const { return m_resourceNameHasBeenSet; } + inline void SetResourceName(const Aws::String& value) { m_resourceNameHasBeenSet = true; m_resourceName = value; } + inline void SetResourceName(Aws::String&& value) { m_resourceNameHasBeenSet = true; m_resourceName = std::move(value); } + inline void SetResourceName(const char* value) { m_resourceNameHasBeenSet = true; m_resourceName.assign(value); } + inline ResourceIdentifier& WithResourceName(const Aws::String& value) { SetResourceName(value); return *this;} + inline ResourceIdentifier& WithResourceName(Aws::String&& value) { SetResourceName(std::move(value)); return *this;} + inline ResourceIdentifier& WithResourceName(const char* value) { SetResourceName(value); return *this;} + ///@} + + ///@{ + /** + *

The time that the resource was deleted.

+ */ + inline const Aws::Utils::DateTime& GetResourceDeletionTime() const{ return m_resourceDeletionTime; } + inline bool ResourceDeletionTimeHasBeenSet() const { return m_resourceDeletionTimeHasBeenSet; } + inline void SetResourceDeletionTime(const Aws::Utils::DateTime& value) { m_resourceDeletionTimeHasBeenSet = true; m_resourceDeletionTime = value; } + inline void SetResourceDeletionTime(Aws::Utils::DateTime&& value) { m_resourceDeletionTimeHasBeenSet = true; m_resourceDeletionTime = std::move(value); } + inline ResourceIdentifier& WithResourceDeletionTime(const Aws::Utils::DateTime& value) { SetResourceDeletionTime(value); return *this;} + inline ResourceIdentifier& WithResourceDeletionTime(Aws::Utils::DateTime&& value) { SetResourceDeletionTime(std::move(value)); return *this;} + ///@} + private: + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + + Aws::String m_resourceName; + bool m_resourceNameHasBeenSet = false; + + Aws::Utils::DateTime m_resourceDeletionTime; + bool m_resourceDeletionTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceKey.h b/include/aws/config/model/ResourceKey.h new file mode 100644 index 0000000000000000000000000000000000000000..3f59fdcde1ecb0988d46fc9bdfd82fc706c1a084 --- /dev/null +++ b/include/aws/config/model/ResourceKey.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The details that identify a resource within Config, including the resource + * type and resource ID.

See Also:

AWS + * API Reference

+ */ + class ResourceKey + { + public: + AWS_CONFIGSERVICE_API ResourceKey(); + AWS_CONFIGSERVICE_API ResourceKey(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceKey& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The resource type.

+ */ + inline const ResourceType& GetResourceType() const{ return m_resourceType; } + inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; } + inline void SetResourceType(const ResourceType& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; } + inline void SetResourceType(ResourceType&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); } + inline ResourceKey& WithResourceType(const ResourceType& value) { SetResourceType(value); return *this;} + inline ResourceKey& WithResourceType(ResourceType&& value) { SetResourceType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The ID of the resource (for example., sg-xxxxxx).

+ */ + inline const Aws::String& GetResourceId() const{ return m_resourceId; } + inline bool ResourceIdHasBeenSet() const { return m_resourceIdHasBeenSet; } + inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; } + inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); } + inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); } + inline ResourceKey& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;} + inline ResourceKey& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;} + inline ResourceKey& WithResourceId(const char* value) { SetResourceId(value); return *this;} + ///@} + private: + + ResourceType m_resourceType; + bool m_resourceTypeHasBeenSet = false; + + Aws::String m_resourceId; + bool m_resourceIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceType.h b/include/aws/config/model/ResourceType.h new file mode 100644 index 0000000000000000000000000000000000000000..a091d1860fc1498f3cadc57d0d74ad3fc95e5e53 --- /dev/null +++ b/include/aws/config/model/ResourceType.h @@ -0,0 +1,436 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ResourceType + { + NOT_SET, + AWS_EC2_CustomerGateway, + AWS_EC2_EIP, + AWS_EC2_Host, + AWS_EC2_Instance, + AWS_EC2_InternetGateway, + AWS_EC2_NetworkAcl, + AWS_EC2_NetworkInterface, + AWS_EC2_RouteTable, + AWS_EC2_SecurityGroup, + AWS_EC2_Subnet, + AWS_CloudTrail_Trail, + AWS_EC2_Volume, + AWS_EC2_VPC, + AWS_EC2_VPNConnection, + AWS_EC2_VPNGateway, + AWS_EC2_RegisteredHAInstance, + AWS_EC2_NatGateway, + AWS_EC2_EgressOnlyInternetGateway, + AWS_EC2_VPCEndpoint, + AWS_EC2_VPCEndpointService, + AWS_EC2_FlowLog, + AWS_EC2_VPCPeeringConnection, + AWS_Elasticsearch_Domain, + AWS_IAM_Group, + AWS_IAM_Policy, + AWS_IAM_Role, + AWS_IAM_User, + AWS_ElasticLoadBalancingV2_LoadBalancer, + AWS_ACM_Certificate, + AWS_RDS_DBInstance, + AWS_RDS_DBSubnetGroup, + AWS_RDS_DBSecurityGroup, + AWS_RDS_DBSnapshot, + AWS_RDS_DBCluster, + AWS_RDS_DBClusterSnapshot, + AWS_RDS_EventSubscription, + AWS_S3_Bucket, + AWS_S3_AccountPublicAccessBlock, + AWS_Redshift_Cluster, + AWS_Redshift_ClusterSnapshot, + AWS_Redshift_ClusterParameterGroup, + AWS_Redshift_ClusterSecurityGroup, + AWS_Redshift_ClusterSubnetGroup, + AWS_Redshift_EventSubscription, + AWS_SSM_ManagedInstanceInventory, + AWS_CloudWatch_Alarm, + AWS_CloudFormation_Stack, + AWS_ElasticLoadBalancing_LoadBalancer, + AWS_AutoScaling_AutoScalingGroup, + AWS_AutoScaling_LaunchConfiguration, + AWS_AutoScaling_ScalingPolicy, + AWS_AutoScaling_ScheduledAction, + AWS_DynamoDB_Table, + AWS_CodeBuild_Project, + AWS_WAF_RateBasedRule, + AWS_WAF_Rule, + AWS_WAF_RuleGroup, + AWS_WAF_WebACL, + AWS_WAFRegional_RateBasedRule, + AWS_WAFRegional_Rule, + AWS_WAFRegional_RuleGroup, + AWS_WAFRegional_WebACL, + AWS_CloudFront_Distribution, + AWS_CloudFront_StreamingDistribution, + AWS_Lambda_Function, + AWS_NetworkFirewall_Firewall, + AWS_NetworkFirewall_FirewallPolicy, + AWS_NetworkFirewall_RuleGroup, + AWS_ElasticBeanstalk_Application, + AWS_ElasticBeanstalk_ApplicationVersion, + AWS_ElasticBeanstalk_Environment, + AWS_WAFv2_WebACL, + AWS_WAFv2_RuleGroup, + AWS_WAFv2_IPSet, + AWS_WAFv2_RegexPatternSet, + AWS_WAFv2_ManagedRuleSet, + AWS_XRay_EncryptionConfig, + AWS_SSM_AssociationCompliance, + AWS_SSM_PatchCompliance, + AWS_Shield_Protection, + AWS_ShieldRegional_Protection, + AWS_Config_ConformancePackCompliance, + AWS_Config_ResourceCompliance, + AWS_ApiGateway_Stage, + AWS_ApiGateway_RestApi, + AWS_ApiGatewayV2_Stage, + AWS_ApiGatewayV2_Api, + AWS_CodePipeline_Pipeline, + AWS_ServiceCatalog_CloudFormationProvisionedProduct, + AWS_ServiceCatalog_CloudFormationProduct, + AWS_ServiceCatalog_Portfolio, + AWS_SQS_Queue, + AWS_KMS_Key, + AWS_QLDB_Ledger, + AWS_SecretsManager_Secret, + AWS_SNS_Topic, + AWS_SSM_FileData, + AWS_Backup_BackupPlan, + AWS_Backup_BackupSelection, + AWS_Backup_BackupVault, + AWS_Backup_RecoveryPoint, + AWS_ECR_Repository, + AWS_ECS_Cluster, + AWS_ECS_Service, + AWS_ECS_TaskDefinition, + AWS_EFS_AccessPoint, + AWS_EFS_FileSystem, + AWS_EKS_Cluster, + AWS_OpenSearch_Domain, + AWS_EC2_TransitGateway, + AWS_Kinesis_Stream, + AWS_Kinesis_StreamConsumer, + AWS_CodeDeploy_Application, + AWS_CodeDeploy_DeploymentConfig, + AWS_CodeDeploy_DeploymentGroup, + AWS_EC2_LaunchTemplate, + AWS_ECR_PublicRepository, + AWS_GuardDuty_Detector, + AWS_EMR_SecurityConfiguration, + AWS_SageMaker_CodeRepository, + AWS_Route53Resolver_ResolverEndpoint, + AWS_Route53Resolver_ResolverRule, + AWS_Route53Resolver_ResolverRuleAssociation, + AWS_DMS_ReplicationSubnetGroup, + AWS_DMS_EventSubscription, + AWS_MSK_Cluster, + AWS_StepFunctions_Activity, + AWS_WorkSpaces_Workspace, + AWS_WorkSpaces_ConnectionAlias, + AWS_SageMaker_Model, + AWS_ElasticLoadBalancingV2_Listener, + AWS_StepFunctions_StateMachine, + AWS_Batch_JobQueue, + AWS_Batch_ComputeEnvironment, + AWS_AccessAnalyzer_Analyzer, + AWS_Athena_WorkGroup, + AWS_Athena_DataCatalog, + AWS_Detective_Graph, + AWS_GlobalAccelerator_Accelerator, + AWS_GlobalAccelerator_EndpointGroup, + AWS_GlobalAccelerator_Listener, + AWS_EC2_TransitGatewayAttachment, + AWS_EC2_TransitGatewayRouteTable, + AWS_DMS_Certificate, + AWS_AppConfig_Application, + AWS_AppSync_GraphQLApi, + AWS_DataSync_LocationSMB, + AWS_DataSync_LocationFSxLustre, + AWS_DataSync_LocationS3, + AWS_DataSync_LocationEFS, + AWS_DataSync_Task, + AWS_DataSync_LocationNFS, + AWS_EC2_NetworkInsightsAccessScopeAnalysis, + AWS_EKS_FargateProfile, + AWS_Glue_Job, + AWS_GuardDuty_ThreatIntelSet, + AWS_GuardDuty_IPSet, + AWS_SageMaker_Workteam, + AWS_SageMaker_NotebookInstanceLifecycleConfig, + AWS_ServiceDiscovery_Service, + AWS_ServiceDiscovery_PublicDnsNamespace, + AWS_SES_ContactList, + AWS_SES_ConfigurationSet, + AWS_Route53_HostedZone, + AWS_IoTEvents_Input, + AWS_IoTEvents_DetectorModel, + AWS_IoTEvents_AlarmModel, + AWS_ServiceDiscovery_HttpNamespace, + AWS_Events_EventBus, + AWS_ImageBuilder_ContainerRecipe, + AWS_ImageBuilder_DistributionConfiguration, + AWS_ImageBuilder_InfrastructureConfiguration, + AWS_DataSync_LocationObjectStorage, + AWS_DataSync_LocationHDFS, + AWS_Glue_Classifier, + AWS_Route53RecoveryReadiness_Cell, + AWS_Route53RecoveryReadiness_ReadinessCheck, + AWS_ECR_RegistryPolicy, + AWS_Backup_ReportPlan, + AWS_Lightsail_Certificate, + AWS_RUM_AppMonitor, + AWS_Events_Endpoint, + AWS_SES_ReceiptRuleSet, + AWS_Events_Archive, + AWS_Events_ApiDestination, + AWS_Lightsail_Disk, + AWS_FIS_ExperimentTemplate, + AWS_DataSync_LocationFSxWindows, + AWS_SES_ReceiptFilter, + AWS_GuardDuty_Filter, + AWS_SES_Template, + AWS_AmazonMQ_Broker, + AWS_AppConfig_Environment, + AWS_AppConfig_ConfigurationProfile, + AWS_Cloud9_EnvironmentEC2, + AWS_EventSchemas_Registry, + AWS_EventSchemas_RegistryPolicy, + AWS_EventSchemas_Discoverer, + AWS_FraudDetector_Label, + AWS_FraudDetector_EntityType, + AWS_FraudDetector_Variable, + AWS_FraudDetector_Outcome, + AWS_IoT_Authorizer, + AWS_IoT_SecurityProfile, + AWS_IoT_RoleAlias, + AWS_IoT_Dimension, + AWS_IoTAnalytics_Datastore, + AWS_Lightsail_Bucket, + AWS_Lightsail_StaticIp, + AWS_MediaPackage_PackagingGroup, + AWS_Route53RecoveryReadiness_RecoveryGroup, + AWS_ResilienceHub_ResiliencyPolicy, + AWS_Transfer_Workflow, + AWS_EKS_IdentityProviderConfig, + AWS_EKS_Addon, + AWS_Glue_MLTransform, + AWS_IoT_Policy, + AWS_IoT_MitigationAction, + AWS_IoTTwinMaker_Workspace, + AWS_IoTTwinMaker_Entity, + AWS_IoTAnalytics_Dataset, + AWS_IoTAnalytics_Pipeline, + AWS_IoTAnalytics_Channel, + AWS_IoTSiteWise_Dashboard, + AWS_IoTSiteWise_Project, + AWS_IoTSiteWise_Portal, + AWS_IoTSiteWise_AssetModel, + AWS_IVS_Channel, + AWS_IVS_RecordingConfiguration, + AWS_IVS_PlaybackKeyPair, + AWS_KinesisAnalyticsV2_Application, + AWS_RDS_GlobalCluster, + AWS_S3_MultiRegionAccessPoint, + AWS_DeviceFarm_TestGridProject, + AWS_Budgets_BudgetsAction, + AWS_Lex_Bot, + AWS_CodeGuruReviewer_RepositoryAssociation, + AWS_IoT_CustomMetric, + AWS_Route53Resolver_FirewallDomainList, + AWS_RoboMaker_RobotApplicationVersion, + AWS_EC2_TrafficMirrorSession, + AWS_IoTSiteWise_Gateway, + AWS_Lex_BotAlias, + AWS_LookoutMetrics_Alert, + AWS_IoT_AccountAuditConfiguration, + AWS_EC2_TrafficMirrorTarget, + AWS_S3_StorageLens, + AWS_IoT_ScheduledAudit, + AWS_Events_Connection, + AWS_EventSchemas_Schema, + AWS_MediaPackage_PackagingConfiguration, + AWS_KinesisVideo_SignalingChannel, + AWS_AppStream_DirectoryConfig, + AWS_LookoutVision_Project, + AWS_Route53RecoveryControl_Cluster, + AWS_Route53RecoveryControl_SafetyRule, + AWS_Route53RecoveryControl_ControlPanel, + AWS_Route53RecoveryControl_RoutingControl, + AWS_Route53RecoveryReadiness_ResourceSet, + AWS_RoboMaker_SimulationApplication, + AWS_RoboMaker_RobotApplication, + AWS_HealthLake_FHIRDatastore, + AWS_Pinpoint_Segment, + AWS_Pinpoint_ApplicationSettings, + AWS_Events_Rule, + AWS_EC2_DHCPOptions, + AWS_EC2_NetworkInsightsPath, + AWS_EC2_TrafficMirrorFilter, + AWS_EC2_IPAM, + AWS_IoTTwinMaker_Scene, + AWS_NetworkManager_TransitGatewayRegistration, + AWS_CustomerProfiles_Domain, + AWS_AutoScaling_WarmPool, + AWS_Connect_PhoneNumber, + AWS_AppConfig_DeploymentStrategy, + AWS_AppFlow_Flow, + AWS_AuditManager_Assessment, + AWS_CloudWatch_MetricStream, + AWS_DeviceFarm_InstanceProfile, + AWS_DeviceFarm_Project, + AWS_EC2_EC2Fleet, + AWS_EC2_SubnetRouteTableAssociation, + AWS_ECR_PullThroughCacheRule, + AWS_GroundStation_Config, + AWS_ImageBuilder_ImagePipeline, + AWS_IoT_FleetMetric, + AWS_IoTWireless_ServiceProfile, + AWS_NetworkManager_Device, + AWS_NetworkManager_GlobalNetwork, + AWS_NetworkManager_Link, + AWS_NetworkManager_Site, + AWS_Panorama_Package, + AWS_Pinpoint_App, + AWS_Redshift_ScheduledAction, + AWS_Route53Resolver_FirewallRuleGroupAssociation, + AWS_SageMaker_AppImageConfig, + AWS_SageMaker_Image, + AWS_ECS_TaskSet, + AWS_Cassandra_Keyspace, + AWS_Signer_SigningProfile, + AWS_Amplify_App, + AWS_AppMesh_VirtualNode, + AWS_AppMesh_VirtualService, + AWS_AppRunner_VpcConnector, + AWS_AppStream_Application, + AWS_CodeArtifact_Repository, + AWS_EC2_PrefixList, + AWS_EC2_SpotFleet, + AWS_Evidently_Project, + AWS_Forecast_Dataset, + AWS_IAM_SAMLProvider, + AWS_IAM_ServerCertificate, + AWS_Pinpoint_Campaign, + AWS_Pinpoint_InAppTemplate, + AWS_SageMaker_Domain, + AWS_Transfer_Agreement, + AWS_Transfer_Connector, + AWS_KinesisFirehose_DeliveryStream, + AWS_Amplify_Branch, + AWS_AppIntegrations_EventIntegration, + AWS_AppMesh_Route, + AWS_Athena_PreparedStatement, + AWS_EC2_IPAMScope, + AWS_Evidently_Launch, + AWS_Forecast_DatasetGroup, + AWS_GreengrassV2_ComponentVersion, + AWS_GroundStation_MissionProfile, + AWS_MediaConnect_FlowEntitlement, + AWS_MediaConnect_FlowVpcInterface, + AWS_MediaTailor_PlaybackConfiguration, + AWS_MSK_Configuration, + AWS_Personalize_Dataset, + AWS_Personalize_Schema, + AWS_Personalize_Solution, + AWS_Pinpoint_EmailTemplate, + AWS_Pinpoint_EventStream, + AWS_ResilienceHub_App, + AWS_ACMPCA_CertificateAuthority, + AWS_AppConfig_HostedConfigurationVersion, + AWS_AppMesh_VirtualGateway, + AWS_AppMesh_VirtualRouter, + AWS_AppRunner_Service, + AWS_CustomerProfiles_ObjectType, + AWS_DMS_Endpoint, + AWS_EC2_CapacityReservation, + AWS_EC2_ClientVpnEndpoint, + AWS_Kendra_Index, + AWS_KinesisVideo_Stream, + AWS_Logs_Destination, + AWS_Pinpoint_EmailChannel, + AWS_S3_AccessPoint, + AWS_NetworkManager_CustomerGatewayAssociation, + AWS_NetworkManager_LinkAssociation, + AWS_IoTWireless_MulticastGroup, + AWS_Personalize_DatasetGroup, + AWS_IoTTwinMaker_ComponentType, + AWS_CodeBuild_ReportGroup, + AWS_SageMaker_FeatureGroup, + AWS_MSK_BatchScramSecret, + AWS_AppStream_Stack, + AWS_IoT_JobTemplate, + AWS_IoTWireless_FuotaTask, + AWS_IoT_ProvisioningTemplate, + AWS_InspectorV2_Filter, + AWS_Route53Resolver_ResolverQueryLoggingConfigAssociation, + AWS_ServiceDiscovery_Instance, + AWS_Transfer_Certificate, + AWS_MediaConnect_FlowSource, + AWS_APS_RuleGroupsNamespace, + AWS_CodeGuruProfiler_ProfilingGroup, + AWS_Route53Resolver_ResolverQueryLoggingConfig, + AWS_Batch_SchedulingPolicy, + AWS_ACMPCA_CertificateAuthorityActivation, + AWS_AppMesh_GatewayRoute, + AWS_AppMesh_Mesh, + AWS_Connect_Instance, + AWS_Connect_QuickConnect, + AWS_EC2_CarrierGateway, + AWS_EC2_IPAMPool, + AWS_EC2_TransitGatewayConnect, + AWS_EC2_TransitGatewayMulticastDomain, + AWS_ECS_CapacityProvider, + AWS_IAM_InstanceProfile, + AWS_IoT_CACertificate, + AWS_IoTTwinMaker_SyncJob, + AWS_KafkaConnect_Connector, + AWS_Lambda_CodeSigningConfig, + AWS_NetworkManager_ConnectPeer, + AWS_ResourceExplorer2_Index, + AWS_AppStream_Fleet, + AWS_Cognito_UserPool, + AWS_Cognito_UserPoolClient, + AWS_Cognito_UserPoolGroup, + AWS_EC2_NetworkInsightsAccessScope, + AWS_EC2_NetworkInsightsAnalysis, + AWS_Grafana_Workspace, + AWS_GroundStation_DataflowEndpointGroup, + AWS_ImageBuilder_ImageRecipe, + AWS_KMS_Alias, + AWS_M2_Environment, + AWS_QuickSight_DataSource, + AWS_QuickSight_Template, + AWS_QuickSight_Theme, + AWS_RDS_OptionGroup, + AWS_Redshift_EndpointAccess, + AWS_Route53Resolver_FirewallRuleGroup, + AWS_SSM_Document + }; + +namespace ResourceTypeMapper +{ +AWS_CONFIGSERVICE_API ResourceType GetResourceTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForResourceType(ResourceType value); +} // namespace ResourceTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceValue.h b/include/aws/config/model/ResourceValue.h new file mode 100644 index 0000000000000000000000000000000000000000..31dfe6e0db2c1ee246998fb30500b3d612e5b5b3 --- /dev/null +++ b/include/aws/config/model/ResourceValue.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The dynamic value of the resource.

See Also:

AWS + * API Reference

+ */ + class ResourceValue + { + public: + AWS_CONFIGSERVICE_API ResourceValue(); + AWS_CONFIGSERVICE_API ResourceValue(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API ResourceValue& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The value is a resource ID.

+ */ + inline const ResourceValueType& GetValue() const{ return m_value; } + inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; } + inline void SetValue(const ResourceValueType& value) { m_valueHasBeenSet = true; m_value = value; } + inline void SetValue(ResourceValueType&& value) { m_valueHasBeenSet = true; m_value = std::move(value); } + inline ResourceValue& WithValue(const ResourceValueType& value) { SetValue(value); return *this;} + inline ResourceValue& WithValue(ResourceValueType&& value) { SetValue(std::move(value)); return *this;} + ///@} + private: + + ResourceValueType m_value; + bool m_valueHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/ResourceValueType.h b/include/aws/config/model/ResourceValueType.h new file mode 100644 index 0000000000000000000000000000000000000000..6498048c6350d893685a31efe68474fb3009369b --- /dev/null +++ b/include/aws/config/model/ResourceValueType.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class ResourceValueType + { + NOT_SET, + RESOURCE_ID + }; + +namespace ResourceValueTypeMapper +{ +AWS_CONFIGSERVICE_API ResourceValueType GetResourceValueTypeForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForResourceValueType(ResourceValueType value); +} // namespace ResourceValueTypeMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/RetentionConfiguration.h b/include/aws/config/model/RetentionConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..872a5ac46f52c0d6a8939d89e9bc298a72d137e6 --- /dev/null +++ b/include/aws/config/model/RetentionConfiguration.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

An object with the name of the retention configuration and the retention + * period in days. The object stores the configuration for data retention in + * Config.

See Also:

AWS + * API Reference

+ */ + class RetentionConfiguration + { + public: + AWS_CONFIGSERVICE_API RetentionConfiguration(); + AWS_CONFIGSERVICE_API RetentionConfiguration(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API RetentionConfiguration& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name of the retention configuration object.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline RetentionConfiguration& WithName(const Aws::String& value) { SetName(value); return *this;} + inline RetentionConfiguration& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline RetentionConfiguration& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

Number of days Config stores your historical information.

+ *

Currently, only applicable to the configuration item history.

+ */ + inline int GetRetentionPeriodInDays() const{ return m_retentionPeriodInDays; } + inline bool RetentionPeriodInDaysHasBeenSet() const { return m_retentionPeriodInDaysHasBeenSet; } + inline void SetRetentionPeriodInDays(int value) { m_retentionPeriodInDaysHasBeenSet = true; m_retentionPeriodInDays = value; } + inline RetentionConfiguration& WithRetentionPeriodInDays(int value) { SetRetentionPeriodInDays(value); return *this;} + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + int m_retentionPeriodInDays; + bool m_retentionPeriodInDaysHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/Scope.h b/include/aws/config/model/Scope.h new file mode 100644 index 0000000000000000000000000000000000000000..699be337ff83ec4b1368513cdd877c8d3532e0fb --- /dev/null +++ b/include/aws/config/model/Scope.h @@ -0,0 +1,127 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Defines which resources trigger an evaluation for an Config rule. The scope + * can include one or more resource types, a combination of a tag key and value, or + * a combination of one resource type and one resource ID. Specify a scope to + * constrain which resources trigger an evaluation for a rule. Otherwise, + * evaluations for the rule are triggered when any resource in your recording group + * changes in configuration.

See Also:

AWS API + * Reference

+ */ + class Scope + { + public: + AWS_CONFIGSERVICE_API Scope(); + AWS_CONFIGSERVICE_API Scope(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Scope& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The resource types of only those Amazon Web Services resources that you want + * to trigger an evaluation for the rule. You can only specify one type if you also + * specify a resource ID for ComplianceResourceId.

+ */ + inline const Aws::Vector& GetComplianceResourceTypes() const{ return m_complianceResourceTypes; } + inline bool ComplianceResourceTypesHasBeenSet() const { return m_complianceResourceTypesHasBeenSet; } + inline void SetComplianceResourceTypes(const Aws::Vector& value) { m_complianceResourceTypesHasBeenSet = true; m_complianceResourceTypes = value; } + inline void SetComplianceResourceTypes(Aws::Vector&& value) { m_complianceResourceTypesHasBeenSet = true; m_complianceResourceTypes = std::move(value); } + inline Scope& WithComplianceResourceTypes(const Aws::Vector& value) { SetComplianceResourceTypes(value); return *this;} + inline Scope& WithComplianceResourceTypes(Aws::Vector&& value) { SetComplianceResourceTypes(std::move(value)); return *this;} + inline Scope& AddComplianceResourceTypes(const Aws::String& value) { m_complianceResourceTypesHasBeenSet = true; m_complianceResourceTypes.push_back(value); return *this; } + inline Scope& AddComplianceResourceTypes(Aws::String&& value) { m_complianceResourceTypesHasBeenSet = true; m_complianceResourceTypes.push_back(std::move(value)); return *this; } + inline Scope& AddComplianceResourceTypes(const char* value) { m_complianceResourceTypesHasBeenSet = true; m_complianceResourceTypes.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The tag key that is applied to only those Amazon Web Services resources that + * you want to trigger an evaluation for the rule.

+ */ + inline const Aws::String& GetTagKey() const{ return m_tagKey; } + inline bool TagKeyHasBeenSet() const { return m_tagKeyHasBeenSet; } + inline void SetTagKey(const Aws::String& value) { m_tagKeyHasBeenSet = true; m_tagKey = value; } + inline void SetTagKey(Aws::String&& value) { m_tagKeyHasBeenSet = true; m_tagKey = std::move(value); } + inline void SetTagKey(const char* value) { m_tagKeyHasBeenSet = true; m_tagKey.assign(value); } + inline Scope& WithTagKey(const Aws::String& value) { SetTagKey(value); return *this;} + inline Scope& WithTagKey(Aws::String&& value) { SetTagKey(std::move(value)); return *this;} + inline Scope& WithTagKey(const char* value) { SetTagKey(value); return *this;} + ///@} + + ///@{ + /** + *

The tag value applied to only those Amazon Web Services resources that you + * want to trigger an evaluation for the rule. If you specify a value for + * TagValue, you must also specify a value for + * TagKey.

+ */ + inline const Aws::String& GetTagValue() const{ return m_tagValue; } + inline bool TagValueHasBeenSet() const { return m_tagValueHasBeenSet; } + inline void SetTagValue(const Aws::String& value) { m_tagValueHasBeenSet = true; m_tagValue = value; } + inline void SetTagValue(Aws::String&& value) { m_tagValueHasBeenSet = true; m_tagValue = std::move(value); } + inline void SetTagValue(const char* value) { m_tagValueHasBeenSet = true; m_tagValue.assign(value); } + inline Scope& WithTagValue(const Aws::String& value) { SetTagValue(value); return *this;} + inline Scope& WithTagValue(Aws::String&& value) { SetTagValue(std::move(value)); return *this;} + inline Scope& WithTagValue(const char* value) { SetTagValue(value); return *this;} + ///@} + + ///@{ + /** + *

The ID of the only Amazon Web Services resource that you want to trigger an + * evaluation for the rule. If you specify a resource ID, you must specify one + * resource type for ComplianceResourceTypes.

+ */ + inline const Aws::String& GetComplianceResourceId() const{ return m_complianceResourceId; } + inline bool ComplianceResourceIdHasBeenSet() const { return m_complianceResourceIdHasBeenSet; } + inline void SetComplianceResourceId(const Aws::String& value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId = value; } + inline void SetComplianceResourceId(Aws::String&& value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId = std::move(value); } + inline void SetComplianceResourceId(const char* value) { m_complianceResourceIdHasBeenSet = true; m_complianceResourceId.assign(value); } + inline Scope& WithComplianceResourceId(const Aws::String& value) { SetComplianceResourceId(value); return *this;} + inline Scope& WithComplianceResourceId(Aws::String&& value) { SetComplianceResourceId(std::move(value)); return *this;} + inline Scope& WithComplianceResourceId(const char* value) { SetComplianceResourceId(value); return *this;} + ///@} + private: + + Aws::Vector m_complianceResourceTypes; + bool m_complianceResourceTypesHasBeenSet = false; + + Aws::String m_tagKey; + bool m_tagKeyHasBeenSet = false; + + Aws::String m_tagValue; + bool m_tagValueHasBeenSet = false; + + Aws::String m_complianceResourceId; + bool m_complianceResourceIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SelectAggregateResourceConfigRequest.h b/include/aws/config/model/SelectAggregateResourceConfigRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..31a43a0598d6b7bb3670bf5d20555f1fd63f50b4 --- /dev/null +++ b/include/aws/config/model/SelectAggregateResourceConfigRequest.h @@ -0,0 +1,120 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class SelectAggregateResourceConfigRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API SelectAggregateResourceConfigRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SelectAggregateResourceConfig"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The SQL query SELECT command.

+ */ + inline const Aws::String& GetExpression() const{ return m_expression; } + inline bool ExpressionHasBeenSet() const { return m_expressionHasBeenSet; } + inline void SetExpression(const Aws::String& value) { m_expressionHasBeenSet = true; m_expression = value; } + inline void SetExpression(Aws::String&& value) { m_expressionHasBeenSet = true; m_expression = std::move(value); } + inline void SetExpression(const char* value) { m_expressionHasBeenSet = true; m_expression.assign(value); } + inline SelectAggregateResourceConfigRequest& WithExpression(const Aws::String& value) { SetExpression(value); return *this;} + inline SelectAggregateResourceConfigRequest& WithExpression(Aws::String&& value) { SetExpression(std::move(value)); return *this;} + inline SelectAggregateResourceConfigRequest& WithExpression(const char* value) { SetExpression(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the configuration aggregator.

+ */ + inline const Aws::String& GetConfigurationAggregatorName() const{ return m_configurationAggregatorName; } + inline bool ConfigurationAggregatorNameHasBeenSet() const { return m_configurationAggregatorNameHasBeenSet; } + inline void SetConfigurationAggregatorName(const Aws::String& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = value; } + inline void SetConfigurationAggregatorName(Aws::String&& value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName = std::move(value); } + inline void SetConfigurationAggregatorName(const char* value) { m_configurationAggregatorNameHasBeenSet = true; m_configurationAggregatorName.assign(value); } + inline SelectAggregateResourceConfigRequest& WithConfigurationAggregatorName(const Aws::String& value) { SetConfigurationAggregatorName(value); return *this;} + inline SelectAggregateResourceConfigRequest& WithConfigurationAggregatorName(Aws::String&& value) { SetConfigurationAggregatorName(std::move(value)); return *this;} + inline SelectAggregateResourceConfigRequest& WithConfigurationAggregatorName(const char* value) { SetConfigurationAggregatorName(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of query results returned on each page.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline SelectAggregateResourceConfigRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of query results returned on each page. Config also allows + * the Limit request parameter.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline SelectAggregateResourceConfigRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use to request + * the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline SelectAggregateResourceConfigRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline SelectAggregateResourceConfigRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline SelectAggregateResourceConfigRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_expression; + bool m_expressionHasBeenSet = false; + + Aws::String m_configurationAggregatorName; + bool m_configurationAggregatorNameHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SelectAggregateResourceConfigResult.h b/include/aws/config/model/SelectAggregateResourceConfigResult.h new file mode 100644 index 0000000000000000000000000000000000000000..52fb3b52214419f3fa0b341dcdcd897a04063f3b --- /dev/null +++ b/include/aws/config/model/SelectAggregateResourceConfigResult.h @@ -0,0 +1,97 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class SelectAggregateResourceConfigResult + { + public: + AWS_CONFIGSERVICE_API SelectAggregateResourceConfigResult(); + AWS_CONFIGSERVICE_API SelectAggregateResourceConfigResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API SelectAggregateResourceConfigResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns the results for the SQL query.

+ */ + inline const Aws::Vector& GetResults() const{ return m_results; } + inline void SetResults(const Aws::Vector& value) { m_results = value; } + inline void SetResults(Aws::Vector&& value) { m_results = std::move(value); } + inline SelectAggregateResourceConfigResult& WithResults(const Aws::Vector& value) { SetResults(value); return *this;} + inline SelectAggregateResourceConfigResult& WithResults(Aws::Vector&& value) { SetResults(std::move(value)); return *this;} + inline SelectAggregateResourceConfigResult& AddResults(const Aws::String& value) { m_results.push_back(value); return *this; } + inline SelectAggregateResourceConfigResult& AddResults(Aws::String&& value) { m_results.push_back(std::move(value)); return *this; } + inline SelectAggregateResourceConfigResult& AddResults(const char* value) { m_results.push_back(value); return *this; } + ///@} + + ///@{ + + inline const QueryInfo& GetQueryInfo() const{ return m_queryInfo; } + inline void SetQueryInfo(const QueryInfo& value) { m_queryInfo = value; } + inline void SetQueryInfo(QueryInfo&& value) { m_queryInfo = std::move(value); } + inline SelectAggregateResourceConfigResult& WithQueryInfo(const QueryInfo& value) { SetQueryInfo(value); return *this;} + inline SelectAggregateResourceConfigResult& WithQueryInfo(QueryInfo&& value) { SetQueryInfo(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use to request + * the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline SelectAggregateResourceConfigResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline SelectAggregateResourceConfigResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline SelectAggregateResourceConfigResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline SelectAggregateResourceConfigResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline SelectAggregateResourceConfigResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline SelectAggregateResourceConfigResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_results; + + QueryInfo m_queryInfo; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SelectResourceConfigRequest.h b/include/aws/config/model/SelectResourceConfigRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1b29cf9d7136ff7cd6699ab92cd9529eeb8f5331 --- /dev/null +++ b/include/aws/config/model/SelectResourceConfigRequest.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class SelectResourceConfigRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API SelectResourceConfigRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SelectResourceConfig"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The SQL query SELECT command.

+ */ + inline const Aws::String& GetExpression() const{ return m_expression; } + inline bool ExpressionHasBeenSet() const { return m_expressionHasBeenSet; } + inline void SetExpression(const Aws::String& value) { m_expressionHasBeenSet = true; m_expression = value; } + inline void SetExpression(Aws::String&& value) { m_expressionHasBeenSet = true; m_expression = std::move(value); } + inline void SetExpression(const char* value) { m_expressionHasBeenSet = true; m_expression.assign(value); } + inline SelectResourceConfigRequest& WithExpression(const Aws::String& value) { SetExpression(value); return *this;} + inline SelectResourceConfigRequest& WithExpression(Aws::String&& value) { SetExpression(std::move(value)); return *this;} + inline SelectResourceConfigRequest& WithExpression(const char* value) { SetExpression(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of query results returned on each page.

+ */ + inline int GetLimit() const{ return m_limit; } + inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; } + inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; } + inline SelectResourceConfigRequest& WithLimit(int value) { SetLimit(value); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline SelectResourceConfigRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline SelectResourceConfigRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline SelectResourceConfigRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_expression; + bool m_expressionHasBeenSet = false; + + int m_limit; + bool m_limitHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SelectResourceConfigResult.h b/include/aws/config/model/SelectResourceConfigResult.h new file mode 100644 index 0000000000000000000000000000000000000000..21d8927887cb4d5a1273fc7780a67ab5124d5629 --- /dev/null +++ b/include/aws/config/model/SelectResourceConfigResult.h @@ -0,0 +1,99 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class SelectResourceConfigResult + { + public: + AWS_CONFIGSERVICE_API SelectResourceConfigResult(); + AWS_CONFIGSERVICE_API SelectResourceConfigResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API SelectResourceConfigResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns the results for the SQL query.

+ */ + inline const Aws::Vector& GetResults() const{ return m_results; } + inline void SetResults(const Aws::Vector& value) { m_results = value; } + inline void SetResults(Aws::Vector&& value) { m_results = std::move(value); } + inline SelectResourceConfigResult& WithResults(const Aws::Vector& value) { SetResults(value); return *this;} + inline SelectResourceConfigResult& WithResults(Aws::Vector&& value) { SetResults(std::move(value)); return *this;} + inline SelectResourceConfigResult& AddResults(const Aws::String& value) { m_results.push_back(value); return *this; } + inline SelectResourceConfigResult& AddResults(Aws::String&& value) { m_results.push_back(std::move(value)); return *this; } + inline SelectResourceConfigResult& AddResults(const char* value) { m_results.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Returns the QueryInfo object.

+ */ + inline const QueryInfo& GetQueryInfo() const{ return m_queryInfo; } + inline void SetQueryInfo(const QueryInfo& value) { m_queryInfo = value; } + inline void SetQueryInfo(QueryInfo&& value) { m_queryInfo = std::move(value); } + inline SelectResourceConfigResult& WithQueryInfo(const QueryInfo& value) { SetQueryInfo(value); return *this;} + inline SelectResourceConfigResult& WithQueryInfo(QueryInfo&& value) { SetQueryInfo(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The nextToken string returned in a previous request that you use + * to request the next page of results in a paginated response.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline SelectResourceConfigResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline SelectResourceConfigResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline SelectResourceConfigResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline SelectResourceConfigResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline SelectResourceConfigResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline SelectResourceConfigResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_results; + + QueryInfo m_queryInfo; + + Aws::String m_nextToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SortBy.h b/include/aws/config/model/SortBy.h new file mode 100644 index 0000000000000000000000000000000000000000..288a86334d6b5a688dcc308d25c0912f6672376f --- /dev/null +++ b/include/aws/config/model/SortBy.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class SortBy + { + NOT_SET, + SCORE + }; + +namespace SortByMapper +{ +AWS_CONFIGSERVICE_API SortBy GetSortByForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForSortBy(SortBy value); +} // namespace SortByMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SortOrder.h b/include/aws/config/model/SortOrder.h new file mode 100644 index 0000000000000000000000000000000000000000..588cafcdeb7967488855d0ba426908f80d16bb8e --- /dev/null +++ b/include/aws/config/model/SortOrder.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + enum class SortOrder + { + NOT_SET, + ASCENDING, + DESCENDING + }; + +namespace SortOrderMapper +{ +AWS_CONFIGSERVICE_API SortOrder GetSortOrderForName(const Aws::String& name); + +AWS_CONFIGSERVICE_API Aws::String GetNameForSortOrder(SortOrder value); +} // namespace SortOrderMapper +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/Source.h b/include/aws/config/model/Source.h new file mode 100644 index 0000000000000000000000000000000000000000..6d925be342777e79726aac8f7f5d971b4c3dc6e7 --- /dev/null +++ b/include/aws/config/model/Source.h @@ -0,0 +1,140 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides the CustomPolicyDetails, the rule owner (Amazon Web + * Services for managed rules, CUSTOM_POLICY for Custom Policy + * rules, and CUSTOM_LAMBDA for Custom Lambda rules), the rule + * identifier, and the events that cause the evaluation of your Amazon Web Services + * resources.

See Also:

AWS API + * Reference

+ */ + class Source + { + public: + AWS_CONFIGSERVICE_API Source(); + AWS_CONFIGSERVICE_API Source(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Source& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Indicates whether Amazon Web Services or the customer owns and manages the + * Config rule.

Config Managed Rules are predefined rules owned by Amazon + * Web Services. For more information, see Config + * Managed Rules in the Config developer guide.

Config Custom + * Rules are rules that you can develop either with Guard + * (CUSTOM_POLICY) or Lambda (CUSTOM_LAMBDA). For more + * information, see Config + * Custom Rules in the Config developer guide.

+ */ + inline const Owner& GetOwner() const{ return m_owner; } + inline bool OwnerHasBeenSet() const { return m_ownerHasBeenSet; } + inline void SetOwner(const Owner& value) { m_ownerHasBeenSet = true; m_owner = value; } + inline void SetOwner(Owner&& value) { m_ownerHasBeenSet = true; m_owner = std::move(value); } + inline Source& WithOwner(const Owner& value) { SetOwner(value); return *this;} + inline Source& WithOwner(Owner&& value) { SetOwner(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

For Config Managed rules, a predefined identifier from a list. For example, + * IAM_PASSWORD_POLICY is a managed rule. To reference a managed rule, + * see List + * of Config Managed Rules.

For Config Custom Lambda rules, the + * identifier is the Amazon Resource Name (ARN) of the rule's Lambda function, such + * as + * arn:aws:lambda:us-east-2:123456789012:function:custom_rule_name.

+ *

For Config Custom Policy rules, this field will be ignored.

+ */ + inline const Aws::String& GetSourceIdentifier() const{ return m_sourceIdentifier; } + inline bool SourceIdentifierHasBeenSet() const { return m_sourceIdentifierHasBeenSet; } + inline void SetSourceIdentifier(const Aws::String& value) { m_sourceIdentifierHasBeenSet = true; m_sourceIdentifier = value; } + inline void SetSourceIdentifier(Aws::String&& value) { m_sourceIdentifierHasBeenSet = true; m_sourceIdentifier = std::move(value); } + inline void SetSourceIdentifier(const char* value) { m_sourceIdentifierHasBeenSet = true; m_sourceIdentifier.assign(value); } + inline Source& WithSourceIdentifier(const Aws::String& value) { SetSourceIdentifier(value); return *this;} + inline Source& WithSourceIdentifier(Aws::String&& value) { SetSourceIdentifier(std::move(value)); return *this;} + inline Source& WithSourceIdentifier(const char* value) { SetSourceIdentifier(value); return *this;} + ///@} + + ///@{ + /** + *

Provides the source and the message types that cause Config to evaluate your + * Amazon Web Services resources against a rule. It also provides the frequency + * with which you want Config to run evaluations for the rule if the trigger type + * is periodic.

If the owner is set to CUSTOM_POLICY, the only + * acceptable values for the Config rule trigger message type are + * ConfigurationItemChangeNotification and + * OversizedConfigurationItemChangeNotification.

+ */ + inline const Aws::Vector& GetSourceDetails() const{ return m_sourceDetails; } + inline bool SourceDetailsHasBeenSet() const { return m_sourceDetailsHasBeenSet; } + inline void SetSourceDetails(const Aws::Vector& value) { m_sourceDetailsHasBeenSet = true; m_sourceDetails = value; } + inline void SetSourceDetails(Aws::Vector&& value) { m_sourceDetailsHasBeenSet = true; m_sourceDetails = std::move(value); } + inline Source& WithSourceDetails(const Aws::Vector& value) { SetSourceDetails(value); return *this;} + inline Source& WithSourceDetails(Aws::Vector&& value) { SetSourceDetails(std::move(value)); return *this;} + inline Source& AddSourceDetails(const SourceDetail& value) { m_sourceDetailsHasBeenSet = true; m_sourceDetails.push_back(value); return *this; } + inline Source& AddSourceDetails(SourceDetail&& value) { m_sourceDetailsHasBeenSet = true; m_sourceDetails.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Provides the runtime system, policy definition, and whether debug logging is + * enabled. Required when owner is set to CUSTOM_POLICY.

+ */ + inline const CustomPolicyDetails& GetCustomPolicyDetails() const{ return m_customPolicyDetails; } + inline bool CustomPolicyDetailsHasBeenSet() const { return m_customPolicyDetailsHasBeenSet; } + inline void SetCustomPolicyDetails(const CustomPolicyDetails& value) { m_customPolicyDetailsHasBeenSet = true; m_customPolicyDetails = value; } + inline void SetCustomPolicyDetails(CustomPolicyDetails&& value) { m_customPolicyDetailsHasBeenSet = true; m_customPolicyDetails = std::move(value); } + inline Source& WithCustomPolicyDetails(const CustomPolicyDetails& value) { SetCustomPolicyDetails(value); return *this;} + inline Source& WithCustomPolicyDetails(CustomPolicyDetails&& value) { SetCustomPolicyDetails(std::move(value)); return *this;} + ///@} + private: + + Owner m_owner; + bool m_ownerHasBeenSet = false; + + Aws::String m_sourceIdentifier; + bool m_sourceIdentifierHasBeenSet = false; + + Aws::Vector m_sourceDetails; + bool m_sourceDetailsHasBeenSet = false; + + CustomPolicyDetails m_customPolicyDetails; + bool m_customPolicyDetailsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SourceDetail.h b/include/aws/config/model/SourceDetail.h new file mode 100644 index 0000000000000000000000000000000000000000..54cabaf4f9f29051dff75a44bd016cd30fff2265 --- /dev/null +++ b/include/aws/config/model/SourceDetail.h @@ -0,0 +1,119 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides the source and the message types that trigger Config to evaluate + * your Amazon Web Services resources against a rule. It also provides the + * frequency with which you want Config to run evaluations for the rule if the + * trigger type is periodic. You can specify the parameter values for + * SourceDetail only for custom rules.

See Also:

AWS + * API Reference

+ */ + class SourceDetail + { + public: + AWS_CONFIGSERVICE_API SourceDetail(); + AWS_CONFIGSERVICE_API SourceDetail(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API SourceDetail& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The source of the event, such as an Amazon Web Services service, that + * triggers Config to evaluate your Amazon Web Services resources.

+ */ + inline const EventSource& GetEventSource() const{ return m_eventSource; } + inline bool EventSourceHasBeenSet() const { return m_eventSourceHasBeenSet; } + inline void SetEventSource(const EventSource& value) { m_eventSourceHasBeenSet = true; m_eventSource = value; } + inline void SetEventSource(EventSource&& value) { m_eventSourceHasBeenSet = true; m_eventSource = std::move(value); } + inline SourceDetail& WithEventSource(const EventSource& value) { SetEventSource(value); return *this;} + inline SourceDetail& WithEventSource(EventSource&& value) { SetEventSource(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The type of notification that triggers Config to run an evaluation for a + * rule. You can specify the following notification types:

  • + * ConfigurationItemChangeNotification - Triggers an evaluation when + * Config delivers a configuration item as a result of a resource change.

  • + *
  • OversizedConfigurationItemChangeNotification - Triggers an + * evaluation when Config delivers an oversized configuration item. Config may + * generate this notification type when a resource changes and the notification + * exceeds the maximum size allowed by Amazon SNS.

  • + * ScheduledNotification - Triggers a periodic evaluation at the + * frequency specified for MaximumExecutionFrequency.

  • + *

    ConfigurationSnapshotDeliveryCompleted - Triggers a periodic + * evaluation when Config delivers a configuration snapshot.

If + * you want your custom rule to be triggered by configuration changes, specify two + * SourceDetail objects, one for ConfigurationItemChangeNotification + * and one for OversizedConfigurationItemChangeNotification.

+ */ + inline const MessageType& GetMessageType() const{ return m_messageType; } + inline bool MessageTypeHasBeenSet() const { return m_messageTypeHasBeenSet; } + inline void SetMessageType(const MessageType& value) { m_messageTypeHasBeenSet = true; m_messageType = value; } + inline void SetMessageType(MessageType&& value) { m_messageTypeHasBeenSet = true; m_messageType = std::move(value); } + inline SourceDetail& WithMessageType(const MessageType& value) { SetMessageType(value); return *this;} + inline SourceDetail& WithMessageType(MessageType&& value) { SetMessageType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The frequency at which you want Config to run evaluations for a custom rule + * with a periodic trigger. If you specify a value for + * MaximumExecutionFrequency, then MessageType must use + * the ScheduledNotification value.

By default, rules + * with a periodic trigger are evaluated every 24 hours. To change the frequency, + * specify a valid value for the MaximumExecutionFrequency + * parameter.

Based on the valid value you choose, Config runs evaluations + * once for each valid value. For example, if you choose Three_Hours, + * Config runs evaluations once every three hours. In this case, + * Three_Hours is the frequency of this rule.

+ */ + inline const MaximumExecutionFrequency& GetMaximumExecutionFrequency() const{ return m_maximumExecutionFrequency; } + inline bool MaximumExecutionFrequencyHasBeenSet() const { return m_maximumExecutionFrequencyHasBeenSet; } + inline void SetMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = value; } + inline void SetMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { m_maximumExecutionFrequencyHasBeenSet = true; m_maximumExecutionFrequency = std::move(value); } + inline SourceDetail& WithMaximumExecutionFrequency(const MaximumExecutionFrequency& value) { SetMaximumExecutionFrequency(value); return *this;} + inline SourceDetail& WithMaximumExecutionFrequency(MaximumExecutionFrequency&& value) { SetMaximumExecutionFrequency(std::move(value)); return *this;} + ///@} + private: + + EventSource m_eventSource; + bool m_eventSourceHasBeenSet = false; + + MessageType m_messageType; + bool m_messageTypeHasBeenSet = false; + + MaximumExecutionFrequency m_maximumExecutionFrequency; + bool m_maximumExecutionFrequencyHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/SsmControls.h b/include/aws/config/model/SsmControls.h new file mode 100644 index 0000000000000000000000000000000000000000..2a72df9cd5daec4381d63a811393b9d4faab8e39 --- /dev/null +++ b/include/aws/config/model/SsmControls.h @@ -0,0 +1,76 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Amazon Web Services Systems Manager (SSM) specific remediation + * controls.

See Also:

AWS + * API Reference

+ */ + class SsmControls + { + public: + AWS_CONFIGSERVICE_API SsmControls(); + AWS_CONFIGSERVICE_API SsmControls(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API SsmControls& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The maximum percentage of remediation actions allowed to run in parallel on + * the non-compliant resources for that specific rule. You can specify a + * percentage, such as 10%. The default value is 10.

+ */ + inline int GetConcurrentExecutionRatePercentage() const{ return m_concurrentExecutionRatePercentage; } + inline bool ConcurrentExecutionRatePercentageHasBeenSet() const { return m_concurrentExecutionRatePercentageHasBeenSet; } + inline void SetConcurrentExecutionRatePercentage(int value) { m_concurrentExecutionRatePercentageHasBeenSet = true; m_concurrentExecutionRatePercentage = value; } + inline SsmControls& WithConcurrentExecutionRatePercentage(int value) { SetConcurrentExecutionRatePercentage(value); return *this;} + ///@} + + ///@{ + /** + *

The percentage of errors that are allowed before SSM stops running + * automations on non-compliant resources for that specific rule. You can specify a + * percentage of errors, for example 10%. If you do not specifiy a percentage, the + * default is 50%. For example, if you set the ErrorPercentage to 40% for 10 + * non-compliant resources, then SSM stops running the automations when the fifth + * error is received.

+ */ + inline int GetErrorPercentage() const{ return m_errorPercentage; } + inline bool ErrorPercentageHasBeenSet() const { return m_errorPercentageHasBeenSet; } + inline void SetErrorPercentage(int value) { m_errorPercentageHasBeenSet = true; m_errorPercentage = value; } + inline SsmControls& WithErrorPercentage(int value) { SetErrorPercentage(value); return *this;} + ///@} + private: + + int m_concurrentExecutionRatePercentage; + bool m_concurrentExecutionRatePercentageHasBeenSet = false; + + int m_errorPercentage; + bool m_errorPercentageHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StartConfigRulesEvaluationRequest.h b/include/aws/config/model/StartConfigRulesEvaluationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..11552800a0201ea9538280134c1767d67a57e999 --- /dev/null +++ b/include/aws/config/model/StartConfigRulesEvaluationRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class StartConfigRulesEvaluationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API StartConfigRulesEvaluationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "StartConfigRulesEvaluation"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The list of names of Config rules that you want to run evaluations for.

+ */ + inline const Aws::Vector& GetConfigRuleNames() const{ return m_configRuleNames; } + inline bool ConfigRuleNamesHasBeenSet() const { return m_configRuleNamesHasBeenSet; } + inline void SetConfigRuleNames(const Aws::Vector& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = value; } + inline void SetConfigRuleNames(Aws::Vector&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames = std::move(value); } + inline StartConfigRulesEvaluationRequest& WithConfigRuleNames(const Aws::Vector& value) { SetConfigRuleNames(value); return *this;} + inline StartConfigRulesEvaluationRequest& WithConfigRuleNames(Aws::Vector&& value) { SetConfigRuleNames(std::move(value)); return *this;} + inline StartConfigRulesEvaluationRequest& AddConfigRuleNames(const Aws::String& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + inline StartConfigRulesEvaluationRequest& AddConfigRuleNames(Aws::String&& value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(std::move(value)); return *this; } + inline StartConfigRulesEvaluationRequest& AddConfigRuleNames(const char* value) { m_configRuleNamesHasBeenSet = true; m_configRuleNames.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_configRuleNames; + bool m_configRuleNamesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StartConfigRulesEvaluationResult.h b/include/aws/config/model/StartConfigRulesEvaluationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..26e6c83f1c0368ec99ab364f95a8817395d2e2ae --- /dev/null +++ b/include/aws/config/model/StartConfigRulesEvaluationResult.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + /** + *

The output when you start the evaluation for the specified Config + * rule.

See Also:

AWS + * API Reference

+ */ + class StartConfigRulesEvaluationResult + { + public: + AWS_CONFIGSERVICE_API StartConfigRulesEvaluationResult(); + AWS_CONFIGSERVICE_API StartConfigRulesEvaluationResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API StartConfigRulesEvaluationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline StartConfigRulesEvaluationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline StartConfigRulesEvaluationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline StartConfigRulesEvaluationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StartConfigurationRecorderRequest.h b/include/aws/config/model/StartConfigurationRecorderRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..317a9022fe46b9b279e0af464450b0ace4933f68 --- /dev/null +++ b/include/aws/config/model/StartConfigurationRecorderRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the StartConfigurationRecorder operation.

See + * Also:

AWS + * API Reference

+ */ + class StartConfigurationRecorderRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API StartConfigurationRecorderRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "StartConfigurationRecorder"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the customer managed configuration recorder that you want to + * start.

+ */ + inline const Aws::String& GetConfigurationRecorderName() const{ return m_configurationRecorderName; } + inline bool ConfigurationRecorderNameHasBeenSet() const { return m_configurationRecorderNameHasBeenSet; } + inline void SetConfigurationRecorderName(const Aws::String& value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName = value; } + inline void SetConfigurationRecorderName(Aws::String&& value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName = std::move(value); } + inline void SetConfigurationRecorderName(const char* value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName.assign(value); } + inline StartConfigurationRecorderRequest& WithConfigurationRecorderName(const Aws::String& value) { SetConfigurationRecorderName(value); return *this;} + inline StartConfigurationRecorderRequest& WithConfigurationRecorderName(Aws::String&& value) { SetConfigurationRecorderName(std::move(value)); return *this;} + inline StartConfigurationRecorderRequest& WithConfigurationRecorderName(const char* value) { SetConfigurationRecorderName(value); return *this;} + ///@} + private: + + Aws::String m_configurationRecorderName; + bool m_configurationRecorderNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StartRemediationExecutionRequest.h b/include/aws/config/model/StartRemediationExecutionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..61502ab3fb56697c6d845985cff5617d35398aca --- /dev/null +++ b/include/aws/config/model/StartRemediationExecutionRequest.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class StartRemediationExecutionRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API StartRemediationExecutionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "StartRemediationExecution"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The list of names of Config rules that you want to run remediation execution + * for.

+ */ + inline const Aws::String& GetConfigRuleName() const{ return m_configRuleName; } + inline bool ConfigRuleNameHasBeenSet() const { return m_configRuleNameHasBeenSet; } + inline void SetConfigRuleName(const Aws::String& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = value; } + inline void SetConfigRuleName(Aws::String&& value) { m_configRuleNameHasBeenSet = true; m_configRuleName = std::move(value); } + inline void SetConfigRuleName(const char* value) { m_configRuleNameHasBeenSet = true; m_configRuleName.assign(value); } + inline StartRemediationExecutionRequest& WithConfigRuleName(const Aws::String& value) { SetConfigRuleName(value); return *this;} + inline StartRemediationExecutionRequest& WithConfigRuleName(Aws::String&& value) { SetConfigRuleName(std::move(value)); return *this;} + inline StartRemediationExecutionRequest& WithConfigRuleName(const char* value) { SetConfigRuleName(value); return *this;} + ///@} + + ///@{ + /** + *

A list of resource keys to be processed with the current request. Each + * element in the list consists of the resource type and resource ID.

+ */ + inline const Aws::Vector& GetResourceKeys() const{ return m_resourceKeys; } + inline bool ResourceKeysHasBeenSet() const { return m_resourceKeysHasBeenSet; } + inline void SetResourceKeys(const Aws::Vector& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = value; } + inline void SetResourceKeys(Aws::Vector&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys = std::move(value); } + inline StartRemediationExecutionRequest& WithResourceKeys(const Aws::Vector& value) { SetResourceKeys(value); return *this;} + inline StartRemediationExecutionRequest& WithResourceKeys(Aws::Vector&& value) { SetResourceKeys(std::move(value)); return *this;} + inline StartRemediationExecutionRequest& AddResourceKeys(const ResourceKey& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(value); return *this; } + inline StartRemediationExecutionRequest& AddResourceKeys(ResourceKey&& value) { m_resourceKeysHasBeenSet = true; m_resourceKeys.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_configRuleName; + bool m_configRuleNameHasBeenSet = false; + + Aws::Vector m_resourceKeys; + bool m_resourceKeysHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StartRemediationExecutionResult.h b/include/aws/config/model/StartRemediationExecutionResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0d2bcc3bf3ec54627ab23917bc14f907d30cc586 --- /dev/null +++ b/include/aws/config/model/StartRemediationExecutionResult.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class StartRemediationExecutionResult + { + public: + AWS_CONFIGSERVICE_API StartRemediationExecutionResult(); + AWS_CONFIGSERVICE_API StartRemediationExecutionResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API StartRemediationExecutionResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Returns a failure message. For example, the resource is already + * compliant.

+ */ + inline const Aws::String& GetFailureMessage() const{ return m_failureMessage; } + inline void SetFailureMessage(const Aws::String& value) { m_failureMessage = value; } + inline void SetFailureMessage(Aws::String&& value) { m_failureMessage = std::move(value); } + inline void SetFailureMessage(const char* value) { m_failureMessage.assign(value); } + inline StartRemediationExecutionResult& WithFailureMessage(const Aws::String& value) { SetFailureMessage(value); return *this;} + inline StartRemediationExecutionResult& WithFailureMessage(Aws::String&& value) { SetFailureMessage(std::move(value)); return *this;} + inline StartRemediationExecutionResult& WithFailureMessage(const char* value) { SetFailureMessage(value); return *this;} + ///@} + + ///@{ + /** + *

For resources that have failed to start execution, the API returns a resource + * key object.

+ */ + inline const Aws::Vector& GetFailedItems() const{ return m_failedItems; } + inline void SetFailedItems(const Aws::Vector& value) { m_failedItems = value; } + inline void SetFailedItems(Aws::Vector&& value) { m_failedItems = std::move(value); } + inline StartRemediationExecutionResult& WithFailedItems(const Aws::Vector& value) { SetFailedItems(value); return *this;} + inline StartRemediationExecutionResult& WithFailedItems(Aws::Vector&& value) { SetFailedItems(std::move(value)); return *this;} + inline StartRemediationExecutionResult& AddFailedItems(const ResourceKey& value) { m_failedItems.push_back(value); return *this; } + inline StartRemediationExecutionResult& AddFailedItems(ResourceKey&& value) { m_failedItems.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline StartRemediationExecutionResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline StartRemediationExecutionResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline StartRemediationExecutionResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_failureMessage; + + Aws::Vector m_failedItems; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StartResourceEvaluationRequest.h b/include/aws/config/model/StartResourceEvaluationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..dc2ca929d39d4ad9829a51bed69d30d06096847b --- /dev/null +++ b/include/aws/config/model/StartResourceEvaluationRequest.h @@ -0,0 +1,129 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class StartResourceEvaluationRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API StartResourceEvaluationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "StartResourceEvaluation"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

Returns a ResourceDetails object.

+ */ + inline const ResourceDetails& GetResourceDetails() const{ return m_resourceDetails; } + inline bool ResourceDetailsHasBeenSet() const { return m_resourceDetailsHasBeenSet; } + inline void SetResourceDetails(const ResourceDetails& value) { m_resourceDetailsHasBeenSet = true; m_resourceDetails = value; } + inline void SetResourceDetails(ResourceDetails&& value) { m_resourceDetailsHasBeenSet = true; m_resourceDetails = std::move(value); } + inline StartResourceEvaluationRequest& WithResourceDetails(const ResourceDetails& value) { SetResourceDetails(value); return *this;} + inline StartResourceEvaluationRequest& WithResourceDetails(ResourceDetails&& value) { SetResourceDetails(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Returns an EvaluationContext object.

+ */ + inline const EvaluationContext& GetEvaluationContext() const{ return m_evaluationContext; } + inline bool EvaluationContextHasBeenSet() const { return m_evaluationContextHasBeenSet; } + inline void SetEvaluationContext(const EvaluationContext& value) { m_evaluationContextHasBeenSet = true; m_evaluationContext = value; } + inline void SetEvaluationContext(EvaluationContext&& value) { m_evaluationContextHasBeenSet = true; m_evaluationContext = std::move(value); } + inline StartResourceEvaluationRequest& WithEvaluationContext(const EvaluationContext& value) { SetEvaluationContext(value); return *this;} + inline StartResourceEvaluationRequest& WithEvaluationContext(EvaluationContext&& value) { SetEvaluationContext(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The mode of an evaluation. The valid values for this API are + * DETECTIVE and PROACTIVE.

+ */ + inline const EvaluationMode& GetEvaluationMode() const{ return m_evaluationMode; } + inline bool EvaluationModeHasBeenSet() const { return m_evaluationModeHasBeenSet; } + inline void SetEvaluationMode(const EvaluationMode& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = value; } + inline void SetEvaluationMode(EvaluationMode&& value) { m_evaluationModeHasBeenSet = true; m_evaluationMode = std::move(value); } + inline StartResourceEvaluationRequest& WithEvaluationMode(const EvaluationMode& value) { SetEvaluationMode(value); return *this;} + inline StartResourceEvaluationRequest& WithEvaluationMode(EvaluationMode&& value) { SetEvaluationMode(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The timeout for an evaluation. The default is 900 seconds. You cannot specify + * a number greater than 3600. If you specify 0, Config uses the default.

+ */ + inline int GetEvaluationTimeout() const{ return m_evaluationTimeout; } + inline bool EvaluationTimeoutHasBeenSet() const { return m_evaluationTimeoutHasBeenSet; } + inline void SetEvaluationTimeout(int value) { m_evaluationTimeoutHasBeenSet = true; m_evaluationTimeout = value; } + inline StartResourceEvaluationRequest& WithEvaluationTimeout(int value) { SetEvaluationTimeout(value); return *this;} + ///@} + + ///@{ + /** + *

A client token is a unique, case-sensitive string of up to 64 ASCII + * characters. To make an idempotent API request using one of these actions, + * specify a client token in the request.

Avoid reusing the same + * client token for other API requests. If you retry a request that completed + * successfully using the same client token and the same parameters, the retry + * succeeds without performing any further actions. If you retry a successful + * request using the same client token, but one or more of the parameters are + * different, other than the Region or Availability Zone, the retry fails with an + * IdempotentParameterMismatch error.

+ */ + inline const Aws::String& GetClientToken() const{ return m_clientToken; } + inline bool ClientTokenHasBeenSet() const { return m_clientTokenHasBeenSet; } + inline void SetClientToken(const Aws::String& value) { m_clientTokenHasBeenSet = true; m_clientToken = value; } + inline void SetClientToken(Aws::String&& value) { m_clientTokenHasBeenSet = true; m_clientToken = std::move(value); } + inline void SetClientToken(const char* value) { m_clientTokenHasBeenSet = true; m_clientToken.assign(value); } + inline StartResourceEvaluationRequest& WithClientToken(const Aws::String& value) { SetClientToken(value); return *this;} + inline StartResourceEvaluationRequest& WithClientToken(Aws::String&& value) { SetClientToken(std::move(value)); return *this;} + inline StartResourceEvaluationRequest& WithClientToken(const char* value) { SetClientToken(value); return *this;} + ///@} + private: + + ResourceDetails m_resourceDetails; + bool m_resourceDetailsHasBeenSet = false; + + EvaluationContext m_evaluationContext; + bool m_evaluationContextHasBeenSet = false; + + EvaluationMode m_evaluationMode; + bool m_evaluationModeHasBeenSet = false; + + int m_evaluationTimeout; + bool m_evaluationTimeoutHasBeenSet = false; + + Aws::String m_clientToken; + bool m_clientTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StartResourceEvaluationResult.h b/include/aws/config/model/StartResourceEvaluationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..8f163ab5dac5ad5cb0b532f98db77fa26dad6ad0 --- /dev/null +++ b/include/aws/config/model/StartResourceEvaluationResult.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + class StartResourceEvaluationResult + { + public: + AWS_CONFIGSERVICE_API StartResourceEvaluationResult(); + AWS_CONFIGSERVICE_API StartResourceEvaluationResult(const Aws::AmazonWebServiceResult& result); + AWS_CONFIGSERVICE_API StartResourceEvaluationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A unique ResourceEvaluationId that is associated with a single execution.

+ */ + inline const Aws::String& GetResourceEvaluationId() const{ return m_resourceEvaluationId; } + inline void SetResourceEvaluationId(const Aws::String& value) { m_resourceEvaluationId = value; } + inline void SetResourceEvaluationId(Aws::String&& value) { m_resourceEvaluationId = std::move(value); } + inline void SetResourceEvaluationId(const char* value) { m_resourceEvaluationId.assign(value); } + inline StartResourceEvaluationResult& WithResourceEvaluationId(const Aws::String& value) { SetResourceEvaluationId(value); return *this;} + inline StartResourceEvaluationResult& WithResourceEvaluationId(Aws::String&& value) { SetResourceEvaluationId(std::move(value)); return *this;} + inline StartResourceEvaluationResult& WithResourceEvaluationId(const char* value) { SetResourceEvaluationId(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline StartResourceEvaluationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline StartResourceEvaluationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline StartResourceEvaluationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_resourceEvaluationId; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StaticValue.h b/include/aws/config/model/StaticValue.h new file mode 100644 index 0000000000000000000000000000000000000000..9f1262a0b07e6f38ec42ae963980841ee318d21b --- /dev/null +++ b/include/aws/config/model/StaticValue.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The static value of the resource.

See Also:

AWS + * API Reference

+ */ + class StaticValue + { + public: + AWS_CONFIGSERVICE_API StaticValue(); + AWS_CONFIGSERVICE_API StaticValue(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API StaticValue& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

A list of values. For example, the ARN of the assumed role.

+ */ + inline const Aws::Vector& GetValues() const{ return m_values; } + inline bool ValuesHasBeenSet() const { return m_valuesHasBeenSet; } + inline void SetValues(const Aws::Vector& value) { m_valuesHasBeenSet = true; m_values = value; } + inline void SetValues(Aws::Vector&& value) { m_valuesHasBeenSet = true; m_values = std::move(value); } + inline StaticValue& WithValues(const Aws::Vector& value) { SetValues(value); return *this;} + inline StaticValue& WithValues(Aws::Vector&& value) { SetValues(std::move(value)); return *this;} + inline StaticValue& AddValues(const Aws::String& value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; } + inline StaticValue& AddValues(Aws::String&& value) { m_valuesHasBeenSet = true; m_values.push_back(std::move(value)); return *this; } + inline StaticValue& AddValues(const char* value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_values; + bool m_valuesHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StatusDetailFilters.h b/include/aws/config/model/StatusDetailFilters.h new file mode 100644 index 0000000000000000000000000000000000000000..aab2b4a804742bcda7aaf7482367cb127d59398c --- /dev/null +++ b/include/aws/config/model/StatusDetailFilters.h @@ -0,0 +1,99 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Status filter object to filter results based on specific member account ID or + * status type for an organization Config rule.

See Also:

AWS + * API Reference

+ */ + class StatusDetailFilters + { + public: + AWS_CONFIGSERVICE_API StatusDetailFilters(); + AWS_CONFIGSERVICE_API StatusDetailFilters(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API StatusDetailFilters& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The 12-digit account ID of the member account within an organization.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline StatusDetailFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline StatusDetailFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline StatusDetailFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates deployment status for Config rule in the member account. When + * management account calls PutOrganizationConfigRule action for the + * first time, Config rule status is created in the member account. When management + * account calls PutOrganizationConfigRule action for the second time, + * Config rule status is updated in the member account. Config rule status is + * deleted when the management account deletes OrganizationConfigRule + * and disables service access for + * config-multiaccountsetup.amazonaws.com.

Config sets the + * state of the rule to:

  • CREATE_SUCCESSFUL when + * Config rule has been created in the member account.

  • + * CREATE_IN_PROGRESS when Config rule is being created in the member + * account.

  • CREATE_FAILED when Config rule creation + * has failed in the member account.

  • DELETE_FAILED + * when Config rule deletion has failed in the member account.

  • + * DELETE_IN_PROGRESS when Config rule is being deleted in the member + * account.

  • DELETE_SUCCESSFUL when Config rule has + * been deleted in the member account.

  • + * UPDATE_SUCCESSFUL when Config rule has been updated in the member + * account.

  • UPDATE_IN_PROGRESS when Config rule is + * being updated in the member account.

  • + * UPDATE_FAILED when Config rule deletion has failed in the member + * account.

+ */ + inline const MemberAccountRuleStatus& GetMemberAccountRuleStatus() const{ return m_memberAccountRuleStatus; } + inline bool MemberAccountRuleStatusHasBeenSet() const { return m_memberAccountRuleStatusHasBeenSet; } + inline void SetMemberAccountRuleStatus(const MemberAccountRuleStatus& value) { m_memberAccountRuleStatusHasBeenSet = true; m_memberAccountRuleStatus = value; } + inline void SetMemberAccountRuleStatus(MemberAccountRuleStatus&& value) { m_memberAccountRuleStatusHasBeenSet = true; m_memberAccountRuleStatus = std::move(value); } + inline StatusDetailFilters& WithMemberAccountRuleStatus(const MemberAccountRuleStatus& value) { SetMemberAccountRuleStatus(value); return *this;} + inline StatusDetailFilters& WithMemberAccountRuleStatus(MemberAccountRuleStatus&& value) { SetMemberAccountRuleStatus(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + MemberAccountRuleStatus m_memberAccountRuleStatus; + bool m_memberAccountRuleStatusHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StopConfigurationRecorderRequest.h b/include/aws/config/model/StopConfigurationRecorderRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1276e0fd6cf1713bf81ff047ce053fc2830d752f --- /dev/null +++ b/include/aws/config/model/StopConfigurationRecorderRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + *

The input for the StopConfigurationRecorder operation.

See + * Also:

AWS + * API Reference

+ */ + class StopConfigurationRecorderRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API StopConfigurationRecorderRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "StopConfigurationRecorder"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the customer managed configuration recorder that you want to + * stop.

+ */ + inline const Aws::String& GetConfigurationRecorderName() const{ return m_configurationRecorderName; } + inline bool ConfigurationRecorderNameHasBeenSet() const { return m_configurationRecorderNameHasBeenSet; } + inline void SetConfigurationRecorderName(const Aws::String& value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName = value; } + inline void SetConfigurationRecorderName(Aws::String&& value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName = std::move(value); } + inline void SetConfigurationRecorderName(const char* value) { m_configurationRecorderNameHasBeenSet = true; m_configurationRecorderName.assign(value); } + inline StopConfigurationRecorderRequest& WithConfigurationRecorderName(const Aws::String& value) { SetConfigurationRecorderName(value); return *this;} + inline StopConfigurationRecorderRequest& WithConfigurationRecorderName(Aws::String&& value) { SetConfigurationRecorderName(std::move(value)); return *this;} + inline StopConfigurationRecorderRequest& WithConfigurationRecorderName(const char* value) { SetConfigurationRecorderName(value); return *this;} + ///@} + private: + + Aws::String m_configurationRecorderName; + bool m_configurationRecorderNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StoredQuery.h b/include/aws/config/model/StoredQuery.h new file mode 100644 index 0000000000000000000000000000000000000000..ad545263f484ccec56813b9a3af39cfa0eed499c --- /dev/null +++ b/include/aws/config/model/StoredQuery.h @@ -0,0 +1,134 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Provides the details of a stored query.

See Also:

AWS + * API Reference

+ */ + class StoredQuery + { + public: + AWS_CONFIGSERVICE_API StoredQuery(); + AWS_CONFIGSERVICE_API StoredQuery(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API StoredQuery& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The ID of the query.

+ */ + inline const Aws::String& GetQueryId() const{ return m_queryId; } + inline bool QueryIdHasBeenSet() const { return m_queryIdHasBeenSet; } + inline void SetQueryId(const Aws::String& value) { m_queryIdHasBeenSet = true; m_queryId = value; } + inline void SetQueryId(Aws::String&& value) { m_queryIdHasBeenSet = true; m_queryId = std::move(value); } + inline void SetQueryId(const char* value) { m_queryIdHasBeenSet = true; m_queryId.assign(value); } + inline StoredQuery& WithQueryId(const Aws::String& value) { SetQueryId(value); return *this;} + inline StoredQuery& WithQueryId(Aws::String&& value) { SetQueryId(std::move(value)); return *this;} + inline StoredQuery& WithQueryId(const char* value) { SetQueryId(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of the query. For example, + * arn:partition:service:region:account-id:resource-type/resource-name/resource-id.

+ */ + inline const Aws::String& GetQueryArn() const{ return m_queryArn; } + inline bool QueryArnHasBeenSet() const { return m_queryArnHasBeenSet; } + inline void SetQueryArn(const Aws::String& value) { m_queryArnHasBeenSet = true; m_queryArn = value; } + inline void SetQueryArn(Aws::String&& value) { m_queryArnHasBeenSet = true; m_queryArn = std::move(value); } + inline void SetQueryArn(const char* value) { m_queryArnHasBeenSet = true; m_queryArn.assign(value); } + inline StoredQuery& WithQueryArn(const Aws::String& value) { SetQueryArn(value); return *this;} + inline StoredQuery& WithQueryArn(Aws::String&& value) { SetQueryArn(std::move(value)); return *this;} + inline StoredQuery& WithQueryArn(const char* value) { SetQueryArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the query.

+ */ + inline const Aws::String& GetQueryName() const{ return m_queryName; } + inline bool QueryNameHasBeenSet() const { return m_queryNameHasBeenSet; } + inline void SetQueryName(const Aws::String& value) { m_queryNameHasBeenSet = true; m_queryName = value; } + inline void SetQueryName(Aws::String&& value) { m_queryNameHasBeenSet = true; m_queryName = std::move(value); } + inline void SetQueryName(const char* value) { m_queryNameHasBeenSet = true; m_queryName.assign(value); } + inline StoredQuery& WithQueryName(const Aws::String& value) { SetQueryName(value); return *this;} + inline StoredQuery& WithQueryName(Aws::String&& value) { SetQueryName(std::move(value)); return *this;} + inline StoredQuery& WithQueryName(const char* value) { SetQueryName(value); return *this;} + ///@} + + ///@{ + /** + *

A unique description for the query.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline StoredQuery& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline StoredQuery& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline StoredQuery& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

The expression of the query. For example, SELECT resourceId, + * resourceType, supplementaryConfiguration.BucketVersioningConfiguration.status + * WHERE resourceType = 'AWS::S3::Bucket' AND + * supplementaryConfiguration.BucketVersioningConfiguration.status = 'Off'. + *

+ */ + inline const Aws::String& GetExpression() const{ return m_expression; } + inline bool ExpressionHasBeenSet() const { return m_expressionHasBeenSet; } + inline void SetExpression(const Aws::String& value) { m_expressionHasBeenSet = true; m_expression = value; } + inline void SetExpression(Aws::String&& value) { m_expressionHasBeenSet = true; m_expression = std::move(value); } + inline void SetExpression(const char* value) { m_expressionHasBeenSet = true; m_expression.assign(value); } + inline StoredQuery& WithExpression(const Aws::String& value) { SetExpression(value); return *this;} + inline StoredQuery& WithExpression(Aws::String&& value) { SetExpression(std::move(value)); return *this;} + inline StoredQuery& WithExpression(const char* value) { SetExpression(value); return *this;} + ///@} + private: + + Aws::String m_queryId; + bool m_queryIdHasBeenSet = false; + + Aws::String m_queryArn; + bool m_queryArnHasBeenSet = false; + + Aws::String m_queryName; + bool m_queryNameHasBeenSet = false; + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + Aws::String m_expression; + bool m_expressionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/StoredQueryMetadata.h b/include/aws/config/model/StoredQueryMetadata.h new file mode 100644 index 0000000000000000000000000000000000000000..7e54039706c1b201de58c45656e001fef47b3e19 --- /dev/null +++ b/include/aws/config/model/StoredQueryMetadata.h @@ -0,0 +1,113 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Returns details of a specific query.

See Also:

AWS + * API Reference

+ */ + class StoredQueryMetadata + { + public: + AWS_CONFIGSERVICE_API StoredQueryMetadata(); + AWS_CONFIGSERVICE_API StoredQueryMetadata(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API StoredQueryMetadata& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The ID of the query.

+ */ + inline const Aws::String& GetQueryId() const{ return m_queryId; } + inline bool QueryIdHasBeenSet() const { return m_queryIdHasBeenSet; } + inline void SetQueryId(const Aws::String& value) { m_queryIdHasBeenSet = true; m_queryId = value; } + inline void SetQueryId(Aws::String&& value) { m_queryIdHasBeenSet = true; m_queryId = std::move(value); } + inline void SetQueryId(const char* value) { m_queryIdHasBeenSet = true; m_queryId.assign(value); } + inline StoredQueryMetadata& WithQueryId(const Aws::String& value) { SetQueryId(value); return *this;} + inline StoredQueryMetadata& WithQueryId(Aws::String&& value) { SetQueryId(std::move(value)); return *this;} + inline StoredQueryMetadata& WithQueryId(const char* value) { SetQueryId(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon Resource Name (ARN) of the query. For example, + * arn:partition:service:region:account-id:resource-type/resource-name/resource-id.

+ */ + inline const Aws::String& GetQueryArn() const{ return m_queryArn; } + inline bool QueryArnHasBeenSet() const { return m_queryArnHasBeenSet; } + inline void SetQueryArn(const Aws::String& value) { m_queryArnHasBeenSet = true; m_queryArn = value; } + inline void SetQueryArn(Aws::String&& value) { m_queryArnHasBeenSet = true; m_queryArn = std::move(value); } + inline void SetQueryArn(const char* value) { m_queryArnHasBeenSet = true; m_queryArn.assign(value); } + inline StoredQueryMetadata& WithQueryArn(const Aws::String& value) { SetQueryArn(value); return *this;} + inline StoredQueryMetadata& WithQueryArn(Aws::String&& value) { SetQueryArn(std::move(value)); return *this;} + inline StoredQueryMetadata& WithQueryArn(const char* value) { SetQueryArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the query.

+ */ + inline const Aws::String& GetQueryName() const{ return m_queryName; } + inline bool QueryNameHasBeenSet() const { return m_queryNameHasBeenSet; } + inline void SetQueryName(const Aws::String& value) { m_queryNameHasBeenSet = true; m_queryName = value; } + inline void SetQueryName(Aws::String&& value) { m_queryNameHasBeenSet = true; m_queryName = std::move(value); } + inline void SetQueryName(const char* value) { m_queryNameHasBeenSet = true; m_queryName.assign(value); } + inline StoredQueryMetadata& WithQueryName(const Aws::String& value) { SetQueryName(value); return *this;} + inline StoredQueryMetadata& WithQueryName(Aws::String&& value) { SetQueryName(std::move(value)); return *this;} + inline StoredQueryMetadata& WithQueryName(const char* value) { SetQueryName(value); return *this;} + ///@} + + ///@{ + /** + *

A unique description for the query.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline StoredQueryMetadata& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline StoredQueryMetadata& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline StoredQueryMetadata& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + private: + + Aws::String m_queryId; + bool m_queryIdHasBeenSet = false; + + Aws::String m_queryArn; + bool m_queryArnHasBeenSet = false; + + Aws::String m_queryName; + bool m_queryNameHasBeenSet = false; + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/Tag.h b/include/aws/config/model/Tag.h new file mode 100644 index 0000000000000000000000000000000000000000..03ea209efb230c53b849334ff74ec56888f25973 --- /dev/null +++ b/include/aws/config/model/Tag.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

The tags for the resource. The metadata that you apply to a resource to help + * you categorize and organize them. Each tag consists of a key and an optional + * value, both of which you define. Tag keys can have a maximum character length of + * 128 characters, and tag values can have a maximum length of 256 + * characters.

See Also:

AWS API + * Reference

+ */ + class Tag + { + public: + AWS_CONFIGSERVICE_API Tag(); + AWS_CONFIGSERVICE_API Tag(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Tag& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

One part of a key-value pair that make up a tag. A key is a general label + * that acts like a category for more specific tag values.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline Tag& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline Tag& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline Tag& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The optional part of a key-value pair that make up a tag. A value acts as a + * descriptor within a tag category (key).

+ */ + inline const Aws::String& GetValue() const{ return m_value; } + inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; } + inline void SetValue(const Aws::String& value) { m_valueHasBeenSet = true; m_value = value; } + inline void SetValue(Aws::String&& value) { m_valueHasBeenSet = true; m_value = std::move(value); } + inline void SetValue(const char* value) { m_valueHasBeenSet = true; m_value.assign(value); } + inline Tag& WithValue(const Aws::String& value) { SetValue(value); return *this;} + inline Tag& WithValue(Aws::String&& value) { SetValue(std::move(value)); return *this;} + inline Tag& WithValue(const char* value) { SetValue(value); return *this;} + ///@} + private: + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_value; + bool m_valueHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/TagResourceRequest.h b/include/aws/config/model/TagResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..8198411435e99a03d995c98f45a2ccf593a0b1d9 --- /dev/null +++ b/include/aws/config/model/TagResourceRequest.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class TagResourceRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API TagResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "TagResource"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) that identifies the resource for which to list + * the tags. The following resources are supported:

  • + * ConfigurationRecorder

  • ConfigRule + *

  • OrganizationConfigRule

  • + * ConformancePack

  • + * OrganizationConformancePack

  • + * ConfigurationAggregator

  • + * AggregationAuthorization

  • + * StoredQuery

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline TagResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline TagResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline TagResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

An array of tag object.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline TagResourceRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline TagResourceRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline TagResourceRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline TagResourceRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/TemplateSSMDocumentDetails.h b/include/aws/config/model/TemplateSSMDocumentDetails.h new file mode 100644 index 0000000000000000000000000000000000000000..64f47af3ed611455c79df66cdfa65af6ed90dbdb --- /dev/null +++ b/include/aws/config/model/TemplateSSMDocumentDetails.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

This API allows you to create a conformance pack template with an Amazon Web + * Services Systems Manager document (SSM document). To deploy a conformance pack + * using an SSM document, first create an SSM document with conformance pack + * content, and then provide the DocumentName in the PutConformancePack + * API. You can also provide the DocumentVersion.

The + * TemplateSSMDocumentDetails object contains the name of the SSM + * document and the version of the SSM document.

See Also:

AWS + * API Reference

+ */ + class TemplateSSMDocumentDetails + { + public: + AWS_CONFIGSERVICE_API TemplateSSMDocumentDetails(); + AWS_CONFIGSERVICE_API TemplateSSMDocumentDetails(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API TemplateSSMDocumentDetails& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The name or Amazon Resource Name (ARN) of the SSM document to use to create a + * conformance pack. If you use the document name, Config checks only your account + * and Amazon Web Services Region for the SSM document.

+ */ + inline const Aws::String& GetDocumentName() const{ return m_documentName; } + inline bool DocumentNameHasBeenSet() const { return m_documentNameHasBeenSet; } + inline void SetDocumentName(const Aws::String& value) { m_documentNameHasBeenSet = true; m_documentName = value; } + inline void SetDocumentName(Aws::String&& value) { m_documentNameHasBeenSet = true; m_documentName = std::move(value); } + inline void SetDocumentName(const char* value) { m_documentNameHasBeenSet = true; m_documentName.assign(value); } + inline TemplateSSMDocumentDetails& WithDocumentName(const Aws::String& value) { SetDocumentName(value); return *this;} + inline TemplateSSMDocumentDetails& WithDocumentName(Aws::String&& value) { SetDocumentName(std::move(value)); return *this;} + inline TemplateSSMDocumentDetails& WithDocumentName(const char* value) { SetDocumentName(value); return *this;} + ///@} + + ///@{ + /** + *

The version of the SSM document to use to create a conformance pack. By + * default, Config uses the latest version.

This field is + * optional.

+ */ + inline const Aws::String& GetDocumentVersion() const{ return m_documentVersion; } + inline bool DocumentVersionHasBeenSet() const { return m_documentVersionHasBeenSet; } + inline void SetDocumentVersion(const Aws::String& value) { m_documentVersionHasBeenSet = true; m_documentVersion = value; } + inline void SetDocumentVersion(Aws::String&& value) { m_documentVersionHasBeenSet = true; m_documentVersion = std::move(value); } + inline void SetDocumentVersion(const char* value) { m_documentVersionHasBeenSet = true; m_documentVersion.assign(value); } + inline TemplateSSMDocumentDetails& WithDocumentVersion(const Aws::String& value) { SetDocumentVersion(value); return *this;} + inline TemplateSSMDocumentDetails& WithDocumentVersion(Aws::String&& value) { SetDocumentVersion(std::move(value)); return *this;} + inline TemplateSSMDocumentDetails& WithDocumentVersion(const char* value) { SetDocumentVersion(value); return *this;} + ///@} + private: + + Aws::String m_documentName; + bool m_documentNameHasBeenSet = false; + + Aws::String m_documentVersion; + bool m_documentVersionHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/TimeWindow.h b/include/aws/config/model/TimeWindow.h new file mode 100644 index 0000000000000000000000000000000000000000..17fdf73309ca25069beca73af3f3b75ca512e46f --- /dev/null +++ b/include/aws/config/model/TimeWindow.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace ConfigService +{ +namespace Model +{ + + /** + *

Filters evaluation results based on start and end times.

See + * Also:

AWS + * API Reference

+ */ + class TimeWindow + { + public: + AWS_CONFIGSERVICE_API TimeWindow(); + AWS_CONFIGSERVICE_API TimeWindow(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API TimeWindow& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_CONFIGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The start time of an execution.

+ */ + inline const Aws::Utils::DateTime& GetStartTime() const{ return m_startTime; } + inline bool StartTimeHasBeenSet() const { return m_startTimeHasBeenSet; } + inline void SetStartTime(const Aws::Utils::DateTime& value) { m_startTimeHasBeenSet = true; m_startTime = value; } + inline void SetStartTime(Aws::Utils::DateTime&& value) { m_startTimeHasBeenSet = true; m_startTime = std::move(value); } + inline TimeWindow& WithStartTime(const Aws::Utils::DateTime& value) { SetStartTime(value); return *this;} + inline TimeWindow& WithStartTime(Aws::Utils::DateTime&& value) { SetStartTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The end time of an execution. The end time must be after the start date.

+ */ + inline const Aws::Utils::DateTime& GetEndTime() const{ return m_endTime; } + inline bool EndTimeHasBeenSet() const { return m_endTimeHasBeenSet; } + inline void SetEndTime(const Aws::Utils::DateTime& value) { m_endTimeHasBeenSet = true; m_endTime = value; } + inline void SetEndTime(Aws::Utils::DateTime&& value) { m_endTimeHasBeenSet = true; m_endTime = std::move(value); } + inline TimeWindow& WithEndTime(const Aws::Utils::DateTime& value) { SetEndTime(value); return *this;} + inline TimeWindow& WithEndTime(Aws::Utils::DateTime&& value) { SetEndTime(std::move(value)); return *this;} + ///@} + private: + + Aws::Utils::DateTime m_startTime; + bool m_startTimeHasBeenSet = false; + + Aws::Utils::DateTime m_endTime; + bool m_endTimeHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/config/model/UntagResourceRequest.h b/include/aws/config/model/UntagResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..afa6c5fdb27df7062329d37a62c3cf02e95f0f57 --- /dev/null +++ b/include/aws/config/model/UntagResourceRequest.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace ConfigService +{ +namespace Model +{ + + /** + */ + class UntagResourceRequest : public ConfigServiceRequest + { + public: + AWS_CONFIGSERVICE_API UntagResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "UntagResource"; } + + AWS_CONFIGSERVICE_API Aws::String SerializePayload() const override; + + AWS_CONFIGSERVICE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) that identifies the resource for which to list + * the tags. The following resources are supported:

  • + * ConfigurationRecorder

  • ConfigRule + *

  • OrganizationConfigRule

  • + * ConformancePack

  • + * OrganizationConformancePack

  • + * ConfigurationAggregator

  • + * AggregationAuthorization

  • + * StoredQuery

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline UntagResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline UntagResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline UntagResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The keys of the tags to be removed.

+ */ + inline const Aws::Vector& GetTagKeys() const{ return m_tagKeys; } + inline bool TagKeysHasBeenSet() const { return m_tagKeysHasBeenSet; } + inline void SetTagKeys(const Aws::Vector& value) { m_tagKeysHasBeenSet = true; m_tagKeys = value; } + inline void SetTagKeys(Aws::Vector&& value) { m_tagKeysHasBeenSet = true; m_tagKeys = std::move(value); } + inline UntagResourceRequest& WithTagKeys(const Aws::Vector& value) { SetTagKeys(value); return *this;} + inline UntagResourceRequest& WithTagKeys(Aws::Vector&& value) { SetTagKeys(std::move(value)); return *this;} + inline UntagResourceRequest& AddTagKeys(const Aws::String& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; } + inline UntagResourceRequest& AddTagKeys(Aws::String&& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(std::move(value)); return *this; } + inline UntagResourceRequest& AddTagKeys(const char* value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; } + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + + Aws::Vector m_tagKeys; + bool m_tagKeysHasBeenSet = false; + }; + +} // namespace Model +} // namespace ConfigService +} // namespace Aws diff --git a/include/aws/core/AmazonSerializableWebServiceRequest.h b/include/aws/core/AmazonSerializableWebServiceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2ba298546e08c09712e36c9a06f2eae552035502 --- /dev/null +++ b/include/aws/core/AmazonSerializableWebServiceRequest.h @@ -0,0 +1,56 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + static const char JSON_CONTENT_TYPE[] = "application/json"; + static const char AMZN_JSON_CONTENT_TYPE_1_0[] = "application/x-amz-json-1.0"; + static const char AMZN_JSON_CONTENT_TYPE_1_1[] = "application/x-amz-json-1.1"; + static const char FORM_CONTENT_TYPE[] = "application/x-www-form-urlencoded"; + static const char AMZN_XML_CONTENT_TYPE[] = "application/xml"; + static const char AMZN_EVENTSTREAM_CONTENT_TYPE[] = "application/vnd.amazon.eventstream"; + + /** + * High-level abstraction over AWS requests. GetBody() calls SerializePayload() and uses a stringbuf under the hood. + * This is for payloads such as query, xml, or json + */ + class AWS_CORE_API AmazonSerializableWebServiceRequest : public AmazonWebServiceRequest + { + public: + AmazonSerializableWebServiceRequest() + { + //prevent unreferenced var warnings + //for these values. + AWS_UNREFERENCED_PARAM(JSON_CONTENT_TYPE); + AWS_UNREFERENCED_PARAM(AMZN_JSON_CONTENT_TYPE_1_0); + AWS_UNREFERENCED_PARAM(AMZN_JSON_CONTENT_TYPE_1_1); + AWS_UNREFERENCED_PARAM(FORM_CONTENT_TYPE); + AWS_UNREFERENCED_PARAM(AMZN_XML_CONTENT_TYPE); + } + + virtual ~AmazonSerializableWebServiceRequest() {} + + /** + * Convert payload into String. + */ + virtual Aws::String SerializePayload() const = 0; + + /** + * Loads serialized payload into string buf and returns the stream + */ + std::shared_ptr GetBody() const override; + }; + +} // namespace Aws + diff --git a/include/aws/core/AmazonStreamingWebServiceRequest.h b/include/aws/core/AmazonStreamingWebServiceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c267d06aaf29ef8c6bb5e8f16d09cf8b036d2542 --- /dev/null +++ b/include/aws/core/AmazonStreamingWebServiceRequest.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + static const char* DEFAULT_CONTENT_TYPE = "binary/octet-stream"; + + /** + * High-level abstraction over AWS requests that don't have well formed payloads. GetBody() uses an underlying stream that has been set by a call to SetBody() + * Also supports request specific headers such as in rest protocols. + */ + class AWS_CORE_API AmazonStreamingWebServiceRequest : public AmazonWebServiceRequest + { + public: + /** + * Initializes members to defaults + */ + AmazonStreamingWebServiceRequest() : m_contentType(DEFAULT_CONTENT_TYPE) + { + } + + virtual ~AmazonStreamingWebServiceRequest(); + + /** + * Get the user set stream + */ + inline std::shared_ptr GetBody() const override { return m_bodyStream; } + /** + * Set the body stream to use for the request. + */ + inline void SetBody(const std::shared_ptr& body) { m_bodyStream = body; } + /** + * Gets all headers that will be needed in the request. Calls GetRequestSpecificHeaders(), which is the chance for subclasses to add + * headers from their modeled data. + */ + inline Aws::Http::HeaderValueCollection GetHeaders() const override + { + auto headers = GetRequestSpecificHeaders(); + headers.insert(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, GetContentType())); + + return headers; + } + + /** + * AmazonStreamingWebServiceRequest always returns true. + */ + bool IsStreaming() const override { return true; } + + /** + * Get the user set contentType. Defaults to binary/octet-stream + */ + const Aws::String& GetContentType() const { return m_contentType; } + /** + * Set the content type. + */ + void SetContentType(const Aws::String& contentType) { m_contentType = contentType; } + + protected: + /** + * Override this method to put data members from a subclass into the headers collection. + */ + virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); }; + + private: + std::shared_ptr m_bodyStream; + Aws::String m_contentType; + }; + +} // namespace Aws + diff --git a/include/aws/core/AmazonWebServiceRequest.h b/include/aws/core/AmazonWebServiceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2b2a9e13c7d78d9bb60095b6ff80cdf17a4bb191 --- /dev/null +++ b/include/aws/core/AmazonWebServiceRequest.h @@ -0,0 +1,248 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Http + { + class URI; + } // namespace Http + + class AmazonWebServiceRequest; + + /** + * Closure definition for handling a retry notification. This is only for if you want to be notified that a particular request is being retried. + */ + typedef std::function RequestRetryHandler; + typedef std::function RequestSignedHandler; + + /** + * Base level abstraction for all modeled AWS requests + */ + class AWS_CORE_API AmazonWebServiceRequest + { + public: + /** + * Sets up default response stream factory. initializes other pointers to nullptr. + */ + AmazonWebServiceRequest(); + virtual ~AmazonWebServiceRequest() = default; + + /** + * Get the payload for the request + */ + virtual std::shared_ptr GetBody() const = 0; + /** + * Get the headers for the request + */ + virtual Aws::Http::HeaderValueCollection GetHeaders() const = 0; + /** + * Get the additional user-set custom headers for the request + */ + virtual const Aws::Http::HeaderValueCollection& GetAdditionalCustomHeaders() const; + /** + * Set an additional custom header value under a key. This value will overwrite any previously set or regular header. + */ + virtual void SetAdditionalCustomHeaderValue(const Aws::String& headerName, const Aws::String& headerValue); + + /** + * Do nothing virtual, override this to add query strings to the request + */ + virtual void AddQueryStringParameters(Aws::Http::URI& uri) const { AWS_UNREFERENCED_PARAM(uri); } + + /** + * Put the request to a url for later presigning. This will push the body to the url and + * then adds the existing query string parameters as normal. + */ + virtual void PutToPresignedUrl(Aws::Http::URI& uri) const { DumpBodyToUrl(uri); AddQueryStringParameters(uri); } + + /** + * Defaults to false, if this is set to true, it's a streaming request, which means the payload is not well structured bits. + */ + virtual bool IsStreaming() const { return false; } + + /** + * Defaults to false, if this is set to true in derived class, it's an event stream request, which means the payload is consisted by multiple structured events. + */ + inline virtual bool IsEventStreamRequest() const { return false; } + + /** + * Defaults to false, if this is set to true in derived class, the operation using this request will return an event stream response. + */ + inline virtual bool HasEventStreamResponse() const { return false; } + + /** + * Defaults to true, if this is set to false, then signers, if they support body signing, will not do so + */ + virtual bool SignBody() const { return true; } + + /** + * Defaults to false, if a derived class returns true it indicates that the body has an embedded error. + */ + virtual bool HasEmbeddedError(Aws::IOStream& body, const Aws::Http::HeaderValueCollection& header) const { + (void) body; + (void) header; + return false; + } + + /** + * Defaults to false, if this is set to true, it supports chunked transfer encoding. + */ + virtual bool IsChunked() const { return false; } + + /** + * Register closure for request signed event. + */ + inline virtual void SetRequestSignedHandler(const RequestSignedHandler& handler) { m_onRequestSigned = handler; } + /** + * Get closure for request signed event. + */ + inline virtual const RequestSignedHandler& GetRequestSignedHandler() const { return m_onRequestSigned; } + + /** + * Retrieves the factory for creating response streams. + */ + const Aws::IOStreamFactory& GetResponseStreamFactory() const { return m_responseStreamFactory; } + /** + * Set the response stream factory. + */ + void SetResponseStreamFactory(const Aws::IOStreamFactory& factory) { m_responseStreamFactory = factory; } + + ///@{ + /** + * Sets the closure for headers received event. + */ + inline virtual void SetHeadersReceivedEventHandler(const Aws::Http::HeadersReceivedEventHandler& headersReceivedEventHandler) { m_onHeadersReceived = headersReceivedEventHandler; } + inline virtual void SetHeadersReceivedEventHandler(Aws::Http::HeadersReceivedEventHandler&& headersReceivedEventHandler) { m_onHeadersReceived = std::move(headersReceivedEventHandler); } + ///@} + + ///@{ + /** + * Register closure for data received event. + */ + inline virtual void SetDataReceivedEventHandler(const Aws::Http::DataReceivedEventHandler& dataReceivedEventHandler) { m_onDataReceived = dataReceivedEventHandler; } + inline virtual void SetDataReceivedEventHandler(Aws::Http::DataReceivedEventHandler&& dataReceivedEventHandler) { m_onDataReceived = std::move(dataReceivedEventHandler); } + ///@} + + ///@{ + /** + * Register closure for data sent event + */ + inline virtual void SetDataSentEventHandler(const Aws::Http::DataSentEventHandler& dataSentEventHandler) { m_onDataSent = dataSentEventHandler; } + inline virtual void SetDataSentEventHandler(Aws::Http::DataSentEventHandler&& dataSentEventHandler) { m_onDataSent = std::move(dataSentEventHandler); } + ///@} + + ///@{ + /** + * Register closure for handling whether or not to continue a request. + */ + inline virtual void SetContinueRequestHandler(const Aws::Http::ContinueRequestHandler& continueRequestHandler) { m_continueRequest = continueRequestHandler; } + inline virtual void SetContinueRequestHandler(Aws::Http::ContinueRequestHandler&& continueRequestHandler) { m_continueRequest = std::move(continueRequestHandler); } + ///@} + + ///@{ + /** + * Register closure for notification that a request is being retried + */ + inline virtual void SetRequestRetryHandler(const RequestRetryHandler& handler) { m_requestRetryHandler = handler; } + inline virtual void SetRequestRetryHandler(RequestRetryHandler&& handler) { m_requestRetryHandler = std::move(handler); } + ///@} + + /** + * get closure for headers received event. + */ + inline virtual const Aws::Http::HeadersReceivedEventHandler& GetHeadersReceivedEventHandler() const { return m_onHeadersReceived; } + /** + * get closure for data received event. + */ + inline virtual const Aws::Http::DataReceivedEventHandler& GetDataReceivedEventHandler() const { return m_onDataReceived; } + /** + * get closure for data sent event + */ + inline virtual const Aws::Http::DataSentEventHandler& GetDataSentEventHandler() const { return m_onDataSent; } + /** + * get closure for handling whether or not to cancel a request. + */ + inline virtual const Aws::Http::ContinueRequestHandler& GetContinueRequestHandler() const { return m_continueRequest; } + /** + * get closure for notification that a request is being retried + */ + inline virtual const RequestRetryHandler& GetRequestRetryHandler() const { return m_requestRetryHandler; } + /** + * If this is set to true, content-md5 needs to be computed and set on the request + */ + inline virtual bool ShouldComputeContentMd5() const { return false; } + + inline virtual bool ShouldValidateResponseChecksum() const { return false; } + + inline virtual Aws::Vector GetResponseChecksumAlgorithmNames() const { return {}; } + + inline virtual Aws::String GetChecksumAlgorithmName() const { return {}; } + + virtual const char* GetServiceRequestName() const = 0; + + inline virtual void SetServiceSpecificParameters(const std::shared_ptr& serviceSpecificParameters) const { m_serviceSpecificParameters = serviceSpecificParameters; }; + + inline virtual std::shared_ptr GetServiceSpecificParameters() const { return m_serviceSpecificParameters; }; + + using EndpointParameters = Aws::Vector; + virtual EndpointParameters GetEndpointContextParams() const; + + virtual Aws::Client::CompressionAlgorithm + GetSelectedCompressionAlgorithm(Aws::Client::RequestCompressionConfig) const { return Aws::Client::CompressionAlgorithm::NONE; } + + /** + * Adds a used feature to the user agent string for the request. + * @param feature the feature to be added in the user agent string. + */ + void AddUserAgentFeature(Aws::Client::UserAgentFeature feature) const { m_userAgentFeatures.insert(feature); } + + /** + * Gets all features that would be included in the requests user agent string. + * @return a set of features that will be included in the user agent associated with this request. + */ + Aws::Set GetUserAgentFeatures() const { return m_userAgentFeatures; } + + inline virtual bool RequestChecksumRequired() const { return false; } + protected: + /** + * Default does nothing. Override this to convert what would otherwise be the payload of the + * request to a query string format. + */ + virtual void DumpBodyToUrl(Aws::Http::URI& uri) const { AWS_UNREFERENCED_PARAM(uri); } + + Aws::Http::HeaderValueCollection m_additionalCustomHeaders; + private: + Aws::IOStreamFactory m_responseStreamFactory; + + Aws::Http::HeadersReceivedEventHandler m_onHeadersReceived; + Aws::Http::DataReceivedEventHandler m_onDataReceived; + Aws::Http::DataSentEventHandler m_onDataSent; + Aws::Http::ContinueRequestHandler m_continueRequest; + RequestSignedHandler m_onRequestSigned; + RequestRetryHandler m_requestRetryHandler; + mutable std::shared_ptr m_serviceSpecificParameters; + mutable Aws::Set m_userAgentFeatures; + }; + +} // namespace Aws + diff --git a/include/aws/core/AmazonWebServiceResult.h b/include/aws/core/AmazonWebServiceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..37538accb71b6ea4999a5ac550630f5f3a13fde6 --- /dev/null +++ b/include/aws/core/AmazonWebServiceResult.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + /** + * Container for web response to an AWS Request. + */ + template + class AmazonWebServiceResult + { + public: + AmazonWebServiceResult() : m_responseCode(Http::HttpResponseCode::REQUEST_NOT_MADE) {} + + /** + * Sets payload, header collection and a response code. + */ + AmazonWebServiceResult(const PAYLOAD_TYPE& payload, const Http::HeaderValueCollection& headers, Http::HttpResponseCode responseCode = Http::HttpResponseCode::OK) : + m_payload(payload), + m_responseHeaders(headers), + m_responseCode(responseCode) + {} + + /** + * Sets payload, header collection and a response code, but transfers ownership of payload and headers (for move only operations). + */ + AmazonWebServiceResult(PAYLOAD_TYPE&& payload, Http::HeaderValueCollection&& headers, Http::HttpResponseCode responseCode = Http::HttpResponseCode::OK) : + m_payload(std::forward(payload)), + m_responseHeaders(std::forward(headers)), + m_responseCode(responseCode) + {} + + AmazonWebServiceResult(const AmazonWebServiceResult& result) : + m_payload(result.m_payload), + m_responseHeaders(result.m_responseHeaders), + m_responseCode(result.m_responseCode) + {} + + AmazonWebServiceResult(AmazonWebServiceResult&& result) : + m_payload(std::move(result.m_payload)), + m_responseHeaders(std::move(result.m_responseHeaders)), + m_responseCode(result.m_responseCode) + {} + + /** + * Get the payload from the response + */ + inline const PAYLOAD_TYPE& GetPayload() const { return m_payload; } + /** + * Get the payload from the response and take ownership of it. + */ + inline PAYLOAD_TYPE&& TakeOwnershipOfPayload() { return std::move(m_payload); } + /** + * Get the headers from the response + */ + inline const Http::HeaderValueCollection& GetHeaderValueCollection() const { return m_responseHeaders; } + /** + * Get the http response code from the response + */ + inline Http::HttpResponseCode GetResponseCode() const { return m_responseCode; } + + private: + PAYLOAD_TYPE m_payload; + Http::HeaderValueCollection m_responseHeaders; + Http::HttpResponseCode m_responseCode; + }; + + +} diff --git a/include/aws/core/Aws.h b/include/aws/core/Aws.h new file mode 100644 index 0000000000000000000000000000000000000000..dc68dde4600b94f9119238631163830eb920ae67 --- /dev/null +++ b/include/aws/core/Aws.h @@ -0,0 +1,300 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws { +static const char* DEFAULT_LOG_PREFIX = "aws_sdk_"; + +/** + * SDK wide options for logging + */ +struct LoggingOptions { + LoggingOptions() = default; + + /** + * Defaults to Off, if this is set to something else, then logging will be turned on and logLevel will be passed to the logger + */ + Aws::Utils::Logging::LogLevel logLevel = Aws::Utils::Logging::LogLevel::Off; + + /** + * Defaults to aws_sdk_. This will only be used if the default logger is used. + */ + const char* defaultLogPrefix = DEFAULT_LOG_PREFIX; + + /** + * Defaults to empty, if logLevel has been set and this field is empty, then the default log system will be used. + * otherwise, we will call this closure to create a logger + */ + std::function()> logger_create_fn; + + /** + * Defaults to empty, if logLevel has been set and this field is empty, then the default CRT log system will be used. + * The default CRT log system will redirect all logs from common runtime libraries (CRT) to C++ SDK with the same log level and + * formatting. + */ + std::function()> crt_logger_create_fn; +}; + +/** + * SDK wide options for memory management + */ +struct MemoryManagementOptions { + MemoryManagementOptions() = default; + + /** + * Defaults to nullptr. If custom memory management is being used and this hasn't been set then the default memory + * manager will be used. If this has been set and custom memory management has been turned on, then this will be installed + * at startup time. + */ + Aws::Utils::Memory::MemorySystemInterface* memoryManager = nullptr; +}; + +/** + * SDK wide options for I/O: client bootstrap and TLS connection options + */ +struct IoOptions { + std::function()> clientBootstrap_create_fn; + std::function()> tlsConnectionOptions_create_fn; +}; + +/** + * SDK wide options for http + */ +struct HttpOptions { + HttpOptions() = default; + + /** + * Defaults to empty, if this is set, then the result of your closure will be installed and used instead of the system defaults + */ + std::function()> httpClientFactory_create_fn; + /** + * libCurl infects everything with its global state. If it is being used then we automatically initialize and clean it up. + * If this is a problem for you, set this to false. If you manually initialize libcurl please add the option CURL_GLOBAL_ALL to your init + * call. + */ + bool initAndCleanupCurl = true; + /** + * Installs a global SIGPIPE handler that logs the error and prevents it from terminating the current process. + * This can be used on operating systems on which CURL is being used. In some situations CURL cannot avoid + * triggering a SIGPIPE. + * For more information see: https://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html + * NOTE: CURLOPT_NOSIGNAL is already being set. + */ + bool installSigPipeHandler = false; + /** + * Disable legacy URL encoding that leaves `$&,:@=` unescaped for legacy purposes. + */ + bool compliantRfc3986Encoding = false; + /** + * When constructing Path segments in a URI preserve path separators instead of collapsing + * slashes. This is useful for aligning with other SDKs and tools on key path for S3 objects + * as currently the C++ SDK sanitizes the path. + * + * TODO: In the next major release, this will become the default to align better with other SDKs. + */ + bool preservePathSeparators = false; +}; + +/** + * SDK wide options for crypto + */ +struct CryptoOptions { + CryptoOptions() = default; + + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> md5Factory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> sha1Factory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> sha256Factory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> sha256HMACFactory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> aes_CBCFactory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> aes_CTRFactory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> aes_GCMFactory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> aes_KeyWrapFactory_create_fn; + /** + * If set, this closure will be used to create and install the factory. + */ + std::function()> secureRandomFactory_create_fn; + /** + * OpenSSL infects everything with its global state. If it is being used then we automatically initialize and clean it up. + * If this is a problem for you, set this to false. Be aware that if you don't use our init and cleanup and you are using + * crypto functionality, you are responsible for installing thread locking, and loading strings and error messages. + */ + bool initAndCleanupOpenSSL = true; +}; + +/** + * MonitoringOptions is used to set up monitoring functionalities globally and(or) for users to customize monitoring listeners. + */ +struct MonitoringOptions { + /** + * These factory functions will be used to try to create customized monitoring listener factories, then be used to create monitoring + * listener instances. Based on functions and factory's implementation, it may fail to create an instance. If a function failed to create + * factory or a created factory failed to create an instance, SDK just ignore it. By default, SDK will try to create a default Client Side + * Monitoring Listener. + */ + std::vector customizedMonitoringFactory_create_fn; +}; + +/** + * You may notice that instead of taking pointers directly to your factories, we take a closure. This is because + * if you have installed custom memory management, the allocation for your factories needs to happen after + * the memory system has been initialized and shutdown needs to happen prior to the memory management being shutdown. + * + * Common Recipes: + * + * Just use defaults: + * + * SDKOptions options; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + * + * Turn logging on using the default logger: + * + * SDKOptions options; + * options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + * + * Install custom memory manager: + * + * MyMemoryManager memoryManager; + * + * SDKOptions options; + * options.memoryManagementOptions.memoryManager = &memoryManager; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + * + * Override default http client factory + * + * SDKOptions options; + * options.httpOptions.httpClientFactory_create_fn = [](){ return Aws::MakeShared("ALLOC_TAG", arg1); }; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + */ +struct SDKOptions { + SDKOptions() = default; + /** + * SDK wide options for I/O: client bootstrap and TLS connection options + */ + IoOptions ioOptions = {}; + /** + * SDK wide options for logging + */ + LoggingOptions loggingOptions = {}; + /** + * SDK wide options for memory management + */ + MemoryManagementOptions memoryManagementOptions = {}; + /** + * SDK wide options for http + */ + HttpOptions httpOptions = {}; + /** + * SDK wide options for crypto + */ + CryptoOptions cryptoOptions = {}; + + /** + * Options used to set up customized monitoring implementations + * Put your monitoring factory in a closure (a create factory function) and put all closures in a vector. + * Basic usage can be found in aws-cpp-sdk-core-tests/monitoring/MonitoringTest.cpp + */ + MonitoringOptions monitoringOptions = {}; + + struct SDKVersion { + unsigned char major = AWS_SDK_VERSION_MAJOR; + unsigned char minor = AWS_SDK_VERSION_MINOR; + unsigned short patch = AWS_SDK_VERSION_PATCH; + } sdkVersion = {}; +}; + +/* + * Initialize SDK wide state for the SDK. This method must be called before doing anything else with this library. + * + * Common Recipes: + * + * Just use defaults: + * + * SDKOptions options; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + * + * Turn logging on using the default logger: + * + * SDKOptions options; + * options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + * + * Install custom memory manager: + * + * MyMemoryManager memoryManager; + * + * SDKOptions options; + * options.memoryManagementOptions.memoryManager = &memoryManager; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + * + * Override default http client factory + * + * SDKOptions options; + * options.httpOptions.httpClientFactory_create_fn = [](){ return Aws::MakeShared("ALLOC_TAG", arg1); }; + * Aws::InitAPI(options); + * ..... + * Aws::ShutdownAPI(options); + */ +AWS_CORE_API void InitAPI(const SDKOptions& options); + +/** + * Shutdown SDK wide state for the SDK. This method must be called when you are finished using the SDK. + * Notes: + * 1) Please call this from the same thread from which InitAPI() has been called (use a dedicated thread + * if necessary). This avoids problems in initializing the dependent Common RunTime C libraries. + * 2) Do not call any other SDK methods after calling ShutdownAPI. + */ +AWS_CORE_API void ShutdownAPI(const SDKOptions& options); +} // namespace Aws diff --git a/include/aws/core/Core_EXPORTS.h b/include/aws/core/Core_EXPORTS.h new file mode 100644 index 0000000000000000000000000000000000000000..ecd5a39db7b2790d76ece21796fdbfd2d429eb4a --- /dev/null +++ b/include/aws/core/Core_EXPORTS.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #ifdef _MSC_VER + #pragma warning(disable : 4251) + #endif // _MSC_VER + + #ifdef USE_IMPORT_EXPORT + #ifdef AWS_CORE_EXPORTS + #define AWS_CORE_API __declspec(dllexport) + #else // AWS_CORE_EXPORTS + #define AWS_CORE_API __declspec(dllimport) + #endif // AWS_CORE_EXPORTS + #define AWS_CORE_EXTERN + #else // USE_IMPORT_EXPORT + #define AWS_CORE_API + #define AWS_CORE_EXTERN extern + #endif // USE_IMPORT_EXPORT + #define AWS_CORE_LOCAL +#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #define AWS_CORE_API + #define AWS_CORE_EXTERN extern + #if __GNUC__ >= 4 + #define AWS_CORE_LOCAL __attribute__((visibility("hidden"))) + #else + #define AWS_CORE_LOCAL + #endif +#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + +#ifdef _MSC_VER + #define AWS_SUPPRESS_WARNING_PUSH(W) \ + __pragma(warning(push)) \ + __pragma(warning(disable:W)) + + #define AWS_SUPPRESS_WARNING_POP __pragma(warning(pop)) + + #define AWS_SUPPRESS_WARNING(W, ...) \ + AWS_SUPPRESS_WARNING_PUSH(W) \ + __VA_ARGS__; \ + AWS_SUPPRESS_WARNING_POP + + #define AWS_SUPPRESS_DEPRECATION(...) AWS_SUPPRESS_WARNING(4996, __VA_ARGS__) + +#elif defined (__clang__) + #define DO_PRAGMA(x) _Pragma(#x) + + #define AWS_SUPPRESS_WARNING_PUSH(W) \ + DO_PRAGMA(clang diagnostic push) \ + DO_PRAGMA(clang diagnostic ignored W) + + #define AWS_SUPPRESS_WARNING_POP DO_PRAGMA(clang diagnostic pop) + + #define AWS_SUPPRESS_WARNING(W, ...) \ + AWS_SUPPRESS_WARNING_PUSH(W) \ + __VA_ARGS__; \ + AWS_SUPPRESS_WARNING_POP + + #define AWS_SUPPRESS_DEPRECATION(...) AWS_SUPPRESS_WARNING("-Wdeprecated-declarations", __VA_ARGS__) + +#elif defined (__GNUC__) + #define DO_PRAGMA(x) _Pragma(#x) + + #define AWS_SUPPRESS_WARNING_PUSH(W) \ + DO_PRAGMA(GCC diagnostic push) \ + DO_PRAGMA(GCC diagnostic ignored W) + + #define AWS_SUPPRESS_WARNING_POP DO_PRAGMA(GCC diagnostic pop) + /** + * WRAP_() is a useless macro to get around GCC quirks related to expanding macros which includes _Pragma + * see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=715271 + * and https://stackoverflow.com/questions/49698645/how-to-use-pragma-operator-in-macro + */ + #define WRAP_(W, ...) \ + W \ + __VA_ARGS__ \ + AWS_SUPPRESS_WARNING_POP + + #define AWS_SUPPRESS_WARNING(W, ...) WRAP_(AWS_SUPPRESS_WARNING_PUSH(W), __VA_ARGS__) + + #define AWS_SUPPRESS_DEPRECATION(...) AWS_SUPPRESS_WARNING("-Wdeprecated-declarations", __VA_ARGS__) + +#else + #define AWS_SUPPRESS_WARNING(W, ...) __VAR_ARGS__ + #define AWS_SUPPRESS_WARNING_PUSH(W) + #define AWS_SUPPRESS_WARNING_POP + #define AWS_SUPPRESS_DEPRECATION(...) __VA_ARGS__ +#endif + +// Due to MSVC can't recognize base class deprecated function in derived class. +// We need AWS_DISABLE_DEPRECATION to make AWS_DEPRECATED useless only on MSVC +// Update: When deprecating a function/components, we won't remove the existing tests +// immediately, so we need AWS_DISABLE_DEPRECATION as well. +#if defined(AWS_DISABLE_DEPRECATION) + #define AWS_DEPRECATED(msg) +#elif defined (__cplusplus) && __cplusplus > 201103L // standard attributes are available since C++14 + #define AWS_DEPRECATED(msg) [[deprecated(msg)]] +#else + #ifdef _MSC_VER + #define AWS_DEPRECATED(msg) __declspec(deprecated(msg)) + #elif defined (__clang__) || defined (__GNUC__) + #define AWS_DEPRECATED(msg) __attribute__((deprecated(msg))) + #else + #define AWS_DEPRECATED(msg) + #endif +#endif diff --git a/include/aws/core/Globals.h b/include/aws/core/Globals.h new file mode 100644 index 0000000000000000000000000000000000000000..08dfafce09dafa37aaab58b45b186ab9e9898192 --- /dev/null +++ b/include/aws/core/Globals.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +namespace Aws +{ + namespace Crt + { + class ApiHandle; + + namespace Io + { + class ClientBootstrap; + class TlsConnectionOptions; + + } + } + + /** + * Like we need to call InitAPI() to initialize aws-sdk-cpp, we need ApiHandle to initialize aws-crt-cpp, which is a wrapper of a collection of common runtime libraries. + * We will wrap the memory management system and pass it to common runtime libraries via ApiHandle. + */ + AWS_CORE_API Aws::Crt::ApiHandle* GetApiHandle(); + + /** + * Set the default ClientBootStrap for AWS common runtime libraries in the global scope. + */ + AWS_CORE_API void SetDefaultClientBootstrap(const std::shared_ptr& clientBootstrap); + + /** + * Get the default ClientBootStrap for AWS common runtime libraries in the global scope. + */ + AWS_CORE_API Aws::Crt::Io::ClientBootstrap* GetDefaultClientBootstrap(); + + /** + * Set the default TlsConnectionOptions for AWS common runtime libraries in the global scope. + */ + AWS_CORE_API void SetDefaultTlsConnectionOptions(const std::shared_ptr& tlsConnectionOptions); + + /** + * Get the default TlsConnectionOptions for AWS common runtime libraries in the global scope. + */ + AWS_CORE_API Aws::Crt::Io::TlsConnectionOptions* GetDefaultTlsConnectionOptions(); + + /** + * Initialize ApiHandle in aws-crt-cpp. + */ + void InitializeCrt(); + + /** + * Clean up ApiHandle in aws-crt-cpp. + */ + void CleanupCrt(); + + namespace Utils + { + class EnumParseOverflowContainer; + } + /** + * This is used to handle the Enum round tripping problem + * for when a service updates their enumerations, but the user does not + * have an up to date client. This container will be initialized during Aws::InitAPI + * and will be cleaned on Aws::ShutdownAPI. + */ + AWS_CORE_API Utils::EnumParseOverflowContainer* GetEnumOverflowContainer(); + + /** + * Initializes a global overflow container to a new instance. + * This should only be called once from within Aws::InitAPI + */ + void InitializeEnumOverflowContainer(); + + /** + * Destroys the global overflow container instance. + * This should only be called once from within Aws::ShutdownAPI + */ + void CleanupEnumOverflowContainer(); +} diff --git a/include/aws/core/NoResult.h b/include/aws/core/NoResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c4f233cbb968369ff6315f4057d427df2ecc3b91 --- /dev/null +++ b/include/aws/core/NoResult.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} +namespace Json +{ + class JsonValue; +} +} // namespace Utils + +class AWS_CORE_API NoResult +{ +public: + NoResult() {}; + NoResult(const Aws::AmazonWebServiceResult&) {}; + NoResult(const Aws::AmazonWebServiceResult&) {}; +}; + +} // namespace Aws diff --git a/include/aws/core/Region.h b/include/aws/core/Region.h new file mode 100644 index 0000000000000000000000000000000000000000..b5366097c8442f95a1f34106f943a5fcd6d70b20 --- /dev/null +++ b/include/aws/core/Region.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + /** + * AWS Regions + */ + namespace Region + { + static const char AF_SOUTH_1[] = "af-south-1"; // Africa (Cape Town) + static const char AP_EAST_1[] = "ap-east-1"; // Asia Pacific (Hong Kong) + static const char AP_NORTHEAST_1[] = "ap-northeast-1"; // Asia Pacific (Tokyo) + static const char AP_NORTHEAST_2[] = "ap-northeast-2"; // Asia Pacific (Seoul) + static const char AP_NORTHEAST_3[] = "ap-northeast-3"; // Asia Pacific (Osaka) + static const char AP_SOUTH_1[] = "ap-south-1"; // Asia Pacific (Mumbai) + static const char AP_SOUTH_2[] = "ap-south-2"; // Asia Pacific (Hyderabad) + static const char AP_SOUTHEAST_1[] = "ap-southeast-1"; // Asia Pacific (Singapore) + static const char AP_SOUTHEAST_2[] = "ap-southeast-2"; // Asia Pacific (Sydney) + static const char AP_SOUTHEAST_3[] = "ap-southeast-3"; // Asia Pacific (Jakarta) + static const char AP_SOUTHEAST_4[] = "ap-southeast-4"; // Asia Pacific (Melbourne) + static const char AP_SOUTHEAST_5[] = "ap-southeast-5"; // Asia Pacific (Malaysia) + static const char AP_SOUTHEAST_7[] = "ap-southeast-7"; // Asia Pacific (Thailand) + static const char AWS_CN_GLOBAL[] = "aws-cn-global"; // AWS China global region + static const char AWS_GLOBAL[] = "aws-global"; // AWS Standard global region + static const char AWS_ISO_B_GLOBAL[] = "aws-iso-b-global"; // AWS ISOB (US) global region + static const char AWS_ISO_F_GLOBAL[] = "aws-iso-f-global"; // AWS ISOF global region + static const char AWS_ISO_GLOBAL[] = "aws-iso-global"; // AWS ISO (US) global region + static const char AWS_US_GOV_GLOBAL[] = "aws-us-gov-global"; // AWS GovCloud (US) global region + static const char CA_CENTRAL_1[] = "ca-central-1"; // Canada (Central) + static const char CA_WEST_1[] = "ca-west-1"; // Canada West (Calgary) + static const char CN_NORTH_1[] = "cn-north-1"; // China (Beijing) + static const char CN_NORTHWEST_1[] = "cn-northwest-1"; // China (Ningxia) + static const char EU_CENTRAL_1[] = "eu-central-1"; // Europe (Frankfurt) + static const char EU_CENTRAL_2[] = "eu-central-2"; // Europe (Zurich) + static const char EU_ISOE_WEST_1[] = "eu-isoe-west-1"; // EU ISOE West + static const char EU_NORTH_1[] = "eu-north-1"; // Europe (Stockholm) + static const char EU_SOUTH_1[] = "eu-south-1"; // Europe (Milan) + static const char EU_SOUTH_2[] = "eu-south-2"; // Europe (Spain) + static const char EU_WEST_1[] = "eu-west-1"; // Europe (Ireland) + static const char EU_WEST_2[] = "eu-west-2"; // Europe (London) + static const char EU_WEST_3[] = "eu-west-3"; // Europe (Paris) + static const char IL_CENTRAL_1[] = "il-central-1"; // Israel (Tel Aviv) + static const char ME_CENTRAL_1[] = "me-central-1"; // Middle East (UAE) + static const char ME_SOUTH_1[] = "me-south-1"; // Middle East (Bahrain) + static const char MX_CENTRAL_1[] = "mx-central-1"; // Mexico (Central) + static const char SA_EAST_1[] = "sa-east-1"; // South America (Sao Paulo) + static const char US_EAST_1[] = "us-east-1"; // US East (N. Virginia) + static const char US_EAST_2[] = "us-east-2"; // US East (Ohio) + static const char US_GOV_EAST_1[] = "us-gov-east-1"; // AWS GovCloud (US-East) + static const char US_GOV_WEST_1[] = "us-gov-west-1"; // AWS GovCloud (US-West) + static const char US_ISO_EAST_1[] = "us-iso-east-1"; // US ISO East + static const char US_ISO_WEST_1[] = "us-iso-west-1"; // US ISO WEST + static const char US_ISOB_EAST_1[] = "us-isob-east-1"; // US ISOB East (Ohio) + static const char US_ISOF_EAST_1[] = "us-isof-east-1"; // US ISOF EAST + static const char US_ISOF_SOUTH_1[] = "us-isof-south-1"; // US ISOF SOUTH + static const char US_WEST_1[] = "us-west-1"; // US West (N. California) + static const char US_WEST_2[] = "us-west-2"; // US West (Oregon) + + // If a pseudo region, for example, aws-global or us-east-1-fips is provided, it should be converted to the region name used for signing. + Aws::String AWS_CORE_API ComputeSignerRegion(const Aws::String& region); + + // A FIPs region starts with "fips-" or ends with "-fips". + bool AWS_CORE_API IsFipsRegion(const Aws::String& region); + } + +} // namespace Aws + diff --git a/include/aws/core/SDKConfig.h b/include/aws/core/SDKConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..9561d202536721013ea9208378015c52e03d6b08 --- /dev/null +++ b/include/aws/core/SDKConfig.h @@ -0,0 +1,7 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* #undef USE_AWS_MEMORY_MANAGEMENT */ + diff --git a/include/aws/core/Version.h b/include/aws/core/Version.h new file mode 100644 index 0000000000000000000000000000000000000000..4c466cbfd46ef8b6bfd1d0c883a26cc6d6c07424 --- /dev/null +++ b/include/aws/core/Version.h @@ -0,0 +1,20 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +namespace Aws +{ +namespace Version +{ + AWS_CORE_API const char* GetVersionString(); + AWS_CORE_API unsigned GetVersionMajor(); + AWS_CORE_API unsigned GetVersionMinor(); + AWS_CORE_API unsigned GetVersionPatch(); + AWS_CORE_API const char* GetCompilerVersionString(); + AWS_CORE_API const char* GetCPPStandard(); +} //namespace Version +} //namespace Aws diff --git a/include/aws/core/VersionConfig.h b/include/aws/core/VersionConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..8d7ea7f5d198f9343261c04f8a973223240ee7e2 --- /dev/null +++ b/include/aws/core/VersionConfig.h @@ -0,0 +1,10 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#define AWS_SDK_VERSION_STRING "1.11.510" +#define AWS_SDK_VERSION_MAJOR 1 +#define AWS_SDK_VERSION_MINOR 11 +#define AWS_SDK_VERSION_PATCH 510 diff --git a/include/aws/core/auth/AWSAuthSigner.h b/include/aws/core/auth/AWSAuthSigner.h new file mode 100644 index 0000000000000000000000000000000000000000..0c4a26dbd3245fb9e964d4fff49e746842b7522c --- /dev/null +++ b/include/aws/core/auth/AWSAuthSigner.h @@ -0,0 +1,15 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +#include +#include +#include + +// This is a header that represents old legacy all-in-one header to maintain backward compatibility diff --git a/include/aws/core/auth/AWSAuthSignerProvider.h b/include/aws/core/auth/AWSAuthSignerProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..b27d0792845d10631b89b55aa32a6ca5e3788265 --- /dev/null +++ b/include/aws/core/auth/AWSAuthSignerProvider.h @@ -0,0 +1,12 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include + +// This is a header that represents old legacy all-in-one header to maintain backward compatibility diff --git a/include/aws/core/auth/AWSBearerToken.h b/include/aws/core/auth/AWSBearerToken.h new file mode 100644 index 0000000000000000000000000000000000000000..9565dd3802f95cd70507af4720c5a5b0f9f0ce92 --- /dev/null +++ b/include/aws/core/auth/AWSBearerToken.h @@ -0,0 +1,113 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Auth + { + /** + * Simple data object around aws credentials + */ + class AWS_CORE_API AWSBearerToken + { + public: + /** + * Initializes an empty token. + * Empty token is not expired by default. + * Token expires only if an expiration date is explicitly set. + */ + AWSBearerToken() : m_expiration((std::chrono::time_point::max)()) + { + } + + /** + * Initializes object with token. + * Expiration date is set to "never expire". + */ + AWSBearerToken(const Aws::String& token) : + m_token(token), + m_expiration((std::chrono::time_point::max)()) + { + } + + /** + * Initializes object with token and expiration date. + */ + AWSBearerToken(const Aws::String& token, Aws::Utils::DateTime expiration) : + m_token(token), + m_expiration(expiration) + { + } + + /** + * If token has not been initialized or been initialized to empty value. + * Expiration date does not affect the result of this function. + */ + inline bool IsEmpty() const { return m_token.empty(); } + + inline bool IsExpired() const { return m_expiration <= Aws::Utils::DateTime::Now(); } + + inline bool IsExpiredOrEmpty() const { return IsEmpty() || IsExpired(); } + + /** + * Gets the underlying token + */ + inline const Aws::String& GetToken() const + { + return m_token; + } + + /** + * Gets the expiration date of the token + */ + inline Aws::Utils::DateTime GetExpiration() const + { + return m_expiration; + } + + /** + * Sets the underlying token. Copies from the parameter token + */ + inline void SetToken(const Aws::String& token) + { + m_token = token; + } + + /** + * Sets the underlying token. Moves from the parameter token + */ + inline void SetToken(Aws::String&& token) + { + m_token = std::move(token); + } + + /** + * Sets the expiration date of the credential + */ + inline void SetExpiration(const Aws::Utils::DateTime& expiration) + { + m_expiration = expiration; + } + + /** + * Sets the expiration date of the credential + */ + inline void SetExpiration(Aws::Utils::DateTime&& expiration) + { + m_expiration = std::move(expiration); + } + + private: + Aws::String m_token; + Aws::Utils::DateTime m_expiration; + }; + } +} diff --git a/include/aws/core/auth/AWSCredentials.h b/include/aws/core/auth/AWSCredentials.h new file mode 100644 index 0000000000000000000000000000000000000000..850664637eb9059882ee093bbc5fb5038f5204cf --- /dev/null +++ b/include/aws/core/auth/AWSCredentials.h @@ -0,0 +1,225 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + #pragma once + +#include +#include +#include +namespace Aws +{ + namespace Auth + { + /** + * Simple data object around aws credentials + */ + class AWS_CORE_API AWSCredentials + { + public: + /** + * Initializes an empty credentials set. + * Empty credentials are not expired by default. + * Credentials expire only if an expiration date is explicitly set on them. + */ + AWSCredentials() : m_expiration((std::chrono::time_point::max)()) + { + } + + /** + * Initializes object with accessKeyId, secretKey. + * SessionToken defaults to empty string. + * Expiration date is set to "never expire". + */ + AWSCredentials(const Aws::String& accessKeyId, const Aws::String& secretKey) : + m_accessKeyId(accessKeyId), m_secretKey(secretKey), m_expiration((std::chrono::time_point::max)()) + { + } + + /** + * Initializes object with accessKeyId, secretKey, and sessionToken. + * Expiration date is set to "never expire". + */ + AWSCredentials(const Aws::String& accessKeyId, const Aws::String& secretKey, const Aws::String& sessionToken) : + m_accessKeyId(accessKeyId), m_secretKey(secretKey), m_sessionToken(sessionToken), m_expiration((std::chrono::time_point::max)()) + { + } + + /** + * Initializes object with accessKeyId, secretKey, sessionToken and expiration date. + */ + AWSCredentials(const Aws::String& accessKeyId, const Aws::String& secretKey, const Aws::String& sessionToken, Aws::Utils::DateTime expiration) : + m_accessKeyId(accessKeyId), m_secretKey(secretKey), m_sessionToken(sessionToken), m_expiration(expiration) + { + } + + /** + * Initializes object with accessKeyId, secretKey, sessionToken, expiration date and account Id. + */ + AWSCredentials(const Aws::String& accessKeyId, + const Aws::String& secretKey, + const Aws::String& sessionToken, + Aws::Utils::DateTime expiration, + const Aws::String& accountId) + : m_accessKeyId(accessKeyId), + m_secretKey(secretKey), + m_sessionToken(sessionToken), + m_expiration(expiration), + m_accountId(accountId) {} + + bool operator == (const AWSCredentials& other) const + { + return m_accessKeyId == other.m_accessKeyId + && m_secretKey == other.m_secretKey + && m_sessionToken == other.m_sessionToken + && m_expiration == other.m_expiration + && m_accountId == other.m_accountId; + + } + + bool operator != (const AWSCredentials& other) const + { + return !(other == *this); + } + + /** + * If credentials haven't been initialized or been initialized to empty values. + * Expiration date does not affect the result of this function. + */ + inline bool IsEmpty() const { return m_accessKeyId.empty() && m_secretKey.empty(); } + + inline bool IsExpired() const { return m_expiration <= Aws::Utils::DateTime::Now(); } + + /** + * Checks to see if the credentials will expire in a threshold of time + * + * @param millisecondThreshold the milliseconds of threshold we will check for expiry. + * @return true if the credentials will expire before the threshold + */ + inline bool ExpiresSoon(int64_t millisecondThreshold = 5000) const { return (m_expiration - Aws::Utils::DateTime::Now()).count() < millisecondThreshold; } + + inline bool IsExpiredOrEmpty() const { return IsEmpty() || IsExpired(); } + + /** + * Gets the underlying access key credential + */ + inline const Aws::String& GetAWSAccessKeyId() const + { + return m_accessKeyId; + } + + /** + * Gets the underlying secret key credential + */ + inline const Aws::String& GetAWSSecretKey() const + { + return m_secretKey; + } + + /** + * Gets the underlying session token + */ + inline const Aws::String& GetSessionToken() const + { + return m_sessionToken; + } + + /** + * Gets the expiration date of the credential + */ + inline Aws::Utils::DateTime GetExpiration() const + { + return m_expiration; + } + + /** + * Gets the underlying account id + */ + inline const Aws::String& GetAccountId() const + { + return m_accountId; + } + + /** + * Sets the underlying access key credential. Copies from parameter accessKeyId. + */ + inline void SetAWSAccessKeyId(const Aws::String& accessKeyId) + { + m_accessKeyId = accessKeyId; + } + + /** + * Sets the underlying secret key credential. Copies from parameter secretKey + */ + inline void SetAWSSecretKey(const Aws::String& secretKey) + { + m_secretKey = secretKey; + } + + /** + * Sets the underlying session token. Copies from parameter sessionToken + */ + inline void SetSessionToken(const Aws::String& sessionToken) + { + m_sessionToken = sessionToken; + } + + /** + * Sets the underlying account id. Copies from parameter accountId + */ + inline void SetAccountId(const Aws::String& accountId) + { + m_accountId = accountId; + } + + + /** + * Sets the underlying access key credential. Copies from parameter accessKeyId. + */ + inline void SetAWSAccessKeyId(const char* accessKeyId) + { + m_accessKeyId = accessKeyId; + } + + /** + * Sets the underlying secret key credential. Copies from parameter secretKey + */ + inline void SetAWSSecretKey(const char* secretKey) + { + m_secretKey = secretKey; + } + + /** + * Sets the underlying secret key credential. Copies from parameter secretKey + */ + inline void SetSessionToken(const char* sessionToken) + { + m_sessionToken = sessionToken; + } + + /** + * Sets the underlying account id. Copies from parameter accountId + */ + inline void SetAccountId(const char* accountId) + { + m_accountId = accountId; + } + + /** + * Sets the expiration date of the credential + */ + inline void SetExpiration(Aws::Utils::DateTime expiration) + { + m_expiration = expiration; + } + + private: + Aws::String m_accessKeyId; + Aws::String m_secretKey; + Aws::String m_sessionToken; + Aws::Utils::DateTime m_expiration; + Aws::String m_accountId; + }; + } +} diff --git a/include/aws/core/auth/AWSCredentialsProvider.h b/include/aws/core/auth/AWSCredentialsProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..32936785bdfbf9c9b10482191dfd28663091f64f --- /dev/null +++ b/include/aws/core/auth/AWSCredentialsProvider.h @@ -0,0 +1,277 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once +#if !defined(AWS_CREDENTIALS_PROVIDER) +#define AWS_CREDENTIALS_PROVIDER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Auth + { + constexpr int REFRESH_THRESHOLD = 1000 * 60 * 5; + + constexpr int AWS_CREDENTIAL_PROVIDER_EXPIRATION_GRACE_PERIOD = 5 * 1000; + + /** + * Returns the full path of the config file. + */ + AWS_CORE_API Aws::String GetConfigProfileFilename(); //defaults to "config" + + /** + * Returns the default profile name. + * The value is the first non-empty value of the following: + * 1. AWS_PROFILE environment variable + * 2. AWS_DEFAULT_PROFILE environment variable + * 3. The literal name "default" + */ + AWS_CORE_API Aws::String GetConfigProfileName(); //defaults to "default" + + /* + * Fetches credentials by executing the process in the parameter + */ + AWS_CORE_API AWSCredentials GetCredentialsFromProcess(const Aws::String& process); + + /** + * Abstract class for retrieving AWS credentials. Create a derived class from this to allow + * various methods of storing and retrieving credentials. Examples would be cognito-identity, some encrypted store etc... + */ + class AWS_CORE_API AWSCredentialsProvider + { + public: + /** + * Initializes provider. Sets last Loaded time count to 0, forcing a refresh on the + * first call to GetAWSCredentials. + */ + AWSCredentialsProvider() : m_lastLoadedMs(0) + { + } + + virtual ~AWSCredentialsProvider() = default; + + /** + * The core of the credential provider interface. Override this method to control how credentials are retrieved. + */ + virtual AWSCredentials GetAWSCredentials() = 0; + + protected: + /** + * The default implementation keeps up with the cache times and lets you know if it's time to refresh your internal caching + * to aid your implementation of GetAWSCredentials. + */ + virtual bool IsTimeToRefresh(long reloadFrequency); + virtual void Reload(); + mutable Aws::Utils::Threading::ReaderWriterLock m_reloadLock; + private: + long long m_lastLoadedMs; + }; + + /** + * Simply a provider that always returns empty credentials. This is useful for a client that needs to make unsigned + * calls. + */ + class AWS_CORE_API AnonymousAWSCredentialsProvider : public AWSCredentialsProvider + { + public: + /** + * Returns empty credentials object. + */ + inline AWSCredentials GetAWSCredentials() override { return AWSCredentials(); } + }; + + /** + * A simple string provider. It takes the AccessKeyId and the SecretKey as constructor args and + * provides them through the interface. This is the default class for AWSClients that take string + * arguments for credentials. + */ + class AWS_CORE_API SimpleAWSCredentialsProvider : public AWSCredentialsProvider + { + public: + /** + * Initializes object from awsAccessKeyId, awsSecretAccessKey, and sessionToken parameters. sessionToken parameter is defaulted to empty. + */ + inline SimpleAWSCredentialsProvider(const Aws::String& awsAccessKeyId, const Aws::String& awsSecretAccessKey, const Aws::String& sessionToken = "") + : m_credentials(awsAccessKeyId, awsSecretAccessKey, sessionToken) + { } + + /** + * Initializes object from credentials object. everything is copied. + */ + inline SimpleAWSCredentialsProvider(const AWSCredentials& credentials) + : m_credentials(credentials) + { } + + /** + * Returns the credentials this object was initialized with as an AWSCredentials object. + */ + inline AWSCredentials GetAWSCredentials() override + { + return m_credentials; + } + + private: + AWSCredentials m_credentials; + }; + + /** + * Reads AWS credentials from the Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN if they exist. If they + * are not found, empty credentials are returned. + */ + class AWS_CORE_API EnvironmentAWSCredentialsProvider : public AWSCredentialsProvider + { + public: + /** + * Reads AWS credentials from the Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN if they exist. If they + * are not found, empty credentials are returned. Credentials are not cached. + */ + AWSCredentials GetAWSCredentials() override; + }; + + /** + * Reads credentials profile from the default Profile Config File. Refreshes at set interval for credential rotation. + * Looks for environment variables AWS_SHARED_CREDENTIALS_FILE and AWS_PROFILE. If they aren't found, then it defaults + * to the default profile in ~/.aws/credentials. + * Optionally a user can specify the profile and it will override the environment variable + * and defaults. To alter the file this pulls from, then the user should alter the AWS_SHARED_CREDENTIALS_FILE variable. + */ + class AWS_CORE_API ProfileConfigFileAWSCredentialsProvider : public AWSCredentialsProvider + { + public: + + /** + * Initializes with refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes. + */ + ProfileConfigFileAWSCredentialsProvider(long refreshRateMs = REFRESH_THRESHOLD); + + /** + * Initializes with a profile override and + * refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes. + */ + ProfileConfigFileAWSCredentialsProvider(const char* profile, long refreshRateMs = REFRESH_THRESHOLD); + + /** + * Retrieves the credentials if found, otherwise returns empty credential set. + */ + AWSCredentials GetAWSCredentials() override; + + /** + * Returns the fullpath of the calculated credentials profile file + */ + static Aws::String GetCredentialsProfileFilename(); + + /** + * Returns the directory storing the profile file. + */ + static Aws::String GetProfileDirectory(); + + protected: + void Reload() override; + private: + + /** + * Checks to see if the refresh interval has expired and reparses the file if it has. + */ + void RefreshIfExpired(); + + Aws::String m_profileToUse; + Aws::Config::AWSConfigFileProfileConfigLoader m_credentialsFileLoader; + long m_loadFrequencyMs; + }; + + /** + * Credentials provider implementation that loads credentials from the Amazon + * EC2 Instance Metadata Service. + */ + class AWS_CORE_API InstanceProfileCredentialsProvider : public AWSCredentialsProvider + { + public: + /** + * Initializes the provider to refresh credentials form the EC2 instance metadata service every 5 minutes. + * Constructs an EC2MetadataClient using the default http stack (most likely what you want). + */ + InstanceProfileCredentialsProvider(long refreshRateMs = REFRESH_THRESHOLD); + + /** + * Initializes the provider to refresh credentials form the EC2 instance metadata service every 5 minutes, + * uses a supplied EC2MetadataClient. + */ + InstanceProfileCredentialsProvider(const std::shared_ptr&, long refreshRateMs = REFRESH_THRESHOLD); + + /** + * Retrieves the credentials if found, otherwise returns empty credential set. + */ + AWSCredentials GetAWSCredentials() override; + + protected: + void Reload() override; + + private: + bool ExpiresSoon() const; + void RefreshIfExpired(); + + std::shared_ptr m_ec2MetadataConfigLoader; + long m_loadFrequencyMs; + }; + + /** + * Process credentials provider that loads credentials by running another command (or program) configured in config file + * The configuration format is as following: + * credential_process = command_path + * Each time the credentials needs to be refreshed, this command will be executed with configured arguments. + * The default profile name to look up this configuration is "default", same as normal aws credentials configuration and other configurations. + * The expected valid output of the command is a Json doc output to stdout: + * {"Version": 1, "AccessKeyId": "AccessKey123", "SecretAccessKey": "SecretKey321", "SessionToken": "Token123", "Expiration": "1970-01-01T00:00:01Z"} + * The Version key specifies the version of the JSON payload and must be set to 1 for now (as an integer type). + * If the Version key is bumped to 2, SDKs would support both versions of the returned payload. + * Value of Expiration field should be an valid ISO8601 formatted date string as above example. + * The expected error message of the command is a string to output to stderr. + */ + class AWS_CORE_API ProcessCredentialsProvider : public AWSCredentialsProvider + { + public: + /** + * Initializes the provider by checking default profile + */ + ProcessCredentialsProvider(); + + /** + * Initializes the provider by checking specified profile + * @param profile which profile in config file to use. + */ + ProcessCredentialsProvider(const Aws::String& profile); + + /** + * Retrieves the credentials if found, otherwise returns empty credential set. + */ + AWSCredentials GetAWSCredentials() override; + + protected: + void Reload() override; + private: + void RefreshIfExpired(); + + private: + Aws::String m_profileToUse; + Aws::Auth::AWSCredentials m_credentials; + }; + } // namespace Auth +} // namespace Aws + +// TODO: remove on a next minor API bump from 1.11.x +#endif // !defined(AWS_CLIENT_H) +#include \ No newline at end of file diff --git a/include/aws/core/auth/AWSCredentialsProviderChain.h b/include/aws/core/auth/AWSCredentialsProviderChain.h new file mode 100644 index 0000000000000000000000000000000000000000..ab2bc80af8b7a0d79a30b6c5b29050a3e382931d --- /dev/null +++ b/include/aws/core/auth/AWSCredentialsProviderChain.h @@ -0,0 +1,72 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Auth + { + /** + * Abstract class for providing chains of credentials providers. When a credentials provider in the chain returns empty credentials, + * We go on to the next provider until we have either exhausted the installed providers in the chain or something returns non-empty credentials. + */ + class AWS_CORE_API AWSCredentialsProviderChain : public AWSCredentialsProvider + { + public: + virtual ~AWSCredentialsProviderChain() = default; + + /** + * When a credentials provider in the chain returns empty credentials, + * We go on to the next provider until we have either exhausted the installed providers in the chain or something returns non-empty credentials. + */ + virtual AWSCredentials GetAWSCredentials(); + + /** + * Gets all providers stored in this chain. + */ + const Aws::Vector>& GetProviders() const { return m_providerChain; } + + protected: + /** + * This class is only allowed to be initialized by subclasses. + */ + AWSCredentialsProviderChain() = default; + + /** + * Adds a provider to the back of the chain. + */ + void AddProvider(const std::shared_ptr& provider) { m_providerChain.push_back(provider); } + + + private: + Aws::Vector > m_providerChain; + std::shared_ptr m_cachedProvider; + mutable Aws::Utils::Threading::ReaderWriterLock m_cachedProviderLock; + }; + + /** + * Creates an AWSCredentialsProviderChain which uses in order EnvironmentAWSCredentialsProvider, ProfileConfigFileAWSCredentialsProvider, + * ProcessCredentialsProvider, STSAssumeRoleWebIdentityCredentialsProvider and SSOCredentialsProvider. + */ + class AWS_CORE_API DefaultAWSCredentialsProviderChain : public AWSCredentialsProviderChain + { + public: + /** + * Initializes the provider chain with EnvironmentAWSCredentialsProvider, ProfileConfigFileAWSCredentialsProvider, + * ProcessCredentialsProvider, STSAssumeRoleWebIdentityCredentialsProvider and SSOCredentialsProvider in that order. + */ + DefaultAWSCredentialsProviderChain(); + + DefaultAWSCredentialsProviderChain(const DefaultAWSCredentialsProviderChain& chain); + }; + + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/GeneralHTTPCredentialsProvider.h b/include/aws/core/auth/GeneralHTTPCredentialsProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..7744f5d9f1856149932da2aea5e38f88479bc953 --- /dev/null +++ b/include/aws/core/auth/GeneralHTTPCredentialsProvider.h @@ -0,0 +1,120 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include + +namespace Aws +{ + namespace Auth + { + /** + * General HTTP Credentials Provider (previously known as ECS credentials provider) + * implementation that loads credentials from an arbitrary HTTP(S) endpoint specified by the environment + * or loop back / Amazon ECS / Amazon EKS container host metadata services by default. + */ + class AWS_CORE_API GeneralHTTPCredentialsProvider : public AWSCredentialsProvider + { + private: + static bool ShouldCreateGeneralHTTPProvider(const Aws::String& relativeUri, const Aws::String& absoluteUri, const Aws::String authToken); + public: + using ShouldCreateFunc = std::function; + + /** + * Initializes the provider to retrieve credentials from a general http provided endpoint every 5 minutes or before it + * expires. + * @param relativeUri A path appended to the metadata service endpoint. OR + * @param absoluteUri The full URI to resolve to get credentials. + * @param authToken An optional authorization token passed to the URI via the 'Authorization' HTTP header. + * @param authTokenFilePath A path to a file with optional authorization token passed to the URI via the 'Authorization' HTTP header. + * @param refreshRateMs The number of milliseconds after which the credentials will be fetched again. + * @param ShouldCreateFunc + */ + GeneralHTTPCredentialsProvider(const Aws::String& relativeUri, + const Aws::String& absoluteUri, + const Aws::String& authToken = "", + const Aws::String& authTokenFilePath = "", + long refreshRateMs = REFRESH_THRESHOLD, + ShouldCreateFunc shouldCreateFunc = ShouldCreateGeneralHTTPProvider); + + /** + * Check if GeneralHTTPCredentialsProvider was initialized with allowed configuration + * @return true if provider configuration is valid + */ + bool IsValid() const + { + if (!m_ecsCredentialsClient) + return false; + if (!m_authTokenFilePath.empty()) + return !LoadTokenFromFile().empty(); + return true; + } + + /** + * Initializes the provider to retrieve credentials from the ECS metadata service every 5 minutes, + * or before it expires. + * @param resourcePath A path appended to the metadata service endpoint. + * @param refreshRateMs The number of milliseconds after which the credentials will be fetched again. + */ + // TODO: 1.12: AWS_DEPRECATED("This c-tor is deprecated, please use one above.") + GeneralHTTPCredentialsProvider(const char* resourcePath, long refreshRateMs = REFRESH_THRESHOLD) + : GeneralHTTPCredentialsProvider(resourcePath, "", "", "", refreshRateMs) + {} + + /** + * Initializes the provider to retrieve credentials from a provided endpoint every 5 minutes or before it + * expires. + * @param endpoint The full URI to resolve to get credentials. + * @param token An optional authorization token passed to the URI via the 'Authorization' HTTP header. + * @param refreshRateMs The number of milliseconds after which the credentials will be fetched again. + */ + // TODO: 1.12: AWS_DEPRECATED("This c-tor is deprecated, please use one above.") + GeneralHTTPCredentialsProvider(const char* endpoint, const char* token, long refreshRateMs = REFRESH_THRESHOLD) + : GeneralHTTPCredentialsProvider("", endpoint, token, "", refreshRateMs) + {} + + /** + * Initializes the provider to retrieve credentials using the provided client. + * @param client The ECSCredentialsClient instance to use when retrieving credentials. + * @param refreshRateMs The number of milliseconds after which the credentials will be fetched again. + */ + GeneralHTTPCredentialsProvider(const std::shared_ptr& client, + long refreshRateMs = REFRESH_THRESHOLD); + /** + * Retrieves the credentials if found, otherwise returns empty credential set. + */ + AWSCredentials GetAWSCredentials() override; + + static const char AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE[]; + static const char AWS_CONTAINER_CREDENTIALS_RELATIVE_URI[]; + static const char AWS_CONTAINER_CREDENTIALS_FULL_URI[]; + static const char AWS_CONTAINER_AUTHORIZATION_TOKEN[]; + + static const char AWS_ECS_CONTAINER_HOST[]; + static const char AWS_EKS_CONTAINER_HOST[]; + static const char AWS_EKS_CONTAINER_HOST_IPV6[]; + + protected: + void Reload() override; + + private: + bool ExpiresSoon() const; + void RefreshIfExpired(); + + Aws::String LoadTokenFromFile() const; + + std::shared_ptr m_ecsCredentialsClient; + Aws::String m_authTokenFilePath; + + long m_loadFrequencyMs = REFRESH_THRESHOLD; + Aws::Auth::AWSCredentials m_credentials; + }; + + // GeneralHTTPCredentialsProvider was previously known as TaskRoleCredentialsProvider or "ECS credentials provider" + using TaskRoleCredentialsProvider = GeneralHTTPCredentialsProvider; + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/SSOCredentialsProvider.h b/include/aws/core/auth/SSOCredentialsProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..2fb5eec70b6f2cc3c02579cd7eaf368670451f97 --- /dev/null +++ b/include/aws/core/auth/SSOCredentialsProvider.h @@ -0,0 +1,54 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include +#include + +namespace Aws { + namespace Auth { + /** + * To support usage of SSO credentials + */ + class AWS_CORE_API SSOCredentialsProvider : public AWSCredentialsProvider + { + public: + SSOCredentialsProvider(); + explicit SSOCredentialsProvider(const Aws::String& profile); + explicit SSOCredentialsProvider(const Aws::String& profile, std::shared_ptr config); + /** + * Retrieves the credentials if found, otherwise returns empty credential set. + */ + AWSCredentials GetAWSCredentials() override; + + private: + Aws::UniquePtr m_client; + Aws::Auth::AWSCredentials m_credentials; + + // Profile description variables + Aws::String m_profileToUse; + + // The AWS account ID that temporary AWS credentials are resolved for. + Aws::String m_ssoAccountId; + // The AWS region where the SSO directory for the given sso_start_url is hosted. + // This is independent of the general region configuration and MUST NOT be conflated. + Aws::String m_ssoRegion; + // The expiration time of the accessToken. + Aws::Utils::DateTime m_expiresAt; + // The SSO Token Provider + Aws::Auth::SSOBearerTokenProvider m_bearerTokenProvider; + // The client configuration to use + std::shared_ptr m_config; + + void Reload() override; + void RefreshIfExpired(); + Aws::String LoadAccessTokenFile(const Aws::String& ssoAccessTokenPath); + }; + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/STSCredentialsProvider.h b/include/aws/core/auth/STSCredentialsProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..720006592c9a46611ae5f8a32eb0d60731f9a158 --- /dev/null +++ b/include/aws/core/auth/STSCredentialsProvider.h @@ -0,0 +1,52 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Auth + { + /** + * To support retrieving credentials of STS AssumeRole with web identity. + * Note that STS accepts request with protocol of queryxml. Calling GetAWSCredentials() will trigger (if expired) + * a query request using AWSHttpResourceClient under the hood. + */ + class AWS_CORE_API STSAssumeRoleWebIdentityCredentialsProvider : public AWSCredentialsProvider + { + public: + STSAssumeRoleWebIdentityCredentialsProvider(); + + /** + * Retrieves the credentials if found, otherwise returns empty credential set. + */ + AWSCredentials GetAWSCredentials() override; + + protected: + void Reload() override; + + private: + void RefreshIfExpired(); + Aws::String CalculateQueryString() const; + + Aws::UniquePtr m_client; + Aws::Auth::AWSCredentials m_credentials; + Aws::String m_roleArn; + Aws::String m_tokenFile; + Aws::String m_sessionName; + Aws::String m_token; + bool m_initialized; + bool ExpiresSoon() const; + }; + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/bearer-token-provider/AWSBearerTokenProviderBase.h b/include/aws/core/auth/bearer-token-provider/AWSBearerTokenProviderBase.h new file mode 100644 index 0000000000000000000000000000000000000000..d7608a351c5ba5dff12e8d130615a538ee19a71b --- /dev/null +++ b/include/aws/core/auth/bearer-token-provider/AWSBearerTokenProviderBase.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include + +namespace Aws +{ + namespace Auth + { + /** + * Abstract class for retrieving Bearer Token. Create a derived class from this to allow + * various methods of storing and retrieving auth bearer tokens. + */ + class AWS_CORE_API AWSBearerTokenProviderBase + { + public: + virtual ~AWSBearerTokenProviderBase() = default; + + /** + * The core of the bearer token provider interface. Override this method to control how credentials are retrieved. + */ + virtual AWSBearerToken GetAWSBearerToken() = 0; + }; + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/bearer-token-provider/AWSBearerTokenProviderChainBase.h b/include/aws/core/auth/bearer-token-provider/AWSBearerTokenProviderChainBase.h new file mode 100644 index 0000000000000000000000000000000000000000..e5f3b828bc9ae574cb43d8613eb59b8db2695b48 --- /dev/null +++ b/include/aws/core/auth/bearer-token-provider/AWSBearerTokenProviderChainBase.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Auth + { + /** + * Abstract class for providing chains of bearer token providers + */ + class AWS_CORE_API AWSBearerTokenProviderChainBase : public AWSBearerTokenProviderBase + { + public: + virtual ~AWSBearerTokenProviderChainBase() = default; + + /** + * Gets all providers stored in this chain. + */ + virtual const Aws::Vector>& GetProviders() = 0; + }; + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/bearer-token-provider/DefaultBearerTokenProviderChain.h b/include/aws/core/auth/bearer-token-provider/DefaultBearerTokenProviderChain.h new file mode 100644 index 0000000000000000000000000000000000000000..8e8a4508a32274a4bd4bfc4636c8b109f2b62aee --- /dev/null +++ b/include/aws/core/auth/bearer-token-provider/DefaultBearerTokenProviderChain.h @@ -0,0 +1,49 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Auth + { + /** + * Default built-in AWSBearerTokenProviderChainBase implementation that includes Aws::Auth::SSOBearerTokenProvider in the chain. + */ + class AWS_CORE_API DefaultBearerTokenProviderChain : public AWSBearerTokenProviderChainBase + { + public: + DefaultBearerTokenProviderChain(); + virtual ~DefaultBearerTokenProviderChain() = default; + + /** + * Return bearer token, implementation of a base class interface + */ + virtual AWSBearerToken GetAWSBearerToken() override; + + /** + * Gets all providers stored in this chain. + */ + const Aws::Vector>& GetProviders() override + { + return m_providerChain; + } + + protected: + /** + * Adds a provider to the back of the chain. + */ + void AddProvider(const std::shared_ptr& provider) { m_providerChain.push_back(provider); } + + Aws::Vector > m_providerChain; + }; + + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/bearer-token-provider/SSOBearerTokenProvider.h b/include/aws/core/auth/bearer-token-provider/SSOBearerTokenProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..e3cad6dee780e81e26474663cd9bb41b5f2b5384 --- /dev/null +++ b/include/aws/core/auth/bearer-token-provider/SSOBearerTokenProvider.h @@ -0,0 +1,65 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Auth + { + /** + * To support usage of SSO bearerToken. + * The SSO token provider assumes that an SSO access token has already been resolved and cached to disk. + */ + class AWS_CORE_API SSOBearerTokenProvider : public AWSBearerTokenProviderBase + { + public: + SSOBearerTokenProvider(); + explicit SSOBearerTokenProvider(const Aws::String& awsProfile); + explicit SSOBearerTokenProvider(const Aws::String& awsProfile, std::shared_ptr config); + /** + * Retrieves the bearerToken if found, otherwise returns empty credential set. + */ + AWSBearerToken GetAWSBearerToken() override; + + protected: + struct CachedSsoToken + { + public: + Aws::String accessToken; + Aws::Utils::DateTime expiresAt; + Aws::String refreshToken; + Aws::String clientId; + Aws::String clientSecret; + Aws::Utils::DateTime registrationExpiresAt; + Aws::String region; + Aws::String startUrl; + }; + + static const size_t REFRESH_ATTEMPT_INTERVAL_S; + static const size_t REFRESH_WINDOW_BEFORE_EXPIRATION_S; + // Profile description variables + Aws::UniquePtr m_client; + Aws::String m_profileToUse; + std::shared_ptr m_config; + + mutable Aws::Auth::AWSBearerToken m_token; + mutable Aws::Utils::DateTime m_lastUpdateAttempt; + + mutable Aws::Utils::Threading::ReaderWriterLock m_reloadLock; + + void Reload(); + void RefreshFromSso(); + CachedSsoToken LoadAccessTokenFile() const; + bool WriteAccessTokenFile(const CachedSsoToken& token) const; + }; + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/bearer-token-provider/StaticBearerTokenProvider.h b/include/aws/core/auth/bearer-token-provider/StaticBearerTokenProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..b1513951ce479b7903148ad7335cb8d1c7d23b87 --- /dev/null +++ b/include/aws/core/auth/bearer-token-provider/StaticBearerTokenProvider.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include + +namespace Aws +{ + namespace Auth + { + /** + * A simple string provider. It takes the AccessKeyId and the SecretKey as constructor args and + * provides them through the interface. This is the default class for AWSClients that take string + * arguments for BearerToken. + */ + class AWS_CORE_API StaticAWSBearerTokenProvider : public AWSBearerTokenProviderBase + { + public: + /** + * Initializes object from BearerToken object. Everything is copied. + */ + StaticAWSBearerTokenProvider(const AWSBearerToken& BearerToken) + : m_bearerToken(BearerToken) + { } + + /** + * Initializes object from opaque token string and expiration. Everything is copied. + */ + StaticAWSBearerTokenProvider(const Aws::String& token, const Aws::Utils::DateTime& expiration) + : m_bearerToken(token, expiration) + { } + + + /** + * Returns the BearerToken this object was initialized with as an AWSBearerToken object. + */ + AWSBearerToken GetAWSBearerToken() override + { + return m_bearerToken; + } + + protected: + AWSBearerToken m_bearerToken; + }; + } // namespace Auth +} // namespace Aws diff --git a/include/aws/core/auth/signer-provider/AWSAuthSignerProviderBase.h b/include/aws/core/auth/signer-provider/AWSAuthSignerProviderBase.h new file mode 100644 index 0000000000000000000000000000000000000000..accf94a1d25f37b8973e11c5dd1383fd161df3ba --- /dev/null +++ b/include/aws/core/auth/signer-provider/AWSAuthSignerProviderBase.h @@ -0,0 +1,35 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include + +#include +#include +#include + +namespace Aws +{ + namespace Client + { + class AWSAuthSigner; + } + namespace Auth + { + class AWSCredentialsProvider; + class DefaultAWSCredentialsProviderChain; + + class AWS_CORE_API AWSAuthSignerProvider + { + public: + virtual std::shared_ptr GetSigner(const Aws::String& signerName) const = 0; + virtual void AddSigner(std::shared_ptr& signer) = 0; + virtual std::shared_ptr GetCredentialsProvider() const; + virtual ~AWSAuthSignerProvider() = default; + }; + } +} diff --git a/include/aws/core/auth/signer-provider/BearerTokenAuthSignerProvider.h b/include/aws/core/auth/signer-provider/BearerTokenAuthSignerProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..09b83a8e2724ca7a1b1f2f20cba993432467ceca --- /dev/null +++ b/include/aws/core/auth/signer-provider/BearerTokenAuthSignerProvider.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + + +namespace Aws +{ + namespace Auth + { + class AWSCredentialsProvider; + + class AWS_CORE_API BearerTokenAuthSignerProvider : public AWSAuthSignerProvider + { + public: + /** + * Creates a Signature-V4 signer provider that supports the different implementations of Signature-V4 + * used for standard and event-stream requests. + * + * @param credentialsProvider A provider to retrieve the access/secret key used to derive the signing + * @param serviceName The canonical name of the AWS service to be used in the signature + * @param region The AWS region in which the requests will be made. + */ + BearerTokenAuthSignerProvider() = delete; + BearerTokenAuthSignerProvider(const std::shared_ptr bearerTokenProvider); + void AddSigner(std::shared_ptr& signer) override; + std::shared_ptr GetSigner(const Aws::String& signerName) const override; + private: + Aws::Vector> m_signers; + }; + } +} diff --git a/include/aws/core/auth/signer-provider/DefaultAuthSignerProvider.h b/include/aws/core/auth/signer-provider/DefaultAuthSignerProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..7b5513b0a2882ec9796945a7b5710bc72209f72c --- /dev/null +++ b/include/aws/core/auth/signer-provider/DefaultAuthSignerProvider.h @@ -0,0 +1,44 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include + +#include + + +namespace Aws +{ + namespace Auth + { + class AWSCredentialsProvider; + + class AWS_CORE_API DefaultAuthSignerProvider : public AWSAuthSignerProvider + { + public: + /** + * Creates a Signature-V4 signer provider that supports the different implementations of Signature-V4 + * used for standard and event-stream requests. + * + * @param credentialsProvider A provider to retrieve the access/secret key used to derive the signing + * @param serviceName The canonical name of the AWS service to be used in the signature + * @param region The AWS region in which the requests will be made. + */ + DefaultAuthSignerProvider(const std::shared_ptr& credentialsProvider, + const Aws::String& serviceName, const Aws::String& region, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signingPolicy = Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::RequestDependent, + bool urlEscapePath = true); + explicit DefaultAuthSignerProvider(const std::shared_ptr& signer); + void AddSigner(std::shared_ptr& signer) override; + std::shared_ptr GetSigner(const Aws::String& signerName) const override; + std::shared_ptr GetCredentialsProvider() const override { return m_credentialsProvider; } + protected: + Aws::Vector> m_signers; + std::shared_ptr m_credentialsProvider; + }; + } +} diff --git a/include/aws/core/auth/signer/AWSAuthBearerSigner.h b/include/aws/core/auth/signer/AWSAuthBearerSigner.h new file mode 100644 index 0000000000000000000000000000000000000000..78e61a883ba05dacf9d53235c81ba942dbe3409f --- /dev/null +++ b/include/aws/core/auth/signer/AWSAuthBearerSigner.h @@ -0,0 +1,108 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include "aws/core/auth/signer/AWSAuthSignerBase.h" + +namespace Aws +{ + namespace Http + { + class HttpRequest; + } // namespace Http + + namespace Utils + { + namespace Event + { + class Message; + } + } // namespace Utils + + namespace Auth + { + class AWSBearerTokenProviderBase; + AWS_CORE_API extern const char BEARER_SIGNER[]; + } // namespace Auth + + namespace Client + { + class AWS_CORE_API AWSAuthBearerSigner : public AWSAuthSigner + { + + public: + /** + * An implementation of a signer interface that uses bearer token auth signature. + */ + AWSAuthBearerSigner(const std::shared_ptr bearerTokenProvider) + : m_bearerTokenProvider(bearerTokenProvider) + {} + + virtual ~AWSAuthBearerSigner() {}; + + /** + * Return the signer's name + */ + const char* GetName() const override + { + return Aws::Auth::BEARER_SIGNER; + } + + /** + * Sign request with a bearer auth token + * @return true if success, false if fail to sign + */ + bool SignRequest(Aws::Http::HttpRequest& ) const override; + + /** + * Dummy function to satisfy the interface requirements of a base Signer interface + * additional arguments are not used. + * @return true if success, false if fail to sign + */ + bool SignRequest(Aws::Http::HttpRequest& ioRequest, const char* /*region*/, const char* /*serviceName*/, bool /*signBody*/) const override + { + return SignRequest(ioRequest); + } + + /** + * Dummy function to satisfy the interface requirements of a base Signer interface + * @return true if success, false if fail to sign + */ + bool PresignRequest(Aws::Http::HttpRequest& ioRequest, long long /*expirationInSeconds = 0*/) const override + { + return SignRequest(ioRequest); + } + + /** + * Dummy function to satisfy the interface requirements of a base Signer interface + * additional arguments are not used. + * @return true if success, false if fail to sign + */ + bool PresignRequest(Aws::Http::HttpRequest& ioRequest, const char* /*region*/, long long expirationInSeconds = 0) const override + { + return PresignRequest(ioRequest, expirationInSeconds); + } + + /** + * Dummy function to satisfy the interface requirements of a base Signer interface + * additional arguments are not used. + * @return true if success, false if fail to sign + */ + bool PresignRequest(Aws::Http::HttpRequest& ioRequest, const char* /*region*/, const char* /*serviceName*/, long long expirationInSeconds = 0) const override + { + return PresignRequest(ioRequest, expirationInSeconds); + } + + std::shared_ptr BearerTokenProvider() const { return m_bearerTokenProvider; } + + protected: + std::shared_ptr m_bearerTokenProvider; + }; + + } // namespace Client +} // namespace Aws + diff --git a/include/aws/core/auth/signer/AWSAuthEventStreamV4Signer.h b/include/aws/core/auth/signer/AWSAuthEventStreamV4Signer.h new file mode 100644 index 0000000000000000000000000000000000000000..27083efb506d7e0d5ecfd78e7b8ddd6d5cebc4f7 --- /dev/null +++ b/include/aws/core/auth/signer/AWSAuthEventStreamV4Signer.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include "aws/core/auth/signer/AWSAuthSignerBase.h" + +#include +#include +#include +#include +#include + +#include + +#include + +namespace Aws +{ + namespace Http + { + class HttpRequest; + } // namespace Http + + namespace Utils + { + namespace Event + { + class Message; + } + } // namespace Utils + + namespace Auth + { + class AWSCredentials; + class AWSCredentialsProvider; + + AWS_CORE_API extern const char EVENTSTREAM_SIGV4_SIGNER[]; + } // namespace Auth + + namespace Client + { + /** + * AWS Auth EventStream v4 Signer implementation of the AWSAuthSigner interface. + */ + class AWS_CORE_API AWSAuthEventStreamV4Signer : public AWSAuthSigner + { + public: + AWSAuthEventStreamV4Signer(const std::shared_ptr& credentialsProvider, + const char* serviceName, const Aws::String& region); + + const char* GetName() const override { return Aws::Auth::EVENTSTREAM_SIGV4_SIGNER; } + + bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& priorSignature) const override; + + bool SignRequest(Aws::Http::HttpRequest& request) const override + { + return SignRequest(request, m_region.c_str(), m_serviceName.c_str(), true); + } + + bool SignRequest(Aws::Http::HttpRequest& request, bool signBody) const override + { + return SignRequest(request, m_region.c_str(), m_serviceName.c_str(), signBody); + } + + bool SignRequest(Aws::Http::HttpRequest& request, const char* region, bool signBody) const override + { + return SignRequest(request, region, m_serviceName.c_str(), signBody); + } + + bool SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool signBody) const override; + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, long long) const override { return false; } + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, const char*, long long) const override { return false; } + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, const char*, const char*, long long) const override { return false; } + + bool ShouldSignHeader(const Aws::String& header) const; + private: + Utils::ByteBuffer GenerateSignature(const Aws::Auth::AWSCredentials& credentials, + const Aws::String& stringToSign, const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const; + Utils::ByteBuffer GenerateSignature(const Aws::String& stringToSign, const Aws::Utils::ByteBuffer& key) const; + Aws::String GenerateStringToSign(const Aws::String& dateValue, const Aws::String& simpleDate, + const Aws::String& canonicalRequestHash, const Aws::String& region, + const Aws::String& serviceName) const; + Aws::Utils::ByteBuffer ComputeHash(const Aws::String& secretKey, const Aws::String& simpleDate) const; + Aws::Utils::ByteBuffer ComputeHash(const Aws::String& secretKey, + const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const; + const Aws::String m_serviceName; + const Aws::String m_region; + mutable Utils::Threading::ReaderWriterLock m_derivedKeyLock; + mutable Aws::Utils::ByteBuffer m_derivedKey; + mutable Aws::String m_currentDateStr; + mutable Aws::String m_currentSecretKey; + Aws::Vector m_unsignedHeaders; + std::shared_ptr m_credentialsProvider; + }; + } // namespace Client +} // namespace Aws + diff --git a/include/aws/core/auth/signer/AWSAuthSignerBase.h b/include/aws/core/auth/signer/AWSAuthSignerBase.h new file mode 100644 index 0000000000000000000000000000000000000000..48be2b8e2b41c592274fc7e59192b8479a897920 --- /dev/null +++ b/include/aws/core/auth/signer/AWSAuthSignerBase.h @@ -0,0 +1,142 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include "aws/core/Core_EXPORTS.h" +#include "aws/core/utils/DateTime.h" + +#include +#include +#include + +namespace Aws +{ + namespace Http + { + class HttpRequest; + } // namespace Http + + namespace Utils + { + namespace Event + { + class Message; + } + } // namespace Utils + + namespace Client + { + /** + * Auth Signer interface. Takes a generic AWS request and applies crypto tamper resistant signatures on the request. + */ + class AWS_CORE_API AWSAuthSigner + { + public: + AWSAuthSigner() : m_clockSkew() { m_clockSkew.store(std::chrono::milliseconds(0L)); } + virtual ~AWSAuthSigner() = default; + + /** + * Signs the request itself (usually by adding a signature header) based on info in the request and uri. + */ + virtual bool SignRequest(Aws::Http::HttpRequest& request) const = 0; + + /** + * Signs the request itself (usually by adding a signature header) based on info in the request and uri. + * If signBody is false and https is being used then the body of the payload will not be signed. + * The default virtual function, just calls SignRequest. + */ + virtual bool SignRequest(Aws::Http::HttpRequest& request, bool signBody) const + { + AWS_UNREFERENCED_PARAM(signBody); + return SignRequest(request); + } + + /** + * Signs the request itself (usually by adding a signature header) based on info in the request and uri. + * If signBody is false and https is being used then the body of the payload will not be signed. + * The default virtual function, just calls SignRequest. + * Using m_region by default if parameter region is nullptr. + */ + virtual bool SignRequest(Aws::Http::HttpRequest& request, const char* region, bool signBody) const + { + AWS_UNREFERENCED_PARAM(signBody); + AWS_UNREFERENCED_PARAM(region); + return SignRequest(request); + } + + /** + * Signs the request itself (usually by adding a signature header) based on info in the request and uri. + * If signBody is false and https is being used then the body of the payload will not be signed. + * The default virtual function, just calls SignRequest. + * Using m_region by default if parameter region is nullptr. + * Using m_serviceName by default if parameter serviceName is nullptr. + */ + virtual bool SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool signBody) const + { + AWS_UNREFERENCED_PARAM(signBody); + AWS_UNREFERENCED_PARAM(region); + AWS_UNREFERENCED_PARAM(serviceName); + return SignRequest(request); + } + + /** + * Signs a single event message in an event stream. + * The input message buffer is copied and signed. The message's input buffer will be deallocated and a new + * buffer will be assigned. The new buffer encodes the original message with its headers as the payload of + * the new message. The signature of the original message will be added as a header to the new message. + * + * A Hex encoded signature of the previous event (or of the HTTP request headers in case of the first event) + * is provided as the 'priorSignature' parameter. 'priorSignature' will contain the value of the new + * signature after this call returns successfully. + * + * The function returns true if the message is successfully signed. + */ + virtual bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& /* priorSignature */) const { return false; } + + /** + * Takes a request and signs the URI based on the HttpMethod, URI and other info from the request. + * The URI can then be used in a normal HTTP call until expiration. + */ + virtual bool PresignRequest(Aws::Http::HttpRequest& request, long long expirationInSeconds) const = 0; + + /** + * Generates a signed Uri using the injected signer. for the supplied uri and http method and region. expirationInSeconds defaults + * to 0 which is the default 7 days. + * Using m_region by default if parameter region is nullptr. + */ + virtual bool PresignRequest(Aws::Http::HttpRequest& request, const char* region, long long expirationInSeconds = 0) const = 0; + + /** + * Generates a signed Uri using the injected signer. for the supplied uri and http method, region, and service name. expirationInSeconds defaults + * to 0 which is the default 7 days. + * Using m_region by default if parameter region is nullptr. + * Using m_serviceName by default if parameter serviceName is nullptr. + */ + virtual bool PresignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, long long expirationInSeconds = 0) const = 0; + + /** + * Return the signer's name + */ + virtual const char* GetName() const = 0; + + /** + * This handles detection of clock skew between clients and the server and adjusts the clock so that the next request will not + * fail on the timestamp check. + */ + virtual void SetClockSkew(const std::chrono::milliseconds& clockSkew) { m_clockSkew = clockSkew; } + + /** + * Gets the timestamp being used by the signer. This may include a clock skew if a clock skew has been detected. + */ + virtual Aws::Utils::DateTime GetSigningTimestamp() const { return Aws::Utils::DateTime::Now() + GetClockSkewOffset(); } + + protected: + virtual std::chrono::milliseconds GetClockSkewOffset() const { return m_clockSkew.load(); } + + std::atomic m_clockSkew; + }; + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/auth/signer/AWSAuthSignerCommon.h b/include/aws/core/auth/signer/AWSAuthSignerCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..7ed72b87b71c4d8f5c7f634d8d2891c2cb283140 --- /dev/null +++ b/include/aws/core/auth/signer/AWSAuthSignerCommon.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Http + { + class HttpRequest; + } // namespace Http + + namespace Auth + { + AWS_CORE_API extern const char SIGNATURE[]; + } // namespace Client +} // namespace Aws + diff --git a/include/aws/core/auth/signer/AWSAuthSignerHelper.h b/include/aws/core/auth/signer/AWSAuthSignerHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..955445b6b637b29d0f8c6f15ef4d1869db78138c --- /dev/null +++ b/include/aws/core/auth/signer/AWSAuthSignerHelper.h @@ -0,0 +1,45 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Http + { + class HttpRequest; + } // namespace Http + + namespace Auth + { + class AWSAuthHelper + { + public: + /** + * Helper functions used across different signers + */ + static Aws::String CanonicalizeRequestSigningString(Aws::Http::HttpRequest &request, bool urlEscapePath); + static Aws::Http::HeaderValueCollection CanonicalizeHeaders(Http::HeaderValueCollection &&headers); + + /** + * Static const variables used across different signers + */ + static const char* EQ; + static const char* AWS_HMAC_SHA256; + static const char* AWS4_REQUEST; + static const char* SIGNED_HEADERS; + static const char* CREDENTIAL; + static const char* NEWLINE; + static const char* X_AMZN_TRACE_ID; + static const char* X_AMZ_CONTENT_SHA256; + static const char* SIGNING_KEY; + static const char* SIMPLE_DATE_FORMAT_STR; + }; + } // namespace Client +} // namespace Aws + diff --git a/include/aws/core/auth/signer/AWSAuthV4Signer.h b/include/aws/core/auth/signer/AWSAuthV4Signer.h new file mode 100644 index 0000000000000000000000000000000000000000..86df54945f60d95d6364a9ae88c0bcad6ace443d --- /dev/null +++ b/include/aws/core/auth/signer/AWSAuthV4Signer.h @@ -0,0 +1,239 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include "aws/core/auth/signer/AWSAuthSignerBase.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +namespace smithy +{ + class AwsSigV4Signer; +} + +namespace Aws +{ + namespace Http + { + class HttpRequest; + } // namespace Http + + namespace Auth + { + class AWSCredentials; + class AWSCredentialsProvider; + + enum class AWSSigningAlgorithm + { + SIGV4 = static_cast(Aws::Crt::Auth::SigningAlgorithm::SigV4), + ASYMMETRIC_SIGV4 = static_cast(Aws::Crt::Auth::SigningAlgorithm::SigV4A), + }; + + AWS_CORE_API extern const char SIGV4_SIGNER[]; + AWS_CORE_API extern const char ASYMMETRIC_SIGV4_SIGNER[]; + } // namespace Auth + + namespace Client + { + /** + * AWS Auth v4 Signer implementation of the AWSAuthSigner interface. More information on AWS Auth v4 Can be found here: + * http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html + */ + class AWS_CORE_API AWSAuthV4Signer : public AWSAuthSigner + { + + public: + /** + * Even though different payload signing polices, HTTP will force payload signing to be on. + */ + enum class PayloadSigningPolicy + { + /** + * Sign the request based on the value returned by AmazonWebServiceRequest::SignBody() + */ + RequestDependent, + /** + * Always sign the body of the request. + */ + Always, + /** + * Never sign the body of the request + */ + Never + }; + /** + * credentialsProvider, source of AWS Credentials to sign requests with + * serviceName, canonical service name to sign with + * region, region string to use in signature + * signPayloads, if Always, the payload will have a sha256 computed on the body of the request. If this is set + * to Never, the sha256 will not be computed on the body. This is only useful for Amazon S3 over Https. If + * Https is not used then this flag will be ignored. If set to RequestDependent, compute or not is based on + * the value from AmazonWebServiceRequest::SignBody() + */ + AWSAuthV4Signer(const std::shared_ptr& credentialsProvider, + const char* serviceName, const Aws::String& region, PayloadSigningPolicy signingPolicy = PayloadSigningPolicy::RequestDependent, + bool urlEscapePath = true, Aws::Auth::AWSSigningAlgorithm signingAlgorithm = Aws::Auth::AWSSigningAlgorithm::SIGV4); + + virtual ~AWSAuthV4Signer(); + + /** + * AWSAuthV4signer's implementation of virtual function from base class + * Return Auth Signer's name, here the value is specified in Aws::Auth::DEFAULT_AUTHV4_SIGNER. + */ + const char* GetName() const override + { + if (m_signingAlgorithm == Aws::Auth::AWSSigningAlgorithm::ASYMMETRIC_SIGV4) + { + return Aws::Auth::ASYMMETRIC_SIGV4_SIGNER; + } + else + { + return Aws::Auth::SIGV4_SIGNER; + } + } + + /** + * Signs the request itself based on info in the request and uri. + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. + */ + bool SignRequest(Aws::Http::HttpRequest& request) const override + { + return SignRequest(request, m_region.c_str(), m_serviceName.c_str(), true/*signBody*/); + } + + /** + * Signs the request itself based on info in the request and uri. + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. If signBody is false + * and https is being used then the body of the payload will not be signed. + */ + bool SignRequest(Aws::Http::HttpRequest& request, bool signBody) const override + { + return SignRequest(request, m_region.c_str(), m_serviceName.c_str(), signBody); + } + + /** + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. If signBody is false + * and https is being used then the body of the payload will not be signed. + * Using m_region by default if parameter region is nullptr. + */ + bool SignRequest(Aws::Http::HttpRequest& request, const char* region, bool signBody) const override + { + return SignRequest(request, region, m_serviceName.c_str(), signBody); + } + + /** + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. If signBody is false + * and https is being used then the body of the payload will not be signed. + * Using m_region by default if parameter region is nullptr. + */ + bool SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool signBody) const override; + + /** + * Takes a request and signs the URI based on the HttpMethod, URI and other info from the request. + * the region the signer was initialized with will be used for the signature. + * The URI can then be used in a normal HTTP call until expiration. + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. + * expirationInSeconds defaults to 0 which provides a URI good for 7 days. + */ + bool PresignRequest(Aws::Http::HttpRequest& request, long long expirationInSeconds = 0) const override; + + /** + * Takes a request and signs the URI based on the HttpMethod, URI and other info from the request. + * The URI can then be used in a normal HTTP call until expiration. + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. + * expirationInSeconds defaults to 0 which provides a URI good for 7 days. + * Using m_region by default if parameter region is nullptr. + */ + bool PresignRequest(Aws::Http::HttpRequest& request, const char* region, long long expirationInSeconds = 0) const override; + + /** + * Takes a request and signs the URI based on the HttpMethod, URI and other info from the request. + * The URI can then be used in a normal HTTP call until expiration. + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. + * expirationInSeconds defaults to 0 which provides a URI good for 7 days. + * Using m_region by default if parameter region is nullptr. + * Using m_serviceName by default if parameter serviceName is nullptr. + */ + bool PresignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, long long expirationInSeconds = 0) const override; + + /** + * Takes a request and signs the URI based on request, region, servicename, expiration and credentials. + * The URI can then be used in a normal HTTP call until expiration. + * Uses AWS Auth V4 signing method with SHA256 HMAC algorithm. + * expirationInSeconds defaults to 0 which provides a URI good for 7 days. + * Using m_region by default if parameter region is nullptr. + * Using m_serviceName by default if parameter serviceName is nullptr. + */ + bool PresignRequest(Aws::Http::HttpRequest& request, const Aws::Auth::AWSCredentials& creds, const char* region, const char* serviceName, long long expirationInSeconds = 0) const; + + + virtual Aws::Auth::AWSCredentials GetCredentials(const std::shared_ptr &serviceSpecificParameters) const; + + Aws::String GetServiceName() const { return m_serviceName; } + Aws::String GetRegion() const { return m_region; } + Aws::String GenerateSignature(const Aws::Auth::AWSCredentials& credentials, + const Aws::String& stringToSign, const Aws::String& simpleDate) const; + bool ShouldSignHeader(const Aws::String& header) const; + + protected: + virtual bool ServiceRequireUnsignedPayload(const Aws::String& serviceName) const; + bool m_includeSha256HashHeader; + + private: + Aws::String GenerateSignature(const Aws::Auth::AWSCredentials& credentials, + const Aws::String& stringToSign, const Aws::String& simpleDate, const Aws::String& region, + const Aws::String& serviceName) const; + + Aws::String GenerateSignature(const Aws::String& stringToSign, const Aws::Utils::ByteBuffer& key) const; + Aws::String ComputePayloadHash(Aws::Http::HttpRequest&) const; + Aws::String GenerateStringToSign(const Aws::String& dateValue, const Aws::String& simpleDate, + const Aws::String& canonicalRequestHash, const Aws::String& region, + const Aws::String& serviceName) const; + Aws::Utils::ByteBuffer ComputeHash(const Aws::String& secretKey, + const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const; + bool SignRequestWithSigV4a(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, + bool signBody, long long expirationTimeInSeconds, Aws::Crt::Auth::SignatureType signatureType) const; + + friend class smithy::AwsSigV4Signer; + /** + * Temporary method added for migration to the smithy architecture. Please do not use. + */ + bool SignRequestWithCreds(Aws::Http::HttpRequest& request, const Auth::AWSCredentials& credentials, + const char* region, const char* serviceName, bool signBody) const; + + + Aws::Auth::AWSSigningAlgorithm m_signingAlgorithm; + std::shared_ptr m_credentialsProvider; + const Aws::String m_serviceName; + const Aws::String m_region; + + Aws::Set m_unsignedHeaders; + + //these next four fields are ONLY for caching purposes and do not change + //the logical state of the signer. They are marked mutable so the + //interface can remain const. + mutable Aws::Utils::ByteBuffer m_partialSignature; + mutable Aws::String m_currentDateStr; + mutable Aws::String m_currentSecretKey; + mutable Utils::Threading::ReaderWriterLock m_partialSignatureLock; + PayloadSigningPolicy m_payloadSigningPolicy; + bool m_urlEscapePath; + mutable Aws::Crt::Auth::Sigv4HttpRequestSigner m_crtSigner{}; + }; + } // namespace Client +} // namespace Aws + diff --git a/include/aws/core/auth/signer/AWSNullSigner.h b/include/aws/core/auth/signer/AWSNullSigner.h new file mode 100644 index 0000000000000000000000000000000000000000..7c40f44fb425049ae2b12d20e4d2e831231ab195 --- /dev/null +++ b/include/aws/core/auth/signer/AWSNullSigner.h @@ -0,0 +1,72 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include "aws/core/auth/signer/AWSAuthSignerBase.h" + +namespace Aws +{ + namespace Http + { + class HttpRequest; + } // namespace Http + + namespace Utils + { + namespace Event + { + class Message; + } + } // namespace Utils + + namespace Auth + { + AWS_CORE_API extern const char NULL_SIGNER[]; + } // namespace Auth + + namespace Client + { + /** + * A no-op implementation of the AWSAuthSigner interface + */ + class AWS_CORE_API AWSNullSigner : public AWSAuthSigner + { + public: + /** + * AWSNullSigner's implementation of virtual function from base class + * Here the returned value is specified in Aws::Auth::NULL_SIGNER. + */ + const char* GetName() const override { return Aws::Auth::NULL_SIGNER; } + + /** + * Do nothing + */ + bool SignRequest(Aws::Http::HttpRequest&) const override { return true; } + + /** + * Do nothing + */ + bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& /* priorSignature */) const override { return true; } + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, long long) const override { return false; } + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, const char*, long long) const override { return false; } + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, const char*, const char*, long long) const override { return false; } + }; + + } // namespace Client +} // namespace Aws + diff --git a/include/aws/core/client/AWSAsyncOperationTemplate.h b/include/aws/core/client/AWSAsyncOperationTemplate.h new file mode 100644 index 0000000000000000000000000000000000000000..15ee45f8859a0ae6a1f38d68fd97702d2473ba9c --- /dev/null +++ b/include/aws/core/client/AWSAsyncOperationTemplate.h @@ -0,0 +1,191 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Client +{ + /** + * A template function that is used to create an Async Operation function body for AWS Operations + */ + template + inline void AWS_CORE_LOCAL MakeAsyncOperation(OperationFuncT&& operationFunc, + const ClientT* clientThis, + const RequestT& request, + const HandlerT& handler, + const HandlerContextT& context, + ExecutorT* pExecutor) + { + std::function asyncTask = + [operationFunc, clientThis, request, handler, context]() // note capture by value + { + handler(clientThis, + request, + (clientThis->*operationFunc)(request), + context); + }; + + pExecutor->Submit(std::move(asyncTask)); + } + + /** + * A template function that is used to create an Async Operation function body for AWS Streaming Operations + * The only difference compared to a regular non-streaming Operation is that + * the request is passed by non-const reference, therefore virtual copy constructor is not needed. + * However, caller code must ensure the life time of the request object is maintained during the Async execution. + */ + template + inline void AWS_CORE_LOCAL MakeAsyncStreamingOperation(OperationFuncT&& operationFunc, + const ClientT* clientThis, + RequestT& request, // note non-const ref + const HandlerT& handler, + const HandlerContextT& context, + ExecutorT* pExecutor) + { + std::function asyncTask = + [operationFunc, clientThis, &request, handler, context]() // note capture by ref + { + handler(clientThis, + request, + (clientThis->*operationFunc)(request), + context); + }; + + pExecutor->Submit(std::move(asyncTask)); + } + + /** + * A template function to create an Async Operation function body for AWS Operation without a request on input. + */ + template + inline void AWS_CORE_LOCAL MakeAsyncOperation(OperationFuncT&& operationFunc, + const ClientT* clientThis, + const HandlerT& handler, + const HandlerContextT& context, + ExecutorT* pExecutor) + { + std::function asyncTask = + [operationFunc, clientThis, handler, context]() + { + handler(clientThis, + (clientThis->*operationFunc)(), + context); + }; + + pExecutor->Submit(std::move(asyncTask)); + } + + /** + * A template function that is used to create a Callable Operation function body for AWS Operations + */ + template + inline auto AWS_CORE_LOCAL MakeCallableOperation(const char* ALLOCATION_TAG, + OperationFuncT&& operationFunc, + const ClientT* clientThis, + const RequestT& request, + ExecutorT* pExecutor) -> std::future*operationFunc)(request))> + { + using OperationOutcomeT = decltype((clientThis->*operationFunc)(request)); + + auto task = Aws::MakeShared< std::packaged_task< OperationOutcomeT() > >( + ALLOCATION_TAG, + [clientThis, operationFunc, request]() // note capture by value + { + auto futureOutcome = (clientThis->*operationFunc)(request); + return futureOutcome; + } ); + + std::function packagedFunction = + [task]() { (*task)(); }; + pExecutor->Submit(std::move(packagedFunction)); + return task->get_future(); + } + + /** + * A template function that is used to create a Callable Operation function body for AWS Streaming Operations + * The only difference compared to a regular non-streaming Operation is that + * the request is passed by non-const reference, therefore virtual copy constructor is not needed. + * However, caller code must ensure the life time of the request object is maintained during the Async execution. + */ + template + inline auto AWS_CORE_LOCAL MakeCallableStreamingOperation(const char* ALLOCATION_TAG, + OperationFuncT&& operationFunc, + const ClientT* clientThis, + RequestT& request, // note non-const ref + ExecutorT* pExecutor) -> std::future*operationFunc)(request))> + { + using OperationOutcomeT = decltype((clientThis->*operationFunc)(request)); + + auto task = Aws::MakeShared< std::packaged_task< OperationOutcomeT() > >( + ALLOCATION_TAG, + [clientThis, operationFunc, &request]() // note capture by ref + { + return (clientThis->*operationFunc)(request); + } ); + + std::function packagedFunction = + [task]() { (*task)(); }; + pExecutor->Submit(std::move(packagedFunction)); + return task->get_future(); + } + + /** + * A template function that is used to create a Callable Operation function body for AWS Operation without a request on input. + */ + template + inline auto AWS_CORE_LOCAL MakeCallableOperation(const char* ALLOCATION_TAG, + OperationFuncT&& operationFunc, + const ClientT* clientThis, + ExecutorT* pExecutor) -> std::future*operationFunc)())> + { + using OperationOutcomeT = decltype((clientThis->*operationFunc)()); + + auto task = Aws::MakeShared< std::packaged_task< OperationOutcomeT() > >( + ALLOCATION_TAG, + [clientThis, operationFunc]() + { + return (clientThis->*operationFunc)(); + } ); + + std::function packagedFunction = + [task]() { (*task)(); }; + pExecutor->Submit(std::move(packagedFunction)); + return task->get_future(); + } +} // namespace Client +} // namespace Aws + + diff --git a/include/aws/core/client/AWSClient.h b/include/aws/core/client/AWSClient.h new file mode 100644 index 0000000000000000000000000000000000000000..777e58e34173033fbc3e73d90bb10699502874cf --- /dev/null +++ b/include/aws/core/client/AWSClient.h @@ -0,0 +1,370 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#if !defined(AWS_CLIENT_H) +#define AWS_CLIENT_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + template + class Outcome; + + namespace RateLimits + { + class RateLimiterInterface; + } // namespace RateLimits + + namespace Crypto + { + class MD5; + } // namespace Crypto + } // namespace Utils + + namespace Http + { + class HttpClient; + + class HttpClientFactory; + + class HttpRequest; + + class HttpResponse; + + class URI; + } // namespace Http + + namespace Auth + { + AWS_CORE_API extern const char SIGV4_SIGNER[]; + AWS_CORE_API extern const char NULL_SIGNER[]; + } + + class AmazonWebServiceRequest; + + namespace Client + { + template + class AWSError; + class AWSErrorMarshaller; + class AWSAuthSigner; + struct ClientConfiguration; + class RetryStrategy; + + typedef Utils::Outcome, AWSError> HttpResponseOutcome; + typedef Utils::Outcome, AWSError> StreamOutcome; + + /** + * Abstract AWS Client. Contains most of the functionality necessary to build an http request, get it signed, and send it across the wire. + */ + class AWS_CORE_API AWSClient + { + public: + /** + * configuration will be used for http client settings, retry strategy, throttles, and signing information. + * supplied signer will be used for all requests, aws sdk clients will use default AuthV4Signer. + * errorMarshaller tells the client how to convert error payloads into AWSError objects. + */ + AWSClient(const Aws::Client::ClientConfiguration& configuration, + const std::shared_ptr& signer, + const std::shared_ptr& errorMarshaller); + + /** + * Configuration will be used for http client settings, retry strategy, throttles, and signing information. + * Pass a signer provider to determine the proper signer for a given request; AWS services will use + * SigV4 signer. errorMarshaller tells the client how to convert error payloads into AWSError objects. + */ + AWSClient(const Aws::Client::ClientConfiguration& configuration, + const std::shared_ptr& signerProvider, + const std::shared_ptr& errorMarshaller); + + virtual ~AWSClient() { }; + + /** + * Generates a signed Uri using the injected signer. for the supplied uri and http method. expirationInSeconds defaults + * to 0 which is the default 7 days. The implication of this function is using auth signer v4 to sign it. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}); + + /** + * Generates a signed Uri using the injected signer. for the supplied uri, http method and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. The implication of this function is using auth signer v4 to sign it. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}); + + /** + * Generates a signed Uri using the injected signer. for the supplied uri and http method and region. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer. for the supplied uri, http method and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}); + + /** + * Generates a signed Uri using the injected signer. for the supplied uri and http method, region, and service name. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer. for the supplied uri, http method and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}); + + /** + * Generates a signed Uri using the injected signer. for the supplied uri and http method, region, service name and signer name. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, const char* signerName, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer. for the supplied uri, http method, region, service name, signer name and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, const char* signerName, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds = 0, const std::shared_ptr serviceSpecificParameter = {}); + + Aws::String GeneratePresignedUrl(const Aws::Endpoint::AWSEndpoint& endpoint, + Aws::Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const Aws::Http::HeaderValueCollection& customizedHeaders = {}, + uint64_t expirationInSeconds = 0, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr, + const std::shared_ptr serviceSpecificParameter = {}); + + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest& request, const Aws::Http::URI& uri, Aws::Http::HttpMethod method, + const Aws::Http::QueryStringParameterCollection& extraParams = Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest& request, const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, + const char* signerName, const Aws::Http::QueryStringParameterCollection& extraParams = Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest& request, const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, + const Aws::Http::QueryStringParameterCollection& extraParams = Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest& request, const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, + const Aws::Http::QueryStringParameterCollection& extraParams = Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + const std::shared_ptr& GetHttpClient() const { return m_httpClient; } + + /** + * Stop all requests immediately. + * In flight requests will likely fail. + */ + void DisableRequestProcessing(); + + /** + * Enable/ReEnable requests. + */ + void EnableRequestProcessing(); + + inline virtual const char* GetServiceClientName() const { return m_serviceName.c_str(); } + /** + * service client name is part of userAgent. + * We need to update userAgent after setting this name if it's not pre-set by customer. + * Note: this API should only be called in your extended class constructors. + */ + virtual void SetServiceClientName(const Aws::String& name); + + void AppendToUserAgent(const Aws::String& valueToAppend); + protected: + /** + * Calls AttemptOneRequest until it either, succeeds, runs out of retries from the retry strategy, + * or encounters and error that is not retryable. + */ + HttpResponseOutcome AttemptExhaustively(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod httpMethod, + const char* signerName, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * Calls AttemptOneRequest until it either, succeeds, runs out of retries from the retry strategy, + * or encounters and error that is not retryable. This method is for payloadless requests e.g. GET, DELETE, HEAD + * + * requestName is used for metrics and defaults to empty string, to avoid empty names in metrics provide a valid + * name. + */ + HttpResponseOutcome AttemptExhaustively(const Aws::Http::URI& uri, + Http::HttpMethod httpMethod, + const char* signerName, + const char* requestName = "", + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * Build an Http Request from the AmazonWebServiceRequest object. Signs the request, sends it across the wire + * then reports the http response. + */ + HttpResponseOutcome AttemptOneRequest(const std::shared_ptr& httpRequest, + const Aws::AmazonWebServiceRequest& request, + const char* signerName, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * Signs an Http Request, sends it across the wire + * then reports the http response. This method is for payloadless requests e.g. GET, DELETE, HEAD + * + * requestName is used for metrics and defaults to empty string, to avoid empty names in metrics provide a valid + * name. + */ + HttpResponseOutcome AttemptOneRequest(const std::shared_ptr& httpRequest, + const char* signerName, + const char* requestName = "", + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * This is used for structureless response payloads (file streams, binary data etc...). It calls AttemptExhaustively, but upon + * return transfers ownership of the underlying stream for the http response to the caller. + */ + StreamOutcome MakeRequestWithUnparsedResponse(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * This is used for structureless response payloads (file streams, binary data etc...). It calls AttemptExhaustively, but upon + * return transfers ownership of the underlying stream for the http response to the caller. + * + * requestName is used for metrics and defaults to empty string, to avoid empty names in metrics provide a valid + * name. + */ + StreamOutcome MakeRequestWithUnparsedResponse(const Aws::Http::URI& uri, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* requestName = "", + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + StreamOutcome MakeRequestWithUnparsedResponse(const Aws::AmazonWebServiceRequest& request, + const Aws::Endpoint::AWSEndpoint& endpoint, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * Abstract. Subclassing clients should override this to tell the client how to marshall error payloads + */ + virtual AWSError BuildAWSError(const std::shared_ptr& response) const = 0; + + /** + * Transforms the AmazonWebServicesResult object into an HttpRequest. + */ + virtual void BuildHttpRequest(const Aws::AmazonWebServiceRequest& request, + const std::shared_ptr& httpRequest) const; + + /** + * Gets the underlying ErrorMarshaller for subclasses to use. + */ + const std::shared_ptr& GetErrorMarshaller() const + { + return m_errorMarshaller; + } + + /** + * Gets the corresponding signer from the signers map by name. + */ + Aws::Client::AWSAuthSigner* GetSignerByName(const char* name) const; + + friend Aws::Client::AWSAuthSigner* AWSUrlPresigner::GetSignerByName(const char* name) const; + + std::shared_ptr GetCredentialsProvider() const { + return m_signerProvider->GetCredentialsProvider(); + } + protected: + + /** + * Creates an HttpRequest instance with the given URI and sets the proper headers from the + * AmazonWebRequest, and finally signs that request with the given the signer. + * The similar member function BuildHttpRequest() does not sign the request. + * This member function is used internally only by clients that perform requests (input operations) using + * event-streams. + */ + std::shared_ptr BuildAndSignHttpRequest(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod method, const char* signerName) const; + + /** + * Performs the HTTP request via the HTTP client while enforcing rate limiters + */ + std::shared_ptr MakeHttpRequest(std::shared_ptr& request) const; + Aws::String m_region; + + /** + * Adds "X-Amzn-Trace-Id" header with the value of _X_AMZN_TRACE_ID if both + * environment variables AWS_LAMBDA_FUNCTION_NAME and _X_AMZN_TRACE_ID are set. + * Does not add/modify header "X-Amzn-Trace-Id" if it is already set. + */ + static void AppendRecursionDetectionHeader(std::shared_ptr ioRequest); + + static CoreErrors GuessBodylessErrorType(Aws::Http::HttpResponseCode responseCode); + static bool DoesResponseGenerateError(const std::shared_ptr& response); + std::shared_ptr m_telemetryProvider; + std::shared_ptr m_signerProvider; + private: + /** + * Try to adjust signer's clock + * return true if signer's clock is adjusted, false otherwise. + */ + bool AdjustClockSkew(HttpResponseOutcome& outcome, const char* signerName) const; + void AddHeadersToRequest(const std::shared_ptr& httpRequest, const Http::HeaderValueCollection& headerValues) const; + void AddContentBodyToRequest(const std::shared_ptr& httpRequest, const std::shared_ptr& body, + bool needsContentMd5 = false, bool isChunked = false) const; + void AppendHeaderValueToRequest(const std::shared_ptr &request, String header, String value) const; + + std::shared_ptr m_httpClient; + std::shared_ptr m_errorMarshaller; + std::shared_ptr m_retryStrategy; + std::shared_ptr m_writeRateLimiter; + std::shared_ptr m_readRateLimiter; + std::shared_ptr m_hash; + long m_requestTimeoutMs; + bool m_enableClockSkewAdjustment; + Aws::String m_serviceName = "AWSBaseClient"; + Aws::Client::RequestCompressionConfig m_requestCompressionConfig; + std::shared_ptr m_userAgentInterceptor; + Aws::Vector> m_interceptors; + }; + + AWS_CORE_API Aws::String GetAuthorizationHeader(const Aws::Http::HttpRequest& httpRequest); + } // namespace Client +} // namespace Aws + +#if !defined(AWS_JSON_CLIENT_H) && !defined(AWS_XML_CLIENT_H) +/* Legacy backward compatibility macros to not break the build for ones including just AWSClient.h */ +#include +#include +#endif // !defined(AWS_JSON_CLIENT_H) && !defined(AWS_XML_CLIENT_H) +#endif // !defined(AWS_CLIENT_H) \ No newline at end of file diff --git a/include/aws/core/client/AWSClientAsyncCRTP.h b/include/aws/core/client/AWSClientAsyncCRTP.h new file mode 100644 index 0000000000000000000000000000000000000000..7210ee38d69d6534041f5ce7c8936ebc97e2438d --- /dev/null +++ b/include/aws/core/client/AWSClientAsyncCRTP.h @@ -0,0 +1,216 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ +namespace Client +{ + class AsyncCallerContext; + + /** + * A helper to determine if AWS Operation is EventStream-enabled or not (based on const-ness of the request) + */ + template + struct AWS_CORE_LOCAL IsEventStreamOperation : IsEventStreamOperation {}; + + template + struct AWS_CORE_LOCAL IsEventStreamOperation + { + static const bool value = !std::is_const::type>::value; + }; + + template + struct AWS_CORE_LOCAL IsEventStreamOperation + { + static const bool value = false; + }; + + + /** + * A CRTP-base class template that is used to add template methods to call AWS Operations in parallel using ThreadExecutor + * An AwsClient is going to inherit from this class and will get methods below available. + */ + template + class ClientWithAsyncTemplateMethods + { + public: + ClientWithAsyncTemplateMethods() + : m_isInitialized(true), + m_operationsProcessed(0) + { + AwsServiceClientT* pThis = static_cast(this); + Aws::Utils::ComponentRegistry::RegisterComponent(AwsServiceClientT::GetServiceName(), + pThis, + &AwsServiceClientT::ShutdownSdkClient); + + } + + ClientWithAsyncTemplateMethods(const ClientWithAsyncTemplateMethods& other) + : m_isInitialized(other.m_isInitialized.load()), + m_operationsProcessed(0) + { + AwsServiceClientT* pThis = static_cast(this); + Aws::Utils::ComponentRegistry::RegisterComponent(AwsServiceClientT::GetServiceName(), + pThis, + &AwsServiceClientT::ShutdownSdkClient); + } + + ClientWithAsyncTemplateMethods& operator=(const ClientWithAsyncTemplateMethods& other) + { + if (&other != this) + { + ShutdownSdkClient(static_cast(this)); + m_operationsProcessed = 0; + m_isInitialized = other.m_isInitialized.load(); + } + + return *this; + } + + virtual ~ClientWithAsyncTemplateMethods() + { + AwsServiceClientT* pClient = static_cast(this); + Aws::Utils::ComponentRegistry::DeRegisterComponent(pClient); + } + + /** + * A callback static method to terminate client (i.e. to free dynamic resources and prevent further processing) + * @param pThis, a void* pointer that points to AWS SDK Service Client, such as "Aws::S3::S3Client" + * @param timeoutMs, a timeout (in ms) that this method will wait for currently running operations to complete. + * "-1" represents "use clientConfiguration.requestTimeoutMs" value. + */ + static void ShutdownSdkClient(void* pThis, int64_t timeoutMs = -1) + { + AwsServiceClientT* pClient = reinterpret_cast(pThis); + AWS_CHECK_PTR(AwsServiceClientT::GetServiceName(), pClient); + if(!pClient->m_isInitialized) + { + return; + } + + std::unique_lock lock(pClient->m_shutdownMutex); + + pClient->m_isInitialized = false; + if (pClient->GetHttpClient().use_count() == 1) + { + pClient->DisableRequestProcessing(); + } + + if (timeoutMs == -1) + { + timeoutMs = pClient->m_clientConfiguration.requestTimeoutMs; + } + pClient->m_shutdownSignal.wait_for(lock, + std::chrono::milliseconds(timeoutMs), + [&](){ return pClient->m_operationsProcessed.load() == 0; }); + + if (pClient->m_operationsProcessed.load()) + { + AWS_LOGSTREAM_FATAL(AwsServiceClientT::GetAllocationTag(), "Service client " + << AwsServiceClientT::GetServiceName() << " is shutting down while async tasks are present."); + } + + pClient->m_clientConfiguration.executor.reset(); + pClient->m_clientConfiguration.retryStrategy.reset(); + pClient->m_endpointProvider.reset(); + } + + /** + * A template to submit a AwsServiceClient regular operation method for async execution. + * This template method copies and queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template::value, int>::type = 0> + void SubmitAsync(OperationFuncT operationFunc, + const RequestT& request, + const HandlerT& handler, + const std::shared_ptr& context = nullptr) const + { + const AwsServiceClientT* clientThis = static_cast(this); + Aws::Client::MakeAsyncOperation(operationFunc, clientThis, request, handler, context, clientThis->m_clientConfiguration.executor.get()); + } + + /** + * A template to submit a AwsServiceClient event stream enabled operation method for async execution. + * This template method queues the original request object into a thread executor and triggers associated callback when operation has finished. + * It is caller's responsibility to ensure the lifetime of the original request object for a duration of the async execution. + */ + template::value, int>::type = 0> + void SubmitAsync(OperationFuncT operationFunc, + RequestT& request, // note non-const ref + const HandlerT& handler, + const std::shared_ptr& context = nullptr) const + { + const AwsServiceClientT* clientThis = static_cast(this); + Aws::Client::MakeAsyncStreamingOperation(operationFunc, clientThis, request, handler, context, clientThis->m_clientConfiguration.executor.get()); + } + + /** + * A template to submit a AwsServiceClient regular operation method without arguments for async execution. + * This template method submits a task into a thread executor and triggers associated callback when operation has finished. + */ + template + void SubmitAsync(OperationFuncT operationFunc, + const HandlerT& handler, + const std::shared_ptr& context = nullptr) const + { + const AwsServiceClientT* clientThis = static_cast(this); + Aws::Client::MakeAsyncOperation(operationFunc, clientThis, handler, context, clientThis->m_clientConfiguration.executor.get()); + } + + /** + * A template to submit a AwsServiceClient regular operation method for async execution that returns a future object. + * This template method copies and queues the request into a thread executor and returns a future object when operation has finished. + */ + template::value, int>::type = 0> + auto SubmitCallable(OperationFuncT operationFunc, + const RequestT& request) const + -> std::future(nullptr)->*operationFunc)(request))> + { + const AwsServiceClientT* clientThis = static_cast(this); + return Aws::Client::MakeCallableOperation(AwsServiceClientT::GetAllocationTag(), operationFunc, clientThis, request, clientThis->m_clientConfiguration.executor.get()); + } + + /** + * A template to submit a AwsServiceClient event stream enabled operation method for async execution that returns a future object. + * This template method queues the original request into a thread executor and returns a future object when operation has finished. + * It is caller's responsibility to ensure the lifetime of the original request object for a duration of the async execution. + */ + template::value, int>::type = 0> + auto SubmitCallable(OperationFuncT operationFunc, /*note non-const ref*/ RequestT& request) const + -> std::future(nullptr)->*operationFunc)(request))> + { + const AwsServiceClientT* clientThis = static_cast(this); + return Aws::Client::MakeCallableStreamingOperation(AwsServiceClientT::GetAllocationTag(), operationFunc, clientThis, request, clientThis->m_clientConfiguration.executor.get()); + } + + /** + * A template to submit a AwsServiceClient regular operation without request argument for + * an async execution that returns a future object. + * This template method copies and queues the request into a thread executor and returns a future object when operation has finished. + */ + template + auto SubmitCallable(OperationFuncT operationFunc) const + -> std::future(nullptr)->*operationFunc)())> + { + const AwsServiceClientT* clientThis = static_cast(this); + return Aws::Client::MakeCallableOperation(AwsServiceClientT::GetAllocationTag(), operationFunc, clientThis, clientThis->m_clientConfiguration.executor.get()); + } + protected: + std::atomic m_isInitialized; + mutable std::atomic m_operationsProcessed; + mutable std::condition_variable m_shutdownSignal; + mutable std::mutex m_shutdownMutex; + + // TODO: track scheduled tasks + // std::atomic m_operationsScheduled; + }; +} // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/AWSError.h b/include/aws/core/client/AWSError.h new file mode 100644 index 0000000000000000000000000000000000000000..696537358399bd044d7ac66cbaf29c760c22f177 --- /dev/null +++ b/include/aws/core/client/AWSError.h @@ -0,0 +1,282 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Client + { + enum class CoreErrors; + class XmlErrorMarshaller; + class JsonErrorMarshaller; + + enum class ErrorPayloadType + { + NOT_SET, + XML, + JSON + }; + + enum class RetryableType + { + NOT_RETRYABLE, + RETRYABLE, + RETRYABLE_THROTTLING + }; + + /** + * Container for Error enumerations with additional exception information. Name, message, retryable etc.... + */ + template + class AWSError + { + // Allow ErrorMarshaller to set error payload. + friend class XmlErrorMarshaller; + friend class JsonErrorMarshaller; + friend class JsonErrorMarshallerQueryCompatible; + template friend class AWSError; + public: + /** + * Initializes AWSError object as empty with the error not being retryable. + */ + AWSError() : + AWSError({}, RetryableType::NOT_RETRYABLE) + {} + + /** + * Initializes AWSError object with errorType, exceptionName, message, and retryable type. + */ + AWSError(ERROR_TYPE errorType, + Aws::String exceptionName, + Aws::String message, + bool isRetryable) : + AWSError(errorType, + isRetryable? RetryableType::RETRYABLE : RetryableType::NOT_RETRYABLE, + exceptionName, + message) + {} + + /** + * Initializes AWSError object with errorType and retryable flag. ExceptionName and message are empty. + */ + AWSError(ERROR_TYPE errorType, + bool isRetryable) : + AWSError(errorType, + isRetryable? RetryableType::RETRYABLE : RetryableType::NOT_RETRYABLE) + {} + + /** + * Initializes AWSError object with errorType and retryable type. ExceptionName and message are empty. + */ + AWSError(ERROR_TYPE errorType, + RetryableType retryableType, + Aws::String exceptionName = "", + Aws::String message = "") : + m_errorType(errorType), + m_exceptionName(std::move(exceptionName)), + m_message(std::move(message)), + m_retryableType(retryableType) + {} + + AWSError(AWSError&&) = default; + AWSError(const AWSError&) = default; + + template + AWSError(AWSError&& rhs) : + m_errorType(static_cast(rhs.m_errorType)), + m_exceptionName(std::move(rhs.m_exceptionName)), + m_message(std::move(rhs.m_message)), + m_remoteHostIpAddress(std::move(rhs.m_remoteHostIpAddress)), + m_requestId(std::move(rhs.m_requestId)), + m_responseHeaders(std::move(rhs.m_responseHeaders)), + m_responseCode(rhs.m_responseCode), + m_errorPayloadType(rhs.m_errorPayloadType), + m_xmlPayload(std::move(rhs.m_xmlPayload)), + m_jsonPayload(std::move(rhs.m_jsonPayload)), + m_retryableType(rhs.m_retryableType) + {} + + template + AWSError(const AWSError& rhs) : + m_errorType(static_cast(rhs.m_errorType)), + m_exceptionName(rhs.m_exceptionName), + m_message(rhs.m_message), + m_remoteHostIpAddress(rhs.m_remoteHostIpAddress), + m_requestId(rhs.m_requestId), + m_responseHeaders(rhs.m_responseHeaders), + m_responseCode(rhs.m_responseCode), + m_errorPayloadType(rhs.m_errorPayloadType), + m_xmlPayload(rhs.m_xmlPayload), + m_jsonPayload(rhs.m_jsonPayload), + m_retryableType(rhs.m_retryableType) + {} + + /** + * Copy assignment operator + */ + AWSError& operator=(const AWSError&) = default; + + /** + * Move assignment operator + */ + AWSError& operator=(AWSError&&) = default; + + /** + * Gets underlying errorType. + */ + inline const ERROR_TYPE GetErrorType() const { return m_errorType; } + /** + * Gets the underlying ExceptionName. + */ + inline const Aws::String& GetExceptionName() const { return m_exceptionName; } + /** + *Sets the underlying ExceptionName. + */ + inline void SetExceptionName(const Aws::String& exceptionName) { m_exceptionName = exceptionName; } + /** + * Gets the error message. + */ +#ifdef _WIN32 + #pragma push_macro("GetMessage") +#undef GetMessage + inline const Aws::String& GetMessage() const { return m_message; } + inline const Aws::String& GetMessageW() const { return GetMessage(); } + inline const Aws::String& GetMessageA() const { return GetMessage(); } + +#pragma pop_macro("GetMessage") +#else + inline const Aws::String& GetMessage() const { return m_message; } +#endif //#ifdef _WIN32 + /** + * Sets the error message + */ + inline void SetMessage(const Aws::String& message) { m_message = message; } + /** + * Gets the resolved remote host IP address. + * This value is only available after DNS resolution and with CURL http client right now. + * Otherwise an empty string is returned. + */ + inline const Aws::String& GetRemoteHostIpAddress() const { return m_remoteHostIpAddress; } + /** + * Sets the resolved remote host IP address. + */ + inline void SetRemoteHostIpAddress(const Aws::String& remoteHostIpAddress) { m_remoteHostIpAddress = remoteHostIpAddress; } + /** + * Gets the request ID. + * This value is available after request is made and when services return it in response. + * Otherwise an empty string is returned. + */ + inline const Aws::String& GetRequestId() const { return m_requestId; } + /** + * Sets the request ID. + */ + inline void SetRequestId(const Aws::String& requestId) { m_requestId = requestId; } + /** + * Returns whether or not this error is eligible for retry. + */ + inline bool ShouldRetry() const { return m_retryableType == RetryableType::RETRYABLE || m_retryableType == RetryableType::RETRYABLE_THROTTLING; } + /** + * Gets the response headers from the http response. + */ + inline const Aws::Http::HeaderValueCollection& GetResponseHeaders() const { return m_responseHeaders; } + /** + * Sets the response headers from the http response. + */ + inline void SetResponseHeaders(const Aws::Http::HeaderValueCollection& headers) { m_responseHeaders = headers; } + /** + * Tests whether or not a header exists. + */ + inline bool ResponseHeaderExists(const Aws::String& headerName) const { return m_responseHeaders.find(Aws::Utils::StringUtils::ToLower(headerName.c_str())) != m_responseHeaders.end(); } + /** + * Gets the response code from the http response + */ + inline Aws::Http::HttpResponseCode GetResponseCode() const { return m_responseCode; } + /** + * Sets the response code from the http response + */ + inline void SetResponseCode(Aws::Http::HttpResponseCode responseCode) { m_responseCode = responseCode; } + /** + * Return whether or not the error should throttle retry strategies. + */ + inline bool ShouldThrottle() const { return m_retryableType == RetryableType::RETRYABLE_THROTTLING; } + /** + * Sets the response code from the http response + */ + inline void SetRetryableType(const RetryableType retryableType) { m_retryableType = retryableType; } + + protected: + inline ErrorPayloadType GetErrorPayloadType() { return m_errorPayloadType; } + inline void SetXmlPayload(const Aws::Utils::Xml::XmlDocument& xmlPayload) + { + m_errorPayloadType = ErrorPayloadType::XML; + m_xmlPayload = xmlPayload; + } + inline void SetXmlPayload(Aws::Utils::Xml::XmlDocument&& xmlPayload) + { + m_errorPayloadType = ErrorPayloadType::XML; + m_xmlPayload = std::move(xmlPayload); + } + inline const Aws::Utils::Xml::XmlDocument& GetXmlPayload() const + { + assert(m_errorPayloadType != ErrorPayloadType::JSON); + return m_xmlPayload; + } + inline void SetJsonPayload(const Aws::Utils::Json::JsonValue& jsonPayload) + { + m_errorPayloadType = ErrorPayloadType::JSON; + m_jsonPayload = jsonPayload; + } + inline void SetJsonPayload(Aws::Utils::Json::JsonValue&& jsonPayload) + { + m_errorPayloadType = ErrorPayloadType::JSON; + m_jsonPayload = std::move(jsonPayload); + } + inline const Aws::Utils::Json::JsonValue& GetJsonPayload() const + { + assert(m_errorPayloadType != ErrorPayloadType::XML); + return m_jsonPayload; + } + + ERROR_TYPE m_errorType; + Aws::String m_exceptionName; + Aws::String m_message; + Aws::String m_remoteHostIpAddress; + Aws::String m_requestId; + Aws::Http::HeaderValueCollection m_responseHeaders; + Aws::Http::HttpResponseCode m_responseCode = Aws::Http::HttpResponseCode::REQUEST_NOT_MADE; + + ErrorPayloadType m_errorPayloadType = ErrorPayloadType::NOT_SET; + Aws::Utils::Xml::XmlDocument m_xmlPayload; + Aws::Utils::Json::JsonValue m_jsonPayload; + RetryableType m_retryableType; + }; + + template + Aws::OStream& operator << (Aws::OStream& s, const AWSError& e) + { + s << "HTTP response code: " << static_cast(e.GetResponseCode()) << "\n" + << "Resolved remote host IP address: " << e.GetRemoteHostIpAddress() << "\n" + << "Request ID: " << e.GetRequestId() << "\n" + << "Exception name: " << e.GetExceptionName() << "\n" + << "Error message: " << e.GetMessage() << "\n" + << e.GetResponseHeaders().size() << " response headers:"; + + for (auto&& header : e.GetResponseHeaders()) + { + s << "\n" << header.first << " : " << header.second; + } + return s; + } + + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/AWSErrorMarshaller.h b/include/aws/core/client/AWSErrorMarshaller.h new file mode 100644 index 0000000000000000000000000000000000000000..eda113ed3e90389fb62976416c22251b778dcf9b --- /dev/null +++ b/include/aws/core/client/AWSErrorMarshaller.h @@ -0,0 +1,120 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Http + { + class HttpResponse; + enum class HttpResponseCode; + } + + namespace Utils + { + namespace Xml + { + class XmlDocument; + } + namespace Json + { + class JsonValue; + } + } + + namespace Client + { + enum class CoreErrors; + + template + class AWSError; + + /** + * Marshaller for core error types. + */ + class AWS_CORE_API AWSErrorMarshaller + { + public: + virtual ~AWSErrorMarshaller() {} + + /** + * Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns + * and AWSError with CoreErrors::UNKNOWN as the error type. + */ + virtual AWSError Marshall(const Aws::Http::HttpResponse& response) const = 0; + /** + * Attempts to finds an error code by the exception name. Otherwise returns CoreErrors::UNKNOWN as the error type. + */ + virtual AWSError FindErrorByName(const char* exceptionName) const; + virtual AWSError FindErrorByHttpResponseCode(Aws::Http::HttpResponseCode code) const; + + /** + * Deserialize http error payload to an error object. + */ + virtual AWSError BuildAWSError(const std::shared_ptr&) const + { + return AWSError(CoreErrors::UNKNOWN, false); + } + + /** + * Attempts to extract region from error. + */ + virtual Aws::String ExtractRegion(const AWSError&) const { return {}; } + /** + * Attempts to extract endpoint from error. + */ + virtual Aws::String ExtractEndpoint(const AWSError&) const { return {}; } + protected: + virtual AWSError Marshall(const Aws::String& exceptionName, const Aws::String& message) const; + virtual void MarshallError(AWSError&, const Http::HttpResponse&) const {}; + }; + + class AWS_CORE_API JsonErrorMarshaller : public AWSErrorMarshaller + { + using AWSErrorMarshaller::Marshall; + public: + /** + * Converts an exceptionName and message into an Error object, if it + * can be parsed. Otherwise, it returns and AWSError with + * CoreErrors::UNKNOWN as the error type. + */ + virtual AWSError Marshall(const Aws::Http::HttpResponse& response) const override; + + AWSError BuildAWSError(const std::shared_ptr& httpResponse) const override; + + protected: + const Aws::Utils::Json::JsonValue& GetJsonPayloadFromError(const AWSError&) const; + static Aws::Utils::Json::JsonValue GetJsonPayloadHttpResponse(const Http::HttpResponse& httpResponse); + }; + + class AWS_CORE_API JsonErrorMarshallerQueryCompatible : public JsonErrorMarshaller { + protected: + void MarshallError(AWSError&, const Http::HttpResponse&) const override; + }; + + class AWS_CORE_API XmlErrorMarshaller : public AWSErrorMarshaller { + using AWSErrorMarshaller::Marshall; + + public: + /** + * Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns + * and AWSError with CoreErrors::UNKNOWN as the error type. + */ + AWSError Marshall(const Aws::Http::HttpResponse& response) const override; + + AWSError BuildAWSError(const std::shared_ptr& httpResponse) const override; + + protected: + const Aws::Utils::Xml::XmlDocument& GetXmlPayloadFromError(const AWSError&) const; + }; + + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/AWSJsonClient.h b/include/aws/core/client/AWSJsonClient.h new file mode 100644 index 0000000000000000000000000000000000000000..877db0aec5b4c2979b562ebacd22140d7b78eaa8 --- /dev/null +++ b/include/aws/core/client/AWSJsonClient.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#if !defined(AWS_JSON_CLIENT_H) +#define AWS_JSON_CLIENT_H + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Json + { + class JsonValue; + } // namespace Json + } // namespace Utils + + namespace Client + { + typedef Utils::Outcome, AWSError> JsonOutcome; + /** + * AWSClient that handles marshalling json response bodies. You would inherit from this class + * to create a client that uses Json as its payload format. + */ + class AWS_CORE_API AWSJsonClient : public AWSClient + { + public: + typedef AWSClient BASECLASS; + + /** + * Simply calls AWSClient constructor. + */ + AWSJsonClient(const Aws::Client::ClientConfiguration& configuration, + const std::shared_ptr& signer, + const std::shared_ptr& errorMarshaller); + + /** + * Simply calls AWSClient constructor. + */ + AWSJsonClient(const Aws::Client::ClientConfiguration& configuration, + const std::shared_ptr& signerProvider, + const std::shared_ptr& errorMarshaller); + + virtual ~AWSJsonClient() = default; + + protected: + /** + * Converts/Parses an http response into a meaningful AWSError object using the json message structure. + */ + virtual AWSError BuildAWSError(const std::shared_ptr& response) const override; + + /** + * Returns a Json document or an error from the request. Does some marshalling json and raw streams, + * then just calls AttemptExhaustively. + * + * method defaults to POST + */ + JsonOutcome MakeRequest(const Aws::AmazonWebServiceRequest& request, + const Aws::Endpoint::AWSEndpoint& endpoint, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + JsonOutcome MakeRequest(const Aws::Endpoint::AWSEndpoint& endpoint, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * Returns a Json document or an error from the request. Does some marshalling json and raw streams, + * then just calls AttemptExhaustively. + * + * method defaults to POST + */ + JsonOutcome MakeRequest(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * Returns a Json document or an error from the request. Does some marshalling json and raw streams, + * then just calls AttemptExhaustively. + * + * requestName is used for metrics and defaults to empty string, to avoid empty names in metrics provide a valid + * name. + * + * method defaults to POST + */ + JsonOutcome MakeRequest(const Aws::Http::URI& uri, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* requestName = "", + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + JsonOutcome MakeEventStreamRequest(std::shared_ptr& request) const; + }; + } // namespace Client +} // namespace Aws + +#endif // !defined(AWS_JSON_CLIENT_H) \ No newline at end of file diff --git a/include/aws/core/client/AWSUrlPresigner.h b/include/aws/core/client/AWSUrlPresigner.h new file mode 100644 index 0000000000000000000000000000000000000000..6fdda6250b5b3f9e0b7d72c43c6c414e3bd81ac7 --- /dev/null +++ b/include/aws/core/client/AWSUrlPresigner.h @@ -0,0 +1,189 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +#include + +namespace Aws +{ + namespace Client + { + class AWSClient; + + /** + * Helper class to generate pre-signed AWS URLs. + */ + class AWS_CORE_API AWSUrlPresigner + { + public: + AWSUrlPresigner(const AWSClient& client); + + virtual ~AWSUrlPresigner() {}; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri and http method. expirationInSeconds defaults + * to 0 which is the default 7 days. The implication of this function is using auth signer v4 to sign it. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri, http method, and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. The implication of this function is using auth signer v4 to sign it. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const Aws::Http::HeaderValueCollection &customizedHeaders, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri, http method, and region. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri, http method, and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const Aws::Http::HeaderValueCollection &customizedHeaders, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri, http method, region, and service name. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const char *serviceNameOverride, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri, http method, and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const char *serviceNameOverride, + const Aws::Http::HeaderValueCollection &customizedHeaders, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri, http method, region, service name, and signer name. expirationInSeconds defaults + * to 0 which is the default 7 days. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const char *serviceNameOverride, + const char *signerName, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer, for the supplied uri, http method, region, service name, signer name, and customized headers. expirationInSeconds defaults + * to 0 which is the default 7 days. + * + * This is a real method for uri pre-signing, the rest are just overloads. + */ + Aws::String GeneratePresignedUrl(const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const char *serviceNameOverride, + const char *signerName, + const Aws::Http::HeaderValueCollection &customizedHeaders, + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri for a supplied AWSEndpoint. + */ + Aws::String GeneratePresignedUrl(const Aws::Endpoint::AWSEndpoint &endpoint, + Aws::Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const Aws::Http::HeaderValueCollection &customizedHeaders = {}, + uint64_t expirationInSeconds = 0, + const char *signerName = Aws::Auth::SIGV4_SIGNER, + const char *signerRegionOverride = nullptr, + const char *signerServiceNameOverride = nullptr, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri for a supplied request and uri. + */ + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest &request, + const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const Aws::Http::QueryStringParameterCollection &extraParams = Aws::Http::QueryStringParameterCollection(), + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri using the injected signer. for the supplied request object, uri, http method, region, service name, signer name, and customized headers. + * expirationInSeconds defaults to 0 which is the default 7 days. + * + * This is a real method for request+uri pre-signing, the rest are just overloads. + */ + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest &request, + const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const char *serviceNameOverride, + const char *signerName, + const Aws::Http::QueryStringParameterCollection &extraParams = Aws::Http::QueryStringParameterCollection(), + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri for a supplied request and uri. + */ + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest &request, + const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const char *serviceNameOverride, + const Aws::Http::QueryStringParameterCollection &extraParams = Aws::Http::QueryStringParameterCollection(), + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + /** + * Generates a signed Uri for a supplied request and uri. + */ + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest &request, + const Aws::Http::URI &uri, + Aws::Http::HttpMethod method, + const char *regionOverride, + const Aws::Http::QueryStringParameterCollection &extraParams = Aws::Http::QueryStringParameterCollection(), + long long expirationInSeconds = 0, + const std::shared_ptr serviceSpecificParameter = {}) const; + + protected: + const AWSClient& m_awsClient; + + friend class AWSClient; // allow AWSClient to see method below to make friends with it + Aws::Client::AWSAuthSigner* GetSignerByName(const char* name) const; + }; // class AWSUrlPresigner + + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/AWSXmlClient.h b/include/aws/core/client/AWSXmlClient.h new file mode 100644 index 0000000000000000000000000000000000000000..1d3426e6e8976129b2ded53e101234e2dcfedee5 --- /dev/null +++ b/include/aws/core/client/AWSXmlClient.h @@ -0,0 +1,135 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#if !defined(AWS_XML_CLIENT_H) +#define AWS_XML_CLIENT_H + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Xml + { + class XmlDocument; + } // namespace Xml + } // namespace Utils + + namespace Client + { + typedef Utils::Outcome, AWSError> XmlOutcome; + + /** + * AWSClient that handles marshalling xml response bodies. You would inherit from this class + * to create a client that uses Xml as its payload format. + */ + class AWS_CORE_API AWSXMLClient : public AWSClient + { + public: + typedef AWSClient BASECLASS; + + AWSXMLClient(const Aws::Client::ClientConfiguration& configuration, + const std::shared_ptr& signer, + const std::shared_ptr& errorMarshaller); + + AWSXMLClient(const Aws::Client::ClientConfiguration& configuration, + const std::shared_ptr& signerProvider, + const std::shared_ptr& errorMarshaller); + + virtual ~AWSXMLClient() = default; + + protected: + /** + * Converts/Parses an http response into a meaningful AWSError object. Using the XML message structure. + */ + virtual AWSError BuildAWSError(const std::shared_ptr& response) const override; + + /** + * Returns an xml document or an error from the request. Does some marshalling xml and raw streams, + * then just calls AttemptExhaustively. + * + * method defaults to POST + */ + XmlOutcome MakeRequest(const Aws::AmazonWebServiceRequest& request, + const Aws::Endpoint::AWSEndpoint& endpoint, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + XmlOutcome MakeRequest(const Aws::Endpoint::AWSEndpoint& endpoint, + const char* requestName = "", + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * Returns an xml document or an error from the request. Does some marshalling xml and raw streams, + * then just calls AttemptExhaustively. + * + * method defaults to POST + */ + XmlOutcome MakeRequest(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + + /** + * Returns an xml document or an error from the request. Does some marshalling xml and raw streams, + * then just calls AttemptExhaustively. + * + * requestName is used for metrics and defaults to empty string, to avoid empty names in metrics provide a valid + * name. + * + * method defaults to POST + */ + XmlOutcome MakeRequest(const Aws::Http::URI& uri, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* requestName = "", + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * This is used for event stream response. + */ + XmlOutcome MakeRequestWithEventStream(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* singerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + XmlOutcome MakeRequestWithEventStream(const Aws::AmazonWebServiceRequest& request, + const Aws::Endpoint::AWSEndpoint& endpoint, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + + /** + * This is used for event stream response. + * requestName is used for metrics and defaults to empty string, to avoid empty names in metrics provide a valid + * name. + */ + XmlOutcome MakeRequestWithEventStream(const Aws::Http::URI& uri, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, + const char* requestName = "", + const char* signerRegionOverride = nullptr, + const char* signerServiceNameOverride = nullptr) const; + }; + + } // namespace Client +} // namespace Aws + +#endif // !defined(AWS_XML_CLIENT_H) \ No newline at end of file diff --git a/include/aws/core/client/AdaptiveRetryStrategy.h b/include/aws/core/client/AdaptiveRetryStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..4a9f4d551d8661d47ac7f1c632b45a796dc3faee --- /dev/null +++ b/include/aws/core/client/AdaptiveRetryStrategy.h @@ -0,0 +1,156 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ +namespace Client +{ + +/** + * A helper class of the AdaptiveRetryStrategy + * representing a (send) token bucket with a dynamically changing fill rate and capacity. + */ +class AWS_CORE_API RetryTokenBucket +{ +public: + /** + * C-tor + */ + RetryTokenBucket() = default; + + /** + * Acquire tokens from the bucket. If the bucket contains enough capacity + * to satisfy the request, this method will return immediately, otherwise + * the method will block the calling thread until enough tokens are refilled + * unless fast fail is provided as an argument. + */ + bool Acquire(size_t amount = 1, bool fastFail = false); + + /** + * Update limiter's client sending rate during the request bookkeeping process + * based on a service response. + */ + void UpdateClientSendingRate(bool throttlingResponse, const Aws::Utils::DateTime& now = Aws::Utils::DateTime::Now()); + +protected: + /** + * Internal C-tor for unit testing + */ + RetryTokenBucket(double fillRate, double maxCapacity, double currentCapacity, + const Aws::Utils::DateTime& lastTimestamp, double measuredTxRate, double lastTxRateBucket, + size_t requestCount, bool enabled, double lastMaxRate, const Aws::Utils::DateTime& lastThrottleTime); + + /** + * Internal method to update the token bucket's fill rate when we receive a response from the service. + * The update amount will depend on whether or not a throttling response is received from a service. + * The request rate is measured using an exponentially smoothed average, + * with the rate being updated in half second buckets. + */ + void UpdateMeasuredRate(const Aws::Utils::DateTime& now = Aws::Utils::DateTime::Now()); + + /** + * Internal method to enable rate limiting. + */ + void Enable(); + + /** + * Internal method to refill and update refill rate with a new refill rate. + */ + void UpdateRate(double newRps, const Aws::Utils::DateTime& now = Aws::Utils::DateTime::Now()); + + /** + * Internal method to refill send tokens based on a current fill rate. + */ + void Refill(const Aws::Utils::DateTime& now = Aws::Utils::DateTime::Now()); + + /** + * Internal method to compute time window for a last max fill rate. + */ + double CalculateTimeWindow() const; + + /** + * Internal method with a modified CUBIC algorithm to compute new max sending rate for a successful response. + */ + double CUBICSuccess(const Aws::Utils::DateTime& timestamp, const double timeWindow) const; + + /** + * Internal method with a modified CUBIC algorithm to compute new max sending rate for a throttled response. + */ + double CUBICThrottle(const double rateToUse) const; + + // The rate at which token are replenished. + double m_fillRate = 0.0; + // The maximum capacity allowed in the token bucket. + double m_maxCapacity = 0.0; + // The current capacity of the token bucket. + double m_currentCapacity = 0.0; + // The last time the token bucket was refilled. + Aws::Utils::DateTime m_lastTimestamp; + // The smoothed rate which tokens are being retrieved. + double m_measuredTxRate = 0.0; + // The last half second time bucket used. + double m_lastTxRateBucket = 0.0; + // The number of requests seen within the current time bucket. + size_t m_requestCount = 0; + // Boolean indicating if the token bucket is enabled. + bool m_enabled = false; + // The maximum rate when the client was last throttled. + double m_lastMaxRate = 0.0; + // The last time when the client was throttled. + Aws::Utils::DateTime m_lastThrottleTime; + + // TokenBucket's mutex to synchronize read/write operations + std::recursive_mutex m_mutex; +}; + +/** + * A retry strategy that builds on the standard strategy and introduces congestion control through + * client side rate limiting. + */ +class AWS_CORE_API AdaptiveRetryStrategy : public StandardRetryStrategy +{ +public: + /** + * C-tors + */ + AdaptiveRetryStrategy(long maxAttempts = 3); + AdaptiveRetryStrategy(std::shared_ptr retryQuotaContainer, long maxAttempts = 3); + + /** + * Retrieve and consume a send token. + * Returns true if send token is available. + * + * If there is not sufficient capacity, HasSendToken() will either sleep a certain amount of time until the rate + * limiter can retrieve a token from its token bucket or return false indicating there is insufficient capacity. + */ + virtual bool HasSendToken() override; + + /** + * Update status, like the information of retry quota when receiving a response. + */ + virtual void RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome) override; + virtual void RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome, const AWSError& lastError) override; + + const char* GetStrategyName() const override { return "adaptive";} + +protected: + RetryTokenBucket m_retryTokenBucket; + bool m_fastFail = false; + +private: + /** + * An internal helper function to check if a given service response is classified as a throttled one. + */ + static bool IsThrottlingResponse(const HttpResponseOutcome& httpResponseOutcome); +}; + +} // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/AsyncCallerContext.h b/include/aws/core/client/AsyncCallerContext.h new file mode 100644 index 0000000000000000000000000000000000000000..6267744bb2c638e8207cda3ee662a7478cd30384 --- /dev/null +++ b/include/aws/core/client/AsyncCallerContext.h @@ -0,0 +1,160 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Client + { + + class AWS_CORE_API MonitorContext{ + + private: + mutable Aws::String clientName; + mutable Aws::String requestName; + mutable Aws::Vector contexts; + + public: + ~MonitorContext() = default; + MonitorContext() = default; + MonitorContext(const MonitorContext&) = delete; + MonitorContext( MonitorContext &&) = delete; + MonitorContext& operator=(const MonitorContext&) = delete; + MonitorContext& operator=(MonitorContext&&) = delete; + + void StartMonitorContext(const Aws::String& client, const Aws::String& request, std::shared_ptr& httpRequest) const + { + clientName = client; + requestName = request; + contexts = Aws::Monitoring::OnRequestStarted(clientName, requestName, httpRequest); + } + + inline void OnRequestFailed(std::shared_ptr& httpRequest, const Aws::Client::HttpResponseOutcome& outcome) const + { + if(!httpRequest) + { + return; + } + Aws::Monitoring::CoreMetricsCollection coreMetrics; + coreMetrics.httpClientMetrics = httpRequest->GetRequestMetrics(); + + Aws::Monitoring::OnRequestFailed( + clientName, + requestName, + httpRequest , + outcome, + coreMetrics, + contexts); + + } + + inline void OnRequestSucceeded(std::shared_ptr httpRequest, const Aws::Client::HttpResponseOutcome& outcome) const + { + + if(!httpRequest) + { + return; + } + + Aws::Monitoring::CoreMetricsCollection coreMetrics; + coreMetrics.httpClientMetrics = httpRequest->GetRequestMetrics(); + + Aws::Monitoring::OnRequestSucceeded( + clientName, + requestName, + httpRequest , + outcome, + coreMetrics, + contexts); + } + + inline void OnRetry(std::shared_ptr httpRequest) const + { + if(!httpRequest) + { + return; + } + Aws::Monitoring::CoreMetricsCollection coreMetrics; + coreMetrics.httpClientMetrics = httpRequest->GetRequestMetrics(); + + Aws::Monitoring::OnRequestRetry( + clientName, + requestName, + httpRequest, + contexts); + } + + inline void OnFinish(std::shared_ptr httpRequest) const + { + if(!httpRequest) + { + return; + } + Aws::Monitoring::OnFinish( + clientName, + requestName, + httpRequest , + contexts); + } + + }; + + /** + * Call-back context for all async client methods. This allows you to pass a context to your callbacks so that you can identify your requests. + * It is entirely intended that you override this class in-lieu of using a void* for the user context. The base class just gives you the ability to + * pass a uuid for your context. + */ + class AWS_CORE_API AsyncCallerContext + { + public: + + /** + * Initializes object with generated UUID + */ + AsyncCallerContext(); + + /** + * Initializes object with UUID + */ + AsyncCallerContext(const Aws::String& uuid) : m_uuid(uuid){} + + /** + * Initializes object with UUID + */ + AsyncCallerContext(const char* uuid) : m_uuid(uuid) {} + + virtual ~AsyncCallerContext() {} + + /** + * Gets underlying UUID + */ + inline const Aws::String& GetUUID() const { return m_uuid; } + + /** + * Sets underlying UUID + */ + inline void SetUUID(const Aws::String& value) { m_uuid = value; } + + /** + * Sets underlying UUID + */ + inline void SetUUID(const char* value) { m_uuid.assign(value); } + + inline const MonitorContext& GetMonitorContext() const{ + return monitorContext; + } + + private: + Aws::String m_uuid; + mutable MonitorContext monitorContext; + }; + } +} diff --git a/include/aws/core/client/ClientConfiguration.h b/include/aws/core/client/ClientConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..97b75797e2c056125614ae4646d067214024e138 --- /dev/null +++ b/include/aws/core/client/ClientConfiguration.h @@ -0,0 +1,473 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Threading + { + class Executor; + } // namespace Threading + + namespace RateLimits + { + class RateLimiterInterface; + } // namespace RateLimits + } // namespace Utils + namespace Client + { + class RetryStrategy; // forward declare + + /** + * Sets the behaviors of the underlying HTTP clients handling response with 30x status code. + * By default, HTTP clients will always redirect the 30x response automatically, except when + * specifying aws-global as the client region, then SDK will handle 30x response and redirect + * the request manually. + */ + enum class FollowRedirectsPolicy + { + DEFAULT, + ALWAYS, + NEVER + }; + + /** + * This setting is an enumeration, not a boolean, to allow for future expansion. + */ + enum class UseRequestCompression + { + DISABLE, + ENABLE, + }; + + /** + * Setting on whether to calculate a checksum for a payload only when it is required. + * i.e. when setting WHEN_REQUIRED the SDK will NOT calculate a checksum for an endpoint + * where it is supported but is NOT required. + */ + enum class RequestChecksumCalculation { + WHEN_SUPPORTED, + WHEN_REQUIRED, + }; + + /** + * Setting on whether to client side response validate a content body that had a checksum + * associated with it. Response validation right now cannot be modeled as required but rely + * on an associated model configuration. + */ + enum class ResponseChecksumValidation { + WHEN_SUPPORTED, + WHEN_REQUIRED, + }; + + struct RequestCompressionConfig { + UseRequestCompression useRequestCompression=UseRequestCompression::ENABLE; + size_t requestMinCompressionSizeBytes = 10240; + }; + /** + * This structure is used to provide initial configuration values to the default ClientConfiguration constructor for the following parameter(s): + * - disableIMDS + */ + struct ClientConfigurationInitValues { + bool shouldDisableIMDS = false; + }; + + /** + * This mutable structure is used to configure any of the AWS clients. + * Default values can only be overwritten prior to passing to the client constructors. + */ + struct AWS_CORE_API ClientConfiguration + { + struct ProviderFactories + { + /** + * Retry Strategy factory method. Default is DefaultRetryStrategy (i.e. exponential backoff). + */ + std::function()> retryStrategyCreateFn; + /** + * Threading Executor factory method. Default creates a factory that creates DefaultExecutor + * (i.e. spawn a separate thread for each task) for backward compatibility reasons. + * Please switch to a better executor such as PooledThreadExecutor. + */ + std::function()> executorCreateFn; + /** + * Rate Limiter factory for outgoing bandwidth. Default is wide-open. + */ + std::function()> writeRateLimiterCreateFn; + /** + * Rate Limiter factory for incoming bandwidth. Default is wide-open. + */ + std::function()> readRateLimiterCreateFn; + /** + * TelemetryProvider factory. Defaults to Noop provider. + */ + std::function()> telemetryProviderCreateFn; + + static ProviderFactories defaultFactories; + }; + + ClientConfiguration(); + + /** + * Create a configuration with default settings. By default IMDS calls are enabled. + * @param ClientConfigurationInitValues ClientConfiguration initial customizable values + */ + ClientConfiguration(const ClientConfigurationInitValues &configuration); + + /** + * Create a configuration based on settings in the aws configuration file for the given profile name. + * The configuration file location can be set via the environment variable AWS_CONFIG_FILE + * @param profileName the aws profile name. + * @param shouldDisableIMDS whether or not to disable IMDS calls. + */ + ClientConfiguration(const char* profileName, bool shouldDisableIMDS = false); + + /** + * Create a configuration with a predefined smart defaults + * @param useSmartDefaults, required to differentiate c-tors + * @param defaultMode, default mode to use + * @param shouldDisableIMDS whether or not to disable IMDS calls. + */ + explicit ClientConfiguration(bool useSmartDefaults, const char* defaultMode = "legacy", bool shouldDisableIMDS = false); + + /** + * Add virtual method to allow use of dynamic_cast under inheritance. + */ + virtual ~ClientConfiguration() = default; + + /** + * Client configuration factory methods to init client utility classes such as Executor, Retry Strategy + */ + ProviderFactories configFactories = ProviderFactories::defaultFactories; + + /** + * User Agent string user for http calls. This is filled in for you in the constructor. Don't override this unless you have a really good reason. + */ + Aws::String userAgent; + /** + * Http scheme to use. E.g. Http or Https. Default HTTPS + */ + Aws::Http::Scheme scheme; + /** + * AWS Region to use in signing requests. Default US_EAST_1 + */ + Aws::String region; + /** + * Use dual stack endpoint in the endpoint calculation. It is your responsibility to verify that the service supports ipv6 in the region you select. + */ + bool useDualStack = false; + + /** + * Use FIPS endpoint in the endpoint calculation. Please check first that the service supports FIPS in a selected region. + */ + bool useFIPS = false; + + /** + * Max concurrent tcp connections for a single http client to use. Default 25. + */ + unsigned maxConnections = 25; + /** + * This is currently only applicable for Curl to set the http request level timeout, including possible dns lookup time, connection establish time, ssl handshake time and actual data transmission time. + * the corresponding Curl option is CURLOPT_TIMEOUT_MS + * defaults to 0, no http request level timeout. + */ + long httpRequestTimeoutMs = 0; + /** + * Socket read timeouts for HTTP clients on Windows. Default 3000 ms. This should be more than adequate for most services. However, if you are transferring large amounts of data + * or are worried about higher latencies, you should set to something that makes more sense for your use case. + * For Curl, it's the low speed time, which contains the time in number milliseconds that transfer speed should be below "lowSpeedLimit" for the library to consider it too slow and abort. + * Note that for Curl this config is converted to seconds by rounding down to the nearest whole second except when the value is greater than 0 and less than 1000. In this case it is set to one second. When it's 0, low speed limit check will be disabled. + * Note that for Windows when this config is 0, the behavior is not specified by Windows. + */ + long requestTimeoutMs = 0; + /** + * Socket connect timeout. Default 1000 ms. Unless you are very far away from your the data center you are talking to, 1000ms is more than sufficient. + */ + long connectTimeoutMs = 1000; + /** + * Enable TCP keep-alive. Default true; + * No-op for WinHTTP, WinINet and IXMLHTTPRequest2 client. + */ + bool enableTcpKeepAlive = true; + /** + * Interval to send a keep-alive packet over the connection. Default 30 seconds. Minimum 15 seconds. + * WinHTTP & libcurl support this option. Note that for Curl, this value will be rounded to an integer with second granularity. + * No-op for WinINet and IXMLHTTPRequest2 client. + */ + unsigned long tcpKeepAliveIntervalMs = 30000; + /** + * Average transfer speed in bytes per second that the transfer should be below during the request timeout interval for it to be considered too slow and abort. + * Default 1 byte/second. Only for CURL client currently. + */ + unsigned long lowSpeedLimit = 1; + /** + * Strategy to use in case of failed requests. Default is DefaultRetryStrategy (i.e. exponential backoff). + * Provide retry strategy here or via a factory method. + */ + std::shared_ptr retryStrategy = nullptr; + /** + * Override the http endpoint used to talk to a service. + */ + Aws::String endpointOverride; + + /** + * Allow HTTP client to discover system proxy setting. Off by default for legacy reasons. + */ + bool allowSystemProxy = false; + /** + * If you have users going through a proxy, set the proxy scheme here. Default HTTP + */ + Aws::Http::Scheme proxyScheme; + /** + * If you have users going through a proxy, set the host here. + */ + Aws::String proxyHost; + /** + * If you have users going through a proxy, set the port here. + */ + unsigned proxyPort = 0; + /** + * If you have users going through a proxy, set the username here. + */ + Aws::String proxyUserName; + /** + * If you have users going through a proxy, set the password here. + */ + Aws::String proxyPassword; + /** + * SSL Certificate file to use for connecting to an HTTPS proxy. + * Used to set CURLOPT_PROXY_SSLCERT in libcurl. Example: client.pem + */ + Aws::String proxySSLCertPath; + /** + * Type of proxy client SSL certificate. + * Used to set CURLOPT_PROXY_SSLCERTTYPE in libcurl. Example: PEM + */ + Aws::String proxySSLCertType; + /** + * Private key file to use for connecting to an HTTPS proxy. + * Used to set CURLOPT_PROXY_SSLKEY in libcurl. Example: key.pem + */ + Aws::String proxySSLKeyPath; + /** + * Type of private key file used to connect to an HTTPS proxy. + * Used to set CURLOPT_PROXY_SSLKEYTYPE in libcurl. Example: PEM + */ + Aws::String proxySSLKeyType; + /** + * Passphrase to the private key file used to connect to an HTTPS proxy. + * Used to set CURLOPT_PROXY_KEYPASSWD in libcurl. Example: password1 + */ + Aws::String proxySSLKeyPassword; + /** + * Calls to hosts in this vector will not use proxy configuration + */ + Aws::Utils::Array nonProxyHosts; + /** + * Threading Executor implementation. Default uses std::thread::detach() + * Provide executor here or via a factory method. + */ + std::shared_ptr executor = nullptr; + /** + * If you need to test and want to get around TLS validation errors, do that here. + * You probably shouldn't use this flag in a production scenario. + */ + bool verifySSL = true; + /** + * If your Certificate Authority path is different from the default, you can tell + * clients that aren't using the default trust store where to find your CA trust store. + * If you are on windows or apple, you likely don't want this. + */ + Aws::String caPath; + /** + * Same as caPath, but used when verifying an HTTPS proxy. + * Used to set CURLOPT_PROXY_CAPATH in libcurl and proxy tls + * settings in crt HTTP client. + * Does nothing on windows. + */ + Aws::String proxyCaPath; + /** + * If you certificate file is different from the default, you can tell clients that + * aren't using the default trust store where to find your ca file. + * If you are on windows or apple, you likely don't want this. + */ + Aws::String caFile; + /** + * Same as caFile, but used when verifying an HTTPS proxy. + * Used to set CURLOPT_PROXY_CAINFO in libcurl and proxy tls + * settings in crt HTTP client. + * Does nothing on windows. + */ + Aws::String proxyCaFile; + /** + * Rate Limiter implementation for outgoing bandwidth. Default is wide-open. + * Provide limiter here or via a factory method. + */ + std::shared_ptr writeRateLimiter = nullptr; + /** + * Rate Limiter implementation for incoming bandwidth. Default is wide-open. + * Provide limiter here or via a factory method. + */ + std::shared_ptr readRateLimiter = nullptr; + /** + * Override the http implementation the default factory returns. + */ + Aws::Http::TransferLibType httpLibOverride; + /** + * Configure low latency or low cpu consumption http client operation mode. + * Currently applies only to streaming APIs and libCurl. Defaults to LOW_LATENCY + */ + Aws::Http::TransferLibPerformanceMode httpLibPerfMode = Http::TransferLibPerformanceMode::LOW_LATENCY; + /** + * Sets the behavior how http stack handles 30x redirect codes. + */ + FollowRedirectsPolicy followRedirects; + + /** + * Only works for Curl http client. + * Curl will by default add "Expect: 100-Continue" header in a Http request so as to avoid sending http + * payload to wire if server respond error immediately after receiving the header. + * Set this option to true will tell Curl to send http request header and body together. + * This can save one round-trip time and especially useful when the payload is small and network latency is more important. + * But be careful when Http request has large payload such S3 PutObject. You don't want to spend long time sending a large payload just getting a error response for server. + * The default value will be false. + */ + bool disableExpectHeader = false; + + /** + * If set to true clock skew will be adjusted after each http attempt, default to true. + */ + bool enableClockSkewAdjustment = true; + + /** + * Enable host prefix injection. + * For services whose endpoint is injectable. e.g. servicediscovery, you can modify the http host's prefix so as to add "data-" prefix for DiscoverInstances request. + * Default to true, enabled. You can disable it for testing purpose. + * + * Deprecated in API v. 1.10. Please set in service-specific client configuration. + */ + bool enableHostPrefixInjection = true; + + /** + * Enable endpoint discovery + * For some services to dynamically set up their endpoints for different requests. + * By default, service clients will decide if endpoint discovery is enabled or not. + * If disabled, regional or overridden endpoint will be used instead. + * If a request requires endpoint discovery but you disabled it. The request will never succeed. + * A boolean value is either true of false, use Optional here to have an instance does not contain a value, + * such that SDK will decide the default behavior as stated before, if no value specified. + * + * Deprecated in API v. 1.10. Please set in service-specific client configuration. + */ + Aws::Crt::Optional enableEndpointDiscovery; + + /** + * Enable http client (WinHTTP or CURL) traces. + * Defaults to false, it's an optional feature. + */ + bool enableHttpClientTrace = false; + + /** + * profileName in config file that will be used by this object to resolve more configurations. + */ + Aws::String profileName; + + /** + * Request compression configuration + * To use this feature, the service needs to provide the support, and the compression + * algorithms needs to be available at SDK build time. + */ + Aws::Client::RequestCompressionConfig requestCompressionConfig; + + /** + * Disable all internal IMDS Calls + */ + bool disableIMDS = false; + + /** + * Request HTTP client to use specific http version. Currently supported for + * only Curl. More or less is a one to one conversion of the CURLOPT_HTTP_VERSION + * configuration option. + * + * Default to Version 2 TLS which is the default after curl version 7.62.0. Will + * fall back to 1.1 if compiled against a earlier version of curl. + */ + Aws::Http::Version version = Http::Version::HTTP_VERSION_2TLS; + + /** + * Disable all internal IMDSV1 Calls + */ + bool disableImdsV1 = false; + + /** + * AppId is an optional application specific identifier that can be set. + * When set it will be appended to the User-Agent header of every request + * in the form of App/{AppId}. This variable is sourced from environment + * variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id. + * See https://docs.aws.amazon.com/sdkref/latest/guide/settings-reference.html for + * more information on environment variables and shared config settings. + */ + Aws::String appId; + + struct { + /** + * Setting on whether to calculate a checksum for a payload only when it is required. + * i.e. when setting WHEN_REQUIRED the SDK will NOT calculate a checksum for an endpoint + * where it is supported but is NOT required. + */ + RequestChecksumCalculation requestChecksumCalculation = RequestChecksumCalculation::WHEN_SUPPORTED; + + /** + * Setting on whether to client side response validate a content body that had a checksum + * associated with it. Response validation right now cannot be modeled as required but rely + * on an associated model configuration. + */ + ResponseChecksumValidation responseChecksumValidation = ResponseChecksumValidation::WHEN_SUPPORTED; + } checksumConfig; + + /** + * A helper function to read config value from env variable or aws profile config + */ + static Aws::String LoadConfigFromEnvOrProfile(const Aws::String& envKey, const Aws::String& profile, + const Aws::String& profileProperty, const Aws::Vector& allowedValues, + const Aws::String& defaultValue); + + /** + * A wrapper for interfacing with telemetry functionality. Defaults to Noop provider. + * Provide TelemetryProvider here or via a factory method. + */ + std::shared_ptr telemetryProvider; + }; + + /** + * A helper function to initialize a retry strategy. + * Default is DefaultRetryStrategy (i.e. exponential backoff) + */ + std::shared_ptr InitRetryStrategy(Aws::String retryMode = ""); + + /** + * A helper function to compute a user agent + * @return Aws::String with a user-agent + */ + AWS_CORE_API Aws::String ComputeUserAgentString(ClientConfiguration const * const pConfig = nullptr); + + AWS_CORE_API Aws::String FilterUserAgentToken(char const * const token); + + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/CoreErrors.h b/include/aws/core/client/CoreErrors.h new file mode 100644 index 0000000000000000000000000000000000000000..6507bbc5d56e386c5d91642b082303c0cdd99279 --- /dev/null +++ b/include/aws/core/client/CoreErrors.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include + +namespace Aws +{ + namespace Http + { + enum class HttpResponseCode; + } + namespace Client + { + template + class AWSError; + + enum class CoreErrors + { + INCOMPLETE_SIGNATURE = 0, + INTERNAL_FAILURE = 1, + INVALID_ACTION = 2, + INVALID_CLIENT_TOKEN_ID = 3, + INVALID_PARAMETER_COMBINATION = 4, + INVALID_QUERY_PARAMETER = 5, + INVALID_PARAMETER_VALUE = 6, + MISSING_ACTION = 7, // SDK should never allow + MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow + MISSING_PARAMETER = 9, // SDK should never allow + OPT_IN_REQUIRED = 10, + REQUEST_EXPIRED = 11, + SERVICE_UNAVAILABLE = 12, + THROTTLING = 13, + VALIDATION = 14, + ACCESS_DENIED = 15, + RESOURCE_NOT_FOUND = 16, // Shared with multiple services + UNRECOGNIZED_CLIENT = 17, // Most likely caused by an invalid access key or secret key + MALFORMED_QUERY_STRING = 18, // Where does this come from? (cognito identity uses it) + SLOW_DOWN = 19, + REQUEST_TIME_TOO_SKEWED = 20, + INVALID_SIGNATURE = 21, + SIGNATURE_DOES_NOT_MATCH = 22, + INVALID_ACCESS_KEY_ID = 23, + REQUEST_TIMEOUT = 24, + NOT_INITIALIZED = 25, + MEMORY_ALLOCATION = 26, + + NETWORK_CONNECTION = 99, // General failure to send message to service + + // These are needed for logical reasons + UNKNOWN = 100, // Unknown to the SDK + CLIENT_SIGNING_FAILURE = 101, // Client failed to sign the request + USER_CANCELLED = 102, // User cancelled the request + ENDPOINT_RESOLUTION_FAILURE = 103, + SERVICE_EXTENSION_START_RANGE = 128, + OK = -1 // No error set + }; + + /** + * Overload ostream operator<< for CoreErrors enum class for a prettier output such as "128" + */ + AWS_CORE_API Aws::OStream& operator<< (Aws::OStream& oStream, CoreErrors code); + + namespace CoreErrorsMapper + { + /** + * Finds a CoreErrors member if possible. Otherwise, returns UNKNOWN + */ + AWS_CORE_API AWSError GetErrorForName(const char* errorName); + + /** + * Build the mapping between predefined exception names and Aws CoreErrors using Aws::Map. + */ + AWS_CORE_API void InitCoreErrorsMapper(); + + /** + * Cleanup memory allocated for Aws::Map used by AWS CoreError Mapper. + */ + AWS_CORE_API void CleanupCoreErrorsMapper(); + /** + * Finds a CoreErrors member if possible by HTTP response code + */ + AWS_CORE_API AWSError GetErrorForHttpResponseCode(Aws::Http::HttpResponseCode code); + } // namespace CoreErrorsMapper + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/DefaultRetryStrategy.h b/include/aws/core/client/DefaultRetryStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..e15094353c0b0fcbc20cf7533efecd16b00027c6 --- /dev/null +++ b/include/aws/core/client/DefaultRetryStrategy.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ +namespace Client +{ + +class AWS_CORE_API DefaultRetryStrategy : public RetryStrategy +{ +public: + + DefaultRetryStrategy(long maxRetries = 10, long scaleFactor = 25) : + m_scaleFactor(scaleFactor), m_maxRetries(maxRetries) + {} + + bool ShouldRetry(const AWSError& error, long attemptedRetries) const override; + + long CalculateDelayBeforeNextRetry(const AWSError& error, long attemptedRetries) const override; + + virtual long GetMaxAttempts() const override { return m_maxRetries + 1; } + + const char* GetStrategyName() const override { return "default";} + +protected: + long m_scaleFactor; + long m_maxRetries; +}; + +} // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/GenericClientConfiguration.h b/include/aws/core/client/GenericClientConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..1a69fcdbc694985a195e832f5afee891ca9c0cd3 --- /dev/null +++ b/include/aws/core/client/GenericClientConfiguration.h @@ -0,0 +1,87 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Client + { + /** + * This mutable structure is used to configure a regular AWS client. + */ + struct AWS_CORE_API GenericClientConfiguration : public ClientConfiguration + { + GenericClientConfiguration(const ClientConfigurationInitValues &configuration = {}) + : ClientConfiguration(configuration) + {} + + /** + * Create a configuration based on settings in the aws configuration file for the given profile name. + * The configuration file location can be set via the environment variable AWS_CONFIG_FILE + * @param profileName the aws profile name. + * @param shouldDisableIMDS whether or not to disable IMDS calls. + */ + GenericClientConfiguration(const char* inputProfileName, bool shouldDisableIMDS = false) + : ClientConfiguration(inputProfileName, shouldDisableIMDS) + {} + + /** + * Create a configuration with a predefined smart defaults + * @param useSmartDefaults, required to differentiate c-tors + * @param defaultMode, default mode to use + * @param shouldDisableIMDS whether or not to disable IMDS calls. + */ + explicit GenericClientConfiguration(bool useSmartDefaults, const char* defaultMode = "legacy", bool shouldDisableIMDS = false) + : ClientConfiguration(useSmartDefaults, defaultMode, shouldDisableIMDS) + {} + + GenericClientConfiguration(const ClientConfiguration& config) + : ClientConfiguration(config) + {} + }; + +#if 0 + /** + * This mutable structure is used to configure a regular AWS client that supports endpoint discovery. + */ + template + struct AWS_CORE_API GenericClientConfiguration : public ClientConfiguration + { + static const bool EndpointDiscoverySupported = true; + static const bool EndpointDiscoveryDefaultValue = EndpointDiscoveryDefaultValT; + + GenericClientConfiguration(const ClientConfigurationInitValues &configuration = {}); + GenericClientConfiguration(const char* profileName, bool shouldDisableIMDS = false); + explicit GenericClientConfiguration(bool useSmartDefaults, const char* defaultMode = "legacy", bool shouldDisableIMDS = false); + GenericClientConfiguration(const ClientConfiguration& config); + GenericClientConfiguration(const GenericClientConfiguration&); + GenericClientConfiguration& operator=(const GenericClientConfiguration&); + + + /** + * Enable host prefix injection. + * For services whose endpoint is injectable. e.g. servicediscovery, you can modify the http host's prefix so as to add "data-" prefix for DiscoverInstances request. + * Default to true, enabled. You can disable it for testing purpose. + */ + bool& enableHostPrefixInjection; + + /** + * Enable endpoint discovery + * For some services to dynamically set up their endpoints for different requests. + * By default, service clients will decide if endpoint discovery is enabled or not. + * If disabled, regional or overridden endpoint will be used instead. + * If a request requires endpoint discovery but you disabled it. The request will never succeed. + * A boolean value is either true of false, use Optional here to have an instance does not contain a value, + * such that SDK will decide the default behavior as stated before, if no value specified. + */ + Aws::Crt::Optional& enableEndpointDiscovery; + }; +#endif + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/RequestCompression.h b/include/aws/core/client/RequestCompression.h new file mode 100644 index 0000000000000000000000000000000000000000..31c0bc98cc67fc7e344b4e716c0b8e50641838a6 --- /dev/null +++ b/include/aws/core/client/RequestCompression.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +using iostream_outcome = + Aws::Utils::Outcome, bool>; + +namespace Aws { +namespace Client { +enum class CompressionAlgorithm { NONE, GZIP }; + +/** + * Converts a compression Algorithms enum to String to be used as content-type + * header value when compressing a request. + * @param algorithm + * @return string with HTTP content type algorithm id + */ +Aws::String AWS_CORE_API +GetCompressionAlgorithmId(const CompressionAlgorithm &algorithm); + +/** + * Request compression API + */ +class AWS_CORE_API RequestCompression final { +public: + /** + * Select the best matching algorithm based in proposed ones, config, length + * of content and the available algorithms. + * @param proposedAlgorithms + * @param config + * @param payloadLength + * @return selected compression algorithm + */ + CompressionAlgorithm + selectAlgorithm(const Aws::Vector &proposedAlgorithms, + const Aws::Client::RequestCompressionConfig &config, + const size_t payloadLength); + /** + * Compress a IOStream input using the requested algorithm. + * @param input + * @param algorithm + * @return IOStream compressed + */ + iostream_outcome compress(std::shared_ptr input, + const CompressionAlgorithm &algorithm) const; + /** + * Uncompress a IOStream input using the requested algorithm. + * @param input + * @param algorithm + * @return + */ + iostream_outcome uncompress(std::shared_ptr input, + const CompressionAlgorithm &algorithm) const; +}; +} // namespace Client +} // namespace Aws \ No newline at end of file diff --git a/include/aws/core/client/RetryStrategy.h b/include/aws/core/client/RetryStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..8f9260c69091f87e916f0eac5fdc4e88105cb901 --- /dev/null +++ b/include/aws/core/client/RetryStrategy.h @@ -0,0 +1,143 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Http + { + class HttpResponse; + } + + namespace Utils + { + template + class Outcome; + } + + namespace Client + { + static const int NO_RETRY_INCREMENT = 1; + + enum class CoreErrors; + template + class AWSError; + + typedef Utils::Outcome, AWSError> HttpResponseOutcome; + + /** + * Interface for defining a Retry Strategy. Override this class to provide your own custom retry behavior. + */ + class AWS_CORE_API RetryStrategy + { + public: + virtual ~RetryStrategy() = default; + /** + * Returns true if the error can be retried given the error and the number of times already tried. + */ + virtual bool ShouldRetry(const AWSError& error, long attemptedRetries) const = 0; + + /** + * Calculates the time in milliseconds the client should sleep before attempting another request based on the error and attemptedRetries count. + */ + virtual long CalculateDelayBeforeNextRetry(const AWSError& error, long attemptedRetries) const = 0; + + /** + * Gets max number of attempts allowed for an operation. + * Returns non positive value if not defined. + */ + virtual long GetMaxAttempts() const { return 0; } + + /** + * Retrieves send tokens from the bucket. Throws an exception if not available. + */ + virtual void GetSendToken() {} + + /** + * Retrieves send tokens from the bucket. Returns true is send token is retrieved. + */ + virtual bool HasSendToken() + { + GetSendToken(); // first call old method for backward compatibility + return true; + } + + /** + * Update status, like the information of retry quota when receiving a response. + */ + virtual void RequestBookkeeping(const HttpResponseOutcome& /* httpResponseOutcome */) {} + virtual void RequestBookkeeping(const HttpResponseOutcome& /* httpResponseOutcome */, const AWSError& /* lastError */) {} + + /** + * Get return strategy name. + */ + virtual const char* GetStrategyName() const + { + // SDK provided strategies will provide actual name + return "custom"; + } + }; + + /** + * The container for retry quotas. + * A failed request will acquire retry quotas to retry. + * And a successful request will release quotas back. + * If running out of retry quotas, then the client is not able to retry. + */ + class AWS_CORE_API RetryQuotaContainer + { + public: + virtual ~RetryQuotaContainer() = default; + virtual bool AcquireRetryQuota(int capacityAmount) = 0; + virtual bool AcquireRetryQuota(const AWSError& error) = 0; + virtual void ReleaseRetryQuota(int capacityAmount) = 0; + virtual void ReleaseRetryQuota(const AWSError& lastError) = 0; + virtual int GetRetryQuota() const = 0; + }; + + class AWS_CORE_API DefaultRetryQuotaContainer : public RetryQuotaContainer + { + public: + DefaultRetryQuotaContainer(); + virtual ~DefaultRetryQuotaContainer() = default; + virtual bool AcquireRetryQuota(int capacityAmount) override; + virtual bool AcquireRetryQuota(const AWSError& error) override; + virtual void ReleaseRetryQuota(int capacityAmount) override; + virtual void ReleaseRetryQuota(const AWSError& lastError) override; + virtual int GetRetryQuota() const override { return m_retryQuota; } + + protected: + mutable Aws::Utils::Threading::ReaderWriterLock m_retryQuotaLock; + int m_retryQuota; + }; + + class AWS_CORE_API StandardRetryStrategy : public RetryStrategy + { + public: + StandardRetryStrategy(long maxAttempts = 3); + StandardRetryStrategy(std::shared_ptr retryQuotaContainer, long maxAttempts = 3); + + virtual void RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome) override; + virtual void RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome, const AWSError& lastError) override; + + virtual bool ShouldRetry(const AWSError& error, long attemptedRetries) const override; + + virtual long CalculateDelayBeforeNextRetry(const AWSError& error, long attemptedRetries) const override; + + virtual long GetMaxAttempts() const override { return m_maxAttempts; } + + const char* GetStrategyName() const override { return "standard";} + + protected: + std::shared_ptr m_retryQuotaContainer; + long m_maxAttempts; + }; + } // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h b/include/aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..09cfc95d8f517c41166c48f239f3e1038abbce3a --- /dev/null +++ b/include/aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h @@ -0,0 +1,34 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +namespace Aws +{ +namespace Client +{ + +/** + * @brief This retry strategy is almost identical to DefaultRetryStrategy, except it accepts a vector of error or exception names + * that you want to retry anyway (bypass the retryable definition of the error instance itself) if the retry attempts is less than maxRetries. + */ +class AWS_CORE_API SpecifiedRetryableErrorsRetryStrategy : public DefaultRetryStrategy +{ +public: + SpecifiedRetryableErrorsRetryStrategy(const Aws::Vector& specifiedRetryableErrors, long maxRetries = 10, long scaleFactor = 25) : + DefaultRetryStrategy(maxRetries, scaleFactor), m_specifiedRetryableErrors(specifiedRetryableErrors) + {} + + bool ShouldRetry(const AWSError& error, long attemptedRetries) const override; + +private: + Aws::Vector m_specifiedRetryableErrors; +}; + +} // namespace Client +} // namespace Aws diff --git a/include/aws/core/client/UserAgent.h b/include/aws/core/client/UserAgent.h new file mode 100644 index 0000000000000000000000000000000000000000..70e83c178cbcf8743f794d48c5bf0d12f84ff767 --- /dev/null +++ b/include/aws/core/client/UserAgent.h @@ -0,0 +1,54 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include + +namespace Aws { +namespace Client { + +enum class UserAgentFeature { + RETRY_MODE_LEGACY, + RETRY_MODE_STANDARD, + RETRY_MODE_ADAPTIVE, + S3_TRANSFER, + S3_CRYPTO_V1N, + S3_CRYPTO_V2, + FLEXIBLE_CHECKSUMS_REQ_CRC32, + FLEXIBLE_CHECKSUMS_REQ_CRC32C, + FLEXIBLE_CHECKSUMS_REQ_CRC64, + FLEXIBLE_CHECKSUMS_REQ_SHA1, + FLEXIBLE_CHECKSUMS_REQ_SHA256, + FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED, + FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED, + FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED, + FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED, +}; + +class AWS_CORE_API UserAgent { + public: + explicit UserAgent(const ClientConfiguration& clientConfiguration, const Aws::String& retryStrategyName, const Aws::String& apiName); + Aws::String SerializeWithFeatures(const Aws::Set& features) const; + void SetApiName(const Aws::String& apiName) { m_api = apiName; } + void AddLegacyFeature(const Aws::String& legacyFeature); + + private: + const Aws::String m_sdkVersion; + const Aws::String m_userAgentVersion; + Aws::String m_api; + const Aws::String m_crtVersion; + const Aws::String m_osVersion; + const Aws::String m_archName; + const Aws::String m_cppVersion; + const Aws::String m_compilerMetadata; + const Aws::String m_retryStrategyName; + const Aws::String m_execEnv; + const Aws::String m_appId; + const Aws::String m_customizations; + Aws::Set m_features; +}; +} // namespace Client +} // namespace Aws diff --git a/include/aws/core/config/AWSConfigFileProfileConfigLoader.h b/include/aws/core/config/AWSConfigFileProfileConfigLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..cc778241b69bb9451c2d834b76db859489688371 --- /dev/null +++ b/include/aws/core/config/AWSConfigFileProfileConfigLoader.h @@ -0,0 +1,51 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +namespace Aws +{ + namespace Config + { + /** + * Reads configuration from a config file (e.g. $HOME/.aws/config or $HOME/.aws/credentials + */ + class AWS_CORE_API AWSConfigFileProfileConfigLoader : public AWSProfileConfigLoader + { + public: + /** + * fileName - file to load config from + * useProfilePrefix - whether or not the profiles are prefixed with "profile", credentials file is not + * while the config file is. Defaults to off. + */ + AWSConfigFileProfileConfigLoader(const Aws::String& fileName, bool useProfilePrefix = false); + + virtual ~AWSConfigFileProfileConfigLoader() = default; + + /** + * File path being used for the config loader. + */ + const Aws::String& GetFileName() const { return m_fileName; } + + /** + * Give loader the ability to change the file path to load config from. + * This can avoid creating new loader object if the file changed. + */ + void SetFileName(const Aws::String& fileName) { m_fileName = fileName; } + + protected: + virtual bool LoadInternal() override; + virtual bool PersistInternal(const Aws::Map&) override; + + private: + Aws::String m_fileName; + bool m_useProfilePrefix; + }; + } +} diff --git a/include/aws/core/config/AWSProfileConfig.h b/include/aws/core/config/AWSProfileConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..4f08231d9ccd074c44db45c7e3d1c3a4002df84b --- /dev/null +++ b/include/aws/core/config/AWSProfileConfig.h @@ -0,0 +1,120 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Config + { + /** + * Simple data container for a Profile. + */ + class Profile + { + public: + /* + * Data container for a sso-session config entry. + * This is independent of the general profile configuration and used by a bearer auth token provider. + */ + class SsoSession + { + public: + inline const Aws::String& GetName() const { return m_name; } + inline void SetName(const Aws::String& value) { m_name = value; } + inline const Aws::String& GetSsoRegion() const { return m_ssoRegion; } + inline void SetSsoRegion(const Aws::String& value) { m_ssoRegion = value; } + inline const Aws::String& GetSsoStartUrl() const { return m_ssoStartUrl; } + inline void SetSsoStartUrl(const Aws::String& value) { m_ssoStartUrl = value; } + + inline void SetAllKeyValPairs(const Aws::Map& map) { m_allKeyValPairs = map; } + inline const Aws::String GetValue(const Aws::String& key) const + { + auto iter = m_allKeyValPairs.find(key); + if (iter == m_allKeyValPairs.end()) return {}; + return iter->second; + } + + bool operator==(SsoSession const& other) const + { + return this->m_name == other.m_name && + this->m_ssoRegion == other.m_ssoRegion && + this->m_ssoStartUrl == other.m_ssoStartUrl && + this->m_allKeyValPairs == other.m_allKeyValPairs; + } + bool operator!=(SsoSession const& other) const + { + return !operator==(other); + } + private: + // This is independent of the general configuration + Aws::String m_name; + Aws::String m_ssoRegion; + Aws::String m_ssoStartUrl; + Aws::Map m_allKeyValPairs; + }; + + inline const Aws::String& GetName() const { return m_name; } + inline void SetName(const Aws::String& value) { m_name = value; } + inline const Aws::Auth::AWSCredentials& GetCredentials() const { return m_credentials; } + inline void SetCredentials(const Aws::Auth::AWSCredentials& value) { m_credentials = value; } + inline const Aws::String& GetRegion() const { return m_region; } + inline void SetRegion(const Aws::String& value) { m_region = value; } + inline const Aws::String& GetRoleArn() const { return m_roleArn; } + inline void SetRoleArn(const Aws::String& value) { m_roleArn = value; } + inline const Aws::String& GetExternalId() const { return m_externalId; } + inline void SetExternalId(const Aws::String& value) { m_externalId = value; } + inline const Aws::String& GetSsoStartUrl() const { return m_ssoStartUrl; } + inline void SetSsoStartUrl(const Aws::String& value) { m_ssoStartUrl = value; } + inline const Aws::String& GetSsoRegion() const { return m_ssoRegion; } + inline void SetSsoRegion(const Aws::String& value) { m_ssoRegion = value; } + inline const Aws::String& GetSsoAccountId() const { return m_ssoAccountId; } + inline void SetSsoAccountId(const Aws::String& value) { m_ssoAccountId = value; } + inline const Aws::String& GetSsoRoleName() const { return m_ssoRoleName; } + inline void SetSsoRoleName(const Aws::String& value) { m_ssoRoleName = value; } + inline const Aws::String& GetDefaultsMode() const { return m_defaultsMode; } + inline void SetDefaultsMode(const Aws::String& value) { m_defaultsMode = value; } + inline const Aws::String& GetSourceProfile() const { return m_sourceProfile; } + inline void SetSourceProfile(const Aws::String& value ) { m_sourceProfile = value; } + inline const Aws::String& GetCredentialProcess() const { return m_credentialProcess; } + inline void SetCredentialProcess(const Aws::String& value ) { m_credentialProcess = value; } + inline void SetAllKeyValPairs(const Aws::Map& map) { m_allKeyValPairs = map; } + inline void SetAllKeyValPairs(Aws::Map&& map) { m_allKeyValPairs = std::move(map); } + inline const Aws::String GetValue(const Aws::String& key) const + { + auto iter = m_allKeyValPairs.find(key); + if (iter == m_allKeyValPairs.end()) return {}; + return iter->second; + } + + inline bool IsSsoSessionSet() const { return m_ssoSessionSet; } + inline const SsoSession& GetSsoSession() const { return m_ssoSession; } + inline void SetSsoSession(const SsoSession& value) { m_ssoSessionSet = true; m_ssoSession = value; } + inline void SetSsoSession(SsoSession&& value) { m_ssoSessionSet = true; m_ssoSession = std::move(value); } + + private: + Aws::String m_name; + Aws::String m_region; + Aws::Auth::AWSCredentials m_credentials; + Aws::String m_roleArn; + Aws::String m_externalId; + Aws::String m_sourceProfile; + Aws::String m_credentialProcess; + Aws::String m_ssoStartUrl; + Aws::String m_ssoRegion; + Aws::String m_ssoAccountId; + Aws::String m_ssoRoleName; + Aws::String m_defaultsMode; + Aws::Map m_allKeyValPairs; + + bool m_ssoSessionSet = false; + SsoSession m_ssoSession; + }; + } +} diff --git a/include/aws/core/config/AWSProfileConfigLoader.h b/include/aws/core/config/AWSProfileConfigLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..b9b4bd9e3013890ed96ea19ad6d1a3cbc1ff29e3 --- /dev/null +++ b/include/aws/core/config/AWSProfileConfigLoader.h @@ -0,0 +1,14 @@ +/**AWSProfileConfigLoaderBaseAWSProfileConfigLoader + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include + +// This is a header that represents old legacy all-in-one header to maintain backward compatibility diff --git a/include/aws/core/config/AWSProfileConfigLoaderBase.h b/include/aws/core/config/AWSProfileConfigLoaderBase.h new file mode 100644 index 0000000000000000000000000000000000000000..8403f8fed086bae406169c6fa49ef7ce943e615c --- /dev/null +++ b/include/aws/core/config/AWSProfileConfigLoaderBase.h @@ -0,0 +1,71 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Config { + /** + * Loads Configuration such as .aws/config, .aws/credentials or ec2 metadata service. + */ + class AWS_CORE_API AWSProfileConfigLoader + { + public: + virtual ~AWSProfileConfigLoader() = default; + + /** + * Load the configuration + */ + bool Load(); + + /** + * Over writes the entire config source with the newly configured profile data. + */ + bool PersistProfiles(const Aws::Map &profiles); + + /** + * Gets all profiles from the configuration file. + */ + inline const Aws::Map &GetProfiles() const { return m_profiles; }; + + /** + * the timestamp from the last time the profile information was loaded from file. + */ + inline const Aws::Utils::DateTime &LastLoadTime() const { return m_lastLoadTime; } + + using ProfilesContainer = Aws::Map; + + // Delete copy c-tor and assignment operator + AWSProfileConfigLoader() = default; + + AWSProfileConfigLoader(const AWSProfileConfigLoader &) = delete; + + const AWSProfileConfigLoader &operator=(AWSProfileConfigLoader &) = delete; + + protected: + /** + * Subclasses override this method to implement fetching the profiles. + */ + virtual bool LoadInternal() = 0; + + /** + * Subclasses override this method to implement persisting the profiles. Default returns false. + */ + virtual bool PersistInternal(const Aws::Map &) { return false; } + + ProfilesContainer m_profiles; + Aws::Utils::DateTime m_lastLoadTime; + }; + } +} diff --git a/include/aws/core/config/ConfigAndCredentialsCacheManager.h b/include/aws/core/config/ConfigAndCredentialsCacheManager.h new file mode 100644 index 0000000000000000000000000000000000000000..12470b4087c2730114696d428d315e6e86ef6b7f --- /dev/null +++ b/include/aws/core/config/ConfigAndCredentialsCacheManager.h @@ -0,0 +1,104 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +namespace Aws +{ + namespace Config + { + /** + * Stores the contents of config file and credentials file to avoid multiple file readings. + * At the same time provides the flexibility to reload from file. + */ + class AWS_CORE_API ConfigAndCredentialsCacheManager + { + public: + ConfigAndCredentialsCacheManager(); + + void ReloadConfigFile(); + + void ReloadCredentialsFile(); + + bool HasConfigProfile(const Aws::String& profileName) const; + + /** + * Returns cached config profile with the specified profile name. + * Using copy instead of const reference to avoid reading bad contents due to thread contention. + */ + Aws::Config::Profile GetConfigProfile(const Aws::String& profileName) const; + + /** + * Returns cached config profiles + * Using copy instead of const reference to avoid reading bad contents due to thread contention. + */ + Aws::Map GetConfigProfiles() const; + + /** + * Returns cached config value with the specified profile name and key. + * Using copy instead of const reference to avoid reading bad contents due to thread contention. + */ + Aws::String GetConfig(const Aws::String& profileName, const Aws::String& key) const; + + bool HasCredentialsProfile(const Aws::String& profileName) const; + /** + * Returns cached credentials profile with the specified profile name. + * Using copy instead of const reference to avoid reading bad contents due to thread contention. + */ + Aws::Config::Profile GetCredentialsProfile(const Aws::String& profileName) const; + + /** + * Returns cached credentials profiles. + * Using copy instead of const reference to avoid reading bad contents due to thread contention. + */ + Aws::Map GetCredentialsProfiles() const; + + /** + * Returns cached credentials with the specified profile name. + * Using copy instead of const reference to avoid reading bad contents due to thread contention. + */ + Aws::Auth::AWSCredentials GetCredentials(const Aws::String& profileName) const; + + private: + mutable Aws::Utils::Threading::ReaderWriterLock m_credentialsLock; + Aws::Config::AWSConfigFileProfileConfigLoader m_credentialsFileLoader; + mutable Aws::Utils::Threading::ReaderWriterLock m_configLock; + Aws::Config::AWSConfigFileProfileConfigLoader m_configFileLoader; + }; + + AWS_CORE_API void InitConfigAndCredentialsCacheManager(); + + AWS_CORE_API void CleanupConfigAndCredentialsCacheManager(); + + AWS_CORE_API void ReloadCachedConfigFile(); + + AWS_CORE_API void ReloadCachedCredentialsFile(); + + AWS_CORE_API bool HasCachedConfigProfile(const Aws::String& profileName); + + AWS_CORE_API Aws::Config::Profile GetCachedConfigProfile(const Aws::String& profileName); + + AWS_CORE_API Aws::Map GetCachedConfigProfiles(); + + AWS_CORE_API Aws::String GetCachedConfigValue(const Aws::String& profileName, const Aws::String& key); + + AWS_CORE_API Aws::String GetCachedConfigValue(const Aws::String& key); + + AWS_CORE_API bool HasCachedCredentialsProfile(const Aws::String &profileName); + + AWS_CORE_API Aws::Config::Profile GetCachedCredentialsProfile(const Aws::String& profileName); + + AWS_CORE_API Aws::Auth::AWSCredentials GetCachedCredentials(const Aws::String& profileName); + + AWS_CORE_API Aws::Map GetCachedCredentialsProfiles(); + } +} diff --git a/include/aws/core/config/EC2InstanceProfileConfigLoader.h b/include/aws/core/config/EC2InstanceProfileConfigLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..ae3a743fc3fc0fc541a330201a07b84ed50835f5 --- /dev/null +++ b/include/aws/core/config/EC2InstanceProfileConfigLoader.h @@ -0,0 +1,47 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +namespace Aws +{ + namespace Internal + { + class EC2MetadataClient; + } + + namespace Config + { + static const char* const INSTANCE_PROFILE_KEY = "InstanceProfile"; + + /** + * Loads configuration from the EC2 Metadata Service + */ + class AWS_CORE_API EC2InstanceProfileConfigLoader : public AWSProfileConfigLoader + { + public: + /** + * If client is nullptr, the default EC2MetadataClient will be created. + */ + EC2InstanceProfileConfigLoader(const std::shared_ptr& = nullptr); + + virtual ~EC2InstanceProfileConfigLoader() = default; + + protected: + virtual bool LoadInternal() override; + private: + std::shared_ptr m_ec2metadataClient; + int64_t credentialsValidUntilMillis = 0; + int64_t calculateRetryTime() const; + }; + } +} diff --git a/include/aws/core/config/defaults/ClientConfigurationDefaults.h b/include/aws/core/config/defaults/ClientConfigurationDefaults.h new file mode 100644 index 0000000000000000000000000000000000000000..cbea1ce997f249a19fb7f181abd593aece1ebe65 --- /dev/null +++ b/include/aws/core/config/defaults/ClientConfigurationDefaults.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/** + * Please note that this file is autogenerated. + * The backwards compatibility of the default values provided by new client configuration defaults is not guaranteed; + * the values might change over time. + */ + +#pragma once + +#include + +namespace Aws +{ + namespace Config + { + namespace Defaults + { + /** + * Set default client configuration parameters per provided default mode + * + * @param clientConfig, a ClientConfiguration to update + * @param defaultMode, requested default mode name + * @param hasEc2MetadataRegion, if ec2 metadata region has been already queried + * @param ec2MetadataRegion, a region resolved by EC2 Instance Metadata service + */ + AWS_CORE_API void SetSmartDefaultsConfigurationParameters(Aws::Client::ClientConfiguration& clientConfig, + const Aws::String& defaultMode, + bool hasEc2MetadataRegion, + const Aws::String& ec2MetadataRegion); + + /** + * Resolve the name of an actual mode for a default mode "auto" + * + * The AUTO mode is an experimental mode that builds on the standard mode. The SDK + * will attempt to discover the execution environment to determine the appropriate + * settings automatically. + * + * Note that the auto detection is heuristics-based and does not guarantee 100% + * accuracy. STANDARD mode will be used if the execution environment cannot be + * determined. The auto detection might query EC2 Instance Metadata service, which + * might introduce latency. Therefore we recommend choosing an explicit + * defaults_mode instead if startup latency is critical to your application. + */ + AWS_CORE_API const char* ResolveAutoClientConfiguration(const Aws::Client::ClientConfiguration& clientConfig, + const Aws::String& ec2MetadataRegion); + + /** + * Default mode "legacy" + * + * The LEGACY mode provides default settings that vary per SDK and were used prior + * to establishment of defaults_mode. + */ + AWS_CORE_API void SetLegacyClientConfiguration(Aws::Client::ClientConfiguration& clientConfig); + + /** + * Default mode "standard" + * + * The STANDARD mode provides the latest recommended default values that should be + * safe to run in most scenarios. + * + * Note that the default values vended from this mode might change as best + * practices may evolve. As a result, it is encouraged to perform tests when + * upgrading the SDK. + */ + AWS_CORE_API void SetStandardClientConfiguration(Aws::Client::ClientConfiguration& clientConfig); + + /** + * Default mode "in-region" + * + * The IN_REGION mode builds on the standard mode and includes optimization + * tailored for applications which call AWS services from within the same AWS + * region. + * + * Note that the default values vended from this mode might change as best + * practices may evolve. As a result, it is encouraged to perform tests when + * upgrading the SDK. + */ + AWS_CORE_API void SetInRegionClientConfiguration(Aws::Client::ClientConfiguration& clientConfig); + + /** + * Default mode "cross-region" + * + * The CROSS_REGION mode builds on the standard mode and includes optimization + * tailored for applications which call AWS services in a different region. + * + * Note that the default values vended from this mode might change as best + * practices may evolve. As a result, it is encouraged to perform tests when + * upgrading the SDK. + */ + AWS_CORE_API void SetCrossRegionClientConfiguration(Aws::Client::ClientConfiguration& clientConfig); + + /** + * Default mode "mobile" + * + * The MOBILE mode builds on the standard mode and includes optimization tailored + * for mobile applications. + * + * Note that the default values vended from this mode might change as best + * practices may evolve. As a result, it is encouraged to perform tests when + * upgrading the SDK. + */ + AWS_CORE_API void SetMobileClientConfiguration(Aws::Client::ClientConfiguration& clientConfig); + + /** + * Internal helper function to resolve smart defaults mode if not provided + * + * @param clientConfig, a ClientConfiguration to update + * @param requestedDefaultMode, requested default mode name + * @param configFileDefaultMode, default mode specified in a config file + * @param hasEc2MetadataRegion, if ec2 metadata region has been already queried + * @param ec2MetadataRegion, a region resolved by EC2 Instance Metadata service + */ + AWS_CORE_API Aws::String ResolveDefaultModeName(const Aws::Client::ClientConfiguration& clientConfig, + Aws::String requestedDefaultMode, + const Aws::String& configFileDefaultMode, + bool hasEc2MetadataRegion, + Aws::String ec2MetadataRegion); + } //namespace Defaults + } //namespace Config +} //namespace Aws diff --git a/include/aws/core/endpoint/AWSEndpoint.h b/include/aws/core/endpoint/AWSEndpoint.h new file mode 100644 index 0000000000000000000000000000000000000000..b5ddbadd07686c1b523c408840b5b9af84d26b95 --- /dev/null +++ b/include/aws/core/endpoint/AWSEndpoint.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +#include + +namespace Aws +{ + namespace Client + { + template + class AWSError; + + enum class CoreErrors; + } + namespace Endpoint + { + /** + * A public type that encapsulates the information about an endpoint + */ + class AWS_CORE_API AWSEndpoint + { + public: + using EndpointAttributes = Internal::Endpoint::EndpointAttributes; + + virtual ~AWSEndpoint() + {}; + + Aws::String GetURL() const; + void SetURL(Aws::String url); + + const Aws::Http::URI& GetURI() const; + void SetURI(Aws::Http::URI uri); + + template + inline void AddPathSegment(T&& pathSegment) + { + m_uri.AddPathSegment(std::forward(pathSegment)); + } + + template + inline void AddPathSegments(T&& pathSegments) + { + m_uri.AddPathSegments(std::forward(pathSegments)); + } + + inline void SetRfc3986Encoded(bool rfcEncoded) + { + m_uri.SetRfc3986Encoded(rfcEncoded); + } + + using OptionalError = Crt::Optional>; + OptionalError AddPrefixIfMissing(const Aws::String& prefix); + + void SetQueryString(const Aws::String& queryString); + + const Crt::Optional& GetAttributes() const; + Crt::Optional& AccessAttributes(); + void SetAttributes(EndpointAttributes&& attributes); + + const Aws::UnorderedMap& GetHeaders() const; + void SetHeaders(Aws::UnorderedMap headers); + + protected: + // A URI containing at minimum the scheme and host. May optionally include a port and a path. + Aws::Http::URI m_uri; + + // A grab bag property map of endpoint attributes. The values here are considered unstable. + Crt::Optional m_attributes; + + // A map of additional headers to be set when calling the endpoint. + // Note: the values in these maps are Lists to support multi-value headers. + Aws::UnorderedMap m_headers; + }; + } +} diff --git a/include/aws/core/endpoint/AWSPartitions.h b/include/aws/core/endpoint/AWSPartitions.h new file mode 100644 index 0000000000000000000000000000000000000000..fe08b9f4b68f4f7f8c45aeca8c92fecfa1e6699b --- /dev/null +++ b/include/aws/core/endpoint/AWSPartitions.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace Endpoint +{ + struct AWS_CORE_API AWSPartitions + { + public: + static const size_t PartitionsBlobStrLen; + static const size_t PartitionsBlobSize; + + static const char* GetPartitionsBlob(); + }; +} // namespace Endpoint +} // namespace Aws diff --git a/include/aws/core/endpoint/BuiltInParameters.h b/include/aws/core/endpoint/BuiltInParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..5937233f589d85f55bd7a7ab010d9c9158de4f6b --- /dev/null +++ b/include/aws/core/endpoint/BuiltInParameters.h @@ -0,0 +1,43 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Endpoint + { + class AWS_CORE_API BuiltInParameters + { + public: + using EndpointParameter = Aws::Endpoint::EndpointParameter; + + BuiltInParameters() = default; + BuiltInParameters(const BuiltInParameters&) = delete; // avoid accidental copy + virtual ~BuiltInParameters() = default; + + virtual void SetFromClientConfiguration(const Client::ClientConfiguration& config); + virtual void SetFromClientConfiguration(const Client::GenericClientConfiguration& config); + + virtual void OverrideEndpoint(const Aws::String& endpoint, const Aws::Http::Scheme& scheme = Aws::Http::Scheme::HTTPS); + + const EndpointParameter& GetParameter(const Aws::String& name) const; + void SetParameter(EndpointParameter param); + void SetStringParameter(Aws::String name, Aws::String value); + void SetBooleanParameter(Aws::String name, bool value); + void SetStringArrayParameter(Aws::String name, const Aws::Vector&& value); + const Aws::Vector& GetAllParameters() const; + + protected: + Aws::Vector m_params; + }; + } // namespace Endpoint +} // namespace Aws diff --git a/include/aws/core/endpoint/ClientContextParameters.h b/include/aws/core/endpoint/ClientContextParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..348bcd1c54c2a741ba18b09f03d004f6602d489f --- /dev/null +++ b/include/aws/core/endpoint/ClientContextParameters.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Endpoint + { + class AWS_CORE_API ClientContextParameters + { + public: + using EndpointParameter = Aws::Endpoint::EndpointParameter; + + ClientContextParameters() = default; + // avoid accidental copy from endpointProvider::AccessClientContextParameters() + ClientContextParameters(const ClientContextParameters&) = delete; + + virtual ~ClientContextParameters(){}; + + const EndpointParameter& GetParameter(const Aws::String& name) const; + void SetParameter(EndpointParameter param); + void SetStringParameter(Aws::String name, Aws::String value); + void SetBooleanParameter(Aws::String name, bool value); + void SetStringArrayParameter(Aws::String name, const Aws::Vector& value); + + const Aws::Vector& GetAllParameters() const; + protected: + Aws::Vector m_params; + }; + } // namespace Endpoint +} // namespace Aws diff --git a/include/aws/core/endpoint/DefaultEndpointProvider.h b/include/aws/core/endpoint/DefaultEndpointProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..bbe1fdee9f46e765f2a61210e52fca32ba539853 --- /dev/null +++ b/include/aws/core/endpoint/DefaultEndpointProvider.h @@ -0,0 +1,120 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include "aws/core/utils/logging/LogMacros.h" + +namespace Aws +{ + namespace Endpoint + { + static const char DEFAULT_ENDPOINT_PROVIDER_TAG[] = "Aws::Endpoint::DefaultEndpointProvider"; + + /** + * Default template implementation for endpoint resolution + * @param ruleEngine + * @param builtInParameters + * @param clientContextParameters + * @param endpointParameters + * @return + */ + AWS_CORE_API ResolveEndpointOutcome + ResolveEndpointDefaultImpl(const Aws::Crt::Endpoints::RuleEngine& ruleEngine, + const EndpointParameters& builtInParameters, + const EndpointParameters& clientContextParameters, + const EndpointParameters& endpointParameters); + + /** + * Default endpoint provider template used in this SDK. + */ + template + class AWS_CORE_API DefaultEndpointProvider : public EndpointProviderBase + { + public: + DefaultEndpointProvider(const char* endpointRulesBlob, const size_t endpointRulesBlobSz) + : m_crtRuleEngine(Aws::Crt::ByteCursorFromArray((const uint8_t*) endpointRulesBlob, endpointRulesBlobSz), + Aws::Crt::ByteCursorFromArray((const uint8_t*) AWSPartitions::GetPartitionsBlob(), AWSPartitions::PartitionsBlobSize)) + { + if(!m_crtRuleEngine) { + AWS_LOGSTREAM_FATAL(DEFAULT_ENDPOINT_PROVIDER_TAG, "Invalid CRT Rule Engine state"); + } + } + + virtual ~DefaultEndpointProvider() + { + } + + void InitBuiltInParameters(const ClientConfigurationT& config) override + { + m_builtInParameters.SetFromClientConfiguration(config); + } + + /** + * Default implementation of the ResolveEndpoint + */ + ResolveEndpointOutcome ResolveEndpoint(const EndpointParameters& endpointParameters) const override + { + auto ResolveEndpointDefaultImpl = Aws::Endpoint::ResolveEndpointDefaultImpl; + return ResolveEndpointDefaultImpl(m_crtRuleEngine, m_builtInParameters.GetAllParameters(), m_clientContextParameters.GetAllParameters(), endpointParameters); + }; + + const ClientContextParametersT& GetClientContextParameters() const override + { + return m_clientContextParameters; + } + ClientContextParametersT& AccessClientContextParameters() override + { + return m_clientContextParameters; + } + + const BuiltInParametersT& GetBuiltInParameters() const + { + return m_builtInParameters; + } + BuiltInParametersT& AccessBuiltInParameters() + { + return m_builtInParameters; + } + + void OverrideEndpoint(const Aws::String& endpoint) override + { + m_builtInParameters.OverrideEndpoint(endpoint); + } + + protected: + /* Crt RuleEngine evaluator built using the service's Rule engine */ + Aws::Crt::Endpoints::RuleEngine m_crtRuleEngine; + + /* Also known as a configurable parameters defined by the AWS Service in their c2j/smithy model definition */ + ClientContextParametersT m_clientContextParameters; + + /* Also known as parameters on the ClientConfiguration in this SDK */ + BuiltInParametersT m_builtInParameters; + }; + + /** + * Export endpoint provider symbols for Windows DLL, otherwise declare as extern + */ + AWS_CORE_EXTERN template class AWS_CORE_API DefaultEndpointProvider; + } // namespace Endpoint +} // namespace Aws diff --git a/include/aws/core/endpoint/EndpointParameter.h b/include/aws/core/endpoint/EndpointParameter.h new file mode 100644 index 0000000000000000000000000000000000000000..f27be38eac2b18cc54998c986004c8779f2f21c3 --- /dev/null +++ b/include/aws/core/endpoint/EndpointParameter.h @@ -0,0 +1,177 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Endpoint + { + class AWS_CORE_API EndpointParameter + { + public: + enum class ParameterType + { + BOOLEAN, + STRING, + STRING_ARRAY + }; + enum class ParameterOrigin + { + STATIC_CONTEXT, + OPERATION_CONTEXT, + CLIENT_CONTEXT, + BUILT_IN, + NOT_SET = -1 + }; + + EndpointParameter(Aws::String name, bool initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET) + : m_storedType(ParameterType::BOOLEAN), + m_parameterOrigin(parameterOrigin), + m_name(std::move(name)), + m_boolValue(initialValue) + {} + + EndpointParameter(Aws::String name, Aws::String initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET) + : m_storedType(ParameterType::STRING), + m_parameterOrigin(parameterOrigin), + m_name(std::move(name)), + m_stringValue(std::move(initialValue)) + {} + + EndpointParameter(Aws::String name, const char* initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET) + : m_storedType(ParameterType::STRING), + m_parameterOrigin(parameterOrigin), + m_name(std::move(name)), + m_stringValue(initialValue) + {} + + EndpointParameter(Aws::String name, const Aws::Vector& initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET) + : m_storedType(ParameterType::STRING_ARRAY), + m_parameterOrigin(parameterOrigin), + m_name(std::move(name)), + m_stringArrayValue(initialValue) + {} + + EndpointParameter(ParameterType storedType, ParameterOrigin parameterOrigin, Aws::String name) + : m_storedType(storedType), + m_parameterOrigin(parameterOrigin), + m_name(std::move(name)) + {} + + EndpointParameter(const EndpointParameter&) = default; + EndpointParameter(EndpointParameter&&) = default; + EndpointParameter& operator=(const EndpointParameter&) = default; + EndpointParameter& operator=(EndpointParameter&&) = default; + + inline ParameterType GetStoredType() const + { + return m_storedType; + } + + inline ParameterOrigin GetParameterOrigin() const + { + return m_parameterOrigin; + } + + inline const Aws::String& GetName() const + { + return m_name; + } + + enum class GetSetResult + { + SUCCESS, + ERROR_WRONG_TYPE + }; + + inline GetSetResult GetBool(bool& ioValue) const + { + if(m_storedType != ParameterType::BOOLEAN) + return GetSetResult::ERROR_WRONG_TYPE; + ioValue = m_boolValue; + return GetSetResult::SUCCESS; + } + + inline GetSetResult GetString(Aws::String& ioValue) const + { + // disabled RTTI... + if(m_storedType != ParameterType::STRING) + return GetSetResult::ERROR_WRONG_TYPE; + ioValue = m_stringValue; + return GetSetResult::SUCCESS; + } + + inline GetSetResult GetStringArray(Aws::Vector& ioValue) const + { + if(m_storedType != ParameterType::STRING_ARRAY) + return GetSetResult::ERROR_WRONG_TYPE; + ioValue = m_stringArrayValue; + return GetSetResult::SUCCESS; + } + + inline GetSetResult SetBool(bool iValue) + { + if(m_storedType != ParameterType::BOOLEAN) + return GetSetResult::ERROR_WRONG_TYPE; + m_boolValue = iValue; + return GetSetResult::SUCCESS; + } + + inline GetSetResult SetString(Aws::String iValue) + { + if(m_storedType != ParameterType::STRING) + return GetSetResult::ERROR_WRONG_TYPE; + m_stringValue = std::move(iValue); + return GetSetResult::SUCCESS; + } + + inline GetSetResult SetStringArray(const Aws::Vector& iValue) + { + if(m_storedType != ParameterType::STRING_ARRAY) + return GetSetResult::ERROR_WRONG_TYPE; + m_stringArrayValue = iValue; + return GetSetResult::SUCCESS; + } + + inline GetSetResult SetStringArray(Aws::Vector&& iValue) + { + if(m_storedType != ParameterType::STRING_ARRAY) + return GetSetResult::ERROR_WRONG_TYPE; + m_stringArrayValue = std::move(iValue); + return GetSetResult::SUCCESS; + } + + bool GetBoolValueNoCheck() const + { + return m_boolValue; + } + const Aws::String& GetStrValueNoCheck() const + { + return m_stringValue; + } + + const Aws::Vector& GetStrArrayValueNoCheck() const + { + return m_stringArrayValue; + } + + protected: + ParameterType m_storedType; + ParameterOrigin m_parameterOrigin; + Aws::String m_name; + + bool m_boolValue = false; + Aws::String m_stringValue; + Aws::Vector m_stringArrayValue; + }; + + using EndpointParameters = Aws::Vector; + } // namespace Endpoint +} // namespace Aws diff --git a/include/aws/core/endpoint/EndpointProviderBase.h b/include/aws/core/endpoint/EndpointProviderBase.h new file mode 100644 index 0000000000000000000000000000000000000000..4de9da1562489bb3bf13cefa7b92e2a55b02918a --- /dev/null +++ b/include/aws/core/endpoint/EndpointProviderBase.h @@ -0,0 +1,73 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + template< typename R, typename E> class Outcome; + } // namespace Utils + namespace Client + { + enum class CoreErrors; + } // namespace CoreErrors + + namespace Endpoint + { + using EndpointParameters = Aws::Vector; + using ResolveEndpointOutcome = Aws::Utils::Outcome >; + + /** + * EndpointProviderBase is an interface definition that resolves the provided + * EndpointParameters to either an Endpoint or an error. + * This Base class represents a min interface required to be implemented to override an endpoint provider. + */ + template + class AWS_CORE_API EndpointProviderBase + { + public: + using BuiltInParameters = BuiltInParametersT; + using ClientContextParameters = ClientContextParametersT; + + virtual ~EndpointProviderBase() = default; + + /** + * Initialize client context parameters from a ClientConfiguration + */ + virtual void InitBuiltInParameters(const ClientConfigurationT& config) = 0; + + /** + * Function to override endpoint, i.e. to set built-in parameter "AWS::Endpoint" + */ + virtual void OverrideEndpoint(const Aws::String& endpoint) = 0; + + /** + * Method for write access to Client Context Parameters (i.e. configurable service-specific parameters) + */ + virtual ClientContextParametersT& AccessClientContextParameters() = 0; + + /** + * Method for read-only access to Client Context Parameters (i.e. configurable service-specific parameters) + */ + virtual const ClientContextParametersT& GetClientContextParameters() const = 0; + + /** + * The core of the endpoint provider interface. + */ + virtual ResolveEndpointOutcome ResolveEndpoint(const EndpointParameters& endpointParameters) const = 0; + }; + } // namespace Endpoint +} // namespace Aws diff --git a/include/aws/core/endpoint/internal/AWSEndpointAttribute.h b/include/aws/core/endpoint/internal/AWSEndpointAttribute.h new file mode 100644 index 0000000000000000000000000000000000000000..648fb59a68e4dca36ee811faba26503676ae10f9 --- /dev/null +++ b/include/aws/core/endpoint/internal/AWSEndpointAttribute.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Internal + { + namespace Endpoint + { + class AWS_CORE_API EndpointAuthScheme + { + public: + virtual ~EndpointAuthScheme(){}; + + inline const Aws::String& GetName() const + { + return m_name; + } + inline void SetName(Aws::String name) + { + m_name = std::move(name); + } + + inline const Crt::Optional& GetSigningName() const + { + return m_signingName; + } + inline void SetSigningName(Aws::String signingName) + { + m_signingName = std::move(signingName); + } + + inline const Crt::Optional& GetSigningRegion() const + { + return m_signingRegion; + } + inline void SetSigningRegion(Aws::String signingRegion) + { + m_signingRegion = std::move(signingRegion); + } + + inline const Crt::Optional& GetSigningRegionSet() const + { + return m_signingRegionSet; + } + inline void SetSigningRegionSet(Aws::String signingRegionSet) + { + m_signingRegionSet = std::move(signingRegionSet); + } + + inline const Crt::Optional& GetDisableDoubleEncoding() const + { + return m_disableDoubleEncoding; + } + inline void SetDisableDoubleEncoding(bool disableDoubleEncoding) + { + m_disableDoubleEncoding = disableDoubleEncoding; + } + + private: + Aws::String m_name; + + Crt::Optional m_signingName; + Crt::Optional m_signingRegion; + Crt::Optional m_signingRegionSet; + Crt::Optional m_disableDoubleEncoding; + }; + + /** + * A grab bag property map of endpoint attributes. The values here are considered unstable. + * C++ SDK supports only endpoint attributes "AuthScheme" and "Bucket Type". + */ + struct AWS_CORE_API EndpointAttributes + { + Aws::Internal::Endpoint::EndpointAuthScheme authScheme; + Aws::String backend; + bool useS3ExpressAuth; + + static EndpointAttributes BuildEndpointAttributesFromJson(const Aws::String& iJsonStr); + }; + } // namespace Endpoint + } // namespace Internal +} // namespace Aws diff --git a/include/aws/core/external/cjson/cJSON.h b/include/aws/core/external/cjson/cJSON.h new file mode 100644 index 0000000000000000000000000000000000000000..e47581c62884ccd45cd7e0e4c4a61cdc8409f936 --- /dev/null +++ b/include/aws/core/external/cjson/cJSON.h @@ -0,0 +1,320 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef cJSON_AS4CPP__h +#define cJSON_AS4CPP__h + +#ifdef __cplusplus +extern "C" +{ +#endif + +#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) +#define __WINDOWS__ +#endif + +#ifdef __WINDOWS__ + +/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options: + +CJSON_AS4CPP_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols +CJSON_AS4CPP_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) +CJSON_AS4CPP_IMPORT_SYMBOLS - Define this if you want to dllimport symbol + +For *nix builds that support visibility attribute, you can define similar behavior by + +setting default visibility to hidden by adding +-fvisibility=hidden (for gcc) +or +-xldscope=hidden (for sun cc) +to CFLAGS + +then using the CJSON_AS4CPP_API_VISIBILITY flag to "export" the same symbols the way CJSON_AS4CPP_EXPORT_SYMBOLS does + +*/ + +#define CJSON_AS4CPP_CDECL __cdecl +#define CJSON_AS4CPP_STDCALL __stdcall + +/* Decide calling convention based on the cmake parameters defined in C++ SDK. */ +#ifdef USE_IMPORT_EXPORT +#ifdef AWS_CORE_EXPORTS +#define CJSON_AS4CPP_EXPORT_SYMBOLS +#else +#define CJSON_AS4CPP_IMPORT_SYMBOLS +#endif // AWS_CORE_EXPORTS +#else +#define CJSON_AS4CPP_HIDE_SYMBOLS +#endif // USE_IMPORT_EXPORT + +/* export symbols by default, this is necessary for copy pasting the C and header file */ +#if !defined(CJSON_AS4CPP_HIDE_SYMBOLS) && !defined(CJSON_AS4CPP_IMPORT_SYMBOLS) && !defined(CJSON_AS4CPP_EXPORT_SYMBOLS) +#define CJSON_AS4CPP_EXPORT_SYMBOLS +#endif + +#if defined(CJSON_AS4CPP_HIDE_SYMBOLS) +#define CJSON_AS4CPP_PUBLIC(type) type CJSON_AS4CPP_STDCALL +#elif defined(CJSON_AS4CPP_EXPORT_SYMBOLS) +#define CJSON_AS4CPP_PUBLIC(type) __declspec(dllexport) type CJSON_AS4CPP_STDCALL +#elif defined(CJSON_AS4CPP_IMPORT_SYMBOLS) +#define CJSON_AS4CPP_PUBLIC(type) __declspec(dllimport) type CJSON_AS4CPP_STDCALL +#endif +#else /* !__WINDOWS__ */ +#define CJSON_AS4CPP_CDECL +#define CJSON_AS4CPP_STDCALL + +#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_AS4CPP_API_VISIBILITY) +#define CJSON_AS4CPP_PUBLIC(type) __attribute__((visibility("default"))) type +#else +#define CJSON_AS4CPP_PUBLIC(type) type +#endif +#endif + +/* project version */ +#define CJSON_AS4CPP_VERSION_MAJOR 1 +#define CJSON_AS4CPP_VERSION_MINOR 7 +#define CJSON_AS4CPP_VERSION_PATCH 18 + +#include + +/* cJSON Types: */ +#define cJSON_AS4CPP_Invalid (0) +#define cJSON_AS4CPP_False (1 << 0) +#define cJSON_AS4CPP_True (1 << 1) +#define cJSON_AS4CPP_NULL (1 << 2) +#define cJSON_AS4CPP_Number (1 << 3) +#define cJSON_AS4CPP_String (1 << 4) +#define cJSON_AS4CPP_Array (1 << 5) +#define cJSON_AS4CPP_Object (1 << 6) +#define cJSON_AS4CPP_Raw (1 << 7) /* raw json */ + +#define cJSON_AS4CPP_IsReference 256 +#define cJSON_AS4CPP_StringIsConst 512 + +/* The cJSON structure: */ +typedef struct cJSON +{ + /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ + struct cJSON *next; + struct cJSON *prev; + /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + struct cJSON *child; + + /* The type of the item, as above. */ + int type; + + /* The item's string, if type==cJSON_AS4CPP_String and type == cJSON_AS4CPP_Raw */ + char *valuestring; + /* writing to valueint is DEPRECATED, use cJSON_AS4CPP_SetNumberValue instead */ + int valueint; + /* The item's number, if type==cJSON_AS4CPP_Number */ + double valuedouble; + + /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ + char *string; +} cJSON; + +typedef struct cJSON_AS4CPP_Hooks +{ + /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */ + void *(CJSON_AS4CPP_CDECL *malloc_fn)(size_t sz); + void (CJSON_AS4CPP_CDECL *free_fn)(void *ptr); +} cJSON_AS4CPP_Hooks; + +typedef int cJSON_AS4CPP_bool; + +/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. + * This is to prevent stack overflows. */ +#ifndef CJSON_AS4CPP_NESTING_LIMIT +#define CJSON_AS4CPP_NESTING_LIMIT 1000 +#endif + +/* Limits the length of circular references can be before cJSON rejects to parse them. + * This is to prevent stack overflows. */ +#ifndef CJSON_AS4CPP_CIRCULAR_LIMIT +#define CJSON_AS4CPP_CIRCULAR_LIMIT 10000 +#endif + +/* returns the version of cJSON as a string */ +CJSON_AS4CPP_PUBLIC(const char*) cJSON_AS4CPP_Version(void); + +/* Supply malloc, realloc and free functions to cJSON */ +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_InitHooks(cJSON_AS4CPP_Hooks* hooks); + +/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_AS4CPP_Parse (with cJSON_AS4CPP_Delete) and cJSON_AS4CPP_Print (with stdlib free, cJSON_AS4CPP_Hooks.free_fn, or cJSON_AS4CPP_free as appropriate). The exception is cJSON_AS4CPP_PrintPreallocated, where the caller has full responsibility of the buffer. */ +/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_Parse(const char *value); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_ParseWithLength(const char *value, size_t buffer_length); +/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ +/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_AS4CPP_GetErrorPtr(). */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_AS4CPP_bool require_null_terminated); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_AS4CPP_bool require_null_terminated); + +/* Render a cJSON entity to text for transfer/storage. */ +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_Print(const cJSON *item); +/* Render a cJSON entity to text for transfer/storage without any formatting. */ +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_PrintUnformatted(const cJSON *item); +/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_PrintBuffered(const cJSON *item, int prebuffer, cJSON_AS4CPP_bool fmt); +/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ +/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_AS4CPP_bool format); +/* Delete a cJSON entity and all subentities. */ +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_Delete(cJSON *item); + +/* Returns the number of items in an array (or object). */ +CJSON_AS4CPP_PUBLIC(int) cJSON_AS4CPP_GetArraySize(const cJSON *array); +/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetArrayItem(const cJSON *array, int index); +/* Get item "string" from object. Case insensitive. */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetObjectItem(const cJSON * const object, const char * const string); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_HasObjectItem(const cJSON *object, const char *string); +/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_AS4CPP_Parse() returns 0. 0 when cJSON_AS4CPP_Parse() succeeds. + * NOTE: disabled, since this method is not thread-safe. See comments in source/external/cjson/cJSON.cpp. +CJSON_AS4CPP_PUBLIC(const char *) cJSON_AS4CPP_GetErrorPtr(void); + */ + +/* Check item type and return its value */ +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_GetStringValue(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(double) cJSON_AS4CPP_GetNumberValue(const cJSON * const item); + +/* These functions check the type of an item */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsInvalid(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsFalse(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsTrue(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsBool(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsNull(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsNumber(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsString(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsArray(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsObject(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsRaw(const cJSON * const item); + +/* These calls create a cJSON item of the appropriate type. */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateNull(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateTrue(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateFalse(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateBool(cJSON_AS4CPP_bool boolean); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateNumber(double num); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateInt64(long long num); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateString(const char *string); +/* raw json */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateRaw(const char *raw); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateArray(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateObject(void); + +/* Create a string where valuestring references a string so + * it will not be freed by cJSON_AS4CPP_Delete */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateStringReference(const char *string); +/* Create an object/array that only references it's elements so + * they will not be freed by cJSON_AS4CPP_Delete */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateObjectReference(const cJSON *child); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateArrayReference(const cJSON *child); + +/* These utilities create an Array of count items. + * The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateIntArray(const int *numbers, int count); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateFloatArray(const float *numbers, int count); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateDoubleArray(const double *numbers, int count); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateStringArray(const char *const *strings, int count); + +/* Append item to the specified array/object. */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_AddItemToArray(cJSON *array, cJSON *item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_AddItemToObject(cJSON *object, const char *string, cJSON *item); +/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. + * WARNING: When this function was used, make sure to always check that (item->type & cJSON_AS4CPP_StringIsConst) is zero before + * writing to `item->string` */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_AddItemReferenceToArray(cJSON *array, cJSON *item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); + +/* Remove/Detach items from Arrays/Objects. */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemViaPointer(cJSON *parent, cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromArray(cJSON *array, int which); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromArray(cJSON *array, int which); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromObject(cJSON *object, const char *string); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromObject(cJSON *object, const char *string); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); + +/* Update array items. */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); + +/* Duplicate a cJSON item */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_Duplicate(const cJSON *item, cJSON_AS4CPP_bool recurse); +/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will + * need to be released. With recurse!=0, it will duplicate any children connected to the item. + * The item->next and ->prev pointers are always zero on return from Duplicate. */ +/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. + * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_Compare(const cJSON * const a, const cJSON * const b, const cJSON_AS4CPP_bool case_sensitive); + +/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. + * The input pointer json cannot point to a read-only address area, such as a string constant, + * but should point to a readable and writable address area. */ +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_Minify(char *json); + +/* Helper functions for creating and adding items to an object at the same time. + * They return the added item or NULL on failure. */ +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddNullToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddTrueToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddFalseToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_AS4CPP_bool boolean); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddNumberToObject(cJSON * const object, const char * const name, const double number); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddStringToObject(cJSON * const object, const char * const name, const char * const string); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddObjectToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddArrayToObject(cJSON * const object, const char * const name); + +/* When assigning an integer value, it needs to be propagated to valuedouble too. */ +#define cJSON_AS4CPP_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) +/* helper for the cJSON_AS4CPP_SetNumberValue macro */ +CJSON_AS4CPP_PUBLIC(double) cJSON_AS4CPP_SetNumberHelper(cJSON *object, double number); +#define cJSON_AS4CPP_SetNumberValue(object, number) ((object != NULL) ? cJSON_AS4CPP_SetNumberHelper(object, (double)number) : (number)) +/* Change the valuestring of a cJSON_AS4CPP_String object, only takes effect when type of object is cJSON_AS4CPP_String */ +CJSON_AS4CPP_PUBLIC(char*) cJSON_AS4CPP_SetValuestring(cJSON *object, const char *valuestring); + +/* If the object is not a boolean type this does nothing and returns cJSON_AS4CPP_Invalid else it returns the new type*/ +#define cJSON_AS4CPP_SetBoolValue(object, boolValue) ( \ + (object != NULL && ((object)->type & (cJSON_AS4CPP_False|cJSON_AS4CPP_True))) ? \ + (object)->type=((object)->type &(~(cJSON_AS4CPP_False|cJSON_AS4CPP_True)))|((boolValue)?cJSON_AS4CPP_True:cJSON_AS4CPP_False) : \ + cJSON_AS4CPP_Invalid\ +) + +/* Macro for iterating over an array or object */ +#define cJSON_AS4CPP_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) + +/* malloc/free objects using the malloc/free functions that have been set with cJSON_AS4CPP_InitHooks */ +CJSON_AS4CPP_PUBLIC(void *) cJSON_AS4CPP_malloc(size_t size); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_free(void *object); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/aws/core/external/tinyxml2/tinyxml2.h b/include/aws/core/external/tinyxml2/tinyxml2.h new file mode 100644 index 0000000000000000000000000000000000000000..3721ed1f976d4f896754e0c634b8b7b7cbc97fdf --- /dev/null +++ b/include/aws/core/external/tinyxml2/tinyxml2.h @@ -0,0 +1,2292 @@ +/* +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ +/* +This file has been modified from its original version by Amazon: + (1) Memory management operations use aws memory management api + (2) Import-export preprocessor logic tweaked for better integration into core library + (3) Wrapped everything in Amazon namespace to prevent static linking issues if the user includes a version of this code through another dependency +*/ +#ifndef TINYXML2_INCLUDED +#define TINYXML2_INCLUDED + +#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) +# include +# include +# include +# include +# include +# if defined(__PS3__) +# include +# endif +#else +# include +# include +# include +# include +# include +#endif +#include + +#include + +/* + TODO: intern strings instead of allocation. +*/ +/* + gcc: + g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe + + Formatting, Artistic Style: + AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h +*/ + +#if defined( _DEBUG ) || defined (__DEBUG__) +# ifndef DEBUG +# define DEBUG +# endif +#endif + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4251) +#endif + +#ifdef _WIN32 + #ifdef USE_IMPORT_EXPORT + #ifdef AWS_CORE_EXPORTS + #define TINYXML2_LIB __declspec(dllexport) + #else + #define TINYXML2_LIB __declspec(dllimport) + #endif // AWS_CORE_EXPORTS + #endif // USE_IMPORT_EXPORT +#elif __GNUC__ >= 4 + #define TINYXML2_LIB __attribute__((visibility("default"))) +#endif // _WIN32 + +#ifndef TINYXML2_LIB + #define TINYXML2_LIB +#endif // TINYXML2_LIB + +#if defined(DEBUG) +# if defined(_MSC_VER) +# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like +# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } +# elif defined (ANDROID_NDK) +# include +# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } +# else +# include +# define TIXMLASSERT assert +# endif +#else +# define TIXMLASSERT( x ) {} +#endif + + +/* Versioning, past 1.0.14: + http://semver.org/ +*/ +static const int TIXML2_MAJOR_VERSION = 6; +static const int TIXML2_MINOR_VERSION = 1; +static const int TIXML2_PATCH_VERSION = 0; + +#define TINYXML2_MAJOR_VERSION 6 +#define TINYXML2_MINOR_VERSION 1 +#define TINYXML2_PATCH_VERSION 0 + +namespace Aws +{ +namespace External +{ +namespace tinyxml2 +{ +class XMLDocument; +class XMLElement; +class XMLAttribute; +class XMLComment; +class XMLText; +class XMLDeclaration; +class XMLUnknown; +class XMLPrinter; + +static const char* ALLOCATION_TAG = "AWS::TinyXML"; + +/* + A class that wraps strings. Normally stores the start and end + pointers into the XML file itself, and will apply normalization + and entity translation if actually read. Can also store (and memory + manage) a traditional char[] +*/ +class TINYXML2_LIB StrPair +{ +public: + enum { + NEEDS_ENTITY_PROCESSING = 0x01, + NEEDS_NEWLINE_NORMALIZATION = 0x02, + NEEDS_WHITESPACE_COLLAPSING = 0x04, + + TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, + TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, + ATTRIBUTE_NAME = 0, + ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, + ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, + COMMENT = NEEDS_NEWLINE_NORMALIZATION + }; + + StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} + ~StrPair(); + + void Set( char* start, char* end, int flags ) { + TIXMLASSERT( start ); + TIXMLASSERT( end ); + Reset(); + _start = start; + _end = end; + _flags = flags | NEEDS_FLUSH; + } + + const char* GetStr(); + + bool Empty() const { + return _start == _end; + } + + void SetInternedStr( const char* str ) { + Reset(); + _start = const_cast(str); + } + + void SetStr( const char* str, int flags=0 ); + + char* ParseText( char* in, const char* endTag, int strFlags, int* curLineNumPtr ); + char* ParseName( char* in ); + + void TransferTo( StrPair* other ); + void Reset(); + +private: + void CollapseWhitespace(); + + enum { + NEEDS_FLUSH = 0x100, + NEEDS_DELETE = 0x200 + }; + + int _flags; + char* _start; + char* _end; + + StrPair( const StrPair& other ); // not supported + void operator=( StrPair& other ); // not supported, use TransferTo() +}; + + +/* + A dynamic array of Plain Old Data. Doesn't support constructors, etc. + Has a small initial memory pool, so that low or no usage will not + cause a call to new/delete +*/ +template +class DynArray +{ +public: + DynArray() : + _mem( _pool ), + _allocated( INITIAL_SIZE ), + _size( 0 ) + { + } + + ~DynArray() { + if ( _mem != _pool ) { + Aws::DeleteArray(_mem); + } + } + + void Clear() { + _size = 0; + } + + void Push( T t ) { + TIXMLASSERT( _size < INT_MAX ); + EnsureCapacity( _size+1 ); + _mem[_size] = t; + ++_size; + } + + T* PushArr( int count ) { + TIXMLASSERT( count >= 0 ); + TIXMLASSERT( _size <= INT_MAX - count ); + EnsureCapacity( _size+count ); + T* ret = &_mem[_size]; + _size += count; + return ret; + } + + T Pop() { + TIXMLASSERT( _size > 0 ); + --_size; + return _mem[_size]; + } + + void PopArr( int count ) { + TIXMLASSERT( _size >= count ); + _size -= count; + } + + bool Empty() const { + return _size == 0; + } + + T& operator[](int i) { + TIXMLASSERT( i>= 0 && i < _size ); + return _mem[i]; + } + + const T& operator[](int i) const { + TIXMLASSERT( i>= 0 && i < _size ); + return _mem[i]; + } + + const T& PeekTop() const { + TIXMLASSERT( _size > 0 ); + return _mem[ _size - 1]; + } + + int Size() const { + TIXMLASSERT( _size >= 0 ); + return _size; + } + + int Capacity() const { + TIXMLASSERT( _allocated >= INITIAL_SIZE ); + return _allocated; + } + + void SwapRemove(int i) { + TIXMLASSERT(i >= 0 && i < _size); + TIXMLASSERT(_size > 0); + _mem[i] = _mem[_size - 1]; + --_size; + } + + const T* Mem() const { + TIXMLASSERT( _mem ); + return _mem; + } + + T* Mem() { + TIXMLASSERT( _mem ); + return _mem; + } + +private: + DynArray( const DynArray& ); // not supported + void operator=( const DynArray& ); // not supported + + void EnsureCapacity( int cap ) { + TIXMLASSERT( cap > 0 ); + if ( cap > _allocated ) { + TIXMLASSERT( cap <= INT_MAX / 2 ); + int newAllocated = cap * 2; + T* newMem = Aws::NewArray(newAllocated, ALLOCATION_TAG); + TIXMLASSERT( newAllocated >= _size ); + memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs + if ( _mem != _pool ) { + Aws::DeleteArray(_mem); + } + _mem = newMem; + _allocated = newAllocated; + } + } + + T* _mem; + T _pool[INITIAL_SIZE]; + int _allocated; // objects allocated + int _size; // number objects in use +}; + + +/* + Parent virtual class of a pool for fast allocation + and deallocation of objects. +*/ +class MemPool +{ +public: + MemPool() {} + virtual ~MemPool() {} + + virtual int ItemSize() const = 0; + virtual void* Alloc() = 0; + virtual void Free( void* ) = 0; + virtual void SetTracked() = 0; + virtual void Clear() = 0; +}; + + +/* + Template child class to create pools of the correct type. +*/ +template< int ITEM_SIZE > +class MemPoolT : public MemPool +{ +public: + MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} + ~MemPoolT() { + Clear(); + } + + void Clear() { + // Delete the blocks. + while( !_blockPtrs.Empty()) { + Block* lastBlock = _blockPtrs.Pop(); + Aws::Delete(lastBlock); + } + _root = 0; + _currentAllocs = 0; + _nAllocs = 0; + _maxAllocs = 0; + _nUntracked = 0; + } + + virtual int ItemSize() const { + return ITEM_SIZE; + } + int CurrentAllocs() const { + return _currentAllocs; + } + + virtual void* Alloc() { + if ( !_root ) { + // Need a new block. + Block* block = Aws::New(ALLOCATION_TAG); + _blockPtrs.Push( block ); + + Item* blockItems = block->items; + for( int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) { + blockItems[i].next = &(blockItems[i + 1]); + } + blockItems[ITEMS_PER_BLOCK - 1].next = 0; + _root = blockItems; + } + Item* const result = _root; + TIXMLASSERT( result != 0 ); + _root = _root->next; + + ++_currentAllocs; + if ( _currentAllocs > _maxAllocs ) { + _maxAllocs = _currentAllocs; + } + ++_nAllocs; + ++_nUntracked; + return result; + } + + virtual void Free( void* mem ) { + if ( !mem ) { + return; + } + --_currentAllocs; + Item* item = static_cast( mem ); +#ifdef DEBUG + memset( item, 0xfe, sizeof( *item ) ); +#endif + item->next = _root; + _root = item; + } + void Trace( const char* name ) { + printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", + name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs, + ITEM_SIZE, _nAllocs, _blockPtrs.Size() ); + } + + void SetTracked() { + --_nUntracked; + } + + int Untracked() const { + return _nUntracked; + } + + // This number is perf sensitive. 4k seems like a good tradeoff on my machine. + // The test file is large, 170k. + // Release: VS2010 gcc(no opt) + // 1k: 4000 + // 2k: 4000 + // 4k: 3900 21000 + // 16k: 5200 + // 32k: 4300 + // 64k: 4000 21000 + // Declared public because some compilers do not accept to use ITEMS_PER_BLOCK + // in private part if ITEMS_PER_BLOCK is private + enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE }; + +private: + MemPoolT( const MemPoolT& ); // not supported + void operator=( const MemPoolT& ); // not supported + + union Item { + Item* next; + char itemData[ITEM_SIZE]; + }; + struct Block { + Item items[ITEMS_PER_BLOCK]; + }; + DynArray< Block*, 10 > _blockPtrs; + Item* _root; + + int _currentAllocs; + int _nAllocs; + int _maxAllocs; + int _nUntracked; +}; + + + +/** + Implements the interface to the "Visitor pattern" (see the Accept() method.) + If you call the Accept() method, it requires being passed a XMLVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs + are simply called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, no children of this node or its siblings will be visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the XMLDocument, although all nodes support visiting. + + You should never change the document from a callback. + + @sa XMLNode::Accept() +*/ +class TINYXML2_LIB XMLVisitor +{ +public: + virtual ~XMLVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const XMLDocument& /*doc*/ ) { + return true; + } + /// Visit a document. + virtual bool VisitExit( const XMLDocument& /*doc*/ ) { + return true; + } + + /// Visit an element. + virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) { + return true; + } + /// Visit an element. + virtual bool VisitExit( const XMLElement& /*element*/ ) { + return true; + } + + /// Visit a declaration. + virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { + return true; + } + /// Visit a text node. + virtual bool Visit( const XMLText& /*text*/ ) { + return true; + } + /// Visit a comment node. + virtual bool Visit( const XMLComment& /*comment*/ ) { + return true; + } + /// Visit an unknown node. + virtual bool Visit( const XMLUnknown& /*unknown*/ ) { + return true; + } +}; + +// WARNING: must match XMLDocument::_errorNames[] +enum XMLError { + XML_SUCCESS = 0, + XML_NO_ATTRIBUTE, + XML_WRONG_ATTRIBUTE_TYPE, + XML_ERROR_FILE_NOT_FOUND, + XML_ERROR_FILE_COULD_NOT_BE_OPENED, + XML_ERROR_FILE_READ_ERROR, + UNUSED_XML_ERROR_ELEMENT_MISMATCH, // remove at next major version + XML_ERROR_PARSING_ELEMENT, + XML_ERROR_PARSING_ATTRIBUTE, + UNUSED_XML_ERROR_IDENTIFYING_TAG, // remove at next major version + XML_ERROR_PARSING_TEXT, + XML_ERROR_PARSING_CDATA, + XML_ERROR_PARSING_COMMENT, + XML_ERROR_PARSING_DECLARATION, + XML_ERROR_PARSING_UNKNOWN, + XML_ERROR_EMPTY_DOCUMENT, + XML_ERROR_MISMATCHED_ELEMENT, + XML_ERROR_PARSING, + XML_CAN_NOT_CONVERT_TEXT, + XML_NO_TEXT_NODE, + + XML_ERROR_COUNT +}; + + +/* + Utility functionality. +*/ +class TINYXML2_LIB XMLUtil +{ +public: + static const char* SkipWhiteSpace( const char* p, int* curLineNumPtr ) { + TIXMLASSERT( p ); + + while( IsWhiteSpace(*p) ) { + if (curLineNumPtr && *p == '\n') { + ++(*curLineNumPtr); + } + ++p; + } + TIXMLASSERT( p ); + return p; + } + static char* SkipWhiteSpace( char* p, int* curLineNumPtr ) { + return const_cast( SkipWhiteSpace( const_cast(p), curLineNumPtr ) ); + } + + // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't + // correct, but simple, and usually works. + static bool IsWhiteSpace( char p ) { + return !IsUTF8Continuation(p) && isspace( static_cast(p) ); + } + + inline static bool IsNameStartChar( unsigned char ch ) { + if ( ch >= 128 ) { + // This is a heuristic guess in attempt to not implement Unicode-aware isalpha() + return true; + } + if ( isalpha( ch ) ) { + return true; + } + return ch == ':' || ch == '_'; + } + + inline static bool IsNameChar( unsigned char ch ) { + return IsNameStartChar( ch ) + || isdigit( ch ) + || ch == '.' + || ch == '-'; + } + + inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { + if ( p == q ) { + return true; + } + TIXMLASSERT( p ); + TIXMLASSERT( q ); + TIXMLASSERT( nChar >= 0 ); + return strncmp( p, q, nChar ) == 0; + } + + inline static bool IsUTF8Continuation( char p ) { + return ( p & 0x80 ) != 0; + } + + static const char* ReadBOM( const char* p, bool* hasBOM ); + // p is the starting location, + // the UTF-8 value of the entity will be placed in value, and length filled in. + static const char* GetCharacterRef( const char* p, char* value, int* length ); + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + + // converts primitive types to strings + static void ToStr( int v, char* buffer, int bufferSize ); + static void ToStr( unsigned v, char* buffer, int bufferSize ); + static void ToStr( bool v, char* buffer, int bufferSize ); + static void ToStr( float v, char* buffer, int bufferSize ); + static void ToStr( double v, char* buffer, int bufferSize ); + static void ToStr(int64_t v, char* buffer, int bufferSize); + + // converts strings to primitive types + static bool ToInt( const char* str, int* value ); + static bool ToUnsigned( const char* str, unsigned* value ); + static bool ToBool( const char* str, bool* value ); + static bool ToFloat( const char* str, float* value ); + static bool ToDouble( const char* str, double* value ); + static bool ToInt64(const char* str, int64_t* value); + + // Changes what is serialized for a boolean value. + // Default to "true" and "false". Shouldn't be changed + // unless you have a special testing or compatibility need. + // Be careful: static, global, & not thread safe. + // Be sure to set static const memory as parameters. + static void SetBoolSerialization(const char* writeTrue, const char* writeFalse); + +private: + static const char* writeBoolTrue; + static const char* writeBoolFalse; +}; + + +/** XMLNode is a base class for every object that is in the + XML Document Object Model (DOM), except XMLAttributes. + Nodes have siblings, a parent, and children which can + be navigated. A node is always in a XMLDocument. + The type of a XMLNode can be queried, and it can + be cast to its more defined type. + + A XMLDocument allocates memory for all its Nodes. + When the XMLDocument gets deleted, all its Nodes + will also be deleted. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + @endverbatim +*/ +class TINYXML2_LIB XMLNode +{ + friend class XMLDocument; + friend class XMLElement; +public: + + /// Get the XMLDocument that owns this XMLNode. + const XMLDocument* GetDocument() const { + TIXMLASSERT( _document ); + return _document; + } + /// Get the XMLDocument that owns this XMLNode. + XMLDocument* GetDocument() { + TIXMLASSERT( _document ); + return _document; + } + + /// Safely cast to an Element, or null. + virtual XMLElement* ToElement() { + return 0; + } + /// Safely cast to Text, or null. + virtual XMLText* ToText() { + return 0; + } + /// Safely cast to a Comment, or null. + virtual XMLComment* ToComment() { + return 0; + } + /// Safely cast to a Document, or null. + virtual XMLDocument* ToDocument() { + return 0; + } + /// Safely cast to a Declaration, or null. + virtual XMLDeclaration* ToDeclaration() { + return 0; + } + /// Safely cast to an Unknown, or null. + virtual XMLUnknown* ToUnknown() { + return 0; + } + + virtual const XMLElement* ToElement() const { + return 0; + } + virtual const XMLText* ToText() const { + return 0; + } + virtual const XMLComment* ToComment() const { + return 0; + } + virtual const XMLDocument* ToDocument() const { + return 0; + } + virtual const XMLDeclaration* ToDeclaration() const { + return 0; + } + virtual const XMLUnknown* ToUnknown() const { + return 0; + } + + /** The meaning of 'value' changes for the specific type. + @verbatim + Document: empty (NULL is returned, not an empty string) + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + const char* Value() const; + + /** Set the Value of an XML node. + @sa Value() + */ + void SetValue( const char* val, bool staticMem=false ); + + /// Gets the line number the node is in, if the document was parsed from a file. + int GetLineNum() const { return _parseLineNum; } + + /// Get the parent of this node on the DOM. + const XMLNode* Parent() const { + return _parent; + } + + XMLNode* Parent() { + return _parent; + } + + /// Returns true if this node has no children. + bool NoChildren() const { + return !_firstChild; + } + + /// Get the first child node, or null if none exists. + const XMLNode* FirstChild() const { + return _firstChild; + } + + XMLNode* FirstChild() { + return _firstChild; + } + + /** Get the first child element, or optionally the first child + element with the specified name. + */ + const XMLElement* FirstChildElement( const char* name = 0 ) const; + + XMLElement* FirstChildElement( const char* name = 0 ) { + return const_cast(const_cast(this)->FirstChildElement( name )); + } + + /// Get the last child node, or null if none exists. + const XMLNode* LastChild() const { + return _lastChild; + } + + XMLNode* LastChild() { + return _lastChild; + } + + /** Get the last child element or optionally the last child + element with the specified name. + */ + const XMLElement* LastChildElement( const char* name = 0 ) const; + + XMLElement* LastChildElement( const char* name = 0 ) { + return const_cast(const_cast(this)->LastChildElement(name) ); + } + + /// Get the previous (left) sibling node of this node. + const XMLNode* PreviousSibling() const { + return _prev; + } + + XMLNode* PreviousSibling() { + return _prev; + } + + /// Get the previous (left) sibling element of this node, with an optionally supplied name. + const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ; + + XMLElement* PreviousSiblingElement( const char* name = 0 ) { + return const_cast(const_cast(this)->PreviousSiblingElement( name ) ); + } + + /// Get the next (right) sibling node of this node. + const XMLNode* NextSibling() const { + return _next; + } + + XMLNode* NextSibling() { + return _next; + } + + /// Get the next (right) sibling element of this node, with an optionally supplied name. + const XMLElement* NextSiblingElement( const char* name = 0 ) const; + + XMLElement* NextSiblingElement( const char* name = 0 ) { + return const_cast(const_cast(this)->NextSiblingElement( name ) ); + } + + /** + Add a child node as the last (right) child. + If the child node is already part of the document, + it is moved from its old location to the new location. + Returns the addThis argument or 0 if the node does not + belong to the same document. + */ + XMLNode* InsertEndChild( XMLNode* addThis ); + + XMLNode* LinkEndChild( XMLNode* addThis ) { + return InsertEndChild( addThis ); + } + /** + Add a child node as the first (left) child. + If the child node is already part of the document, + it is moved from its old location to the new location. + Returns the addThis argument or 0 if the node does not + belong to the same document. + */ + XMLNode* InsertFirstChild( XMLNode* addThis ); + /** + Add a node after the specified child node. + If the child node is already part of the document, + it is moved from its old location to the new location. + Returns the addThis argument or 0 if the afterThis node + is not a child of this node, or if the node does not + belong to the same document. + */ + XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ); + + /** + Delete all the children of this node. + */ + void DeleteChildren(); + + /** + Delete a child of this node. + */ + void DeleteChild( XMLNode* node ); + + /** + Make a copy of this node, but not its children. + You may pass in a Document pointer that will be + the owner of the new Node. If the 'document' is + null, then the node returned will be allocated + from the current Document. (this->GetDocument()) + + Note: if called on a XMLDocument, this will return null. + */ + virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0; + + /** + Make a copy of this node and all its children. + + If the 'target' is null, then the nodes will + be allocated in the current document. If 'target' + is specified, the memory will be allocated is the + specified XMLDocument. + + NOTE: This is probably not the correct tool to + copy a document, since XMLDocuments can have multiple + top level XMLNodes. You probably want to use + XMLDocument::DeepCopy() + */ + XMLNode* DeepClone( XMLDocument* target ) const; + + /** + Test if 2 nodes are the same, but don't test children. + The 2 nodes do not need to be in the same Document. + + Note: if called on a XMLDocument, this will return false. + */ + virtual bool ShallowEqual( const XMLNode* compare ) const = 0; + + /** Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the XMLVisitor interface. + + This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + XMLPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( XMLVisitor* visitor ) const = 0; + + /** + Set user data into the XMLNode. TinyXML-2 in + no way processes or interprets user data. + It is initially 0. + */ + void SetUserData(void* userData) { _userData = userData; } + + /** + Get user data set into the XMLNode. TinyXML-2 in + no way processes or interprets user data. + It is initially 0. + */ + void* GetUserData() const { return _userData; } + +protected: + XMLNode( XMLDocument* ); + virtual ~XMLNode(); + + virtual char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr); + + XMLDocument* _document; + XMLNode* _parent; + mutable StrPair _value; + int _parseLineNum; + + XMLNode* _firstChild; + XMLNode* _lastChild; + + XMLNode* _prev; + XMLNode* _next; + + void* _userData; + +private: + MemPool* _memPool; + void Unlink( XMLNode* child ); + static void DeleteNode( XMLNode* node ); + void InsertChildPreamble( XMLNode* insertThis ) const; + const XMLElement* ToElementWithName( const char* name ) const; + + XMLNode( const XMLNode& ); // not supported + XMLNode& operator=( const XMLNode& ); // not supported +}; + + +/** XML text. + + Note that a text node can have child element nodes, for example: + @verbatim + This is bold + @endverbatim + + A text node can have 2 ways to output the next. "normal" output + and CDATA. It will default to the mode it was parsed from the XML file and + you generally want to leave it alone, but you can change the output mode with + SetCData() and query it with CData(). +*/ +class TINYXML2_LIB XMLText : public XMLNode +{ + friend class XMLDocument; +public: + virtual bool Accept( XMLVisitor* visitor ) const; + + virtual XMLText* ToText() { + return this; + } + virtual const XMLText* ToText() const { + return this; + } + + /// Declare whether this should be CDATA or standard text. + void SetCData( bool isCData ) { + _isCData = isCData; + } + /// Returns true if this is a CDATA text element. + bool CData() const { + return _isCData; + } + + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} + virtual ~XMLText() {} + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); + +private: + bool _isCData; + + XMLText( const XMLText& ); // not supported + XMLText& operator=( const XMLText& ); // not supported +}; + + +/** An XML Comment. */ +class TINYXML2_LIB XMLComment : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLComment* ToComment() { + return this; + } + virtual const XMLComment* ToComment() const { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const; + + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLComment( XMLDocument* doc ); + virtual ~XMLComment(); + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr); + +private: + XMLComment( const XMLComment& ); // not supported + XMLComment& operator=( const XMLComment& ); // not supported +}; + + +/** In correct XML the declaration is the first entry in the file. + @verbatim + + @endverbatim + + TinyXML-2 will happily read or write files without a declaration, + however. + + The text of the declaration isn't interpreted. It is parsed + and written as a string. +*/ +class TINYXML2_LIB XMLDeclaration : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLDeclaration* ToDeclaration() { + return this; + } + virtual const XMLDeclaration* ToDeclaration() const { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const; + + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLDeclaration( XMLDocument* doc ); + virtual ~XMLDeclaration(); + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); + +private: + XMLDeclaration( const XMLDeclaration& ); // not supported + XMLDeclaration& operator=( const XMLDeclaration& ); // not supported +}; + + +/** Any tag that TinyXML-2 doesn't recognize is saved as an + unknown. It is a tag of text, but should not be modified. + It will be written back to the XML, unchanged, when the file + is saved. + + DTD tags get thrown into XMLUnknowns. +*/ +class TINYXML2_LIB XMLUnknown : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLUnknown* ToUnknown() { + return this; + } + virtual const XMLUnknown* ToUnknown() const { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const; + + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLUnknown( XMLDocument* doc ); + virtual ~XMLUnknown(); + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); + +private: + XMLUnknown( const XMLUnknown& ); // not supported + XMLUnknown& operator=( const XMLUnknown& ); // not supported +}; + + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not XMLNodes. You may only query the + Next() attribute in a list. +*/ +class TINYXML2_LIB XMLAttribute +{ + friend class XMLElement; +public: + /// The name of the attribute. + const char* Name() const; + + /// The value of the attribute. + const char* Value() const; + + /// Gets the line number the attribute is in, if the document was parsed from a file. + int GetLineNum() const { return _parseLineNum; } + + /// The next attribute in the list. + const XMLAttribute* Next() const { + return _next; + } + + /** IntValue interprets the attribute as an integer, and returns the value. + If the value isn't an integer, 0 will be returned. There is no error checking; + use QueryIntValue() if you need error checking. + */ + int IntValue() const { + int i = 0; + QueryIntValue(&i); + return i; + } + + int64_t Int64Value() const { + int64_t i = 0; + QueryInt64Value(&i); + return i; + } + + /// Query as an unsigned integer. See IntValue() + unsigned UnsignedValue() const { + unsigned i=0; + QueryUnsignedValue( &i ); + return i; + } + /// Query as a boolean. See IntValue() + bool BoolValue() const { + bool b=false; + QueryBoolValue( &b ); + return b; + } + /// Query as a double. See IntValue() + double DoubleValue() const { + double d=0; + QueryDoubleValue( &d ); + return d; + } + /// Query as a float. See IntValue() + float FloatValue() const { + float f=0; + QueryFloatValue( &f ); + return f; + } + + /** QueryIntValue interprets the attribute as an integer, and returns the value + in the provided parameter. The function will return XML_SUCCESS on success, + and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful. + */ + XMLError QueryIntValue( int* value ) const; + /// See QueryIntValue + XMLError QueryUnsignedValue( unsigned int* value ) const; + /// See QueryIntValue + XMLError QueryInt64Value(int64_t* value) const; + /// See QueryIntValue + XMLError QueryBoolValue( bool* value ) const; + /// See QueryIntValue + XMLError QueryDoubleValue( double* value ) const; + /// See QueryIntValue + XMLError QueryFloatValue( float* value ) const; + + /// Set the attribute to a string value. + void SetAttribute( const char* value ); + /// Set the attribute to value. + void SetAttribute( int value ); + /// Set the attribute to value. + void SetAttribute( unsigned value ); + /// Set the attribute to value. + void SetAttribute(int64_t value); + /// Set the attribute to value. + void SetAttribute( bool value ); + /// Set the attribute to value. + void SetAttribute( double value ); + /// Set the attribute to value. + void SetAttribute( float value ); + +private: + enum { BUF_SIZE = 200 }; + + XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {} + virtual ~XMLAttribute() {} + + XMLAttribute( const XMLAttribute& ); // not supported + void operator=( const XMLAttribute& ); // not supported + void SetName( const char* name ); + + char* ParseDeep( char* p, bool processEntities, int* curLineNumPtr ); + + mutable StrPair _name; + mutable StrPair _value; + int _parseLineNum; + XMLAttribute* _next; + MemPool* _memPool; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TINYXML2_LIB XMLElement : public XMLNode +{ + friend class XMLDocument; +public: + /// Get the name of an element (which is the Value() of the node.) + const char* Name() const { + return Value(); + } + /// Set the name of the element. + void SetName( const char* str, bool staticMem=false ) { + SetValue( str, staticMem ); + } + + virtual XMLElement* ToElement() { + return this; + } + virtual const XMLElement* ToElement() const { + return this; + } + virtual bool Accept( XMLVisitor* visitor ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none + exists. For example: + + @verbatim + const char* value = ele->Attribute( "foo" ); + @endverbatim + + The 'value' parameter is normally null. However, if specified, + the attribute will only be returned if the 'name' and 'value' + match. This allow you to write code: + + @verbatim + if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); + @endverbatim + + rather than: + @verbatim + if ( ele->Attribute( "foo" ) ) { + if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); + } + @endverbatim + */ + const char* Attribute( const char* name, const char* value=0 ) const; + + /** Given an attribute name, IntAttribute() returns the value + of the attribute interpreted as an integer. The default + value will be returned if the attribute isn't present, + or if there is an error. (For a method with error + checking, see QueryIntAttribute()). + */ + int IntAttribute(const char* name, int defaultValue = 0) const; + /// See IntAttribute() + unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const; + /// See IntAttribute() + int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const; + /// See IntAttribute() + bool BoolAttribute(const char* name, bool defaultValue = false) const; + /// See IntAttribute() + double DoubleAttribute(const char* name, double defaultValue = 0) const; + /// See IntAttribute() + float FloatAttribute(const char* name, float defaultValue = 0) const; + + /** Given an attribute name, QueryIntAttribute() returns + XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion + can't be performed, or XML_NO_ATTRIBUTE if the attribute + doesn't exist. If successful, the result of the conversion + will be written to 'value'. If not successful, nothing will + be written to 'value'. This allows you to provide default + value: + + @verbatim + int value = 10; + QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 + @endverbatim + */ + XMLError QueryIntAttribute( const char* name, int* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryIntValue( value ); + } + + /// See QueryIntAttribute() + XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryUnsignedValue( value ); + } + + /// See QueryIntAttribute() + XMLError QueryInt64Attribute(const char* name, int64_t* value) const { + const XMLAttribute* a = FindAttribute(name); + if (!a) { + return XML_NO_ATTRIBUTE; + } + return a->QueryInt64Value(value); + } + + /// See QueryIntAttribute() + XMLError QueryBoolAttribute( const char* name, bool* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryBoolValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryDoubleAttribute( const char* name, double* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryDoubleValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryFloatAttribute( const char* name, float* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryFloatValue( value ); + } + + + /** Given an attribute name, QueryAttribute() returns + XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion + can't be performed, or XML_NO_ATTRIBUTE if the attribute + doesn't exist. It is overloaded for the primitive types, + and is a generally more convenient replacement of + QueryIntAttribute() and related functions. + + If successful, the result of the conversion + will be written to 'value'. If not successful, nothing will + be written to 'value'. This allows you to provide default + value: + + @verbatim + int value = 10; + QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 + @endverbatim + */ + int QueryAttribute( const char* name, int* value ) const { + return QueryIntAttribute( name, value ); + } + + int QueryAttribute( const char* name, unsigned int* value ) const { + return QueryUnsignedAttribute( name, value ); + } + + int QueryAttribute(const char* name, int64_t* value) const { + return QueryInt64Attribute(name, value); + } + + int QueryAttribute( const char* name, bool* value ) const { + return QueryBoolAttribute( name, value ); + } + + int QueryAttribute( const char* name, double* value ) const { + return QueryDoubleAttribute( name, value ); + } + + int QueryAttribute( const char* name, float* value ) const { + return QueryFloatAttribute( name, value ); + } + + /// Sets the named attribute to value. + void SetAttribute( const char* name, const char* value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, int value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, unsigned value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + + /// Sets the named attribute to value. + void SetAttribute(const char* name, int64_t value) { + XMLAttribute* a = FindOrCreateAttribute(name); + a->SetAttribute(value); + } + + /// Sets the named attribute to value. + void SetAttribute( const char* name, bool value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, double value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, float value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + + /** + Delete an attribute. + */ + void DeleteAttribute( const char* name ); + + /// Return the first attribute in the list. + const XMLAttribute* FirstAttribute() const { + return _rootAttribute; + } + /// Query a specific attribute in the list. + const XMLAttribute* FindAttribute( const char* name ) const; + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the XMLText child + and accessing it directly. + + If the first child of 'this' is a XMLText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + This is text + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + This is text + @endverbatim + GetText() will return "This is ". + */ + const char* GetText() const; + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, SetText() is limited compared to creating an XMLText child + and mutating it directly. + + If the first child of 'this' is a XMLText, SetText() sets its value to + the given string, otherwise it will create a first child that is an XMLText. + + This is a convenient method for setting the text of simple contained text: + @verbatim + This is text + fooElement->SetText( "Hullaballoo!" ); + Hullaballoo! + @endverbatim + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then it will not change "This is text", but rather prefix it with a text element: + @verbatim + Hullaballoo!This is text + @endverbatim + + For this XML: + @verbatim + + @endverbatim + SetText() will generate + @verbatim + Hullaballoo! + @endverbatim + */ + void SetText( const char* inText ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( int value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( unsigned value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText(int64_t value); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( bool value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( double value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( float value ); + + /** + Convenience method to query the value of a child text node. This is probably best + shown by example. Given you have a document is this form: + @verbatim + + 1 + 1.4 + + @endverbatim + + The QueryIntText() and similar functions provide a safe and easier way to get to the + "value" of x and y. + + @verbatim + int x = 0; + float y = 0; // types of x and y are contrived for example + const XMLElement* xElement = pointElement->FirstChildElement( "x" ); + const XMLElement* yElement = pointElement->FirstChildElement( "y" ); + xElement->QueryIntText( &x ); + yElement->QueryFloatText( &y ); + @endverbatim + + @returns XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted + to the requested type, and XML_NO_TEXT_NODE if there is no child text to query. + + */ + XMLError QueryIntText( int* ival ) const; + /// See QueryIntText() + XMLError QueryUnsignedText( unsigned* uval ) const; + /// See QueryIntText() + XMLError QueryInt64Text(int64_t* uval) const; + /// See QueryIntText() + XMLError QueryBoolText( bool* bval ) const; + /// See QueryIntText() + XMLError QueryDoubleText( double* dval ) const; + /// See QueryIntText() + XMLError QueryFloatText( float* fval ) const; + + int IntText(int defaultValue = 0) const; + + /// See QueryIntText() + unsigned UnsignedText(unsigned defaultValue = 0) const; + /// See QueryIntText() + int64_t Int64Text(int64_t defaultValue = 0) const; + /// See QueryIntText() + bool BoolText(bool defaultValue = false) const; + /// See QueryIntText() + double DoubleText(double defaultValue = 0) const; + /// See QueryIntText() + float FloatText(float defaultValue = 0) const; + + // internal: + enum ElementClosingType { + OPEN, // + CLOSED, // + CLOSING // + }; + ElementClosingType ClosingType() const { + return _closingType; + } + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); + +private: + XMLElement( XMLDocument* doc ); + virtual ~XMLElement(); + XMLElement( const XMLElement& ); // not supported + void operator=( const XMLElement& ); // not supported + + XMLAttribute* FindAttribute( const char* name ) { + return const_cast(const_cast(this)->FindAttribute( name )); + } + XMLAttribute* FindOrCreateAttribute( const char* name ); + //void LinkAttribute( XMLAttribute* attrib ); + char* ParseAttributes( char* p, int* curLineNumPtr ); + static void DeleteAttribute( XMLAttribute* attribute ); + XMLAttribute* CreateAttribute(); + + enum { BUF_SIZE = 200 }; + ElementClosingType _closingType; + // The attribute list is ordered; there is no 'lastAttribute' + // because the list needs to be scanned for dupes before adding + // a new attribute. + XMLAttribute* _rootAttribute; +}; + + +enum Whitespace { + PRESERVE_WHITESPACE, + COLLAPSE_WHITESPACE +}; + + +/** A Document binds together all the functionality. + It can be saved, loaded, and printed to the screen. + All Nodes are connected and allocated to a Document. + If the Document is deleted, all its Nodes are also deleted. +*/ +class TINYXML2_LIB XMLDocument : public XMLNode +{ + friend class XMLElement; + // Gives access to SetError, but over-access for everything else. + // Wishing C++ had "internal" scope. + friend class XMLNode; + friend class XMLText; + friend class XMLComment; + friend class XMLDeclaration; + friend class XMLUnknown; +public: + /// constructor + XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE ); + ~XMLDocument(); + + virtual XMLDocument* ToDocument() { + TIXMLASSERT( this == _document ); + return this; + } + virtual const XMLDocument* ToDocument() const { + TIXMLASSERT( this == _document ); + return this; + } + + /** + Parse an XML file from a character string. + Returns XML_SUCCESS (0) on success, or + an errorID. + + You may optionally pass in the 'nBytes', which is + the number of bytes which will be parsed. If not + specified, TinyXML-2 will assume 'xml' points to a + null terminated string. + */ + XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) ); + + /** + Load an XML file from disk. + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError LoadFile( const char* filename ); + + /** + Load an XML file from disk. You are responsible + for providing and closing the FILE*. + + NOTE: The file should be opened as binary ("rb") + not text in order for TinyXML-2 to correctly + do newline normalization. + + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError LoadFile( FILE* ); + + /** + Save the XML file to disk. + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError SaveFile( const char* filename, bool compact = false ); + + /** + Save the XML file to disk. You are responsible + for providing and closing the FILE*. + + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError SaveFile( FILE* fp, bool compact = false ); + + bool ProcessEntities() const { + return _processEntities; + } + Whitespace WhitespaceMode() const { + return _whitespaceMode; + } + + /** + Returns true if this document has a leading Byte Order Mark of UTF8. + */ + bool HasBOM() const { + return _writeBOM; + } + /** Sets whether to write the BOM when writing the file. + */ + void SetBOM( bool useBOM ) { + _writeBOM = useBOM; + } + + /** Return the root element of DOM. Equivalent to FirstChildElement(). + To get the first node, use FirstChild(). + */ + XMLElement* RootElement() { + return FirstChildElement(); + } + const XMLElement* RootElement() const { + return FirstChildElement(); + } + + /** Print the Document. If the Printer is not provided, it will + print to stdout. If you provide Printer, this can print to a file: + @verbatim + XMLPrinter printer( fp ); + doc.Print( &printer ); + @endverbatim + + Or you can use a printer to print to memory: + @verbatim + XMLPrinter printer; + doc.Print( &printer ); + // printer.CStr() has a const char* to the XML + @endverbatim + */ + void Print( XMLPrinter* streamer=0 ) const; + virtual bool Accept( XMLVisitor* visitor ) const; + + /** + Create a new Element associated with + this Document. The memory for the Element + is managed by the Document. + */ + XMLElement* NewElement( const char* name ); + /** + Create a new Comment associated with + this Document. The memory for the Comment + is managed by the Document. + */ + XMLComment* NewComment( const char* comment ); + /** + Create a new Text associated with + this Document. The memory for the Text + is managed by the Document. + */ + XMLText* NewText( const char* text ); + /** + Create a new Declaration associated with + this Document. The memory for the object + is managed by the Document. + + If the 'text' param is null, the standard + declaration is used.: + @verbatim + + @endverbatim + */ + XMLDeclaration* NewDeclaration( const char* text=0 ); + /** + Create a new Unknown associated with + this Document. The memory for the object + is managed by the Document. + */ + XMLUnknown* NewUnknown( const char* text ); + + /** + Delete a node associated with this document. + It will be unlinked from the DOM. + */ + void DeleteNode( XMLNode* node ); + + void ClearError() { + SetError(XML_SUCCESS, 0, 0); + } + + /// Return true if there was an error parsing the document. + bool Error() const { + return _errorID != XML_SUCCESS; + } + /// Return the errorID. + XMLError ErrorID() const { + return _errorID; + } + const char* ErrorName() const; + static const char* ErrorIDToName(XMLError errorID); + + /** Returns a "long form" error description. A hopefully helpful + diagnostic with location, line number, and/or additional info. + */ + const char* ErrorStr() const; + + /// A (trivial) utility function that prints the ErrorStr() to stdout. + void PrintError() const; + + /// Return the line where the error occurred, or zero if unknown. + int ErrorLineNum() const + { + return _errorLineNum; + } + + /// Clear the document, resetting it to the initial state. + void Clear(); + + /** + Copies this document to a target document. + The target will be completely cleared before the copy. + If you want to copy a sub-tree, see XMLNode::DeepClone(). + + NOTE: that the 'target' must be non-null. + */ + void DeepCopy(XMLDocument* target) const; + + // internal + char* Identify( char* p, XMLNode** node ); + + // internal + void MarkInUse(XMLNode*); + + virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const { + return 0; + } + virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const { + return false; + } + +private: + XMLDocument( const XMLDocument& ); // not supported + void operator=( const XMLDocument& ); // not supported + + bool _writeBOM; + bool _processEntities; + XMLError _errorID; + Whitespace _whitespaceMode; + mutable StrPair _errorStr; + int _errorLineNum; + char* _charBuffer; + int _parseCurLineNum; + // Memory tracking does add some overhead. + // However, the code assumes that you don't + // have a bunch of unlinked nodes around. + // Therefore it takes less memory to track + // in the document vs. a linked list in the XMLNode, + // and the performance is the same. + DynArray _unlinked; + + MemPoolT< sizeof(XMLElement) > _elementPool; + MemPoolT< sizeof(XMLAttribute) > _attributePool; + MemPoolT< sizeof(XMLText) > _textPool; + MemPoolT< sizeof(XMLComment) > _commentPool; + + static const char* _errorNames[XML_ERROR_COUNT]; + + void Parse(); + + void SetError( XMLError error, int lineNum, const char* format, ... ); + + template + NodeType* CreateUnlinkedNode( MemPoolT& pool ); +}; + +template +inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT& pool ) +{ + TIXMLASSERT( sizeof( NodeType ) == PoolElementSize ); + TIXMLASSERT( sizeof( NodeType ) == pool.ItemSize() ); + NodeType* returnNode = new (pool.Alloc()) NodeType( this ); + TIXMLASSERT( returnNode ); + returnNode->_memPool = &pool; + + _unlinked.Push(returnNode); + return returnNode; +} + +/** + A XMLHandle is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that XMLHandle is not part of the TinyXML-2 + DOM structure. It is a separate utility class. + + Take an example: + @verbatim + + + + + + + @endverbatim + + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + easy to write a *lot* of code that looks like: + + @verbatim + XMLElement* root = document.FirstChildElement( "Document" ); + if ( root ) + { + XMLElement* element = root->FirstChildElement( "Element" ); + if ( element ) + { + XMLElement* child = element->FirstChildElement( "Child" ); + if ( child ) + { + XMLElement* child2 = child->NextSiblingElement( "Child" ); + if ( child2 ) + { + // Finally do something useful. + @endverbatim + + And that doesn't even cover "else" cases. XMLHandle addresses the verbosity + of such code. A XMLHandle checks for null pointers so it is perfectly safe + and correct to use: + + @verbatim + XMLHandle docHandle( &document ); + XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement(); + if ( child2 ) + { + // do something useful + @endverbatim + + Which is MUCH more concise and useful. + + It is also safe to copy handles - internally they are nothing more than node pointers. + @verbatim + XMLHandle handleCopy = handle; + @endverbatim + + See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects. +*/ +class TINYXML2_LIB XMLHandle +{ +public: + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + XMLHandle( XMLNode* node ) : _node( node ) { + } + /// Create a handle from a node. + XMLHandle( XMLNode& node ) : _node( &node ) { + } + /// Copy constructor + XMLHandle( const XMLHandle& ref ) : _node( ref._node ) { + } + /// Assignment + XMLHandle& operator=( const XMLHandle& ref ) { + _node = ref._node; + return *this; + } + + /// Get the first child of this handle. + XMLHandle FirstChild() { + return XMLHandle( _node ? _node->FirstChild() : 0 ); + } + /// Get the first child element of this handle. + XMLHandle FirstChildElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 ); + } + /// Get the last child of this handle. + XMLHandle LastChild() { + return XMLHandle( _node ? _node->LastChild() : 0 ); + } + /// Get the last child element of this handle. + XMLHandle LastChildElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->LastChildElement( name ) : 0 ); + } + /// Get the previous sibling of this handle. + XMLHandle PreviousSibling() { + return XMLHandle( _node ? _node->PreviousSibling() : 0 ); + } + /// Get the previous sibling element of this handle. + XMLHandle PreviousSiblingElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); + } + /// Get the next sibling of this handle. + XMLHandle NextSibling() { + return XMLHandle( _node ? _node->NextSibling() : 0 ); + } + /// Get the next sibling element of this handle. + XMLHandle NextSiblingElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 ); + } + + /// Safe cast to XMLNode. This can return null. + XMLNode* ToNode() { + return _node; + } + /// Safe cast to XMLElement. This can return null. + XMLElement* ToElement() { + return ( _node ? _node->ToElement() : 0 ); + } + /// Safe cast to XMLText. This can return null. + XMLText* ToText() { + return ( _node ? _node->ToText() : 0 ); + } + /// Safe cast to XMLUnknown. This can return null. + XMLUnknown* ToUnknown() { + return ( _node ? _node->ToUnknown() : 0 ); + } + /// Safe cast to XMLDeclaration. This can return null. + XMLDeclaration* ToDeclaration() { + return ( _node ? _node->ToDeclaration() : 0 ); + } + +private: + XMLNode* _node; +}; + + +/** + A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the + same in all regards, except for the 'const' qualifiers. See XMLHandle for API. +*/ +class TINYXML2_LIB XMLConstHandle +{ +public: + XMLConstHandle( const XMLNode* node ) : _node( node ) { + } + XMLConstHandle( const XMLNode& node ) : _node( &node ) { + } + XMLConstHandle( const XMLConstHandle& ref ) : _node( ref._node ) { + } + + XMLConstHandle& operator=( const XMLConstHandle& ref ) { + _node = ref._node; + return *this; + } + + const XMLConstHandle FirstChild() const { + return XMLConstHandle( _node ? _node->FirstChild() : 0 ); + } + const XMLConstHandle FirstChildElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 ); + } + const XMLConstHandle LastChild() const { + return XMLConstHandle( _node ? _node->LastChild() : 0 ); + } + const XMLConstHandle LastChildElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 ); + } + const XMLConstHandle PreviousSibling() const { + return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); + } + const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); + } + const XMLConstHandle NextSibling() const { + return XMLConstHandle( _node ? _node->NextSibling() : 0 ); + } + const XMLConstHandle NextSiblingElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 ); + } + + + const XMLNode* ToNode() const { + return _node; + } + const XMLElement* ToElement() const { + return ( _node ? _node->ToElement() : 0 ); + } + const XMLText* ToText() const { + return ( _node ? _node->ToText() : 0 ); + } + const XMLUnknown* ToUnknown() const { + return ( _node ? _node->ToUnknown() : 0 ); + } + const XMLDeclaration* ToDeclaration() const { + return ( _node ? _node->ToDeclaration() : 0 ); + } + +private: + const XMLNode* _node; +}; + + +/** + Printing functionality. The XMLPrinter gives you more + options than the XMLDocument::Print() method. + + It can: + -# Print to memory. + -# Print to a file you provide. + -# Print XML without a XMLDocument. + + Print to Memory + + @verbatim + XMLPrinter printer; + doc.Print( &printer ); + SomeFunction( printer.CStr() ); + @endverbatim + + Print to a File + + You provide the file pointer. + @verbatim + XMLPrinter printer( fp ); + doc.Print( &printer ); + @endverbatim + + Print without a XMLDocument + + When loading, an XML parser is very useful. However, sometimes + when saving, it just gets in the way. The code is often set up + for streaming, and constructing the DOM is just overhead. + + The Printer supports the streaming case. The following code + prints out a trivially simple XML file without ever creating + an XML document. + + @verbatim + XMLPrinter printer( fp ); + printer.OpenElement( "foo" ); + printer.PushAttribute( "foo", "bar" ); + printer.CloseElement(); + @endverbatim +*/ +class TINYXML2_LIB XMLPrinter : public XMLVisitor +{ +public: + /** Construct the printer. If the FILE* is specified, + this will print to the FILE. Else it will print + to memory, and the result is available in CStr(). + If 'compact' is set to true, then output is created + with only required whitespace and newlines. + */ + XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 ); + virtual ~XMLPrinter() {} + + /** If streaming, write the BOM and declaration. */ + void PushHeader( bool writeBOM, bool writeDeclaration ); + /** If streaming, start writing an element. + The element must be closed with CloseElement() + */ + void OpenElement( const char* name, bool compactMode=false ); + /// If streaming, add an attribute to an open element. + void PushAttribute( const char* name, const char* value ); + void PushAttribute( const char* name, int value ); + void PushAttribute( const char* name, unsigned value ); + void PushAttribute(const char* name, int64_t value); + void PushAttribute( const char* name, bool value ); + void PushAttribute( const char* name, double value ); + /// If streaming, close the Element. + virtual void CloseElement( bool compactMode=false ); + + /// Add a text node. + void PushText( const char* text, bool cdata=false ); + /// Add a text node from an integer. + void PushText( int value ); + /// Add a text node from an unsigned. + void PushText( unsigned value ); + /// Add a text node from an unsigned. + void PushText(int64_t value); + /// Add a text node from a bool. + void PushText( bool value ); + /// Add a text node from a float. + void PushText( float value ); + /// Add a text node from a double. + void PushText( double value ); + + /// Add a comment + void PushComment( const char* comment ); + + void PushDeclaration( const char* value ); + void PushUnknown( const char* value ); + + virtual bool VisitEnter( const XMLDocument& /*doc*/ ); + virtual bool VisitExit( const XMLDocument& /*doc*/ ) { + return true; + } + + virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ); + virtual bool VisitExit( const XMLElement& element ); + + virtual bool Visit( const XMLText& text ); + virtual bool Visit( const XMLComment& comment ); + virtual bool Visit( const XMLDeclaration& declaration ); + virtual bool Visit( const XMLUnknown& unknown ); + + /** + If in print to memory mode, return a pointer to + the XML file in memory. + */ + const char* CStr() const { + return _buffer.Mem(); + } + /** + If in print to memory mode, return the size + of the XML file in memory. (Note the size returned + includes the terminating null.) + */ + int CStrSize() const { + return _buffer.Size(); + } + /** + If in print to memory mode, reset the buffer to the + beginning. + */ + void ClearBuffer() { + _buffer.Clear(); + _buffer.Push(0); + _firstElement = true; + } + +protected: + virtual bool CompactMode( const XMLElement& ) { return _compactMode; } + + /** Prints out the space before an element. You may override to change + the space and tabs used. A PrintSpace() override should call Print(). + */ + virtual void PrintSpace( int depth ); + void Print( const char* format, ... ); + void Write( const char* data, size_t size ); + inline void Write( const char* data ) { Write( data, strlen( data ) ); } + void Putc( char ch ); + + void SealElementIfJustOpened(); + bool _elementJustOpened; + DynArray< const char*, 10 > _stack; + +private: + void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities. + + bool _firstElement; + FILE* _fp; + int _depth; + int _textDepth; + bool _processEntities; + bool _compactMode; + + enum { + ENTITY_RANGE = 64, + BUF_SIZE = 200 + }; + bool _entityFlag[ENTITY_RANGE]; + bool _restrictedEntityFlag[ENTITY_RANGE]; + + DynArray< char, 20 > _buffer; + + // Prohibit cloning, intentionally not implemented + XMLPrinter( const XMLPrinter& ); + XMLPrinter& operator=( const XMLPrinter& ); +}; + + +} // tinyxml2 +} // namespace External +} // namespace Aws + +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + +#endif // TINYXML2_INCLUDED \ No newline at end of file diff --git a/include/aws/core/http/HttpClient.h b/include/aws/core/http/HttpClient.h new file mode 100644 index 0000000000000000000000000000000000000000..cb6e928e768e85ad565a6ef576aa66481583f70f --- /dev/null +++ b/include/aws/core/http/HttpClient.h @@ -0,0 +1,88 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace RateLimits + { + class RateLimiterInterface; + } // namespace RateLimits + } // namespace Utils + + namespace Http + { + class HttpRequest; + class HttpResponse; + + /** + * Abstract HttpClient. All it does is make HttpRequests and return their response. + */ + class AWS_CORE_API HttpClient + { + public: + HttpClient(); + virtual ~HttpClient() {} + + /** + * Takes an http request, makes it, and returns the newly allocated HttpResponse. + */ + virtual std::shared_ptr MakeRequest(const std::shared_ptr& request, + Aws::Utils::RateLimits::RateLimiterInterface* readLimiter = nullptr, + Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter = nullptr) const = 0; + + /** + * If yes, the http client supports transfer-encoding:chunked. + */ + virtual bool SupportsChunkedTransferEncoding() const { return true; } + + /** + * Stops all requests in progress and prevents any others from initiating. + */ + void DisableRequestProcessing(); + /** + * Enables/ReEnables request processing. + */ + void EnableRequestProcessing(); + /** + * Returns true if request processing is enabled. + */ + bool IsRequestProcessingEnabled() const; + /** + * Sleeps current thread for sleepTime. + */ + void RetryRequestSleep(std::chrono::milliseconds sleepTime); + + bool ContinueRequest(const Aws::Http::HttpRequest&) const; + + explicit operator bool() const + { + return !m_bad; + } + + protected: + bool m_bad; + + private: + + std::atomic< bool > m_disableRequestProcessing; + std::mutex m_requestProcessingSignalLock; + std::condition_variable m_requestProcessingSignal; + }; + + } // namespace Http +} // namespace Aws + + diff --git a/include/aws/core/http/HttpClientFactory.h b/include/aws/core/http/HttpClientFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..a82a773c0421203ce39d2948565d6b51959b039b --- /dev/null +++ b/include/aws/core/http/HttpClientFactory.h @@ -0,0 +1,65 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Client + { + struct ClientConfiguration; + } // namespace Client + namespace Http + { + class URI; + class HttpClient; + class HttpRequest; + + /** + * Interface and default implementation of client for Http stack + */ + class AWS_CORE_API HttpClientFactory + { + public: + virtual ~HttpClientFactory() {} + + /** + * Creates a shared_ptr of HttpClient with the relevant settings from clientConfiguration + */ + virtual std::shared_ptr CreateHttpClient(const Aws::Client::ClientConfiguration& clientConfiguration) const = 0; + /** + * Creates a shared_ptr of HttpRequest with uri, method, and closure for how to create a response stream. + */ + virtual std::shared_ptr CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory) const = 0; + /** + * Creates a shared_ptr of HttpRequest with uri, method, and closure for how to create a response stream. + */ + virtual std::shared_ptr CreateHttpRequest(const URI& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory) const = 0; + + virtual void InitStaticState() {} + virtual void CleanupStaticState() {} + }; + + /** + * libCurl infects everything with its global state. If it is being used then we automatically initialize and clean it up. + * If this is a problem for you, set this to false. If you manually initialize libcurl please add the option CURL_GLOBAL_ALL to your init call. + */ + AWS_CORE_API void SetInitCleanupCurlFlag(bool initCleanupFlag); + AWS_CORE_API void SetInstallSigPipeHandlerFlag(bool installHandler); + AWS_CORE_API void InitHttp(); + AWS_CORE_API void CleanupHttp(); + AWS_CORE_API void SetHttpClientFactory(const std::shared_ptr& factory); + AWS_CORE_API std::shared_ptr CreateHttpClient(const Aws::Client::ClientConfiguration& clientConfiguration); + AWS_CORE_API std::shared_ptr CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory); + AWS_CORE_API std::shared_ptr CreateHttpRequest(const URI& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory); + + } // namespace Http +} // namespace Aws + diff --git a/include/aws/core/http/HttpRequest.h b/include/aws/core/http/HttpRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..6b87fb4ba2fe545068982cb1bef9652ccc9a607d --- /dev/null +++ b/include/aws/core/http/HttpRequest.h @@ -0,0 +1,627 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Crt + { + namespace Http + { + class HttpRequest; + } + } + namespace Utils + { + namespace Crypto + { + class Hash; + } + } + namespace Http + { + extern AWS_CORE_API const char DATE_HEADER[]; + extern AWS_CORE_API const char AWS_DATE_HEADER[]; + extern AWS_CORE_API const char AWS_SECURITY_TOKEN[]; + extern AWS_CORE_API const char ACCEPT_HEADER[]; + extern AWS_CORE_API const char ACCEPT_CHAR_SET_HEADER[]; + extern AWS_CORE_API const char ACCEPT_ENCODING_HEADER[]; + extern AWS_CORE_API const char AUTHORIZATION_HEADER[]; + extern AWS_CORE_API const char AWS_AUTHORIZATION_HEADER[]; + extern AWS_CORE_API const char COOKIE_HEADER[]; + extern AWS_CORE_API const char DECODED_CONTENT_LENGTH_HEADER[]; + extern AWS_CORE_API const char CONTENT_LENGTH_HEADER[]; + extern AWS_CORE_API const char CONTENT_TYPE_HEADER[]; + extern AWS_CORE_API const char CONTENT_ENCODING_HEADER[]; + extern AWS_CORE_API const char TRANSFER_ENCODING_HEADER[]; + extern AWS_CORE_API const char USER_AGENT_HEADER[]; + extern AWS_CORE_API const char VIA_HEADER[]; + extern AWS_CORE_API const char HOST_HEADER[]; + extern AWS_CORE_API const char AMZ_TARGET_HEADER[]; + extern AWS_CORE_API const char X_AMZ_EXPIRES_HEADER[]; + extern AWS_CORE_API const char CONTENT_MD5_HEADER[]; + extern AWS_CORE_API const char API_VERSION_HEADER[]; + extern AWS_CORE_API const char AWS_TRAILER_HEADER[]; + extern AWS_CORE_API const char SDK_INVOCATION_ID_HEADER[]; + extern AWS_CORE_API const char SDK_REQUEST_HEADER[]; + extern AWS_CORE_API const char X_AMZN_TRACE_ID_HEADER[]; + extern AWS_CORE_API const char CHUNKED_VALUE[]; + extern AWS_CORE_API const char AWS_CHUNKED_VALUE[]; + extern AWS_CORE_API const char X_AMZN_ERROR_TYPE[]; + extern AWS_CORE_API const char X_AMZN_QUERY_MODE[]; + + class HttpRequest; + class HttpResponse; + + /** + * closure type for receiving notifications that headers have been received. + */ + typedef std::function HeadersReceivedEventHandler; + /** + * closure type for receiving notifications that data has been received. + */ + typedef std::function DataReceivedEventHandler; + /** + * closure type for receiving notifications that data has been sent. + */ + typedef std::function DataSentEventHandler; + /** + * Closure type for handling whether or not a request should be canceled. + */ + typedef std::function ContinueRequestHandler; + + /** + * A "grab bag" of anything that requests can dynamically attach to a + * request to be used later in the call flow. + */ + struct ServiceSpecificParameters { + Aws::Map parameterMap; + }; + + /** + * Abstract class for representing an HttpRequest. + */ + class AWS_CORE_API HttpRequest + { + public: + /** + * Initializes an HttpRequest object with uri and http method. + */ + HttpRequest(const URI& uri, HttpMethod method) : + m_uri(uri), m_method(method), m_isEvenStreamRequest(false) + {} + + virtual ~HttpRequest() {} + + /** + * Get All headers for this request. + */ + virtual HeaderValueCollection GetHeaders() const = 0; + /** + * Get the value for a Header based on its name. (in default StandardHttpRequest implementation, an empty string will be returned if headerName doesn't exist) + */ + virtual const Aws::String& GetHeaderValue(const char* headerName) const = 0; + ///@{ + /** + * Add a header pair + */ + virtual void SetHeaderValue(const char* headerName, const Aws::String& headerValue) = 0; + virtual void SetHeaderValue(const Aws::String& headerName, const Aws::String& headerValue) = 0; + ///@} + + /** + * Deletes a header from the request by name. + */ + virtual void DeleteHeader(const char* headerName) = 0; + /** + * Adds a content body stream to the request. This stream will be used to send the body to the endpoint. + */ + virtual void AddContentBody(const std::shared_ptr& strContent) = 0; + /** + * Gets the content body stream that will be used for this request. + */ + virtual const std::shared_ptr& GetContentBody() const = 0; + /** + * Returns true if a header exists in the request with name + */ + virtual bool HasHeader(const char* name) const = 0; + /** + * Get size in bytes of the request when as it will be going across the wire. + */ + virtual int64_t GetSize() const = 0; + /** + * Gets the factory for creating the stream that will be used in the http response. + */ + virtual const Aws::IOStreamFactory& GetResponseStreamFactory() const = 0; + /** + * Sets the factory for creating the stream that will be used in the http response. + */ + virtual void SetResponseStreamFactory(const Aws::IOStreamFactory& factory) = 0; + /** + * Gets underlying URI object with mutation access. + */ + inline URI& GetUri() + { + return m_uri; + } + /** + * Gets the underlying URI object. + */ + const URI& GetUri() const { return m_uri; } + /** + * Converts the URI into a string and returns it. If includeQueryString is set to true, the query string + * will be included in the returned value. + */ + inline Aws::String GetURIString(bool includeQueryString = true) const + { + return m_uri.GetURIString(includeQueryString); + } + /** + * Get the http method for this request. + */ + inline HttpMethod GetMethod() const + { + return m_method; + } + /** + * Gets the query string from the URI on this request. + */ + inline const Aws::String& GetQueryString() const + { + return m_uri.GetQueryString(); + } + /** + * Normalizes the URI for use with signing. + */ + inline void CanonicalizeRequest() + { + m_uri.CanonicalizeQueryString(); + } + /** + * Gets the query string for the underlying URI as a key value mapping + */ + inline QueryStringParameterCollection GetQueryStringParameters() const + { + return m_uri.GetQueryStringParameters(); + } + /** + * Adds a query string parameter to the underlying URI by key and value. + */ + inline void AddQueryStringParameter(const char* key, const Aws::String& value) + { + m_uri.AddQueryStringParameter(key, value); + } + + inline bool HasDate() const + { + return HasHeader(DATE_HEADER); + } + /** + * Gets date header. + */ + inline const Aws::String& GetDate() const + { + return GetHeaderValue(DATE_HEADER); + } + /** + * Gets date header. + */ + inline void SetDate(const Aws::String& value) + { + SetHeaderValue(DATE_HEADER, value); + } + + inline bool HasAccept() const + { + return HasHeader(ACCEPT_HEADER); + } + /** + * Gets accept header. + */ + inline const Aws::String& GetAccept() const + { + return GetHeaderValue(ACCEPT_HEADER); + } + /** + * Gets accept header. + */ + inline void SetAccept(const Aws::String& value) + { + SetHeaderValue(ACCEPT_HEADER, value); + } + + inline bool HasAcceptCharSet() const + { + return HasHeader(ACCEPT_CHAR_SET_HEADER); + } + /** + * Gets Accept CharSet header. + */ + inline const Aws::String& GetAcceptCharSet() const + { + return GetHeaderValue(ACCEPT_CHAR_SET_HEADER); + } + /** + * Sets Accept CharSet header. + */ + inline void SetAcceptCharSet(const Aws::String& value) + { + SetHeaderValue(ACCEPT_CHAR_SET_HEADER, value); + } + + inline bool HasAcceptEncoding() const + { + return HasHeader(ACCEPT_ENCODING_HEADER); + } + /** + * Gets accept encoding header. + */ + inline const Aws::String& GetAcceptEncoding() const + { + return GetHeaderValue(ACCEPT_ENCODING_HEADER); + } + /** + * Sets accept encoding header. + */ + inline void SetAcceptEncoding(const Aws::String& value) + { + SetHeaderValue(ACCEPT_ENCODING_HEADER, value); + } + + inline bool HasAuthorization() const + { + return HasHeader(AUTHORIZATION_HEADER); + } + /** + * Gets authorization encoding header. + */ + inline const Aws::String& GetAuthorization() const + { + return GetHeaderValue(AUTHORIZATION_HEADER); + } + /** + * Set authorization header. + */ + inline void SetAuthorization(const Aws::String& value) + { + SetHeaderValue(AUTHORIZATION_HEADER, value); + } + + inline bool HasAwsAuthorization() const + { + return HasHeader(AWS_AUTHORIZATION_HEADER); + } + /** + * Gets aws authorization header. + */ + inline const Aws::String& GetAwsAuthorization() const + { + return GetHeaderValue(AWS_AUTHORIZATION_HEADER); + } + /** + * Sets aws authorization header. + */ + inline void SetAwsAuthorization(const Aws::String& value) + { + SetHeaderValue(AWS_AUTHORIZATION_HEADER, value); + } + + inline bool HasAwsSessionToken() const + { + return HasHeader(AWS_SECURITY_TOKEN); + } + /** + * Gets session token header. + */ + inline const Aws::String& GetAwsSessionToken() const + { + return GetHeaderValue(AWS_SECURITY_TOKEN); + } + /** + * Sets session token header. + */ + inline void SetAwsSessionToken(const Aws::String& value) + { + SetHeaderValue(AWS_SECURITY_TOKEN, value); + } + + inline bool HasCookie() const + { + return HasHeader(COOKIE_HEADER); + } + /** + * Gets cookie header. + */ + inline const Aws::String& GetCookie() const + { + return GetHeaderValue(COOKIE_HEADER); + } + /** + * Sets cookie header. + */ + inline void SetCookie(const Aws::String& value) + { + SetHeaderValue(COOKIE_HEADER, value); + } + + inline bool HasContentLength() const + { + return HasHeader(CONTENT_LENGTH_HEADER); + } + /** + * Gets content-length header. + */ + inline const Aws::String& GetContentLength() const + { + return GetHeaderValue(CONTENT_LENGTH_HEADER); + } + /** + * Sets content-length header. + */ + inline void SetContentLength(const Aws::String& value) + { + SetHeaderValue(CONTENT_LENGTH_HEADER, value); + } + + inline bool HasContentType() const + { + return HasHeader(CONTENT_TYPE_HEADER); + } + /** + * Gets content-type header. + */ + inline const Aws::String& GetContentType() const + { + return GetHeaderValue(CONTENT_TYPE_HEADER); + } + /** + * sets content-type header. + */ + inline void SetContentType(const Aws::String& value) + { + SetHeaderValue(CONTENT_TYPE_HEADER, value); + } + + /** + * Has content-encoding header. + */ + inline bool HasContentEncoding() const { return HasHeader(CONTENT_ENCODING_HEADER); } + /** + * Gets content-encoding header. + */ + inline const Aws::String& GetContentEncoding() const { return GetHeaderValue(CONTENT_ENCODING_HEADER); } + /** + * Sets content-encoding header. + */ + inline void SetContentEncoding(const Aws::String& value) { SetHeaderValue(CONTENT_ENCODING_HEADER, value); } + + inline bool HasTransferEncoding() const + { + return HasHeader(TRANSFER_ENCODING_HEADER); + } + /** + * Gets transfer-encoding header. + */ + inline const Aws::String& GetTransferEncoding() const + { + return GetHeaderValue(TRANSFER_ENCODING_HEADER); + } + /** + * Sets transfer-encoding header. + */ + inline void SetTransferEncoding(const Aws::String& value) + { + SetHeaderValue(TRANSFER_ENCODING_HEADER, value); + } + + inline bool HasUserAgent() const + { + return HasHeader(USER_AGENT_HEADER); + } + /** + * Gets User Agent header. + */ + inline const Aws::String& GetUserAgent() const + { + return GetHeaderValue(USER_AGENT_HEADER); + } + /** + * Sets User Agent header. + */ + inline void SetUserAgent(const Aws::String& value) + { + SetHeaderValue(USER_AGENT_HEADER, value); + } + + inline bool HasVia() const + { + return HasHeader(VIA_HEADER); + } + /** + * Gets via header header. + */ + inline const Aws::String& GetVia() const + { + return GetHeaderValue(VIA_HEADER); + } + /** + * Sets via header. + */ + inline void SetVia(const Aws::String& value) + { + SetHeaderValue(VIA_HEADER, value); + } + + /** + * Has Api version header x-amz-api-version + */ + inline bool HasApiVersion() const + { + return HasHeader(API_VERSION_HEADER); + } + + /** + * Gets Api version header x-amz-api-version. + */ + inline const Aws::String& GetApiVersion() const + { + return GetHeaderValue(API_VERSION_HEADER); + } + /** + * Sets Api version header x-amz-api-version. + */ + inline void SetApiVersion(const Aws::String& value) + { + SetHeaderValue(API_VERSION_HEADER, value); + } + + ///@{ + /** + * Sets the closure for receiving events when headers are received from the server. + */ + inline void SetHeadersReceivedEventHandler(const HeadersReceivedEventHandler& headersReceivedEventHandler) { m_onHeadersReceived = headersReceivedEventHandler; } + inline void SetHeadersReceivedEventHandler(HeadersReceivedEventHandler&& headersReceivedEventHandler) { m_onHeadersReceived = std::move(headersReceivedEventHandler); } + ///@} + + ///@{ + /** + * Sets the closure for receiving events when data is received from the server. + */ + inline void SetDataReceivedEventHandler(const DataReceivedEventHandler& dataReceivedEventHandler) { m_onDataReceived = dataReceivedEventHandler; } + inline void SetDataReceivedEventHandler(DataReceivedEventHandler&& dataReceivedEventHandler) { m_onDataReceived = std::move(dataReceivedEventHandler); } + ///@} + + ///@{ + /** + * Sets the closure for receiving events when data is sent to the server. + */ + inline void SetDataSentEventHandler(const DataSentEventHandler& dataSentEventHandler) { m_onDataSent = dataSentEventHandler; } + inline void SetDataSentEventHandler(DataSentEventHandler&& dataSentEventHandler) { m_onDataSent = std::move(dataSentEventHandler); } + ///@} + + ///@{ + /** + * Sets the closure for handling whether or not to cancel a request. + */ + inline void SetContinueRequestHandle(const ContinueRequestHandler& continueRequestHandler) { m_continueRequest = continueRequestHandler; } + inline void SetContinueRequestHandle(ContinueRequestHandler&& continueRequestHandler) { m_continueRequest = std::move(continueRequestHandler); } + ///@} + + /** + * Gets the closure for receiving events when headers are received from the server. + */ + inline const HeadersReceivedEventHandler & GetHeadersReceivedEventHandler() const { return m_onHeadersReceived; } + /** + * Gets the closure for receiving events when data is received from the server. + */ + inline const DataReceivedEventHandler& GetDataReceivedEventHandler() const { return m_onDataReceived; } + /** + * Gets the closure for receiving events when data is sent to the server. + */ + inline const DataSentEventHandler& GetDataSentEventHandler() const { return m_onDataSent; } + + inline const ContinueRequestHandler& GetContinueRequestHandler() const { return m_continueRequest; } + + /** + * Gets the AWS Access Key if this HttpRequest is signed with Aws Access Key + */ + inline const Aws::String& GetSigningAccessKey() const { return m_signingAccessKey; } + /** + * Sets the Aws Access Key if this HttpRequest is signed with Aws Access Key + */ + inline void SetSigningAccessKey(const Aws::String& accessKey) { m_signingAccessKey = accessKey; } + + /** + * Gets the signing region if this request is signed. + */ + inline const Aws::String& GetSigningRegion() const { return m_signingRegion; } + /** + * Sets the signing region if this request is signed. + */ + inline void SetSigningRegion(const Aws::String& region) { m_signingRegion = region; } + + /** + * Add a request metric + * @param key, HttpClientMetricsKey defined in HttpClientMetrics.cpp + * @param value, the corresponding value of this key measured during http request. + */ + virtual void AddRequestMetric(const Aws::String& key, int64_t value) { m_httpRequestMetrics.emplace(key, value); } + + /** + * Sets the request metrics + */ + virtual void SetRequestMetrics(const Aws::Monitoring::HttpClientMetricsCollection& collection) { m_httpRequestMetrics = collection; } + + /** + * Gets the request metrics + */ + virtual const Aws::Monitoring::HttpClientMetricsCollection& GetRequestMetrics() const { return m_httpRequestMetrics; } + + /** + * Returns the IP address of the remote host the request was made out to. + * This value is populated after the request is made and when the HTTP client supports retrieving such + * information. + * If the information is not available, an empty string is returned. + */ + Aws::String GetResolvedRemoteHost() const { return m_resolvedRemoteHost; } + void SetResolvedRemoteHost(const Aws::String& ip) { m_resolvedRemoteHost = ip; } + + bool IsEventStreamRequest() { return m_isEvenStreamRequest; } + void SetEventStreamRequest(bool eventStreamRequest) { m_isEvenStreamRequest = eventStreamRequest; } + + bool HasEventStreamResponse() { return m_hasEvenStreamResponse; } + void SetHasEventStreamResponse(bool hasEventStreamResponse) { m_hasEvenStreamResponse = hasEventStreamResponse; } + + virtual std::shared_ptr ToCrtHttpRequest(); + + void SetRequestHash(const Aws::String& algorithmName, const std::shared_ptr& hash) + { + m_requestHash = std::make_pair(algorithmName, hash); + } + const std::pair>& GetRequestHash() const { return m_requestHash; } + + void AddResponseValidationHash(const Aws::String& algorithmName, const std::shared_ptr& hash) + { + m_responseValidationHashes.emplace_back(algorithmName, hash); + } + const Aws::Vector>>& GetResponseValidationHashes() const { return m_responseValidationHashes; } + + inline void SetServiceSpecificParameters(const std::shared_ptr &serviceSpecificParameters) { m_serviceSpecificParameters = serviceSpecificParameters; } + + inline std::shared_ptr GetServiceSpecificParameters() { return m_serviceSpecificParameters; } + + private: + URI m_uri; + HttpMethod m_method; + bool m_isEvenStreamRequest = false; + bool m_hasEvenStreamResponse{false}; + HeadersReceivedEventHandler m_onHeadersReceived; + DataReceivedEventHandler m_onDataReceived; + DataSentEventHandler m_onDataSent; + ContinueRequestHandler m_continueRequest; + Aws::String m_signingRegion; + Aws::String m_signingAccessKey; + Aws::String m_resolvedRemoteHost; + Aws::Monitoring::HttpClientMetricsCollection m_httpRequestMetrics; + std::pair> m_requestHash; + Aws::Vector>> m_responseValidationHashes; + std::shared_ptr m_serviceSpecificParameters; + }; + + } // namespace Http +} // namespace Aws diff --git a/include/aws/core/http/HttpResponse.h b/include/aws/core/http/HttpResponse.h new file mode 100644 index 0000000000000000000000000000000000000000..fc56f4ae34cfadd0b6bbba6ec6b2385228e03c1a --- /dev/null +++ b/include/aws/core/http/HttpResponse.h @@ -0,0 +1,234 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Stream + { + class ResponseStream; + } + } + namespace Http + { + /** + * Enum of Http response Codes. The integer values of the response codes correspond to the values in the RFC. + */ + enum class HttpResponseCode + { + REQUEST_NOT_MADE = -1, + CONTINUE = 100, + SWITCHING_PROTOCOLS = 101, + PROCESSING = 102, + OK = 200, + CREATED = 201, + ACCEPTED = 202, + NON_AUTHORITATIVE_INFORMATION = 203, + NO_CONTENT = 204, + RESET_CONTENT = 205, + PARTIAL_CONTENT = 206, + MULTI_STATUS = 207, + ALREADY_REPORTED = 208, + IM_USED = 226, + MULTIPLE_CHOICES = 300, + MOVED_PERMANENTLY = 301, + FOUND = 302, + SEE_OTHER = 303, + NOT_MODIFIED = 304, + USE_PROXY = 305, + SWITCH_PROXY = 306, + TEMPORARY_REDIRECT = 307, + PERMANENT_REDIRECT = 308, + BAD_REQUEST = 400, + UNAUTHORIZED = 401, + PAYMENT_REQUIRED = 402, + FORBIDDEN = 403, + NOT_FOUND = 404, + METHOD_NOT_ALLOWED = 405, + NOT_ACCEPTABLE = 406, + PROXY_AUTHENTICATION_REQUIRED = 407, + REQUEST_TIMEOUT = 408, + CONFLICT = 409, + GONE = 410, + LENGTH_REQUIRED = 411, + PRECONDITION_FAILED = 412, + REQUEST_ENTITY_TOO_LARGE = 413, + REQUEST_URI_TOO_LONG = 414, + UNSUPPORTED_MEDIA_TYPE = 415, + REQUESTED_RANGE_NOT_SATISFIABLE = 416, + EXPECTATION_FAILED = 417, + IM_A_TEAPOT = 418, + AUTHENTICATION_TIMEOUT = 419, + METHOD_FAILURE = 420, + UNPROC_ENTITY = 422, + LOCKED = 423, + FAILED_DEPENDENCY = 424, + UPGRADE_REQUIRED = 426, + PRECONDITION_REQUIRED = 427, + TOO_MANY_REQUESTS = 429, + REQUEST_HEADER_FIELDS_TOO_LARGE = 431, + LOGIN_TIMEOUT = 440, + NO_RESPONSE = 444, + RETRY_WITH = 449, + BLOCKED = 450, + REDIRECT = 451, + REQUEST_HEADER_TOO_LARGE = 494, + CERT_ERROR = 495, + NO_CERT = 496, + HTTP_TO_HTTPS = 497, + CLIENT_CLOSED_TO_REQUEST = 499, + INTERNAL_SERVER_ERROR = 500, + NOT_IMPLEMENTED = 501, + BAD_GATEWAY = 502, + SERVICE_UNAVAILABLE = 503, + GATEWAY_TIMEOUT = 504, + HTTP_VERSION_NOT_SUPPORTED = 505, + VARIANT_ALSO_NEGOTIATES = 506, + INSUFFICIENT_STORAGE = 507, + LOOP_DETECTED = 508, + BANDWIDTH_LIMIT_EXCEEDED = 509, + NOT_EXTENDED = 510, + NETWORK_AUTHENTICATION_REQUIRED = 511, + NETWORK_READ_TIMEOUT = 598, + NETWORK_CONNECT_TIMEOUT = 599 + }; + + /** + * Overload ostream operator<< for HttpResponseCode enum class for a prettier output such as "200" + */ + AWS_CORE_API Aws::OStream& operator<< (Aws::OStream& oStream, HttpResponseCode code); + + inline bool IsRetryableHttpResponseCode(HttpResponseCode responseCode) + { + switch (responseCode) + { + case HttpResponseCode::INTERNAL_SERVER_ERROR: + case HttpResponseCode::SERVICE_UNAVAILABLE: + case HttpResponseCode::BAD_GATEWAY: + case HttpResponseCode::TOO_MANY_REQUESTS: + case HttpResponseCode::BANDWIDTH_LIMIT_EXCEEDED: + case HttpResponseCode::REQUEST_TIMEOUT: + case HttpResponseCode::AUTHENTICATION_TIMEOUT: + case HttpResponseCode::LOGIN_TIMEOUT: + case HttpResponseCode::GATEWAY_TIMEOUT: + case HttpResponseCode::NETWORK_READ_TIMEOUT: + case HttpResponseCode::NETWORK_CONNECT_TIMEOUT: + return true; + default: + return false; + } + } + + /** + * Abstract class for representing an Http Response. + */ + class AWS_CORE_API HttpResponse + { + public: + /** + * Initializes an http response with the originalRequest and the response code. + */ + HttpResponse(const std::shared_ptr& originatingRequest) : + m_httpRequest(originatingRequest), + m_responseCode(HttpResponseCode::REQUEST_NOT_MADE), + m_hasClientError(false), + m_clientErrorType(Aws::Client::CoreErrors::OK) + {} + + virtual ~HttpResponse() = default; + + /** + * Gets the request that originated this response + */ + virtual inline const HttpRequest& GetOriginatingRequest() const { return *m_httpRequest; } + + /** + * Sets the request that originated this response + */ + virtual inline void SetOriginatingRequest(const std::shared_ptr& httpRequest) { m_httpRequest = httpRequest; } + + /** + * Get the headers from this response + */ + virtual HeaderValueCollection GetHeaders() const = 0; + /** + * Returns true if the response contains a header by headerName + */ + virtual bool HasHeader(const char* headerName) const = 0; + /** + * Returns the value for a header at headerName if it exists. + */ + virtual const Aws::String& GetHeader(const Aws::String& headerName) const = 0; + /** + * Gets response code for this http response. + */ + virtual inline HttpResponseCode GetResponseCode() const { return m_responseCode; } + /** + * Sets the response code for this http response. + */ + virtual inline void SetResponseCode(HttpResponseCode httpResponseCode) { m_responseCode = httpResponseCode; } + /** + * Gets the content-type of the response body + */ + virtual const Aws::String& GetContentType() const { return GetHeader(Http::CONTENT_TYPE_HEADER); } + /** + * Gets the response body of the response. + */ + virtual Aws::IOStream& GetResponseBody() const = 0; + /** + * Gives full control of the memory of the ResponseBody over to the caller. At this point, it is the caller's + * responsibility to clean up this object. + */ + virtual Utils::Stream::ResponseStream&& SwapResponseStreamOwnership() = 0; + /** + * Adds a header to the http response object. + */ + virtual void AddHeader(const Aws::String&, const Aws::String&) = 0; + /** + * Add a header to the http response object, and move the value. + * The name can't be moved as it is converted to lower-case. + * + * It isn't pure virtual for backwards compatiblity reasons, but the StandardHttpResponse used by default in the SDK + * implements the move. + */ + virtual void AddHeader(const Aws::String& headerName, Aws::String&& headerValue) { AddHeader(headerName, headerValue); }; + /** + * Sets the content type header on the http response object. + */ + virtual void SetContentType(const Aws::String& contentType) { AddHeader("content-type", contentType); } + + inline bool HasClientError() const { return m_hasClientError; } + inline void SetClientErrorType(Aws::Client::CoreErrors errorType) {m_hasClientError = true; m_clientErrorType = errorType;} + inline Aws::Client::CoreErrors GetClientErrorType() { return m_clientErrorType; } + + inline const Aws::String &GetClientErrorMessage() const { return m_clientErrorMessage; } + inline void SetClientErrorMessage(const Aws::String &error) { m_clientErrorMessage = error; } + + private: + HttpResponse(const HttpResponse&); + HttpResponse& operator = (const HttpResponse&); + + std::shared_ptr m_httpRequest; + HttpResponseCode m_responseCode; + // Error generated by http client, SDK or users, indicating non service error during http request + bool m_hasClientError; + Aws::Client::CoreErrors m_clientErrorType; + Aws::String m_clientErrorMessage; + }; + + } // namespace Http +} // namespace Aws + + diff --git a/include/aws/core/http/HttpTypes.h b/include/aws/core/http/HttpTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..1c139fe9270d29a7d07c63b7883eca04f80aa446 --- /dev/null +++ b/include/aws/core/http/HttpTypes.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include + +#include + +namespace Aws +{ + namespace Http + { + /** + * Models Http methods. + */ + enum class HttpMethod { + HTTP_GET, + HTTP_POST, + HTTP_DELETE, + HTTP_PUT, + HTTP_HEAD, + HTTP_PATCH, + HTTP_CONNECT, + HTTP_OPTIONS, + HTTP_TRACE, + }; + + /** + * Possible default http factory vended http client implementations. + */ + enum class TransferLibType { DEFAULT_CLIENT = 0, CURL_CLIENT, WIN_INET_CLIENT, WIN_HTTP_CLIENT }; + + /** + * Configuration for a HTTP client, currently used only by libCurl + */ + enum class TransferLibPerformanceMode { + LOW_LATENCY = 0, // run http client for a lower latency, at the expense of CPU + REGULAR + }; + + namespace HttpMethodMapper { + /** + * Gets the string value of an httpMethod. + */ + AWS_CORE_API const char* GetNameForHttpMethod(HttpMethod httpMethod); + } // namespace HttpMethodMapper + + typedef std::pair HeaderValuePair; + typedef Aws::Map HeaderValueCollection; + + } // namespace Http +} // namespace Aws + diff --git a/include/aws/core/http/Scheme.h b/include/aws/core/http/Scheme.h new file mode 100644 index 0000000000000000000000000000000000000000..a0ec88ad16b915c35e8205f30fe74fe67d1dec77 --- /dev/null +++ b/include/aws/core/http/Scheme.h @@ -0,0 +1,38 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +namespace Aws +{ + namespace Http + { + /** + * Enum representing URI scheme. + */ + enum class Scheme + { + HTTP, + HTTPS + }; + + namespace SchemeMapper + { + /** + * Converts a Scheme instance to a String. + */ + AWS_CORE_API const char* ToString(Scheme scheme); + /** + * Converts a string instance to a Scheme. Defaults to https. + */ + AWS_CORE_API Scheme FromString(const char* name); + } // namespace SchemeMapper + } // namespace Http +} // namespace Aws + diff --git a/include/aws/core/http/URI.h b/include/aws/core/http/URI.h new file mode 100644 index 0000000000000000000000000000000000000000..5b674d94c45025bda616f830c23c556e9eb6a6a3 --- /dev/null +++ b/include/aws/core/http/URI.h @@ -0,0 +1,236 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include + +#include + +namespace Aws +{ + namespace Http + { + extern AWS_CORE_API const char* SEPARATOR; + static const uint16_t HTTP_DEFAULT_PORT = 80; + static const uint16_t HTTPS_DEFAULT_PORT = 443; + + extern bool s_compliantRfc3986Encoding; + AWS_CORE_API void SetCompliantRfc3986Encoding(bool compliant); + + extern AWS_CORE_API bool s_preservePathSeparators; + AWS_CORE_API void SetPreservePathSeparators(bool preservePathSeparators); + + //per https://tools.ietf.org/html/rfc3986#section-3.4 there is nothing preventing servers from allowing + //multiple values for the same key. So use a multimap instead of a map. + typedef Aws::MultiMap QueryStringParameterCollection; + + /** + * class modeling universal resource identifier, but implemented for http + */ + class AWS_CORE_API URI + { + public: + /** + * Defaults to http and port 80 + */ + URI(); + /** + * Parses string and sets uri fields + */ + URI(const Aws::String&); + /** + * Parses string and sets uri fields + */ + URI(const char*); + + URI& operator = (const Aws::String&); + URI& operator = (const char*); + + bool operator == (const URI&) const; + bool operator == (const Aws::String&) const; + bool operator == (const char*) const; + bool operator != (const URI&) const; + bool operator != (const Aws::String&) const; + bool operator != (const char*) const; + + /** + * scheme or protocol e.g. http, https, ftp + */ + inline Scheme GetScheme() const { return m_scheme; } + + /** + * Sets scheme, if the port is incompatible with this scheme, the port will automatically be set as well. + */ + void SetScheme(Scheme value); + + /** + * Gets the domain portion of the uri + */ + inline const Aws::String& GetAuthority() const { return m_authority; } + + /** + * Sets the domain portion of the uri + */ + inline void SetAuthority(const Aws::String& value) { m_authority = value; } + + /** + * Gets the port portion of the uri, defaults to 22 for ftp, 80 for http and 443 for https + */ + inline uint16_t GetPort() const { return m_port; } + + /** + * Sets the port portion of the uri, normally you will not have to do this. If the scheme is set to ftp, http + * or https then the default ports will be set. + */ + inline void SetPort(uint16_t value) { m_port = value; } + + /** + * Gets the path portion of the uri e.g. the portion after the first slash after the authority and prior to the + * query string. This is not url encoded. + */ + Aws::String GetPath() const; + + /** + * Gets the path portion of the uri, url encodes it and returns it + */ + Aws::String GetURLEncodedPath() const; + + /** + * Gets the path portion of the uri, url encodes it according to RFC3986 and returns it. + */ + Aws::String GetURLEncodedPathRFC3986() const; + + /** + * Sets the path portion of the uri. URL encodes it if needed + */ + void SetPath(const Aws::String& value); + + /** + * Add a path segment to the uri. + * Leading slashes and trailing slashes will be removed. + * Use AddPathSegments() to enable trailing slashes. + */ + template + inline void AddPathSegment(T pathSegment) + { + Aws::StringStream ss; + ss << pathSegment; + Aws::String segment = ss.str(); + segment.erase(0, segment.find_first_not_of('/')); + segment.erase(segment.find_last_not_of('/') + 1); + m_pathSegments.push_back(segment); + m_pathHasTrailingSlash = false; + } + + /** + * Add path segments to the uri. + */ + template + inline void AddPathSegments(T pathSegments) + { + Aws::StringStream ss; + ss << pathSegments; + Aws::String segments = ss.str(); + const auto splitOption = s_preservePathSeparators + ? Utils::StringUtils::SplitOptions::INCLUDE_EMPTY_SEGMENTS + : Utils::StringUtils::SplitOptions::NOT_SET; + // Preserve legacy behavior -- we need to remove a leading "/" if use `INCLUDE_EMPTY_SEGMENTS` is specified + // because string split will no longer ignore leading delimiters -- which is correct. + auto split = Aws::Utils::StringUtils::Split(segments, '/', splitOption); + if (s_preservePathSeparators && m_pathSegments.empty() && !split.empty() && split.front().empty() && !m_pathHasTrailingSlash) { + split.erase(split.begin()); + } + for (const auto& segment: split) + { + m_pathSegments.push_back(segment); + } + m_pathHasTrailingSlash = (!segments.empty() && segments.back() == '/'); + } + + /** + * Gets the raw query string including the ? + */ + inline const Aws::String& GetQueryString() const { return m_queryString; } + + /** + * Resets the query string to the raw string. all query string manipulations made before this call will be lost + */ + void SetQueryString(const Aws::String& str); + + Aws::String GetFormParameters() const; + + /** + * Canonicalizes the query string. + */ + void CanonicalizeQueryString(); + + /** + * parses query string and returns url decoded key/value mappings from it. Spaces and all url encoded + * values will not be encoded. + */ + QueryStringParameterCollection GetQueryStringParameters(bool decode = true) const; + + /** + * Adds query string parameter to underlying query string. + */ + void AddQueryStringParameter(const char* key, const Aws::String& value); + + /** + * Adds multiple query string parameters to underlying query string. + */ + void AddQueryStringParameter(const Aws::Map& queryStringPairs); + + /** + * Converts the URI to a String usable for its context. e.g. an http request. + */ + Aws::String GetURIString(bool includeQueryString = true) const; + + /** + * Returns true if this URI is going to be encoded in Rfc3986 compliant mode + */ + inline bool IsRfc3986Encoded() const { return m_useRfcEncoding; } + + /** + * Sets Rfc3986 compliant encoding mode. False (i.e. use legacy encoding with some chars unescaped) is the default. + */ + inline void SetRfc3986Encoded(const bool value) { m_useRfcEncoding = value; } + + /** + * URLEncodes the path portions of path (doesn't encode the "/" portion) + * Keeps the first and the last "/". + */ + static Aws::String URLEncodePath(const Aws::String& path); + + /** + * URLEncodes the path portion of the URI according to RFC3986 + */ + static Aws::String URLEncodePathRFC3986(const Aws::String& path, bool rfcCompliantEncoding = false); + + private: + void ParseURIParts(const Aws::String& uri); + void ExtractAndSetScheme(const Aws::String& uri); + void ExtractAndSetAuthority(const Aws::String& uri); + void ExtractAndSetPort(const Aws::String& uri); + void ExtractAndSetPath(const Aws::String& uri); + void ExtractAndSetQueryString(const Aws::String& uri); + bool CompareURIParts(const URI& other) const; + + Scheme m_scheme = Scheme::HTTP; + Aws::String m_authority; + uint16_t m_port = HTTP_DEFAULT_PORT; + Aws::Vector m_pathSegments; + bool m_pathHasTrailingSlash = false; + bool m_useRfcEncoding = false; + Aws::String m_queryString; + }; + + } // namespace Http +} // namespace Aws + diff --git a/include/aws/core/http/Version.h b/include/aws/core/http/Version.h new file mode 100644 index 0000000000000000000000000000000000000000..b89fd8f8fde3ecd14788464ec56ca8ed1e05dd45 --- /dev/null +++ b/include/aws/core/http/Version.h @@ -0,0 +1,33 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +namespace Aws { + namespace Http { + /** + * Enum to represent version of the http protocol to use + */ + +#ifdef _WIN32 +#pragma push_macro("WIN_HTTP_VERSION") +#undef HTTP_VERSION_1_0 +#undef HTTP_VERSION_1_1 +#undef HTTP_VERSION_2_0 + +#pragma pop_macro("WIN_HTTP_VERSION") +#endif //#ifdef _WIN32 + enum class Version { + HTTP_VERSION_NONE, + HTTP_VERSION_1_0, + HTTP_VERSION_1_1, + HTTP_VERSION_2_0, + HTTP_VERSION_2TLS, + HTTP_VERSION_2_PRIOR_KNOWLEDGE, + HTTP_VERSION_3, + HTTP_VERSION_3ONLY, + }; + } +} diff --git a/include/aws/core/http/curl/CurlHandleContainer.h b/include/aws/core/http/curl/CurlHandleContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..3ce921b57db1c9df65c79861a79eb7445bcfbcb7 --- /dev/null +++ b/include/aws/core/http/curl/CurlHandleContainer.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +#include +#include + +namespace Aws +{ +namespace Http +{ + +/** + * Simple Connection pool manager for Curl. It maintains connections in a thread safe manner. You + * can call into acquire a handle, then put it back when finished. It is assumed that reusing an already + * initialized handle is preferable (especially for synchronous clients). The pool doubles in capacity as + * needed up to the maximum amount of connections. + */ +class CurlHandleContainer +{ +public: + /** + * Initializes an empty stack of CURL handles. If you are only making synchronous calls via your http client + * then a small size is best. For async support, a good value would be 6 * number of Processors. * + */ + CurlHandleContainer(unsigned maxSize = 50, long httpRequestTimeout = 0, long connectTimeout = 1000, bool tcpKeepAlive = true, + unsigned long tcpKeepAliveIntervalMs = 30000, long lowSpeedTime = 3000, unsigned long lowSpeedLimit = 1, + Version version = Version::HTTP_VERSION_2TLS); + ~CurlHandleContainer(); + + /** + * Blocks until a curl handle from the pool is available for use. + */ + CURL* AcquireCurlHandle(); + /** + * Returns a handle to the pool for reuse. It is imperative that this is called + * after you are finished with the handle. + */ + void ReleaseCurlHandle(CURL* handle); + + /** + * When the handle has bad DNS entries, problematic live connections, we need to destroy the handle from pool. + */ + void DestroyCurlHandle(CURL* handle); + +private: + CurlHandleContainer(const CurlHandleContainer&) = delete; + const CurlHandleContainer& operator = (const CurlHandleContainer&) = delete; + CurlHandleContainer(const CurlHandleContainer&&) = delete; + const CurlHandleContainer& operator = (const CurlHandleContainer&&) = delete; + + CURL* CreateCurlHandleInPool(); + bool CheckAndGrowPool(); + void SetDefaultOptionsOnHandle(CURL* handle); + static long ConvertHttpVersion(Version version); + + Aws::Utils::ExclusiveOwnershipResourceManager m_handleContainer; + unsigned m_maxPoolSize; + unsigned long m_httpRequestTimeout; + unsigned long m_connectTimeout; + bool m_enableTcpKeepAlive; + unsigned long m_tcpKeepAliveIntervalMs; + unsigned long m_lowSpeedTime; + unsigned long m_lowSpeedLimit; + unsigned m_poolSize; + std::mutex m_containerLock; + Version m_version; +}; + +} // namespace Http +} // namespace Aws + diff --git a/include/aws/core/http/curl/CurlHttpClient.h b/include/aws/core/http/curl/CurlHttpClient.h new file mode 100644 index 0000000000000000000000000000000000000000..924cd59d830bd4c113a46f4328cdafd2220b2a89 --- /dev/null +++ b/include/aws/core/http/curl/CurlHttpClient.h @@ -0,0 +1,88 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ +namespace Standard +{ + class StandardHttpResponse; +} + +//Curl implementation of an http client. Right now it is only synchronous. +class AWS_CORE_API CurlHttpClient: public HttpClient +{ +public: + + using Base = HttpClient; + + //Creates client, initializes curl handle if it hasn't been created already. + CurlHttpClient(const Aws::Client::ClientConfiguration& clientConfig); + + //Makes request and receives response synchronously + std::shared_ptr MakeRequest(const std::shared_ptr& request, + Aws::Utils::RateLimits::RateLimiterInterface* readLimiter = nullptr, + Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter = nullptr) const override; + + static void InitGlobalState(); + static void CleanupGlobalState(); + +protected: + /** + * Override any configuration on CURL handle for each request before sending. + * The usage is to have a subclass of CurlHttpClient and have your own implementation of this function to configure whatever you want on CURL handle. + */ + virtual void OverrideOptionsOnConnectionHandle(CURL*) const {} + +private: + mutable CurlHandleContainer m_curlHandleContainer; + bool m_isAllowSystemProxy = false; + bool m_isUsingProxy = false; + Aws::String m_proxyUserName; + Aws::String m_proxyPassword; + Aws::String m_proxyScheme; + Aws::String m_proxyHost; + Aws::String m_proxySSLCertPath; + Aws::String m_proxySSLCertType; + Aws::String m_proxySSLKeyPath; + Aws::String m_proxySSLKeyType; + Aws::String m_proxyKeyPasswd; + unsigned m_proxyPort = 0; + Aws::String m_nonProxyHosts; + bool m_verifySSL = true; + Aws::String m_caPath; + Aws::String m_caFile; + Aws::String m_proxyCaPath; + Aws::String m_proxyCaFile; + bool m_disableExpectHeader = false; + bool m_allowRedirects = false; + bool m_enableHttpClientTrace = false; + Aws::Http::TransferLibPerformanceMode m_perfMode = TransferLibPerformanceMode::LOW_LATENCY; + static std::atomic isInit; + std::shared_ptr m_telemetryProvider; + +#if LIBCURL_VERSION_NUM >= 0x072000 // 7.32.0 + static int CurlProgressCallback(void *userdata, curl_off_t, curl_off_t, curl_off_t, curl_off_t); +#else + static int CurlProgressCallback(void *userdata, double, double, double, double); +#endif +}; + +using PlatformHttpClient = CurlHttpClient; + +} // namespace Http +} // namespace Aws + diff --git a/include/aws/core/http/standard/StandardHttpRequest.h b/include/aws/core/http/standard/StandardHttpRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..adf10fd182f68e946c53fcfe2603f49b36c1a1ed --- /dev/null +++ b/include/aws/core/http/standard/StandardHttpRequest.h @@ -0,0 +1,88 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Http + { + namespace Standard + { + /** + * Simple STL container modeling of HttpRequest. Implementation of the HttpRequest interface. + */ + class AWS_CORE_API StandardHttpRequest : public HttpRequest + { + public: + /** + * Initializes an HttpRequest object with uri and http method. + */ + StandardHttpRequest(const URI& uri, HttpMethod method); + + /** + * Get All headers for this request. + */ + virtual HeaderValueCollection GetHeaders() const override; + /** + * Get the value for a Header based on its name. + * This function doesn't check the existence of headerName. + * So make sure you call HasHeader() first before calling this function, otherwise the behavior is undefined. + */ + virtual const Aws::String& GetHeaderValue(const char* headerName) const override; + /** + * Add a header pair + */ + virtual void SetHeaderValue(const char* headerName, const Aws::String& headerValue) override; + /** + * Add a header pair + */ + virtual void SetHeaderValue(const Aws::String& headerName, const Aws::String& headerValue) override; + /** + * delete pair by headerName + */ + virtual void DeleteHeader(const char* headerName) override; + /** + * Adds a content body stream to the request. This stream will be used to send the body to the endpoint. + */ + virtual inline void AddContentBody(const std::shared_ptr& strContent) override { bodyStream = strContent; } + /** + * Gets the content body stream that will be used for this request. + */ + virtual inline const std::shared_ptr& GetContentBody() const override { return bodyStream; } + /** + * Returns true if a header exists in the request with name + */ + virtual bool HasHeader(const char*) const override; + /** + * Get size in bytes of the request when as it will be going across the wire. + */ + virtual int64_t GetSize() const override; + /** + * Gets the factory for creating the stream that will be used in the http response. + */ + virtual const Aws::IOStreamFactory& GetResponseStreamFactory() const override; + /** + * Sets the factory for creating the stream that will be used in the http response. + */ + virtual void SetResponseStreamFactory(const Aws::IOStreamFactory& factory) override; + + private: + HeaderValueCollection headerMap; + std::shared_ptr bodyStream; + Aws::IOStreamFactory m_responseStreamFactory; + }; + + } // namespace Standard + } // namespace Http +} // namespace Aws + + diff --git a/include/aws/core/http/standard/StandardHttpResponse.h b/include/aws/core/http/standard/StandardHttpResponse.h new file mode 100644 index 0000000000000000000000000000000000000000..a3c5a20bdc73a00919095cc62a9f3cfaf59f6b94 --- /dev/null +++ b/include/aws/core/http/standard/StandardHttpResponse.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +namespace Aws +{ + namespace Http + { + namespace Standard + { + /** + * Simple STL representation an Http Response, implements HttpResponse. + */ + class AWS_CORE_API StandardHttpResponse : public HttpResponse + { + public: + /** + * Initializes an http response with the originalRequest and the response code. + */ + StandardHttpResponse(const std::shared_ptr& originatingRequest) : + HttpResponse(originatingRequest), + bodyStream(originatingRequest->GetResponseStreamFactory()) + {} + + ~StandardHttpResponse() = default; + + /** + * Get the headers from this response + */ + HeaderValueCollection GetHeaders() const override; + /** + * Returns true if the response contains a header by headerName + */ + bool HasHeader(const char* headerName) const override; + /** + * Returns the value for a header at headerName if it exists. + */ + const Aws::String& GetHeader(const Aws::String&) const override; + /** + * Gets the response body of the response. + */ + inline Aws::IOStream& GetResponseBody() const override { return bodyStream.GetUnderlyingStream(); } + /** + * Gives full control of the memory of the ResponseBody over to the caller. At this point, it is the caller's + * responsibility to clean up this object. + */ + inline Utils::Stream::ResponseStream&& SwapResponseStreamOwnership() override { return std::move(bodyStream); } + /** + * Adds a header to the http response object. + */ + void AddHeader(const Aws::String&, const Aws::String&) override; + /** + * Add a header to the http response object, and move the value. + * The name can't be moved as it is converted to lower-case. + */ + void AddHeader(const Aws::String& headerName, Aws::String&& headerValue) override; + + private: + StandardHttpResponse(const StandardHttpResponse&); + + Aws::Map headerMap; + Utils::Stream::ResponseStream bodyStream; + }; + + } // namespace Standard + } // namespace Http +} // namespace Aws + + diff --git a/include/aws/core/internal/AWSHttpResourceClient.h b/include/aws/core/internal/AWSHttpResourceClient.h new file mode 100644 index 0000000000000000000000000000000000000000..e30204ef1cea209c8798e1277753a747ed27af8e --- /dev/null +++ b/include/aws/core/internal/AWSHttpResourceClient.h @@ -0,0 +1,302 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace Aws +{ + namespace Http + { + class HttpClient; + class HttpRequest; + enum class HttpResponseCode; + } // namespace Http + + namespace Internal + { + /** + * Simple client for accessing the AWS remote data by Http. + * Currently we use it to access EC2 Metadata and ECS Credential. + */ + class AWS_CORE_API AWSHttpResourceClient + { + public: + /** + * Builds an AWSHttpResourceClient instance by using default http stack. + */ + AWSHttpResourceClient(const char* logtag = "AWSHttpResourceClient"); + AWSHttpResourceClient(const Client::ClientConfiguration& clientConfiguration, const char* logtag = "AWSHttpResourceClient"); + + AWSHttpResourceClient& operator =(const AWSHttpResourceClient& rhs) = delete; + AWSHttpResourceClient(const AWSHttpResourceClient& rhs) = delete; + AWSHttpResourceClient& operator =(const AWSHttpResourceClient&& rhs) = delete; + AWSHttpResourceClient(const AWSHttpResourceClient&& rhs) = delete; + + virtual ~AWSHttpResourceClient(); + + /** + * Connects to an HTTP endpoint to read the specified resource and returns the text contents. + * The resource URI = endpoint + resourcePath (e.g:http://domain/path/to/res) + * @param endpoint The HTTP resource to connect to. + * @param resourcePath A path appended to the endpoint to form the final URI. + * @param authToken An optional authorization token that will be passed as the value of the HTTP + * header 'Authorization'. + * @return The response from the HTTP endpoint as a string. + */ + virtual Aws::String GetResource(const char* endpoint, const char* resourcePath, const char* authToken) const; + + /** + * Connects to an HTTP endpoint to read the specified resource and returns the text contents. + * The resource URI = endpoint + resourcePath (e.g:http://domain/path/to/res) + * @param endpoint The HTTP resource to connect to. + * @param resourcePath A path appended to the endpoint to form the final URI. + * @param authToken An optional authorization token that will be passed as the value of the HTTP + * header 'Authorization'. + * @return The response from the HTTP endpoint as a string, together with the http response code. + */ + virtual AmazonWebServiceResult GetResourceWithAWSWebServiceResult(const char *endpoint, const char *resourcePath, const char *authToken) const; + + /** + * Above Function: Aws::String GetResource(const char* endpoint, const char* resourcePath, const char* authToken) const; + * is limited to HTTP GET method and caller can't add wanted HTTP headers as well. + * This overload gives caller the flexibility to manipulate the request, as well returns the HttpResponseCode of the last attempt. + */ + virtual AmazonWebServiceResult GetResourceWithAWSWebServiceResult(const std::shared_ptr &httpRequest) const; + + /** + * Set an error marshaller so as to marshall error type from http response body if any. + * So that it can work with retry strategy to decide if a request should retry or not. + */ + void SetErrorMarshaller(Aws::UniquePtr errorMarshaller) { m_errorMarshaller = std::move(errorMarshaller); } + const Client::AWSErrorMarshaller* GetErrorMarshaller() const { return m_errorMarshaller.get(); } + + protected: + Aws::String m_logtag; + Aws::String m_userAgent; + + private: + std::shared_ptr m_retryStrategy; + std::shared_ptr m_httpClient; + Aws::UniquePtr m_errorMarshaller; + }; + + /** + * Derived class to support retrieving of EC2 Metadata + */ + class AWS_CORE_API EC2MetadataClient : public AWSHttpResourceClient + { + public: + /** + * Build an instance with default EC2 Metadata service endpoint + */ + EC2MetadataClient(const char* endpoint = "http://169.254.169.254"); + EC2MetadataClient(const Client::ClientConfiguration& clientConfiguration, const char* endpoint = "http://169.254.169.254"); + + EC2MetadataClient& operator =(const EC2MetadataClient& rhs) = delete; + EC2MetadataClient(const EC2MetadataClient& rhs) = delete; + EC2MetadataClient& operator =(const EC2MetadataClient&& rhs) = delete; + EC2MetadataClient(const EC2MetadataClient&& rhs) = delete; + + virtual ~EC2MetadataClient(); + + using AWSHttpResourceClient::GetResource; + + /** + * Connects to the metadata service to read the specified resource and + * returns the text contents. The resource URI = m_endpoint + resourcePath. + */ + virtual Aws::String GetResource(const char* resourcePath) const; + +#if !defined(DISABLE_IMDSV1) + /** + * Connects to the Amazon EC2 Instance Metadata Service to retrieve the + * default credential information (if any). + */ + virtual Aws::String GetDefaultCredentials() const; +#endif + /** + * Connects to the Amazon EC2 Instance Metadata Service to retrieve the + * credential information (if any) in a more secure way. + */ + virtual Aws::String GetDefaultCredentialsSecurely() const; + + /** + * connects to the Amazon EC2 Instance metadata Service to retrieve the region + * the current EC2 instance is running in. + */ + virtual Aws::String GetCurrentRegion() const; + + /** + * Sets endpoint used to connect to the EC2 Instance metadata Service + */ + virtual void SetEndpoint(const Aws::String& endpoint); + + /** + * Gets endpoint used to connect to the EC2 Instance metadata Service + */ + virtual Aws::String GetEndpoint() const; + + private: + Aws::String m_endpoint; + bool m_disableIMDS; + mutable std::recursive_mutex m_tokenMutex; + mutable Aws::String m_token; + mutable bool m_tokenRequired; + mutable Aws::String m_region; + bool m_disableIMDSV1 = false; + }; + + void AWS_CORE_API InitEC2MetadataClient(); + void AWS_CORE_API CleanupEC2MetadataClient(); + std::shared_ptr AWS_CORE_API GetEC2MetadataClient(); + + /** + * Derived class to support retrieving of ECS Credentials + */ + class AWS_CORE_API ECSCredentialsClient : public AWSHttpResourceClient + { + public: + /** + * Build an instance with default ECS service endpoint + * @param resourcePath The path part of the metadata URL + * @param endpoint The URL authority to hit. Default is the IP address of the Task metadata service endpoint. + */ + ECSCredentialsClient(const char* resourcePath, const char* endpoint = "http://169.254.170.2", + const char* authToken = ""); + ECSCredentialsClient(const Client::ClientConfiguration& clientConfiguration, + const char* resourcePath, const char* endpoint = "http://169.254.170.2", + const char* authToken = ""); + + ECSCredentialsClient& operator =(ECSCredentialsClient& rhs) = delete; + ECSCredentialsClient(const ECSCredentialsClient& rhs) = delete; + ECSCredentialsClient& operator =(ECSCredentialsClient&& rhs) = delete; + ECSCredentialsClient(const ECSCredentialsClient&& rhs) = delete; + + /** + * Connects to the Amazon ECS service to retrieve the credential + */ + virtual Aws::String GetECSCredentials() const + { + return GetResource(m_endpoint.c_str(), + m_resourcePath.c_str(), + m_token.empty() ? nullptr : m_token.c_str()); + } + + inline void SetToken(Aws::String token) + { + m_token = std::move(token); + } + + private: + Aws::String m_resourcePath; + Aws::String m_endpoint; + Aws::String m_token; + }; + + /** + * To support retrieving credentials from STS. + * Note that STS accepts request with protocol of queryxml. Calling GetResource() will trigger + * a query request using AWSHttpResourceClient under the hood. + */ + class AWS_CORE_API STSCredentialsClient : public AWSHttpResourceClient + { + public: + /** + * Initializes the provider to retrieve credentials from STS when it expires. + */ + STSCredentialsClient(const Client::ClientConfiguration& clientConfiguration); + + STSCredentialsClient& operator =(STSCredentialsClient& rhs) = delete; + STSCredentialsClient(const STSCredentialsClient& rhs) = delete; + STSCredentialsClient& operator =(STSCredentialsClient&& rhs) = delete; + STSCredentialsClient(const STSCredentialsClient&& rhs) = delete; + + // If you want to make an AssumeRoleWithWebIdentity call to sts. use these classes to pass data to and get info from STSCredentialsClient client. + // If you want to make an AssumeRole call to sts, define the request/result members class/struct like this. + struct STSAssumeRoleWithWebIdentityRequest + { + Aws::String roleSessionName; + Aws::String roleArn; + Aws::String webIdentityToken; + }; + + struct STSAssumeRoleWithWebIdentityResult + { + Aws::Auth::AWSCredentials creds; + }; + + STSAssumeRoleWithWebIdentityResult GetAssumeRoleWithWebIdentityCredentials(const STSAssumeRoleWithWebIdentityRequest& request); + + private: + Aws::String m_endpoint; + }; + + /** + * To support retrieving credentials from SSO. + */ + class AWS_CORE_API SSOCredentialsClient : public AWSHttpResourceClient + { + public: + SSOCredentialsClient(const Client::ClientConfiguration& clientConfiguration); + SSOCredentialsClient(const Client::ClientConfiguration& clientConfiguration, Aws::Http::Scheme scheme, const Aws::String& region); + + SSOCredentialsClient& operator =(SSOCredentialsClient& rhs) = delete; + SSOCredentialsClient(const SSOCredentialsClient& rhs) = delete; + SSOCredentialsClient& operator =(SSOCredentialsClient&& rhs) = delete; + SSOCredentialsClient(SSOCredentialsClient&& rhs) = delete; + + struct SSOGetRoleCredentialsRequest + { + Aws::String m_ssoAccountId; + Aws::String m_ssoRoleName; + Aws::String m_accessToken; + }; + + struct SSOGetRoleCredentialsResult + { + Aws::Auth::AWSCredentials creds; + }; + + SSOGetRoleCredentialsResult GetSSOCredentials(const SSOGetRoleCredentialsRequest& request); + + struct SSOCreateTokenRequest + { + Aws::String clientId; + Aws::String clientSecret; + Aws::String grantType; + Aws::String refreshToken; + }; + + struct SSOCreateTokenResult + { + Aws::String accessToken; + size_t expiresIn = 0; //seconds + Aws::String idToken; + Aws::String refreshToken; + Aws::String clientId; + Aws::String tokenType; + }; + + SSOCreateTokenResult CreateToken(const SSOCreateTokenRequest& request); + private: + Aws::String buildEndpoint(Aws::Http::Scheme scheme, + const Aws::String& region, + const Aws::String& domain, + const Aws::String& endpoint); + Aws::String m_endpoint; + Aws::String m_oidcEndpoint; + }; + } // namespace Internal +} // namespace Aws diff --git a/include/aws/core/monitoring/CoreMetrics.h b/include/aws/core/monitoring/CoreMetrics.h new file mode 100644 index 0000000000000000000000000000000000000000..575a6003e2c4a7ec3341cd0f05419ae6b319ca3a --- /dev/null +++ b/include/aws/core/monitoring/CoreMetrics.h @@ -0,0 +1,27 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ + namespace Monitoring + { + /** + * Metrics collected from AWS SDK Core include Http Client Metrics and other types of metrics. + */ + struct AWS_CORE_API CoreMetricsCollection + { + /** + * Metrics collected from underlying http client during execution of a request + */ + HttpClientMetricsCollection httpClientMetrics; + + // Add Other types of metrics here. + }; + } +} diff --git a/include/aws/core/monitoring/DefaultMonitoring.h b/include/aws/core/monitoring/DefaultMonitoring.h new file mode 100644 index 0000000000000000000000000000000000000000..148a3a23c5b3204c2c89456c626751d306fc2ab2 --- /dev/null +++ b/include/aws/core/monitoring/DefaultMonitoring.h @@ -0,0 +1,73 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +namespace Aws +{ + namespace Monitoring + { + /** + * Default monitoring implementation definition + */ + class AWS_CORE_API DefaultMonitoring: public MonitoringInterface + { + public: + const static int DEFAULT_MONITORING_VERSION; + const static char DEFAULT_CSM_CONFIG_ENABLED[]; + const static char DEFAULT_CSM_CONFIG_CLIENT_ID[]; + const static char DEFAULT_CSM_CONFIG_HOST[]; + const static char DEFAULT_CSM_CONFIG_PORT[]; + const static char DEFAULT_CSM_ENVIRONMENT_VAR_ENABLED[]; + const static char DEFAULT_CSM_ENVIRONMENT_VAR_CLIENT_ID[]; + const static char DEFAULT_CSM_ENVIRONMENT_VAR_HOST[]; + const static char DEFAULT_CSM_ENVIRONMENT_VAR_PORT[]; + + /** + * @brief Construct a default monitoring instance + * @param clientId, used to identify the application + * @param host, either the host name or the host ip address (could be ipv4 or ipv6). Note that "localhost" will be treated as host name and address look up will be performed. + * @param port, used to send collected metric to a local agent listen on this port. + */ + DefaultMonitoring(const Aws::String& clientId, const Aws::String& host, unsigned short port); + + void* OnRequestStarted(const Aws::String& serviceName, const Aws::String& requestName, const std::shared_ptr& request) const override; + + void OnRequestSucceeded(const Aws::String& serviceName, const Aws::String& requestName, const std::shared_ptr& request, + const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, void* context) const override; + + + void OnRequestFailed(const Aws::String& serviceName, const Aws::String& requestName, const std::shared_ptr& request, + const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, void* context) const override; + + + void OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request, void* context) const override; + + + void OnFinish(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request, void* context) const override; + + static inline int GetVersion() { return DEFAULT_MONITORING_VERSION; } + private: + void CollectAndSendAttemptData(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request, const Aws::Client::HttpResponseOutcome& outcome, + const CoreMetricsCollection& metricsFromCore, void* context) const; + + Aws::Net::SimpleUDP m_udp; + Aws::String m_clientId; + }; + + class AWS_CORE_API DefaultMonitoringFactory : public MonitoringFactory + { + public: + Aws::UniquePtr CreateMonitoringInstance() const override; + }; + } // namespace Monitoring +} // namespace Aws diff --git a/include/aws/core/monitoring/HttpClientMetrics.h b/include/aws/core/monitoring/HttpClientMetrics.h new file mode 100644 index 0000000000000000000000000000000000000000..6127929fd1ed2cc5e8be77f5c34d78fb3470b09f --- /dev/null +++ b/include/aws/core/monitoring/HttpClientMetrics.h @@ -0,0 +1,96 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ + namespace Monitoring + { + /** + * Metrics definitions optional from HttpClient module inside AWS Sdk core. + */ + enum class HttpClientMetricsType + { + /* + * Requires a successful DNS lookup, contains the (IPv4 or IPv6 as appropriate) numeric address of the connection endpoint to which the attempt was sent. + */ + DestinationIp = 0, + + /** + * Requires the SDK to recognize that an existing connection was reused to make the request, + * contains the time interval (in milliseconds) between the construction of the http request and when a connection was successfully acquired from the connection pool. + */ + AcquireConnectionLatency, + + /** + * Requires the SDK to recognize whether or not an existing connection was used to make the request, + * contains 1 if an existing connection was used to perform the http request; contains 0 if a new connection was opened to perform the http request. + */ + ConnectionReused, + + /** + * Requires the SDK to recognize that a new connection was established to make the request, + * contains the time interval (in milliseconds) between the construction of the http request and when a connection was fully established. + * If the SDK is able to estimate this time despite not having a perfectly accurate callback for the specific event, then it should. + * For example, if the http client includes user-level data write functions that are guaranteed to be called shortly after connection establishment, + * then the first call could be used as a reasonable time marker for ConnectLatency + */ + ConnectLatency, + + /** + * Requires the SDK to be able to mark the point in time where the request starts transmission, + * contains the time interval (in milliseconds) between when the request begins transmission to the service and when a terminal error has occurred or the response has been parsed, + * excluding streaming payloads. Like ConnectLatency, if the SDK has access to an event that is a "close enough" marker in time, it should include this entry. + * The request here is a http level request, not a service level API request. + */ + RequestLatency, + + /** + * Requires the SDK to have access to how long it took to perform DNS lookup, if it took place, + * contains the time (in milliseconds) it took to perform DNS lookup, during the Api Call attempt. + */ + DnsLatency, + + /** + * Requires the SDK to have access to how long it took to establish the underlying Tcp/Ip connection used for the request, + * contains the time (in milliseconds) it took to fully establish the TCP/IP connection used to make the request attempt. + */ + TcpLatency, + + /** + * Requires the SDK to have access to how long it took to perform the SSL handshake for a secure request, + * contains the time (in milliseconds) it took to perform a SSL handshake over the established TCP/IP connection. + */ + SslLatency, + + /** + * Request the SDK to have access to the download speed in bytes per + * second for a request. + */ + DownloadSpeed, + Throughput, + + /** + * Upload speed of the request in bytes per second. + */ + UploadSpeed, + + /** + * Unknow Metrics Type + */ + Unknown + }; + + typedef Aws::Map HttpClientMetricsCollection; + + AWS_CORE_API HttpClientMetricsType GetHttpClientMetricTypeByName(const Aws::String& name); + + AWS_CORE_API Aws::String GetHttpClientMetricNameByType(HttpClientMetricsType type); + } +} diff --git a/include/aws/core/monitoring/MonitoringFactory.h b/include/aws/core/monitoring/MonitoringFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..2d03efa712511a49dde8eb841351a353eda27e72 --- /dev/null +++ b/include/aws/core/monitoring/MonitoringFactory.h @@ -0,0 +1,26 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ + namespace Monitoring + { + class MonitoringInterface; + + /** + * Factory to create monitoring instance. + */ + class AWS_CORE_API MonitoringFactory + { + public: + virtual ~MonitoringFactory() = default; + virtual Aws::UniquePtr CreateMonitoringInstance() const = 0; + }; + + } // namespace Monitoring +} // namespace Aws diff --git a/include/aws/core/monitoring/MonitoringInterface.h b/include/aws/core/monitoring/MonitoringInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..68a308a092fedd9e0cbc7028c3cfaddaba6570e3 --- /dev/null +++ b/include/aws/core/monitoring/MonitoringInterface.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Monitoring + { + /** + * Monitoring interface definition for SDK metrics collection. + */ + class AWS_CORE_API MonitoringInterface + { + public: + virtual ~MonitoringInterface() = default; + + /** + * @brief This function lets you do preparation work when a http attempt(request) starts. It returns a pointer to an implementation defined context which will be + * passed down with the other facilities that completes the request's lifetime. This context can be used to track the lifetime of the request and record metrics + * specific to this particular request. You are responsible for deleting the context during your OnFinish call. + * @param serviceName, the service client who initiates this http attempt. like "s3", "ec2", etc. + * @param requestName, the operation or API name of this http attempt, like "GetObject" in s3. + * @param request, the actual Http Request. + * @return implementation depends memory address of context. + */ + virtual void* OnRequestStarted(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request) const = 0; + + /** + * @brief Once a Http attempt finished and received "Succeeded" response, this function will be called. + * @param serviceName, the service client who initiate this http attempt. like "s3", "ec2", etc. + * @param requestName, the operation or API name of this http attempt, like "GetObject" in s3. + * @param request, the actual Http Request. + * @param outcome, the outcome of the http attempt, you can access httpResponse and original httpRequest from it. + * @param metricsFromCore, metrics collected from core, such as detailed latencies during http connection. + * @param context parameter pointed to the same place returned by OnRequestStarted() function. + * @return void. + */ + virtual void OnRequestSucceeded(const Aws::String& serviceName, + const Aws::String& requestName, const std::shared_ptr& request, + const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, void* context) const = 0; + + /** + * @brief Once a Http request finished and received "Failed" response, this function will be called. + * @param serviceName, the service client who initiate this http attempt. like "s3", "ec2", etc. + * @param requestName, the operation or API name of this http attempt, like "GetObject" in s3. + * @param request, the actual Http Request. + * @param outcome, the outcome of the http attempt, you can access httpResponse and original httpRequest from it. + * @param metricsFromCore, metrics collected from core, such as detailed latencies during http connection. + * @param context parameter pointed to the same place returned by OnRequestStarted() function. + * @return void. + */ + virtual void OnRequestFailed(const Aws::String& serviceName, + const Aws::String& requestName, const std::shared_ptr& request, + const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, void* context) const = 0; + + /** + * @brief Once an API call retried the attempt and send the request again, this function will be called. + * @param serviceName, the service client who initiate this http attempt. like "s3", "ec2", etc. + * @param requestName, the operation or API name of this http attempt, like "GetObject" in s3. + * @param request, the actual Http Request. + * @param context parameter pointed to the same place returned by OnRequestStarted() function. + * @return void. + */ + virtual void OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request, void* context) const = 0; + + /** + * @brief This function will always be called by the SDK to signal the implementer that this request is done. The implementer can safely delete the context. + * @param serviceName, the service client who initiate this http attempt. like "s3", "ec2", etc. + * @param requestName, the operation or API name of this http attempt, like "GetObject" in s3. + * @param request, the actual Http Request. + * @param context parameter pointed to the same place returned by OnRequestStarted() function. + * @return void. + */ + virtual void OnFinish(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request, void* context) const = 0; + }; + } // namespace Monitoring +} // namespace Aws diff --git a/include/aws/core/monitoring/MonitoringManager.h b/include/aws/core/monitoring/MonitoringManager.h new file mode 100644 index 0000000000000000000000000000000000000000..206f385c6751a80e39163440474cabc8e2cc8099 --- /dev/null +++ b/include/aws/core/monitoring/MonitoringManager.h @@ -0,0 +1,71 @@ + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Monitoring + { + class MonitoringFactory; + /** + * Wrapper function of OnRequestStarted defined by all monitoring instances + */ + Aws::Vector OnRequestStarted(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request); + + /** + * Wrapper function of OnRequestSucceeded defined by all monitoring instances + */ + void OnRequestSucceeded(const Aws::String& serviceName, const Aws::String& requestName, const std::shared_ptr& request, + const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, const Aws::Vector& contexts); + + /** + * Wrapper function of OnRequestFailed defined by all monitoring instances + */ + void OnRequestFailed(const Aws::String& serviceName, const Aws::String& requestName, const std::shared_ptr& request, + const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, const Aws::Vector& contexts); + + /** + * Wrapper function of OnRequestRetry defined by all monitoring instances + */ + void OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request, const Aws::Vector& contexts); + + /** + * Wrapper function of OnFinish defined by all monitoring instances + */ + void OnFinish(const Aws::String& serviceName, const Aws::String& requestName, + const std::shared_ptr& request, const Aws::Vector& contexts); + + typedef std::function()> MonitoringFactoryCreateFunction; + + /** + * Init monitoring using supplied factories, monitoring can support multiple instances. + * We will try to (based on config resolution result) create a default client side monitoring listener instance defined in AWS SDK Core module. + * and create other instances from these factories. + * This function will be called during Aws::InitAPI call, argument is acquired from Aws::SDKOptions->MonitoringOptions + */ + AWS_CORE_API void InitMonitoring(const std::vector& monitoringFactoryCreateFunctions); + + /** + * Clean up monitoring related global variables. This should be done first at shutdown, to avoid a race condition in + * testing whether the global Monitoring instance has been destructed. + */ + AWS_CORE_API void CleanupMonitoring(); + + /** + * Add monitoring using supplied factories + */ + AWS_CORE_API void AddMonitoring(const std::vector& monitoringFactoryCreateFunctions); + + } +} diff --git a/include/aws/core/net/Net.h b/include/aws/core/net/Net.h new file mode 100644 index 0000000000000000000000000000000000000000..00aca57e0a05cb39ba188b1c85eb09e60ac8ee7f --- /dev/null +++ b/include/aws/core/net/Net.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +namespace Aws +{ + namespace Net + { + // Has network stack been initiated. + bool IsNetworkInitiated(); + + // Initiate network stack. + void InitNetwork(); + + // Cleanup network stack. + void CleanupNetwork(); + } +} diff --git a/include/aws/core/net/SimpleUDP.h b/include/aws/core/net/SimpleUDP.h new file mode 100644 index 0000000000000000000000000000000000000000..a9f2f4f59ff0f14eae765b39f7f60fbce1b7df5c --- /dev/null +++ b/include/aws/core/net/SimpleUDP.h @@ -0,0 +1,163 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +struct sockaddr; + +namespace Aws +{ + namespace Net + { + // 8K is aligned with default monitoring packet size. + const static size_t UDP_BUFFER_SIZE = 8192; + /** + * SimpleUDP definition. + */ + class AWS_CORE_API SimpleUDP + { + public: + /** + * @brief Constructor of SimpleUDP + * @param addressFamily, AF_INET for IPV4 or AF_INET6 for IPV6 + * @param sendBufSize, if nonzero, try set socket's send buffer size to this value. + * @param receiveBufSize, if nonzero, try set socket's receive buffer size to this value. + * @param nonBlocking, if it is true, implementation will try to create a non-blocking underlying UDP socket. + * Implementation should create and set the underlying udp socket. + */ + SimpleUDP(int addressFamily, size_t sendBufSize = UDP_BUFFER_SIZE, size_t receiveBufSize = UDP_BUFFER_SIZE, bool nonBlocking = true); + + /** + * @brief An easy constructor of an IPV4 or IPV6 SimpleUDP + * @param addressFamily, either AF_INET for IPV4 or AF_INET6 for IPV6 + * @param sendBufSize, if nonzero, try set socket's send buffer size to this value. + * @param receiveBufSize, if nonzero, try set socket's receive buffer size to this value. + * @param nonBlocking, if it is true, implementation will try to create a non-blocking underlying UDP socket. + * Implementation should create and set the underlying udp socket. + */ + SimpleUDP(bool IPV4 = true, size_t sendBufSize = UDP_BUFFER_SIZE, size_t receiveBufSize = UDP_BUFFER_SIZE, bool nonBlocking = true); + + /** + * @brief An easy constructor of SimpleUDP based on host and port + * @param host, the host that packets will be sent to, could be ipv4 or ipv6 address, or a hostname + * Note that "localhost" is not necessarily bind to 127.0.0.1, it could bind to ipv6 address ::1, or other type of ip addresses. If you pass localhost here, we will go through getaddrinfo procedure on Linux and Windows. + * @param port, the port number that the host listens on. + * @param sendBufSize, if nonzero, try set socket's send buffer size to this value. + * @param receiveBufSize, if nonzero, try set socket's receive buffer size to this value. + * @param nonBlocking, if it is true, implementation will try to create a non-blocking underlying UDP socket. + * Implementation should create and set the underlying udp socket. + */ + SimpleUDP(const char* host, unsigned short port, size_t sendBufSize = UDP_BUFFER_SIZE, size_t receiveBufSize = UDP_BUFFER_SIZE, bool nonBlocking = true); + + ~SimpleUDP(); + + /** + * @brief Connect underlying udp socket to server specified in address. + * @param address, the server's address info. + * @param addressLength, length of address, structure of address can vary. + * @return 0 on success, -1 on error, check errno for detailed error information. + */ + int Connect(const sockaddr* address, size_t addressLength); + + /** + * @brief An easy way to connect to host + * @param hostIP, a valid ipv4 or ipv6 address. The address type should match the m_addressFamily type settled during construction. + * Otherwise the connection will fail. + * @param port, the port that host listens on. + */ + int ConnectToHost(const char* hostIP, unsigned short port) const; + + /** + * @brief An easy way to connect to 127.0.0.1 or ::1 based on m_addressFamily + */ + int ConnectToLocalHost(unsigned short port) const; + + /** + * @brief Bind underlying udp socket to an address. + * @param address, the server's address info. + * @param addressLength, length of address, structure of address can vary. + * @return 0 on success, -1 on error, check errno for detailed error information. + */ + int Bind(const sockaddr* address, size_t addressLength) const; + + /** + * @brief An easy way to bind to localhost + */ + int BindToLocalHost(unsigned short port) const; + + /** + * @brief Send data to server without specifying address, only usable if hostIP and port are available. + * @param data, the data you want to send. + * @param dataLen, the length of data you want to send. On Windows, dataLen larger than INT32_MAX will cause undefined behavior + * @return 0 on success, -1 on error, check errno for detailed error information. + */ + int SendData(const uint8_t* data, size_t dataLen) const; + + /** + * @brief Send data to server. + * @param address, the server's address info. + * @param addressLength, length of address, structure of address can vary. + * @param data, the memory address of the data you want to send. + * @param dataLen, the length of data you want to send. On Windows, dataLen larger than INT32_MAX will cause undefined behavior + * @return 0 on success, -1 on error check errno for detailed error information. + */ + int SendDataTo(const sockaddr* address, size_t addressLength, const uint8_t* data, size_t dataLen) const; + + /** + * @brief An easy way to send data to localhost, when the underlying udp is connected, call this function will + * send the data to where it connects to, not essentially to localhost. when it's not connected, it will send data + * to localhost, but this call will not connect underlying socket to localhost for you. + * @param data, the memory address of the data you want to send. + * @param dataLen, the length of data you want to send. On Windows, dataLen larger than INT32_MAX will cause undefined behavior + * @param port, port of localhost. + * @return 0 on success, -1 on error, check errno for detailed error information. + */ + int SendDataToLocalHost(const uint8_t* data, size_t dataLen, unsigned short port) const; + + /** + * @brief Receive data from unique address specified in ConnectWithServer call. + * this function is equivalent to call ReceiveDataFrom(nullptr, 0, data, dataLen, flags). + * @param buffer, the memory address where you want to store received data. + * @param bufferLen, the size of data buffer. + * @return -1 on failure, check errno for detailed error information, on success, returns the actual bytes of data received + */ + int ReceiveData(uint8_t* buffer, size_t bufferLen) const; + + /** + * @brief Receive data from network. + * @param address, if not null and underlying implementation supply the incoming data's source address, this will be filled with source address info. + * @param addressLength, the size of source address, should not be null. + * @param buffer, the memory address where you want to store received data. + * @param bufferLen, the size of data buffer. + * @return -1 on failure, check errno for detailed error information, on success, returns the actual bytes of data received. + */ + int ReceiveDataFrom(sockaddr* address, size_t* addressLength, uint8_t* buffer, size_t bufferLen) const; + + /** + * Gets the AddressFamily used for the underlying socket. E.g. AF_INET, AF_INET6 etc. + */ + inline int GetAddressFamily() const { return m_addressFamily; } + + /** + * Is the underlying socket connected with a remote address + */ + inline bool IsConnected() const { return m_connected; } + + private: + void CreateSocket(int addressFamily, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking); + int GetUnderlyingSocket() const { return m_socket; } + void SetUnderlyingSocket(int socket) { m_socket = socket; } + int m_addressFamily; + // if not connected, you can't perform SendData, if connected, SendDataTo will call SendData + mutable bool m_connected; + int m_socket; + unsigned short m_port; + Aws::String m_hostIP; + }; + } +} diff --git a/include/aws/core/platform/Android.h b/include/aws/core/platform/Android.h new file mode 100644 index 0000000000000000000000000000000000000000..b012a49d5013e5b45c8db41ca2f31097c4111a3e --- /dev/null +++ b/include/aws/core/platform/Android.h @@ -0,0 +1,29 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#ifdef __ANDROID__ + +#include + +#include + +#include + +namespace Aws +{ +namespace Platform +{ + +// must be called before any other native SDK functions when running on Android +AWS_CORE_API void InitAndroid(JNIEnv* env, jobject context); + +// helper functions for functionality requiring JNI calls; not valid until InitAndroid has been called +AWS_CORE_API JavaVM* GetJavaVM(); +AWS_CORE_API const char* GetCacheDirectory(); + +} //namespace Platform +} //namespace Aws + +#endif // __ANDROID__ diff --git a/include/aws/core/platform/Environment.h b/include/aws/core/platform/Environment.h new file mode 100644 index 0000000000000000000000000000000000000000..f522bf3a229f50cb3462874f5ecf93174b07472c --- /dev/null +++ b/include/aws/core/platform/Environment.h @@ -0,0 +1,22 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ +namespace Environment +{ + /** + * shim for getenv + */ + AWS_CORE_API Aws::String GetEnv(const char* name); + +} // namespace Environment +} // namespace Aws + diff --git a/include/aws/core/platform/FileSystem.h b/include/aws/core/platform/FileSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..056a98b42b166af3722a926aa1669a722fa0d9a0 --- /dev/null +++ b/include/aws/core/platform/FileSystem.h @@ -0,0 +1,226 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include +#include + +namespace Aws +{ + +namespace FileSystem +{ + struct DirectoryEntry; + class Directory; + + #ifdef _WIN32 + static const char PATH_DELIM = '\\'; + #else + static const char PATH_DELIM = '/'; + #endif + + /** + * Returns the directory path for the home dir env variable + */ + AWS_CORE_API Aws::String GetHomeDirectory(); + + /** + * Returns the directory path for the directory containing the currently running executable + */ + AWS_CORE_API Aws::String GetExecutableDirectory(); + + /** + * @brief Creates directory if it doesn't exist. Returns true if the directory was created or already exists. False for failure. + * @param path, the absolute path of the directory. + * @param createParentDirs, if true, then this function will create missing directories on the path like linux command: mkdir -p + */ + AWS_CORE_API bool CreateDirectoryIfNotExists(const char* path, bool createParentDirs = false); + + /** + * Creates directory if it doesn't exist. Returns true if the directory was created + * or already exists. False for failure. + */ + AWS_CORE_API bool RemoveDirectoryIfExists(const char* path); + + /** + * Deletes file if it exists. Returns true if file doesn't exist or on success. + */ + AWS_CORE_API bool RemoveFileIfExists(const char* fileName); + + /** + * Moves the file. Returns true on success + */ + AWS_CORE_API bool RelocateFileOrDirectory(const char* from, const char* to); + + /** + * Copies a directory and all of its contents. + */ + AWS_CORE_API bool DeepCopyDirectory(const char* from, const char* to); + + /** + * Deletes a directory and all of its contents. + */ + AWS_CORE_API bool DeepDeleteDirectory(const char* toDelete); + + /** + * Computes a unique tmp file path + */ + AWS_CORE_API Aws::String CreateTempFilePath(); + + /** + * Opens a directory for traversal. + */ + AWS_CORE_API Aws::UniquePtr OpenDirectory(const Aws::String& path, const Aws::String& relativePath = ""); + + /** + * Joins the leftSegment and rightSegment of a path together using platform specific delimiter. + * e.g. C:\users\name\ and .aws becomes C:\users\name\.aws + */ + AWS_CORE_API Aws::String Join(const Aws::String& leftSegment, const Aws::String& rightSegment); + + /** + * Joins the leftSegment and rightSegment of a path together using the specified delimiter. + * e.g. with delimiter & C:\users\name\ and .aws becomes C:\users\name&.aws + */ + AWS_CORE_API Aws::String Join(char delimiter, const Aws::String& leftSegment, const Aws::String& rightSegment); + + /** + * Type of directory entry encountered. + */ + enum class FileType + { + None, + File, + Symlink, + Directory + }; + + struct DirectoryEntry + { + DirectoryEntry() : fileType(FileType::None), fileSize(0) {} + + operator bool() const { return !path.empty() && fileType != FileType::None; } + + Aws::String path; + Aws::String relativePath; + FileType fileType = FileType::None; + int64_t fileSize = 0; + }; + + /** + * Base level representation of a directory. Provides the ability to iterate all entries in a directory and to descend into directories. + * We don't recommend you use this class directly. Instead see DirectoryTree. + */ + class AWS_CORE_API Directory + { + public: + virtual ~Directory() = default; + + /** + * Initialize a directory with it's absolute path. If the path is invalid, the bool operator will return false. + */ + Directory(const Aws::String& path, const Aws::String& relativePath); + + /** + * If this directory is valid for use. + */ + virtual operator bool() const { return m_directoryEntry.operator bool(); } + + /** + * Get the entry representing this current directory object. + */ + const DirectoryEntry& GetDirectoryEntry() const { return m_directoryEntry; } + + /** + * Get the current path of this directory object. + */ + const Aws::String& GetPath() const { return m_directoryEntry.path; } + + /** + * Get the next entry inside this directory. + */ + virtual DirectoryEntry Next() = 0; + + /** + * Descend into a directory if it is a directory. Returns a shared pointer to a Directory object which you can then call Next() and Descend on. + * The original Directory object you use is responsible for the memory this method allocates, so do not attempt to delete the return value. + */ + Aws::UniquePtr Descend(const DirectoryEntry& directoryEntry); + + /** + * Recursively search directories with path as root directory, return all normal(non directory and non symlink) files' paths. + */ + static Aws::Vector GetAllFilePathsInDirectory(const Aws::String& path); + + protected: + DirectoryEntry m_directoryEntry; + }; + + class DirectoryTree; + + /** + * Visitor for a Directory Tree traversal. Return true to continue the traversal, false to exit the traversal immediately. + */ + typedef std::function DirectoryEntryVisitor; + + /** + * Wrapper around directory. Currently provides a Depth-first and Breadth-first traversal of the provided path. This is most likely the class you are + * looking for. + */ + class AWS_CORE_API DirectoryTree + { + public: + /** + * Create a directory object for use with traversal using the provided path. + */ + DirectoryTree(const Aws::String& path); + + /** + * Returns true if the Directory Tree structures match. Otherwise false. + */ + bool operator==(DirectoryTree& other); + + /** + * Returns true if the Directory tree structure at path matches. Otherwise false. + */ + bool operator==(const Aws::String& path); + + /** + * Computes the difference between two directory trees based on their relative paths. + * File contents are not taken into account, only the tree structure. + * + * Returns the diff between the two trees where the key is the relative path. The Directory entry will + * contain the absolute path and file size. + */ + Aws::Map Diff(DirectoryTree& other); + + /** + * If the object is valid for use: true. Otherwise: false. + */ + operator bool() const; + + /** + * Performs a depth-first traversal of the directory tree. Upon encountering an entry, visitor will be invoked. + * If postOrder is true, a pre-order traversal will be used. otherwise pre-order will be used. + */ + void TraverseDepthFirst(const DirectoryEntryVisitor& visitor, bool postOrderTraversal = false); + + /** + * Performs a breadth-first traversal of the directory tree. Upon encountering an entry, visitor will be invoked. + */ + void TraverseBreadthFirst(const DirectoryEntryVisitor& visitor); + + private: + bool TraverseDepthFirst(Directory& dir, const DirectoryEntryVisitor& visitor, bool postOrder = false); + void TraverseBreadthFirst(Directory& dir, const DirectoryEntryVisitor& visitor); + + Aws::UniquePtr m_dir; + }; + +} // namespace FileSystem +} // namespace Aws diff --git a/include/aws/core/platform/OSVersionInfo.h b/include/aws/core/platform/OSVersionInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..6563fd1a97d4721c227d3785cc0d1bc2acfa7c86 --- /dev/null +++ b/include/aws/core/platform/OSVersionInfo.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ +namespace OSVersionInfo +{ + /** + * computing the version string for the current running operating system. + */ + AWS_CORE_API Aws::String ComputeOSVersionString(); + + /** + * Get architecture of the current running operating system. + */ + AWS_CORE_API Aws::String ComputeOSVersionArch(); + + /** + * runs a (shell) command string and returns the output; not needed on windows currently + */ + AWS_CORE_API Aws::String GetSysCommandOutput(const char* command); + +} // namespace OSVersionInfo +} // namespace Aws + diff --git a/include/aws/core/platform/Platform.h b/include/aws/core/platform/Platform.h new file mode 100644 index 0000000000000000000000000000000000000000..e1cae5262e957d5a935ead954d3c0f13c2b923ea --- /dev/null +++ b/include/aws/core/platform/Platform.h @@ -0,0 +1,9 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include + diff --git a/include/aws/core/platform/Security.h b/include/aws/core/platform/Security.h new file mode 100644 index 0000000000000000000000000000000000000000..d1533dd19fccf106669830459b0f3b957ca19c57 --- /dev/null +++ b/include/aws/core/platform/Security.h @@ -0,0 +1,24 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +namespace Aws +{ +namespace Security +{ + + /* + * Securely clears a block of memory + */ + AWS_CORE_API void SecureMemClear(unsigned char *data, size_t length); + +} // namespace Security +} // namespace Aws + diff --git a/include/aws/core/platform/Time.h b/include/aws/core/platform/Time.h new file mode 100644 index 0000000000000000000000000000000000000000..ecf802db6672f7fcb2447880ddac64404f5e34f0 --- /dev/null +++ b/include/aws/core/platform/Time.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ +namespace Time +{ + + /* + * A platform-agnostic implementation of the timegm function from gnu extensions + */ + AWS_CORE_API time_t TimeGM(tm* const t); + + /* + * Converts from a time value of std::time_t type to a C tm structure for easier date analysis + */ + AWS_CORE_API void LocalTime(tm* t, std::time_t time); + + /* + * Converts from a time value of std::time_t type to a C tm structure for easier date analysis + */ + AWS_CORE_API void GMTime(tm* t, std::time_t time); + +} // namespace Time +} // namespace Aws diff --git a/include/aws/core/utils/ARN.h b/include/aws/core/utils/ARN.h new file mode 100644 index 0000000000000000000000000000000000000000..7df956022df7da1bf2c6d2c984c688b443b4f2a0 --- /dev/null +++ b/include/aws/core/utils/ARN.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + #pragma once + +#include +#include + +namespace Aws +{ + namespace Utils + { + /** + * ARN (Amazon Resource Name) is used to identify an unique resource on AWS. + * A full qualified ARN has two forms: + * 1. arn:partition:service:region:account-id:resource-type:resource-id:qualifier + * 2. arn:partition:service:region:account-id:resource-type/resource-id/qualifier + * Different services have different resource definition, here we treat anything + * after "[account-id]:" as resource. Service should have their own resource parser. + */ + class AWS_CORE_API ARN + { + public: + ARN(const Aws::String& arnString); + /** + * return if the ARN is valid after construction. + */ + explicit operator bool() const { return m_valid; } + + /** + * Get the originating arn string. + */ + const Aws::String& GetARNString() const { return m_arnString; } + + const Aws::String& GetPartition() const { return m_partition; } + + const Aws::String& GetService() const { return m_service; } + + const Aws::String& GetRegion() const { return m_region; } + + const Aws::String& GetAccountId() const { return m_accountId; } + + const Aws::String& GetResource() const { return m_resource; } + + private: + Aws::String m_arnString; + Aws::String m_partition; + Aws::String m_service; + Aws::String m_region; + Aws::String m_accountId; + Aws::String m_resource; + + bool m_valid; + }; + } +} \ No newline at end of file diff --git a/include/aws/core/utils/Array.h b/include/aws/core/utils/Array.h new file mode 100644 index 0000000000000000000000000000000000000000..e466f2735d98e90aa00c0020a1e2ac834ca6349b --- /dev/null +++ b/include/aws/core/utils/Array.h @@ -0,0 +1,305 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 + +#include + +#endif // _WIN32 + +namespace Aws +{ + namespace Utils + { + static const char* ARRAY_ALLOCATION_TAG = "Aws::Array"; + + /** + * Safe array class with move and copy semantics. + */ + template + class Array + { + + public: + /** + * Create new empty array of size arraySize. Default argument is 0. If it is empty then no allocation happens. + */ + Array(size_t arraySize = 0) : + m_capacity(arraySize), + m_length(arraySize), + m_data(arraySize > 0 ? Aws::MakeUniqueArray(arraySize, ARRAY_ALLOCATION_TAG) : nullptr) + { + } + + /** + * Create new array and initialize it to a raw array + */ + Array(const T* arrayToCopy, size_t arraySize) : + m_capacity(arraySize), + m_length(arraySize), + m_data(nullptr) + { + if (arrayToCopy != nullptr && m_capacity > 0) + { + m_data.reset(Aws::NewArray(m_capacity, ARRAY_ALLOCATION_TAG)); + std::copy(arrayToCopy, arrayToCopy + arraySize, m_data.get()); + } + } + + /** + * Create new array with a pointer and its dimensions. + */ + Array(size_t capacity, + size_t length, + UniqueArrayPtr data) + : m_capacity(capacity), + m_length(length), + m_data(std::move(data)) + { + } + + /** + * Merge multiple arrays into one + */ + Array(Aws::Vector&& toMerge) + { + size_t totalSize = 0; + for(auto& array : toMerge) + { + totalSize += array->m_length; + } + + m_capacity = totalSize; + m_data.reset(Aws::NewArray(m_capacity, ARRAY_ALLOCATION_TAG)); + + size_t location = 0; + for(auto& arr : toMerge) + { + if(arr->m_capacity > 0 && arr->m_data) + { + size_t arraySize = arr->m_length; + std::copy(arr->m_data.get(), arr->m_data.get() + arraySize, m_data.get() + location); + location += arraySize; + } + } + m_length = location; + } + + Array(const Array& other) + { + m_capacity = other.m_capacity; + m_length = other.m_length; + m_data = nullptr; + + if (m_capacity > 0) + { + m_data.reset(Aws::NewArray(m_capacity, ARRAY_ALLOCATION_TAG)); + std::copy(other.m_data.get(), other.m_data.get() + other.m_capacity, m_data.get()); + } + } + + //move c_tor + Array(Array&& other) noexcept: + m_capacity(other.m_capacity), + m_length(other.m_length), + m_data(std::move(other.m_data)) + { + other.m_capacity = 0; + other.m_data = nullptr; + } + + virtual ~Array() = default; + + Array& operator=(const Array& other) + { + if (this == &other) + { + return *this; + } + + m_capacity = other.m_capacity; + m_length = other.m_length; + m_data = nullptr; + + if (m_capacity > 0) + { + m_data.reset(Aws::NewArray(m_capacity, ARRAY_ALLOCATION_TAG)); + std::copy(other.m_data.get(), other.m_data.get() + other.m_length, m_data.get()); + } + + return *this; + } + + Array& operator=(Array&& other) noexcept + { + m_capacity = other.m_capacity; + m_length = other.m_length; + m_data = std::move(other.m_data); + + return *this; + } + + Array(const Aws::String& string): + m_capacity(string.capacity()), + m_length(string.length()), + m_data(nullptr) + { + m_data.reset(Aws::NewArray(m_capacity, ARRAY_ALLOCATION_TAG)); + std::copy(string.c_str(), string.c_str() + string.length(), m_data.get()); + } + + bool operator==(const Array& other) const + { + if (this == &other) + return true; + + if (m_capacity == 0 && other.m_capacity == 0) + { + return true; + } + + if (m_length != other.m_length) + { + return false; + } + + if (m_length == other.m_length && m_capacity == other.m_capacity && m_data && other.m_data) + { + for (unsigned i = 0; i < m_length; ++i) + { + if (m_data.get()[i] != other.m_data.get()[i]) + return false; + } + + return true; + } + + return false; + } + + bool operator!=(const Array& other) const + { + return !(*this == other); + } + + T const& GetItem(size_t index) const + { + assert(index < m_length); + return m_data.get()[index]; + } + + T& GetItem(size_t index) + { + assert(index < m_length); + return m_data.get()[index]; + } + + T& operator[](size_t index) + { + return GetItem(index); + } + + T const& operator[](size_t index) const + { + return GetItem(index); + } + + inline size_t GetLength() const + { + return m_length; + } + + inline size_t GetSize() const + { + return m_capacity; + } + + inline T* GetUnderlyingData() const + { + return m_data.get(); + } + + inline void SetLength(size_t len) + { + m_length = len; + } + + protected: + size_t m_capacity = 0; + size_t m_length = 0; + Aws::UniqueArrayPtr m_data; + }; + + typedef Array ByteBuffer; + + /** + * Buffer for cryptographic operations. It zeroes itself back out upon deletion. Everything else is identical + * to byte buffer. + */ + class AWS_CORE_API CryptoBuffer : public ByteBuffer + { + public: + CryptoBuffer(size_t arraySize = 0) : ByteBuffer(arraySize) {} + CryptoBuffer(const unsigned char* arrayToCopy, size_t arraySize) : ByteBuffer(arrayToCopy, arraySize) {} + CryptoBuffer(Aws::Vector&& toMerge) : ByteBuffer(std::move(toMerge)) {} + CryptoBuffer(const ByteBuffer& other) : ByteBuffer(other) {} + CryptoBuffer(const CryptoBuffer& other) : ByteBuffer(other) {} + CryptoBuffer(CryptoBuffer&& other) : ByteBuffer(std::move(other)) {} + CryptoBuffer& operator=(const CryptoBuffer& other) { Zero(); ByteBuffer::operator=(other); return *this; } + CryptoBuffer& operator=(CryptoBuffer&& other) { Zero(); ByteBuffer::operator=(std::move(other)); return *this; } + + CryptoBuffer(Crt::ByteBuf&& other) noexcept : ByteBuffer( + other.len, + other.len, + nullptr) + { + // Crt::ByteBuf must be allocated using SDK not CRT allocator + assert(get_aws_allocator() == other.allocator); + m_data.reset(other.buffer); + other.capacity = 0; + other.len = 0; + other.allocator = nullptr; + other.buffer = nullptr; + } + + CryptoBuffer& operator=(Crt::ByteBuf&& other) noexcept + { + // Crt::ByteBuf must be allocated using SDK not CRT allocator + assert(get_aws_allocator() == other.allocator); + m_capacity = other.len; + m_length = other.len; + m_data.reset(other.buffer); + other.capacity = 0; + other.len = 0; + other.allocator = nullptr; + other.buffer = nullptr; + return *this; + } + + bool operator==(const CryptoBuffer& other) const { return ByteBuffer::operator==(other); } + bool operator!=(const CryptoBuffer& other) const { return ByteBuffer::operator!=(other); } + + ~CryptoBuffer() override { Zero(); } + + Array Slice(size_t sizeOfSlice) const; + CryptoBuffer& operator^(const CryptoBuffer& operand); + void Zero(); + }; + + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/Cache.h b/include/aws/core/utils/Cache.h new file mode 100644 index 0000000000000000000000000000000000000000..74d40ea02d160c697107129cbf29fd1a616916d3 --- /dev/null +++ b/include/aws/core/utils/Cache.h @@ -0,0 +1,176 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + /** + * In-memory fixed-size cache utility. + */ + template + class Cache + { + public: + /** + * Initialize the cache with a particular size. + * The size of the cache is fixed and does not grow over time. + */ + explicit Cache(size_t initialSize = 1000) : m_maxSize(initialSize) + { + } + + struct Value + { + DateTime expiration; + TValue val; + }; + + /** + * Retrieves the value associated with the given key if exists and returns true. Otherwise, returns false. + * @param key The of key of the entry to retrieve. + * @param value The retrieved value in case the key exists in the cache + */ + bool Get(const TKey& key, TValue& value) const + { + auto it = m_entries.find(key); + if (it == m_entries.end()) + { + return false; + } + + if (DateTime::Now() > it->second.expiration) + { + return false; + } + + value = it->second.val; + return true; + } + + /** + * Add or update a cache entry. + * When the number of items in the cache reaches the maximum, newly added items will evict expired items. + * If the cache size is at its maximum and none of the existing items are expired, the entry that is closest + * to expiration will be evicted. + * + * Note: Expired entries are not evicted upon expiration, but rather when space is needed for new items. + * + * @param key The of key of the entry that will be used to retrieve it. + * @param val The value of the entry to associate with the given key. + * @param duration The duration after which the cache entry will expire and become a candidate for eviction. + */ + template + void Put(TKey&& key, UValue&& val, std::chrono::milliseconds duration) + { + auto it = m_entries.find(key); + const DateTime expiration = DateTime::Now() + duration; + if (it != m_entries.end()) + { + it->second.val = std::forward(val); + it->second.expiration = expiration; + return; + } + + if (m_entries.size() >= m_maxSize) + { + Prune(); // removes expired/expiring elements + } + + m_entries.emplace(std::move(key), Value { expiration, std::forward(val) }); + } + + template + void Put(const TKey& key, UValue&& val, std::chrono::milliseconds duration) + { + auto it = m_entries.find(key); + const DateTime expiration = DateTime::Now() + duration; + if (it != m_entries.end()) + { + it->second.val = std::forward(val); + it->second.expiration = expiration; + return; + } + + if (m_entries.size() >= m_maxSize) + { + Prune(); // removes expired/expiring elements + } + + m_entries.emplace(key, Value { expiration, std::forward(val) }); + } + + /** + * Will transform the underlying cache to have a updated Value from the result of a function. + * + * @param function A function that returns type value that will be inserted into the cache at the + * specified key. + */ + using TransformFunction = std::function; + void Transform(TransformFunction function) { + for (auto it = m_entries.begin(); it != m_entries.end(); ++it) { + it->second = function(it->first, it->second); + } + } + + /** + * Will remove a entry from the map base on a function applied on the value of the entry. If true the + * entry will be remove from the cache. + * + * @param function The predicate that will determine if a value is removed. + */ + using FilterFunction = std::function; + void Filter(FilterFunction function) { + auto it = m_entries.begin(); + while (it != m_entries.end()) { + auto shouldFilter = function(it->first, it->second); + if (shouldFilter) { + it = m_entries.erase(it); + } else { + ++it; + } + } + } + + private: + + void Prune() + { + auto mostExpiring = m_entries.begin(); + // remove the expired ones. If none expired, remove the one that's closest to expiring. + for (auto it = m_entries.begin(); it != m_entries.end();) + { + if (DateTime::Now() > it->second.expiration) + { + it = m_entries.erase(it); + } + else + { + if (it->second.expiration < mostExpiring->second.expiration) + { + mostExpiring = it; + } + ++it; + } + } + + // if nothing was erased. Remove the most expiring element. + if (m_entries.size() >= m_maxSize) + { + m_entries.erase(mostExpiring); + } + } + + Aws::Map m_entries; + const size_t m_maxSize; + }; + } +} diff --git a/include/aws/core/utils/ConcurrentCache.h b/include/aws/core/utils/ConcurrentCache.h new file mode 100644 index 0000000000000000000000000000000000000000..f0c2b4346c44f8ce057c7707e57963a6597b099b --- /dev/null +++ b/include/aws/core/utils/ConcurrentCache.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + template + class ConcurrentCache + { + public: + explicit ConcurrentCache(size_t size = 1000) : m_cache(size) { } + + bool Get(const TKey& key, TValue& value) const + { + Aws::Utils::Threading::ReaderLockGuard g(m_rwlock); + return m_cache.Get(key, value); + } + + template + void Put(const TKey& key, UValue&& val, std::chrono::milliseconds duration) + { + Aws::Utils::Threading::WriterLockGuard g(m_rwlock); + m_cache.Put(key, std::forward(val), duration); + } + + template + void Put(TKey&& key, UValue&& val, std::chrono::milliseconds duration) + { + Aws::Utils::Threading::WriterLockGuard g(m_rwlock); + m_cache.Put(std::move(key), std::forward(val), duration); + } + + using TransformFunction = std::function::Value(const TKey &, + const typename Aws::Utils::Cache::Value &)>; + + void Transform(TransformFunction function) { + Aws::Utils::Threading::WriterLockGuard g(m_rwlock); + m_cache.Transform(function); + } + + using FilterFunction = std::function::Value &)>; + + void Filter(FilterFunction function) { + Aws::Utils::Threading::WriterLockGuard g(m_rwlock); + m_cache.Filter(function); + } + + private: + Aws::Utils::Cache m_cache; + mutable Aws::Utils::Threading::ReaderWriterLock m_rwlock; + }; + } +} diff --git a/include/aws/core/utils/DNS.h b/include/aws/core/utils/DNS.h new file mode 100644 index 0000000000000000000000000000000000000000..7472a386c0377da096b317bf7877783b04c0f072 --- /dev/null +++ b/include/aws/core/utils/DNS.h @@ -0,0 +1,18 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +namespace Aws +{ + namespace Utils + { + AWS_CORE_API bool IsValidDnsLabel(const Aws::String& label); + + AWS_CORE_API bool IsValidHost(const Aws::String& host); + } +} diff --git a/include/aws/core/utils/DateTime.h b/include/aws/core/utils/DateTime.h new file mode 100644 index 0000000000000000000000000000000000000000..d93434cea4b41f179ebd2903204be19de4dcc50b --- /dev/null +++ b/include/aws/core/utils/DateTime.h @@ -0,0 +1,267 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + enum class DateFormat + { + RFC822, //for http headers + ISO_8601, //for query and xml payloads + ISO_8601_BASIC, // for retry headers and signers + AutoDetect + }; + + enum class Month + { + January = 0, + February, + March, + April, + May, + June, + July, + August, + September, + October, + November, + December + }; + + enum class DayOfWeek + { + Sunday = 0, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday + }; + + /** + * Wrapper for timestamp functionality. + */ + class AWS_CORE_API DateTime + { + public: + /** + * Initializes time point to epoch + */ + DateTime(); + + /** + * Initializes time point to any other arbitrary timepoint + */ + DateTime(const std::chrono::system_clock::time_point& timepointToAssign); + + /** + * Initializes time point to millis Since epoch + */ + DateTime(int64_t millisSinceEpoch); + + /** + * Initializes time point to epoch time in seconds with a millis mantissa, + * + * i.e. 1.1 would be 1100 milliseconds + */ + DateTime(double secondsSinceEpoch); + + /** + * Initializes time point to value represented by timestamp and format. + */ + DateTime(const Aws::String& timestamp, DateFormat format); + + /** + * Initializes time point to value represented by timestamp and format. + */ + DateTime(const char* timestamp, DateFormat format); + + bool operator == (const DateTime& other) const; + bool operator < (const DateTime& other) const; + bool operator > (const DateTime& other) const; + bool operator != (const DateTime& other) const; + bool operator <= (const DateTime& other) const; + bool operator >= (const DateTime& other) const; + + DateTime operator+(const std::chrono::milliseconds& a) const; + DateTime operator-(const std::chrono::milliseconds& a) const; + + /** + * Initializes time point to epoch time in seconds with a millis mantissa, + * + * i.e. 1.1 would be 1100 milliseconds + */ + DateTime& operator=(double secondsSinceEpoch); + + /** + * Assign from millis since epoch. + */ + DateTime& operator=(int64_t millisSinceEpoch); + + /** + * Assign from another time_point + */ + DateTime& operator=(const std::chrono::system_clock::time_point& timepointToAssign); + + /** + * Assign from an ISO8601 or RFC822 formatted string + */ + DateTime& operator=(const Aws::String& timestamp); + + /** + * Whether or not parsing the timestamp from string was successful. + */ + inline bool WasParseSuccessful() const { return m_valid; } + + /** + * Convert dateTime to local time string using predefined format. + */ + Aws::String ToLocalTimeString(DateFormat format) const; + + /** + * Convert dateTime to local time string using arbitrary format. + */ + Aws::String ToLocalTimeString(const char* formatStr) const; + + /** + * Convert dateTime to GMT time string using predefined format. + */ + Aws::String ToGmtString(DateFormat format) const; + + /** + * Convert dateTime to GMT time string using arbitrary format. + */ + Aws::String ToGmtString(const char* formatStr) const; + + /** + * Convert dateTime to GMT time string using predefined format. + */ + Aws::String ToGmtStringWithMs() const; + + /** + * Get the representation of this datetime as seconds with a millis mantissa since epoch + * + * i.e. 1.1 would be 1100 milliseconds + */ + double SecondsWithMSPrecision() const; + + /** + * Get the seconds without millisecond precision. + */ + int64_t Seconds() const; + + /** + * Milliseconds since epoch of this datetime. + */ + int64_t Millis() const; + + /** + * In the likely case this class doesn't do everything you need to do, here's a copy of the time_point structure. Have fun. + */ + std::chrono::system_clock::time_point UnderlyingTimestamp() const; + + /** + * Get the Year portion of this dateTime. localTime if true, return local time, otherwise return UTC + */ + int GetYear(bool localTime = false) const; + + /** + * Get the Month portion of this dateTime. localTime if true, return local time, otherwise return UTC + */ + Month GetMonth(bool localTime = false) const; + + /** + * Get the Day of the Month portion of this dateTime. localTime if true, return local time, otherwise return UTC + */ + int GetDay(bool localTime = false) const; + + /** + * Get the Day of the Week portion of this dateTime. localTime if true, return local time, otherwise return UTC + */ + DayOfWeek GetDayOfWeek(bool localTime = false) const; + + /** + * Get the Hour portion of this dateTime. localTime if true, return local time, otherwise return UTC + */ + int GetHour(bool localTime = false) const; + + /** + * Get the Minute portion of this dateTime. localTime if true, return local time, otherwise return UTC + */ + int GetMinute(bool localTime = false) const; + + /** + * Get the Second portion of this dateTime. localTime if true, return local time, otherwise return UTC + */ + int GetSecond(bool localTime = false) const; + + /** + * Get whether or not this dateTime is in Daylight savings time. localTime if true, return local time, otherwise return UTC + */ + bool IsDST(bool localTime = false) const; + + /** + * Get an instance of DateTime representing this very instant. + */ + static DateTime Now(); + + /** + * Get the millis since epoch representing this very instant. + */ + static int64_t CurrentTimeMillis(); + + /** + * Calculates the current local timestamp, formats it and returns it as a string + */ + static Aws::String CalculateLocalTimestampAsString(const char* formatStr); + + /** + * Calculates the current gmt timestamp, formats it, and returns it as a string + */ + static Aws::String CalculateGmtTimestampAsString(const char* formatStr); + + /** + * Calculates the current hour of the day in localtime. + */ + static int CalculateCurrentHour(); + + /** + * The amazon timestamp format is a double with seconds.milliseconds + */ + static double ComputeCurrentTimestampInAmazonFormat(); + + /** + * Calculates the current time in GMT with millisecond precision using the format + * "Year-month-day hours:minutes:seconds.milliseconds" + */ + static Aws::String CalculateGmtTimeWithMsPrecision(); + + /** + * Compute the difference between two timestamps. + */ + static std::chrono::milliseconds Diff(const DateTime& a, const DateTime& b); + + std::chrono::milliseconds operator - (const DateTime& other) const; + private: + std::chrono::system_clock::time_point m_time; + bool m_valid; + + void ConvertTimestampStringToTimePoint(const char* timestamp, DateFormat format); + tm GetTimeStruct(bool localTime) const; + tm ConvertTimestampToLocalTimeStruct() const; + tm ConvertTimestampToGmtStruct() const; + }; + + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/Document.h b/include/aws/core/utils/Document.h new file mode 100644 index 0000000000000000000000000000000000000000..6989aa7d8046be2f1a207a91b8c4e6f441163bc0 --- /dev/null +++ b/include/aws/core/utils/Document.h @@ -0,0 +1,374 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Json + { + class JsonValue; + class JsonView; + } + + class DocumentView; + /** + * A Document type represents open content that is serialized using the same format as its surroundings and requires no additional encoding or escaping. + * Document types provide a JSON "view" of data regardless of the underlying protocol. This normalized JSON interface makes document types protocol-agnostic. + * Clients can use the data stored in a document without prior knowledge of the protocol by interacting with the normalized JSON view of the data. + * Document types are only initially supported in JSON protocol, so it's identical to Aws::Utils::Json::JsonValue and Aws::Utils::Json::JsonView at this moment. + */ + class AWS_CORE_API Document + { + public: + /** + * Constructs empty Document. + */ + Document(); + + /** + * Constructs a Document by parsing the input string. + */ + Document(const Aws::String& value); + + /** + * Constructs a Document by parsing the text in the input stream. + */ + Document(Aws::IStream& istream); + + /** + * Performs a deep copy of the Document parameter. + * Prefer using a @ref DocumentView if copying is not needed. + */ + Document(const Document& value); + + /** + * Moves the ownership of the internal Document. + * No copying is performed. + */ + Document(Document&& value); + + /** + * Performs a deep copy of the JsonView parameter. + */ + Document(const Json::JsonView& view); + + ~Document(); + + /** + * Performs a deep copy of the Document parameter. + */ + Document& operator=(const Document& other); + + /** + * Performs a deep copy of the JsonView parameter. + */ + Document& operator=(const Json::JsonView& view); + + /** + * Moves the ownership of the internal Document of the parameter to the current object. + * No copying is performed. + * A Document currently owned by the object will be freed prior to copying. + * @warning This will result in invalidating any outstanding views of the current Document. However, views + * to the moved-from Document would still valid. + */ + Document& operator=(Document&& other); + + bool operator==(const Document& other) const; + bool operator!=(const Document& other) const; + + /** + * Adds a string to the top level of this Document with key. + */ + Document& WithString(const Aws::String& key, const Aws::String& value); + Document& WithString(const char* key, const Aws::String& value); + /** + * Converts the current Document to a string. + */ + Document& AsString(const Aws::String& value); + + /** + * Adds a bool value with key to the top level of this Document. + */ + Document& WithBool(const Aws::String& key, bool value); + Document& WithBool(const char* key, bool value); + /** + * Converts the current Document to a bool. + */ + Document& AsBool(bool value); + + /** + * Adds an integer value at key at the top level of this Document. + */ + Document& WithInteger(const Aws::String& key, int value); + Document& WithInteger(const char* key, int value); + /** + * Converts the current Document to an integer. + */ + Document& AsInteger(int value); + + /** + * Adds a 64-bit integer value at key to the top level of this Document. + */ + Document& WithInt64(const Aws::String& key, long long value); + Document& WithInt64(const char* key, long long value); + /** + * Converts the current Document to a 64-bit integer. + */ + Document& AsInt64(long long value); + + /** + * Adds a double value at key at the top level of this Document. + */ + Document& WithDouble(const Aws::String& key, double value); + Document& WithDouble(const char* key, double value); + /** + * Converts the current Document to a double. + */ + Document& AsDouble(double value); + + /** + * Adds an array of strings to the top level of this Document at key. + */ + Document& WithArray(const Aws::String& key, const Array& array); + Document& WithArray(const char* key, const Array& array); + /** + * Adds an array of arbitrary Document objects to the top level of this Document at key. + * The values in the array parameter will be deep-copied. + */ + Document& WithArray(const Aws::String& key, const Array& array); + /** + * Adds an array of arbitrary Document objects to the top level of this Document at key. + * The values in the array parameter will be moved-from. + */ + Document& WithArray(const Aws::String& key, Array&& array); + /** + * Converts the current Document to an array whose values are deep-copied from the array parameter. + */ + Document& AsArray(const Array& array); + /** + * Converts the current Document to an array whose values are moved from the array parameter. + */ + Document& AsArray(Array&& array); + + /** + * Adds a Document object to the top level of this Document at key. + * The object parameter is deep-copied. + */ + Document& WithObject(const Aws::String& key, const Document& value); + Document& WithObject(const char* key, const Document& value); + /** + * Adds a Document object to the top level of this Document at key. + */ + Document& WithObject(const Aws::String& key, Document&& value); + Document& WithObject(const char* key, Document&& value); + /** + * Converts the current Document to a Document object by deep-copying the parameter. + */ + Document& AsObject(const Document& value); + /** + * Converts the current Document to a Document object by moving from the parameter. + */ + Document& AsObject(Document&& value); + + /** + * Returns true if the last parse request was successful. If this returns false, + * you can call GetErrorMessage() to find the cause. + */ + inline bool WasParseSuccessful() const + { + return m_wasParseSuccessful; + } + + /** + * Returns the last error message from a failed parse attempt. Returns empty string if no error. + */ + inline const Aws::String& GetErrorMessage() const + { + return m_errorMessage; + } + + /** + * Creates a view from the current Document. + */ + DocumentView View() const; + + /** + * Convert this document to a JsonValue + */ + Aws::Utils::Json::JsonValue Jsonize() const; + private: + void Destroy(); + Document(cJSON* value); + cJSON* m_json; + bool m_wasParseSuccessful; + Aws::String m_errorMessage; + friend DocumentView; + }; + + /** + * Provides read-only view to an existing Document. This allows lightweight copying without making deep + * copies of the Document. + * Note: This class does not extend the lifetime of the given Document. It's your responsibility to ensure + * the lifetime of the Document is extended beyond the lifetime of its view. + */ + class AWS_CORE_API DocumentView + { + public: + /* constructors */ + DocumentView(); + DocumentView(const Document& value); + DocumentView& operator=(const Document& value); + + /** + * Gets a string from this Document by its key. + */ + Aws::String GetString(const Aws::String& key) const; + /** + * Returns the value of this Document as a string. + */ + Aws::String AsString() const; + /** + * Tests whether the current value is a string. + */ + bool IsString() const; + + /** + * Gets a boolean value from this Document by its key. + */ + bool GetBool(const Aws::String& key) const; + /** + * Returns the value of this Document as a boolean. + */ + bool AsBool() const; + /** + * Tests whether the current value is a boolean. + */ + bool IsBool() const; + + /** + * Gets an integer value from this Document by its key. + * The integer is of the same size as an int on the machine. + */ + int GetInteger(const Aws::String& key) const; + /** + * Returns the value of this Document as an int. + */ + int AsInteger() const; + /** + * Tests whether the current value is an int or int64_t. + * Returns false if the value is floating-point. + */ + bool IsIntegerType() const; + + /** + * Converts the current Document to a 64-bit integer. + */ + Document& AsInt64(long long value); + /** + * Gets a 64-bit integer value from this Document by its key. + * The value is 64-bit regardless of the platform/machine. + */ + int64_t GetInt64(const Aws::String& key) const; + /** + * Returns the value of this Document as 64-bit integer. + */ + int64_t AsInt64() const; + + /** + * Gets a double precision floating-point value from this Document by its key. + */ + double GetDouble(const Aws::String& key) const; + /** + * Returns the value of this Document as a double precision floating-point. + */ + double AsDouble() const; + /** + * Tests whether the current value is a floating-point. + */ + bool IsFloatingPointType() const; + + /** + * Gets an array of DocumentView objects from this Document by its key. + */ + Array GetArray(const Aws::String& key) const; + /** + * Returns the value of this Document as an array of DocumentView objects. + */ + Array AsArray() const; + /** + * Tests whether the current value is a Document array. + */ + bool IsListType() const; + + /** + * Gets a DocumentView object from this Document by its key. + */ + DocumentView GetObject(const Aws::String& key) const; + /** + * Returns the value of this Document as a DocumentView object. + */ + DocumentView AsObject() const; + /** + * Reads all Document objects at the top level of this Document (does not traverse the tree any further) + * along with their keys. + */ + Aws::Map GetAllObjects() const; + /** + * Tests whether the current value is a Document object. + */ + bool IsObject() const; + + /** + * Tests whether the current value is NULL. + */ + bool IsNull() const; + + /** + * Tests whether a value exists at the current Document level for the given key. + * Returns true if a value has been found and its value is not null, false otherwise. + */ + bool ValueExists(const Aws::String& key) const; + + /** + * Tests whether a key exists at the current Document level. + */ + bool KeyExists(const Aws::String& key) const; + + /** + * Writes the current Document view without whitespace characters starting at the current level to a string. + */ + Aws::String WriteCompact() const; + + /** + * Writes the current Document view to a string in a human friendly format. + */ + Aws::String WriteReadable() const; + + /** + * Creates a deep copy of the JSON value rooted in the current JSON view. + */ + Document Materialize() const; + private: + DocumentView(cJSON* value); + DocumentView& operator=(cJSON* value); + cJSON* m_json; + friend Aws::Utils::Json::JsonValue; + }; + + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/EnumParseOverflowContainer.h b/include/aws/core/utils/EnumParseOverflowContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..0302e2bd3642072a3a1e46545fa1258ca62d2469 --- /dev/null +++ b/include/aws/core/utils/EnumParseOverflowContainer.h @@ -0,0 +1,36 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + /** + * This container is for storing unknown enum values that are encountered during parsing. + * This is to work around the round-tripping enums problem. It's really just a simple thread-safe + * hashmap. + */ + class AWS_CORE_API EnumParseOverflowContainer + { + public: + const Aws::String& RetrieveOverflow(int hashCode) const; + void StoreOverflow(int hashCode, const Aws::String& value); + + private: + mutable Aws::Utils::Threading::ReaderWriterLock m_overflowLock; + Aws::Map m_overflowMap; + Aws::String m_emptyString; + }; + } +} + + diff --git a/include/aws/core/utils/FileSystemUtils.h b/include/aws/core/utils/FileSystemUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..430e7ae4418100c3ddd5a9595937dcd7a959929b --- /dev/null +++ b/include/aws/core/utils/FileSystemUtils.h @@ -0,0 +1,70 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include +#include + +#include + +namespace Aws +{ + namespace Utils + { + + class AWS_CORE_API FStreamWithFileName : public Aws::FStream + { + public: + FStreamWithFileName(const Aws::String& fileName, std::ios_base::openmode openFlags) : + Aws::FStream(fileName.c_str(), openFlags), m_fileName(fileName) {} + + virtual ~FStreamWithFileName() = default; + + const Aws::String& GetFileName() const { return m_fileName; } + protected: + Aws::String m_fileName; + }; + + /** + * Provides a fstream around a temporary file. This file gets deleted upon an instance of this class's destructor being called. + */ + class AWS_CORE_API TempFile : public Aws::Utils::FStreamWithFileName + { + public: + /** + * Creates a temporary file with [prefix][temp name][suffix] e.g. + * prefix of "foo" and suffix of ".bar" will generate foo[some random string].bar + */ + TempFile(const char* prefix, const char* suffix, std::ios_base::openmode openFlags); + /** + * Creates a temporary file with [prefix][temp name] e.g. + * prefix of "foo" will generate foo[some random string] + */ + TempFile(const char* prefix, std::ios_base::openmode openFlags); + /** + * Creates a temporary file with a random string for the name. + */ + TempFile(std::ios_base::openmode openFlags); + + ~TempFile(); + }; + + class AWS_CORE_API PathUtils + { + public: + + /** + * Get file name from it's full path, e.g get "file1" from "/path/to/file1.ext"; get "file2" from "/path/to/file2" + */ + static Aws::String GetFileNameFromPathWithoutExt(const Aws::String& path); + + /** + * Get file name from it's full path, e.g get "file1.ext" from "/path/to/file1.ext"; get "file2" from "/path/to/file2" + */ + static Aws::String GetFileNameFromPathWithExt(const Aws::String& path); + }; + } +} diff --git a/include/aws/core/utils/FutureOutcome.h b/include/aws/core/utils/FutureOutcome.h new file mode 100644 index 0000000000000000000000000000000000000000..e8d30b4a8c50df40ac7db2365dbd99bb2db17b54 --- /dev/null +++ b/include/aws/core/utils/FutureOutcome.h @@ -0,0 +1,24 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +namespace Aws +{ + namespace Utils + { + + /** + * Template class representing the std::future object of outcome of calling some other API. + * It will contain a future of an either a successful result or the failure error. + * The caller must check whether the outcome of the request was a success before attempting to access + * the result or the error. + */ + template // Result, Error + using FutureOutcome = Aws::Utils::Outcome; + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/GetTheLights.h b/include/aws/core/utils/GetTheLights.h new file mode 100644 index 0000000000000000000000000000000000000000..f42475c8e4f9758699fdad9f4cd65b6f71e63b6b --- /dev/null +++ b/include/aws/core/utils/GetTheLights.h @@ -0,0 +1,35 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + /** + * Make initialization and cleanup of shared resources less painful. + * If you have this problem. Create a static instance of GetTheLights, + * have each actor call Enter the room with your callable. + * + * When you are finished with the shared resources call LeaveRoom(). The last caller will + * have its callable executed. + */ + class AWS_CORE_API GetTheLights + { + public: + GetTheLights(); + void EnterRoom(std::function&&); + void LeaveRoom(std::function&&); + private: + std::atomic m_value; + }; + } +} \ No newline at end of file diff --git a/include/aws/core/utils/HashingUtils.h b/include/aws/core/utils/HashingUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..ddd63c6bd2030d0646cf4abf3966292c6092e9d4 --- /dev/null +++ b/include/aws/core/utils/HashingUtils.h @@ -0,0 +1,126 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + + /** + * Generic utils for hashing strings + */ + class AWS_CORE_API HashingUtils + { + public: + /** + * Base64 encodes string + */ + static Aws::String Base64Encode(const ByteBuffer& byteBuffer); + + /** + * Base64 decodes string + */ + static ByteBuffer Base64Decode(const Aws::String&); + + /** + * Hex encodes string + */ + static Aws::String HexEncode(const ByteBuffer& byteBuffer); + + /** + * Hex encodes string + */ + static ByteBuffer HexDecode(const Aws::String& str); + + /** + * Calculates a SHA256 HMAC digest (not hex encoded) + */ + static ByteBuffer CalculateSHA256HMAC(const ByteBuffer& toSign, const ByteBuffer& secret); + + /** + * Calculates a SHA256 Hash digest (not hex encoded) + */ + static ByteBuffer CalculateSHA256(const Aws::String& str); + + /** + * Calculates a SHA256 Hash digest on a stream (the entire stream is read, not hex encoded.) + */ + static ByteBuffer CalculateSHA256(Aws::IOStream& stream); + + /** + * Calculates a SHA256 Tree Hash digest (not hex encoded, see tree hash definition: http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html) + */ + static ByteBuffer CalculateSHA256TreeHash(const Aws::String& str); + + /** + * Calculates a SHA256 Tree Hash digest on a stream (the entire stream is read, not hex encoded.) + */ + static ByteBuffer CalculateSHA256TreeHash(Aws::IOStream& stream); + + /** + * Calculates a SHA1 Hash digest (not hex encoded) + */ + static ByteBuffer CalculateSHA1(const Aws::String& str); + + /** + * Calculates a SHA1 Hash digest on a stream (the entire stream is read, not hex encoded.) + */ + static ByteBuffer CalculateSHA1(Aws::IOStream& stream); + + /** + * Calculates a MD5 Hash value + */ + static ByteBuffer CalculateMD5(const Aws::String& str); + + /** + * Calculates a MD5 Hash value + */ + static ByteBuffer CalculateMD5(Aws::IOStream& stream); + + /** + * Calculates a CRC32 Hash value + */ + static ByteBuffer CalculateCRC32(const Aws::String& str); + + /** + * Calculates a CRC32 Hash value + */ + static ByteBuffer CalculateCRC32(Aws::IOStream& stream); + + /** + * Calculates a CRC32C Hash value + */ + static ByteBuffer CalculateCRC32C(const Aws::String& str); + + /** + * Calculates a CRC32C Hash value + */ + static ByteBuffer CalculateCRC32C(Aws::IOStream& stream); + + /** + * Calculates a CRC64 Hash value + */ + static ByteBuffer CalculateCRC64(const Aws::String& str); + + /** + * Calculates a CRC64 Hash value + */ + static ByteBuffer CalculateCRC64(Aws::IOStream& stream); + + static int HashString(const char* strToHash); + + }; + + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/Outcome.h b/include/aws/core/utils/Outcome.h new file mode 100644 index 0000000000000000000000000000000000000000..440ff1fd98799292fb46500d57fbd56228afbe63 --- /dev/null +++ b/include/aws/core/utils/Outcome.h @@ -0,0 +1,183 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Utils + { + + /** + * Template class representing the outcome of making a request. It will contain + * either a successful result or the failure error. The caller must check + * whether the outcome of the request was a success before attempting to access + * the result or the error. + */ + template // Result, Error + class Outcome + { + public: + + Outcome() : result(), error(), success(false) + { + } + Outcome(const R& r) : result(r), error(), success(true) + { + } + Outcome(const E& e) : result(), error(e), success(false) + { + } + Outcome(R&& r) : result(std::forward(r)), error(), success(true) + { + } + Outcome(E&& e) : result(), error(std::forward(e)), success(false) + { + } + Outcome(const Outcome& o) : + result(o.result), + error(o.error), + success(o.success) + { + } + + template + friend class Outcome; + +#if defined (__cplusplus) && __cplusplus > 201103L + template< bool B, class T = void > + using enable_if_t = std::enable_if_t; +#else + template< bool B, class T = void > + using enable_if_t = typename std::enable_if::type; +#endif + + // Move both result and error from other type of outcome + template::value && + std::is_convertible::value, int> = 0> + Outcome(Outcome&& o) : + result(std::move(o.result)), + error(std::move(o.error)), + success(o.success) + { + } + + // Move result from other type of outcome + template::value && + !std::is_convertible::value, int> = 0> + Outcome(Outcome&& o) : + result(std::move(o.result)), + success(o.success) + { + assert(o.success); + } + + // Move error from other type of outcome + template::value && + std::is_convertible::value, int> = 0> + Outcome(Outcome&& o) : + error(std::move(o.error)), + success(o.success) + { + assert(!o.success); + } + + template::value, int> = 0> + Outcome(ET&& e) : error(std::forward(e)), success(false) + { + } + + Outcome& operator=(const Outcome& o) + { + if (this != &o) + { + result = o.result; + error = o.error; + success = o.success; + retryCount = o.retryCount; + } + + return *this; + } + + Outcome(Outcome&& o) : // Required to force Move Constructor + result(std::move(o.result)), + error(std::move(o.error)), + success(o.success), + retryCount(std::move(o.retryCount)) + { + } + + Outcome& operator=(Outcome&& o) + { + if (this != &o) + { + result = std::move(o.result); + error = std::move(o.error); + success = o.success; + retryCount = std::move(o.retryCount); + } + + return *this; + } + + inline const R& GetResult() const + { + return result; + } + + inline R& GetResult() + { + return result; + } + + /** + * casts the underlying result to an r-value so that caller can take ownership of underlying resources. + * this is necessary when streams are involved. + */ + inline R&& GetResultWithOwnership() + { + return std::move(result); + } + + inline const E& GetError() const + { + return error; + } + + template + inline T GetError() + { + return error.template GetModeledError(); + } + + inline bool IsSuccess() const + { + return this->success; + } + + /** + * Returns how many times the retry happened before getting this outcome. + */ + inline unsigned int GetRetryCount() const { return retryCount; } + /** + * Sets the retry count. + */ + inline void SetRetryCount(const unsigned int iRetryCount) { retryCount = iRetryCount; } + + private: + R result; + E error; + bool success = false; + unsigned int retryCount = 0; + }; + + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/RAIICounter.h b/include/aws/core/utils/RAIICounter.h new file mode 100644 index 0000000000000000000000000000000000000000..7da11be87750ca3b7f4cfedc47b108439e9a4063 --- /dev/null +++ b/include/aws/core/utils/RAIICounter.h @@ -0,0 +1,39 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + /** + * A simple wrapper over std::atomic that captures atomic by reference and + * increases-decreases it's count in constructor-destructor. + * Optionally notifies all on conditional variable pointer if set and counter reaches 0. + */ + class AWS_CORE_API RAIICounter final + { + public: + RAIICounter(std::atomic& iCount, std::condition_variable* cv = nullptr); + ~RAIICounter(); + + RAIICounter(const RAIICounter&) = delete; + RAIICounter(RAIICounter&&) = delete; + RAIICounter& operator=(const RAIICounter&) = delete; + RAIICounter& operator=(RAIICounter&&) = delete; + + protected: + std::atomic& m_count; + std::condition_variable* m_cv; + }; + } +} + diff --git a/include/aws/core/utils/ResourceManager.h b/include/aws/core/utils/ResourceManager.h new file mode 100644 index 0000000000000000000000000000000000000000..718c32beba61e99b62b001196cad57a2727f8607 --- /dev/null +++ b/include/aws/core/utils/ResourceManager.h @@ -0,0 +1,173 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + /** + * Generic resource manager with Acquire/Release semantics. Acquire will block waiting on a an available resource. Release will + * cause one blocked acquisition to unblock. + * + * You must call ShutdownAndWait() when finished with this container, this unblocks the listening thread and gives you a chance to + * clean up the resource if needed. + * After calling ShutdownAndWait(), you must not call Acquire any more. + */ + template< typename RESOURCE_TYPE> + class ExclusiveOwnershipResourceManager + { + public: + ExclusiveOwnershipResourceManager() : m_shutdown(false) {} + + /** + * Returns a resource with exclusive ownership. You must call Release on the resource when you are finished or other + * threads will block waiting to acquire it. + * + * @return instance of RESOURCE_TYPE + */ + RESOURCE_TYPE Acquire() + { + std::unique_lock locker(m_queueLock); + while(!m_shutdown.load() && m_resources.size() == 0) + { + m_semaphore.wait(locker, [&](){ return m_shutdown.load() || m_resources.size() > 0; }); + } + + assert(!m_shutdown); + + RESOURCE_TYPE resource = m_resources.back(); + m_resources.pop_back(); + + return resource; + } + + /** + * Returns a resource with exclusive ownership. You must call Release on the resource when you are finished or other + * threads will block waiting to acquire it. + * + * @return instance of RESOURCE_TYPE, nullptr if the resource manager is being shutdown + */ + RESOURCE_TYPE TryAcquire(typename std::enable_if::value >::type* = 0) + { + std::unique_lock locker(m_queueLock); + while(!m_shutdown.load() && m_resources.size() == 0) + { + m_semaphore.wait(locker, [&](){ return m_shutdown.load() || m_resources.size() > 0; }); + } + + if (m_shutdown) { + return nullptr; + } + + RESOURCE_TYPE resource = m_resources.back(); + m_resources.pop_back(); + + return resource; + } + + /** + * Returns a resource with exclusive ownership or a nullptr. + * If resource is available within the wait timeout then the resource is returned. + * otherwise (if the timeout has expired or container is shutdown) the nullptr is returned. + * You must call Release on the resource when you are finished. + * This method is enabled only for pointer RESOURCE_TYPE type. + * + * @return instance of RESOURCE_TYPE, nullptr if the resource manager is being shutdown + */ + template ::value>::type* = nullptr> + RESOURCE_TYPE TryAcquire(const uint64_t timeoutMs) { + std::unique_lock locker(m_queueLock); + bool hasResource = m_shutdown.load() || !m_resources.empty(); + if (!hasResource) { + hasResource = m_semaphore.wait_for(locker, std::chrono::milliseconds(timeoutMs), + [&]() { return m_shutdown.load() || !m_resources.empty(); }); + } + + if (m_shutdown || !hasResource) { + return nullptr; + } + + RESOURCE_TYPE resource = m_resources.back(); + m_resources.pop_back(); + + return resource; + } + + /** + * Returns whether or not resources are currently available for acquisition + * + * @return true means that at this instant some resources are available (though another thread may grab them from under you), + * this is only a hint. + */ + bool HasResourcesAvailable() + { + std::lock_guard locker(m_queueLock); + return m_resources.size() > 0 && !m_shutdown.load(); + } + + /** + * Releases a resource back to the pool. This will unblock one waiting Acquire call if any are waiting. + * + * @param resource resource to release back to the pool + */ + void Release(RESOURCE_TYPE resource) + { + std::unique_lock locker(m_queueLock); + m_resources.push_back(resource); + locker.unlock(); + m_semaphore.notify_one(); + } + + /** + * Does not block or even touch the semaphores. This is intended for setup only, do not use this after Acquire has been called for the first time. + * + * @param resource resource to be managed. + */ + void PutResource(RESOURCE_TYPE resource) + { + m_resources.push_back(resource); + } + + /** + * Waits for all acquired resources to be released, then empties the queue. + * You must call ShutdownAndWait() when finished with this container, this unblocks the listening thread and gives you a chance to + * clean up the resource if needed. + * After calling ShutdownAndWait(), you must not call Acquire any more. + * + * @params resourceCount the number of resources you've added to the resource manager. + * @return the previously managed resources that are now available for cleanup. + */ + Aws::Vector ShutdownAndWait(size_t resourceCount) + { + std::unique_lock locker(m_queueLock); + m_shutdown = true; + m_semaphore.notify_all(); + + //wait for all acquired resources to be released. + while (m_resources.size() < resourceCount) + { + m_semaphore.wait(locker, [&]() { return m_resources.size() == resourceCount; }); + } + + Aws::Vector resources{std::move(m_resources)}; + m_semaphore.notify_one(); + return resources; + } + + private: + Aws::Vector m_resources; + std::mutex m_queueLock; + std::condition_variable m_semaphore; + std::atomic m_shutdown; + }; + } +} diff --git a/include/aws/core/utils/StringUtils.h b/include/aws/core/utils/StringUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..9edb2de1873298bf09d27a99cf69ce47febc6d6d --- /dev/null +++ b/include/aws/core/utils/StringUtils.h @@ -0,0 +1,240 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include + + +namespace Aws +{ + namespace Utils + { + /** + * All the things the c++ stdlib is missing for string operations that I needed. + */ + class AWS_CORE_API StringUtils + { + public: + static void Replace(Aws::String& s, const char* search, const char* replace); + + + /** + * Converts a string to lower case. + */ + static Aws::String ToLower(const char* source); + + + /** + * Converts a string to upper case. + */ + static Aws::String ToUpper(const char* source); + + + /** + * Does a caseless comparison of two strings. + */ + static bool CaselessCompare(const char* value1, const char* value2); + + + /** + * URL encodes a string (uses %20 not + for spaces). + */ + static Aws::String URLEncode(const char* unsafe); + + static inline Aws::String URLEncode(const Aws::String& unsafe) + { + return URLEncode(unsafe.c_str()); + } + + /** + * Http Clients tend to escape some characters but not all. Escaping all of them causes problems, because the client + * will also try to escape them. + * So this only escapes non-ascii characters and the + character + */ + static Aws::String UTF8Escape(const char* unicodeString, const char* delimiter); + + /** + * URL encodes a double (if it ends up going to scientific notation) otherwise it just returns it as a string. + */ + static Aws::String URLEncode(double unsafe); + + + /** + * Decodes a URL encoded string (will handle both encoding schemes for spaces). + */ + static Aws::String URLDecode(const char* safe); + + enum class SplitOptions + { + /** + * By default, removes all the empty entries in the vector returned by Split() + */ + NOT_SET, + /** + * Deprecated use INCLUDE_EMPTY_SEGMENTS instead. + */ + INCLUDE_EMPTY_ENTRIES, + /** + * Include delimiters as empty segments in the split string + */ + INCLUDE_EMPTY_SEGMENTS, + }; + + /** + * @brief Splits a string on a delimiter (empty items are excluded). + * @param toSplit, the original string to split + * @param splitOn, the delimiter you want to use. + */ + static Aws::Vector Split(const Aws::String& toSplit, char splitOn); + + /** + * @brief Splits a string on a delimiter. + * @param toSplit, the original string to split + * @param splitOn, the delimiter you want to use. + * @param option, if INCLUDE_EMPTY_ENTRIES, includes empty entries in the result, otherwise removes empty entries. + */ + static Aws::Vector Split(const Aws::String& toSplit, char splitOn, SplitOptions option); + + /** + * @brief Splits a string on a delimiter (empty items are excluded). + * @param toSplit, the original string to split + * @param splitOn, the delimiter you want to use. + * @param numOfTargetParts, how many target parts you want to get, if it is 0, as many as possible. + */ + static Aws::Vector Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts); + + /** + * @brief Splits a string on a delimiter. + * @param toSplit, the original string to split + * @param splitOn, the delimiter you want to use. + * @param numOfTargetParts, how many target parts you want to get, if it is 0, as many as possible. + * @param option, if INCLUDE_EMPTY_ENTRIES, includes empty entries in the result, otherwise removes empty entries. + */ + static Aws::Vector Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts, SplitOptions option); + + /** + * Splits a string on delimeter, keeping the delimiter in the string as a empty space. + * @param toSplit, the original string to split + * @param splitOn, the delimiter you want to use. + */ + static Aws::Vector SplitWithSpaces(const Aws::String& toSplit, char splitOn); + + /** + * Splits a string on new line characters. + */ + static Aws::Vector SplitOnLine(const Aws::String& toSplit); + + + /** static Aws::Vector SplitOnRegex(Aws::String regex); + * trim from start + */ + static Aws::String LTrim(const char* source); + + + /** + * trim from end + */ + static Aws::String RTrim(const char* source); + + /** + * trim from both ends + */ + static Aws::String Trim(const char* source); + + + /** + * convert to int 64 + */ + static long long ConvertToInt64(const char* source); + + + /** + * convert to int 32 + */ + static long ConvertToInt32(const char* source); + + + /** + * convert to bool + */ + static bool ConvertToBool(const char* source); + + + /** + * convert to double + */ + static double ConvertToDouble(const char* source); + + +#ifdef _WIN32 + /** + * Converts a string to wstring. + */ + static Aws::WString ToWString(const char* source); + + /** + * Converts a wstring to string. + */ + static Aws::String FromWString(const wchar_t* source); +#endif + + /** + * not all platforms (Android) have std::to_string + */ + template< typename T > + static Aws::String to_string(T value) + { + Aws::OStringStream os; + os << value; + return os.str(); + } + + /** + * locale agnostic implementation of std::isalnum + */ + static bool IsAlnum(char c) + { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'); + } + + /** + * Convert an unsigned integer to its hex string in upper case. + */ + template::value>::type> + static Aws::String ToHexString(T value) + { + if (value == 0) + { + return "0"; + } + + Aws::String s; + s.reserve(sizeof(value) * 2); + T r = value; + while (r > 0) + { + s += "0123456789ABCDEF"[r & 0xf]; + r >>= 4; + } + + std::reverse(s.begin(), s.end()); + return s; + } + + static Aws::String FromByteCursor(aws_byte_cursor cursor) + { + return Aws::String(reinterpret_cast(cursor.ptr), cursor.len); + } + }; + + + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/UUID.h b/include/aws/core/utils/UUID.h new file mode 100644 index 0000000000000000000000000000000000000000..6968b7780072165754e038bf3defc4195f862a3a --- /dev/null +++ b/include/aws/core/utils/UUID.h @@ -0,0 +1,57 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + static const size_t UUID_BINARY_SIZE = 0x10; + + /** + * Class encapsulating a UUID. This is platform dependent. The method you are most likely interested in is RandomUUID(). + */ + class AWS_CORE_API UUID + { + public: + /** + * Parses a GUID string into the raw data. + */ + UUID(const Aws::String&); + /** + * Sets the raw uuid data + */ + UUID(const unsigned char uuid[UUID_BINARY_SIZE]); + + /** + * Returns the current UUID as a GUID string + */ + operator Aws::String() const; + /** + * Returns a copy of the raw uuid + */ + inline operator ByteBuffer() const { return ByteBuffer(m_uuid, sizeof(m_uuid)); } + + /** + * Generates a UUID. It will always try to prefer a random implementation from the entropy source on the machine. If none, is available, it will + * fallback to the mac address and timestamp implementation. + */ + static Aws::Utils::UUID RandomUUID(); + + /** + * Generates a pseudo-random UUID. + */ + static Aws::Utils::UUID PseudoRandomUUID(); + + private: + unsigned char m_uuid[UUID_BINARY_SIZE]; + }; + } +} diff --git a/include/aws/core/utils/UnreferencedParam.h b/include/aws/core/utils/UnreferencedParam.h new file mode 100644 index 0000000000000000000000000000000000000000..d1bb74467d0317fada46246d3485e2e34bdf3f1a --- /dev/null +++ b/include/aws/core/utils/UnreferencedParam.h @@ -0,0 +1,18 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +// taken from http://stackoverflow.com/questions/3020584/avoid-warning-unreferenced-formal-parameter, ugly but avoids having to #include the definition of an unreferenced struct/class + +#if defined (_MSC_VER) + + #define AWS_UNREFERENCED_PARAM(x) (&reinterpret_cast(x)) + +#else + + #define AWS_UNREFERENCED_PARAM(x) ((void)(x)) + +#endif // _MSC_VER diff --git a/include/aws/core/utils/base64/Base64.h b/include/aws/core/utils/base64/Base64.h new file mode 100644 index 0000000000000000000000000000000000000000..503e73a24cfbd304ab3d7afe605aba25a7142977 --- /dev/null +++ b/include/aws/core/utils/base64/Base64.h @@ -0,0 +1,69 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#ifdef __APPLE__ + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // __clang__ + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif // __GNUC__ + +#endif // __APPLE__ + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Base64 + { + + /** + * interface for platform specific Base64 encoding/decoding. + */ + class AWS_CORE_API Base64 + { + public: + Base64(const char *encodingTable = nullptr); + + /** + * Encode a byte buffer into a base64 stream. + * + * throws Base64Exception if encoding fails. + */ + Aws::String Encode(const ByteBuffer&) const; + + /** + * Decode a base64 string into a byte buffer. + */ + ByteBuffer Decode(const Aws::String&) const; + + /** + * Calculates the required length of a base64 buffer after decoding the + * input string. + */ + static size_t CalculateBase64DecodedLength(const Aws::String& b64input); + /** + * Calculates the length of an encoded base64 string based on the buffer being encoded + */ + static size_t CalculateBase64EncodedLength(const ByteBuffer& buffer); + + private: + char m_mimeBase64EncodingTable[64]; + uint8_t m_mimeBase64DecodingTable[256]; + + }; + + } // namespace Base64 + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/component-registry/ComponentRegistry.h b/include/aws/core/utils/component-registry/ComponentRegistry.h new file mode 100644 index 0000000000000000000000000000000000000000..b80eca924006e4dc0e8ebf70965bb5692c5d9b5f --- /dev/null +++ b/include/aws/core/utils/component-registry/ComponentRegistry.h @@ -0,0 +1,48 @@ + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + /** + * A helper utility set of methods to track currently allocated components (i.e. AWS SDK service clients) + */ + namespace ComponentRegistry + { + /** + * A callback method type alias to terminate component. + */ + typedef void (*ComponentTerminateFn)(void* pClient, int64_t timeoutMs); + + /** + * Initialize a component registry (i.e. init global dictionary). + */ + AWS_CORE_API void InitComponentRegistry(); + /** + * Shutdown a component registry (i.e. release global dictionary). + */ + AWS_CORE_API void ShutdownComponentRegistry(); + /** + * Register component (i.e. AWS SDK service client) as active. + */ + AWS_CORE_API void RegisterComponent(const char* clientName, void* pClient, ComponentTerminateFn terminateMethod); + /** + * Remove component from a registry. + */ + AWS_CORE_API void DeRegisterComponent(void* pClient); + /** + * Terminate all registered clients. + */ + AWS_CORE_API void TerminateAllComponents(); + } + } +} diff --git a/include/aws/core/utils/crypto/CRC.h b/include/aws/core/utils/crypto/CRC.h new file mode 100644 index 0000000000000000000000000000000000000000..3d05b7a6d6fd4dad6a1bbf50643468764b342dd2 --- /dev/null +++ b/include/aws/core/utils/crypto/CRC.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include + +namespace Aws { +namespace Utils { +namespace Crypto { +template ByteBuffer ConvertToBuffer(HashT value) { + static_assert(std::is_integral::value, + "Must use integral type to convert to buffer"); + Aws::Utils::ByteBuffer buffer(sizeof(HashT)); + for (size_t i = 0; i < sizeof(HashT); ++i) { + size_t shiftSize = (sizeof(HashT) - 1) * 8 - i * 8; + buffer[i] = (value >> shiftSize) & 0xFF; + } + return buffer; +} + +template +class CRCChecksum : public Hash { +public: + CRCChecksum() : m_runningChecksum{0} {} + + ~CRCChecksum() override = default; + + HashResult Calculate(const Aws::String &str) override { + Aws::Crt::ByteCursor byteCursor = Aws::Crt::ByteCursorFromArray( + reinterpret_cast(str.data()), str.size()); + m_runningChecksum = CRTChecksumFuncT(byteCursor, m_runningChecksum); + return ByteBufferFuncT(m_runningChecksum); + }; + + HashResult Calculate(Aws::IStream &stream) override { + auto currentPos = stream.tellg(); + if (stream.eof()) { + currentPos = 0; + stream.clear(); + } + + stream.seekg(0, Aws::IStream::beg); + + uint8_t streamBuffer + [Aws::Utils::Crypto::Hash::INTERNAL_HASH_STREAM_BUFFER_SIZE]; + while (stream.good()) { + stream.read(reinterpret_cast(streamBuffer), + Aws::Utils::Crypto::Hash::INTERNAL_HASH_STREAM_BUFFER_SIZE); + const auto bytesRead = static_cast(stream.gcount()); + + if (bytesRead > 0) { + Aws::Crt::ByteCursor byteCursor = + Aws::Crt::ByteCursorFromArray(streamBuffer, bytesRead); + m_runningChecksum = CRTChecksumFuncT(byteCursor, m_runningChecksum); + } + } + + if (stream.bad()) { + AWS_LOGSTREAM_ERROR( + "CRCChecksum", + "Stream encountered an error while calculating CRC Checksum"); + } + + stream.clear(); + stream.seekg(currentPos, Aws::IStream::beg); + + return ByteBufferFuncT(m_runningChecksum); + }; + + void Update(unsigned char *buffer, size_t bufferSize) override { + Aws::Crt::ByteCursor byteCursor = + Aws::Crt::ByteCursorFromArray(buffer, bufferSize); + m_runningChecksum = CRTChecksumFuncT(byteCursor, m_runningChecksum); + }; + + HashResult GetHash() override { return ByteBufferFuncT(m_runningChecksum); }; + +private: + RunningChecksumT m_runningChecksum; +}; +} // namespace Crypto +} // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/crypto/CRC32.h b/include/aws/core/utils/crypto/CRC32.h new file mode 100644 index 0000000000000000000000000000000000000000..4b6001cfcdf41d06f7e7cec80daef09b2148bf31 --- /dev/null +++ b/include/aws/core/utils/crypto/CRC32.h @@ -0,0 +1,118 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* +* Interface for CRC32 and CRC32C +*/ +#pragma once + +#ifdef __APPLE__ + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // __clang__ + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif // __GNUC__ + +#endif // __APPLE__ + +#include + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + /** + * CRC32 hash implementation. + */ + class AWS_CORE_API CRC32 : public Hash + { + public: + /** + * Initializes platform crypto libs for crc32. + */ + CRC32(); + virtual ~CRC32(); + + /** + * Calculates a CRC32 Hash digest + */ + virtual HashResult Calculate(const Aws::String& str) override; + + /** + * Calculates a CRC32 Hash digest on a stream (the entire stream is read) + */ + virtual HashResult Calculate(Aws::IStream& stream) override; + + /** + * Updates a Hash digest + */ + virtual void Update(unsigned char* buffer, size_t bufferSize) override; + + /** + * Get the result in the current value + */ + virtual HashResult GetHash() override; + private: + + std::shared_ptr< Hash > m_hashImpl; + }; + + /** + * CRC32C hash implementation. + */ + class AWS_CORE_API CRC32C : public Hash + { + public: + /** + * Initializes platform crypto libs for crc32c. + */ + CRC32C(); + virtual ~CRC32C(); + + /** + * Calculates a CRC32C Hash digest + */ + virtual HashResult Calculate(const Aws::String& str) override; + + /** + * Calculates a CRC32C Hash digest on a stream (the entire stream is read) + */ + virtual HashResult Calculate(Aws::IStream& stream) override; + + /** + * Updates a Hash digest + */ + virtual void Update(unsigned char* buffer, size_t bufferSize) override; + + /** + * Get the result in the current value + */ + virtual HashResult GetHash() override; + + private: + + std::shared_ptr< Hash > m_hashImpl; + }; + + using CRC32Impl = + CRCChecksum>; + + using CRC32CImpl = + CRCChecksum>; + } // namespace Crypto + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/CRC64.h b/include/aws/core/utils/crypto/CRC64.h new file mode 100644 index 0000000000000000000000000000000000000000..f20db8972af4ab06e945d77e403c39b4cd42f7d6 --- /dev/null +++ b/include/aws/core/utils/crypto/CRC64.h @@ -0,0 +1,35 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include + +namespace Aws { +namespace Utils { +namespace Crypto { +/** + * CRC64 hash implementation. + */ +class AWS_CORE_API CRC64 : public Hash { +public: + CRC64(); + ~CRC64() override = default; + HashResult Calculate(const Aws::String &str) override; + HashResult Calculate(Aws::IStream &stream) override; + void Update(unsigned char *buffer, size_t bufferSize) override; + HashResult GetHash() override; + +private: + std::shared_ptr m_hashImpl; +}; + +using CRC64Impl = CRCChecksum>; +} // namespace Crypto +} // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/crypto/Cipher.h b/include/aws/core/utils/crypto/Cipher.h new file mode 100644 index 0000000000000000000000000000000000000000..de18f338af23628b525d3f94cc4c9a98e92fa4ce --- /dev/null +++ b/include/aws/core/utils/crypto/Cipher.h @@ -0,0 +1,206 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + static const size_t SYMMETRIC_KEY_LENGTH = 32; + static const size_t MIN_IV_LENGTH = 12; + + AWS_CORE_API CryptoBuffer IncrementCTRCounter(const CryptoBuffer& counter, uint32_t numberOfBlocks); + + /** + * Interface for symmetric encryption and decryption providers. An instance of this class is good for exactly one encryption or decryption run. + * It should not be used to encrypt or decrypt multiple messages. + */ + class AWS_CORE_API SymmetricCipher + { + public: + /** + * Initialize with key and an auto-generated initializationVector. Copies key. + * ivGenerationInCtrMode, if true, initializes the iv with a 4 byte counter at the end. + */ + SymmetricCipher(const CryptoBuffer& key, size_t ivSize, bool ivGenerationInCtrMode = false) : + m_key(key), + m_initializationVector(ivSize > 0 ? GenerateIV(ivSize, ivGenerationInCtrMode) : 0), + m_failure(false) + { + } + + /** + * Initialize with key and initializationVector, set tag for decryption of authenticated modes (makes copies of the buffers) + */ + SymmetricCipher(const CryptoBuffer& key, const CryptoBuffer& initializationVector, const CryptoBuffer& tag = CryptoBuffer(0)) : + m_key(key), + m_initializationVector(initializationVector), + m_tag(tag), + m_failure(false) + { + } + + /** + * Initialize with key and initializationVector, set tag for decryption of authenticated modes (move the buffers) + */ + SymmetricCipher(CryptoBuffer&& key, CryptoBuffer&& initializationVector, CryptoBuffer&& tag = CryptoBuffer(0)) : + m_key(std::move(key)), + m_initializationVector(std::move(initializationVector)), + m_tag(std::move(tag)), + m_failure(false) + { + } + + SymmetricCipher(const SymmetricCipher& other) = delete; + SymmetricCipher& operator=(const SymmetricCipher& other) = delete; + + /** + * Normally we don't work around VS 2013 not auto-generating these, but they are kind of expensive, + * so let's go ahead and optimize by defining default move operations. Implementors of this class + * need to be sure to define the move operations and call the base class. + */ + SymmetricCipher(SymmetricCipher&& toMove) : + m_key(std::move(toMove.m_key)), + m_initializationVector(std::move(toMove.m_initializationVector)), + m_tag(std::move(toMove.m_tag)), + m_failure(toMove.m_failure) + { + } + + /** + * Normally we don't work around VS 2013 not auto-generating these, but they are kind of expensive, + * so let's go ahead and optimize by defining default move operations. Implementors of this class + * need to be sure to define the move operations and call the base class. + */ + SymmetricCipher& operator=(SymmetricCipher&& toMove) + { + m_key = std::move(toMove.m_key); + m_initializationVector = std::move(toMove.m_initializationVector); + m_tag = std::move(toMove.m_tag); + m_failure = toMove.m_failure; + + return *this; + } + + virtual ~SymmetricCipher() = default; + + /** + * Whether or not the cipher is in a good state. If this ever returns false, throw away all buffers + * it has vended. + */ + virtual operator bool() const { return Good(); } + + /** + * Encrypt a buffer of data. Part of the contract for this interface is that intention that + * a user call this function multiple times for a large stream. As such, multiple calls to this function + * on the same instance should produce valid sequential output for an encrypted stream. + */ + virtual CryptoBuffer EncryptBuffer( const CryptoBuffer& unEncryptedData) = 0; + + /** + * Finalize Encryption, returns anything remaining in the last block + */ + virtual CryptoBuffer FinalizeEncryption () = 0; + + /** + * Decrypt a buffer of data. Part of the contract for this interface is that intention that + * a user call this function multiple times for a large stream. As such, multiple calls to this function + * on the same instance should produce valid sequential output from an encrypted stream. + */ + virtual CryptoBuffer DecryptBuffer(const CryptoBuffer& encryptedData) = 0; + + /** + * Finalize Decryption, returns anything remaining in the last block + */ + virtual CryptoBuffer FinalizeDecryption () = 0; + + virtual void Reset() = 0; + + /** + * IV used for encryption/decryption + */ + const CryptoBuffer& GetIV() const { return m_initializationVector; } + + /** + * Tag generated by encryption and used for the decryption. + * This will be set in an authenticated mode, otherwise empty + */ + const CryptoBuffer& GetTag() const { return m_tag; } + + bool Fail() const { return m_failure; } + virtual bool Good() const { return !Fail(); } + + /** + * Generates a non-deterministic random IV. The first call is somewhat expensive but subsequent calls + * should be fast. If ctrMode is true, it will pad nonce in the first 1/4 of the iv and initialize + * the back 1/4 to 1. + */ + static CryptoBuffer GenerateIV(size_t ivLengthBytes, bool ctrMode = false); + + /** + * Generates a non-deterministic random symmetric key. Default (and minimum bar for security) is 256 bits. + */ + static CryptoBuffer GenerateKey(size_t keyLengthBytes = SYMMETRIC_KEY_LENGTH); + + protected: + + SymmetricCipher() : m_failure(false) {} + + CryptoBuffer m_key; + CryptoBuffer m_initializationVector; + CryptoBuffer m_tag; + bool m_failure; + }; + + /** + * Abstract factory class for Creating platform specific implementations of a Symmetric Cipher + */ + class SymmetricCipherFactory + { + public: + virtual ~SymmetricCipherFactory() {} + + /** + * Factory method. Returns cipher implementation. See the SymmetricCipher class for more details. + */ + virtual std::shared_ptr CreateImplementation(const CryptoBuffer& key) const = 0; + /** + * Factory method. Returns cipher implementation. See the SymmetricCipher class for more details. + */ + virtual std::shared_ptr CreateImplementation(const CryptoBuffer& key, const CryptoBuffer*) const + { + return CreateImplementation(key); + } + /** + * Factory method. Returns cipher implementation. See the SymmetricCipher class for more details. + */ + virtual std::shared_ptr CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag = CryptoBuffer(0), const CryptoBuffer& aad = CryptoBuffer(0)) const = 0; + /** + * Factory method. Returns cipher implementation. See the SymmetricCipher class for more details. + */ + virtual std::shared_ptr CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag = CryptoBuffer(0), CryptoBuffer&& aad = CryptoBuffer(0)) const = 0; + + /** + * Only called once per factory, your chance to make static library calls for setup. + * Default is no-op. + */ + virtual void InitStaticState() {} + + /** + * Only called once per factory, your chance to cleanup static library calls for setup. + * Default is no-op. + */ + virtual void CleanupStaticState() {} + }; + } + } +} diff --git a/include/aws/core/utils/crypto/ContentCryptoMaterial.h b/include/aws/core/utils/crypto/ContentCryptoMaterial.h new file mode 100644 index 0000000000000000000000000000000000000000..ea997988539320cdd1b6c25fb848ee4222d02244 --- /dev/null +++ b/include/aws/core/utils/crypto/ContentCryptoMaterial.h @@ -0,0 +1,244 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + class AWS_CORE_API ContentCryptoMaterial + { + public: + /* + Default constructor. + */ + ContentCryptoMaterial(); + /* + Initialize content crypto material with content crypto scheme. Constructor will also generate the cek automatically. + Since the creation of the crypto content material will be within the S3 crypto modules, only the crypto scheme is needed for initialization. + The rest of the data will be set using the accessors below. + */ + ContentCryptoMaterial(ContentCryptoScheme contentCryptoScheme); + + /* + Initialize with content encryption key (cek) and content crypto scheme. + */ + ContentCryptoMaterial(const Aws::Utils::CryptoBuffer& cek, ContentCryptoScheme contentCryptoScheme); + + /** + * Gets the underlying content encryption key. + */ + inline const Aws::Utils::CryptoBuffer& GetContentEncryptionKey() const + { + return m_contentEncryptionKey; + } + + /** + * Gets the underlying encrypted content encryption key. + */ + inline const Aws::Utils::CryptoBuffer& GetEncryptedContentEncryptionKey() const + { + return m_encryptedContentEncryptionKey; + } + + /** + * Gets the underlying initialization vector + */ + inline const Aws::Utils::CryptoBuffer& GetIV() const + { + return m_iv; + } + + /** + * Gets the underlying crypto tag length + */ + inline size_t GetCryptoTagLength() const + { + return m_cryptoTagLength; + } + + /** + * Gets the underlying materials description map. + */ + inline const Aws::Map& GetMaterialsDescription() const + { + return m_materialsDescription; + } + + /* + * Gets the value of the key in the current materials description map. + */ + inline const Aws::String& GetMaterialsDescription(const Aws::String& key) const + { + return m_materialsDescription.at(key); + } + + /** + * Gets the underlying key wrap algorithm + */ + inline KeyWrapAlgorithm GetKeyWrapAlgorithm() const + { + return m_keyWrapAlgorithm; + } + + /** + * Gets the underlying content crypto scheme. + */ + inline ContentCryptoScheme GetContentCryptoScheme() const + { + return m_contentCryptoScheme; + } + + /** + * Sets the underlying content encryption key. Copies from parameter content encryption key. + */ + inline void SetContentEncryptionKey(const Aws::Utils::CryptoBuffer& contentEncryptionKey) + { + m_contentEncryptionKey = contentEncryptionKey; + } + + /** + * Sets the underlying encrypted content encryption key. Copies from parameter encrypted content encryption key. + */ + inline void SetEncryptedContentEncryptionKey(const Aws::Utils::CryptoBuffer& encryptedContentEncryptionKey) + { + m_encryptedContentEncryptionKey = encryptedContentEncryptionKey; + } + + /** + * Sets the underlying iv. Copies from parameter iv. + */ + inline void SetIV(const Aws::Utils::CryptoBuffer& iv) + { + m_iv = iv; + } + + /** + * Sets the underlying crypto Tag Length. Copies from parameter cryptoTagLength. + */ + inline void SetCryptoTagLength(size_t cryptoTagLength) + { + m_cryptoTagLength = cryptoTagLength; + } + + /** + * Adds to the current materials description map using a key and a value. + */ + inline void AddMaterialsDescription(const Aws::String& key, const Aws::String& value) + { + m_materialsDescription[key] = value; + } + + /** + * Sets the underlying materials description. Copies from parameter materials description. + */ + inline void SetMaterialsDescription(const Aws::Map& materialsDescription) + { + m_materialsDescription = materialsDescription; + } + + /** + * Sets the underlying Key Wrap Algorithm. Copies from parameter keyWrapAlgorithm. + */ + inline void SetKeyWrapAlgorithm(KeyWrapAlgorithm keyWrapAlgorithm) + { + m_keyWrapAlgorithm = keyWrapAlgorithm; + } + + /** + * Sets the underlying content Crypto Scheme. Copies from parameter contentCryptoScheme. + */ + inline void SetContentCryptoScheme(ContentCryptoScheme contentCryptoScheme) + { + m_contentCryptoScheme = contentCryptoScheme; + } + + /** + * Sets the underlying AAD for GCM if needed. + */ + inline void SetGCMAAD(const Aws::Utils::CryptoBuffer& aad) + { + m_gcmAAD = aad; + } + /** + * Gets the underlying aad for GCM if needed. + */ + inline const Aws::Utils::CryptoBuffer& GetGCMAAD() const + { + return m_gcmAAD; + } + + /** + * Sets the underlying tag for decrypting CEK if it's GCM encrypted. + */ + inline void SetCEKGCMTag(const Aws::Utils::CryptoBuffer& tag) + { + m_cekGCMTag = tag; + } + /** + * Gets the underlying aad for GCM if needed. + */ + inline const Aws::Utils::CryptoBuffer& GetCEKGCMTag() const + { + return m_cekGCMTag; + } + + /** + * Sets the underlying initialization vector for CEK if it's GCM encrypted. + */ + inline void SetCekIV(const Aws::Utils::CryptoBuffer& iv) + { + m_cekIV = iv; + } + /** + * Gets the underlying CEK initialization vector. + */ + inline const Aws::Utils::CryptoBuffer& GetCekIV() const + { + return m_cekIV; + } + + /** + * Sets the underlying final CEK + */ + inline void SetFinalCEK(const Aws::Utils::CryptoBuffer& finalCEK) + { + m_finalCEK = finalCEK; + } + /** + * Gets the underlying final CEK. + */ + inline const Aws::Utils::CryptoBuffer& GetFinalCEK() const + { + return m_finalCEK; + } + + private: + Aws::Utils::CryptoBuffer m_contentEncryptionKey; + Aws::Utils::CryptoBuffer m_encryptedContentEncryptionKey; + /* if using AES_GCM key wrap algorithm, then final CEK is iv + encrypted_key + tag + * otherwise it's the same as m_encryptedContentEncryptionKey + */ + Aws::Utils::CryptoBuffer m_finalCEK; + Aws::Utils::CryptoBuffer m_iv; + Aws::Utils::CryptoBuffer m_cekIV; + Aws::Utils::CryptoBuffer m_gcmAAD; + Aws::Utils::CryptoBuffer m_cekGCMTag; + size_t m_cryptoTagLength; + Aws::Map m_materialsDescription; + KeyWrapAlgorithm m_keyWrapAlgorithm; + ContentCryptoScheme m_contentCryptoScheme; + }; + } + } +} diff --git a/include/aws/core/utils/crypto/ContentCryptoScheme.h b/include/aws/core/utils/crypto/ContentCryptoScheme.h new file mode 100644 index 0000000000000000000000000000000000000000..605ad4e375701accce3c119ea56359ee21c5864a --- /dev/null +++ b/include/aws/core/utils/crypto/ContentCryptoScheme.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + enum class ContentCryptoScheme + { + CBC, + CTR, + GCM, + NONE + }; + + namespace ContentCryptoSchemeMapper + { + AWS_CORE_API ContentCryptoScheme GetContentCryptoSchemeForName(const Aws::String& name); + + AWS_CORE_API Aws::String GetNameForContentCryptoScheme(ContentCryptoScheme enumValue); + } + } //namespace Crypto + + }//namespace Utils +}//namespace Aws \ No newline at end of file diff --git a/include/aws/core/utils/crypto/CryptoBuf.h b/include/aws/core/utils/crypto/CryptoBuf.h new file mode 100644 index 0000000000000000000000000000000000000000..1270c6b427cb1b6197cd2af436293af9a2ba9db9 --- /dev/null +++ b/include/aws/core/utils/crypto/CryptoBuf.h @@ -0,0 +1,149 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + typedef std::mbstate_t FPOS_TYPE; + static const size_t DEFAULT_BUF_SIZE = 1024; + static const size_t PUT_BACK_SIZE = 1; + + /** + * Which mode a cipher is being used for. Encryption or Decryption + */ + enum class CipherMode + { + Encrypt, + Decrypt + }; + + /** + * Generic base class for a streambuf that handles cryptography. + */ + class AWS_CORE_API CryptoBuf : public std::streambuf + { + public: + CryptoBuf() = default; + virtual ~CryptoBuf() = default; + CryptoBuf(const CryptoBuf&) = delete; + CryptoBuf(CryptoBuf&& rhs) = delete; + /** + * If the buffer needs to do a final push to the sink or needs to empty the cipher blocks etc... + */ + virtual void Finalize() {} + }; + + /** + * StreamBuf that takes data from an input stream, encrypts or decrypts it, and causes all input received from the stream that is using it + * to go through the cipher. A common use case is a file that is encrypted on disk being read via ifstream and then read decrypted into memory. + * Or you could send a plain text file through an iostream and have it encrypted when the stream is read. + * + * This streambuf is seekable, but it is very expensive to seek backwards since we have to reset the cipher and re-encrypt everything up to that point. + * So seeking should be avoided if at all possible. + */ + class AWS_CORE_API SymmetricCryptoBufSrc : public CryptoBuf + { + public: + /** + * stream to src from + * cipher to encrypt or decrypt the src stream with + * mode to use cipher in. Encryption or Decryption + * buffersize, the size of the src buffers to read at a time. Defaults to 1kb + */ + SymmetricCryptoBufSrc(Aws::IStream& stream, SymmetricCipher& cipher, CipherMode cipherMode, size_t bufferSize = DEFAULT_BUF_SIZE); + + SymmetricCryptoBufSrc(const SymmetricCryptoBufSrc&) = delete; + SymmetricCryptoBufSrc(SymmetricCryptoBufSrc&&) = delete; + + SymmetricCryptoBufSrc& operator=(const SymmetricCryptoBufSrc&) = delete; + SymmetricCryptoBufSrc& operator=(SymmetricCryptoBufSrc&&) = delete; + + virtual ~SymmetricCryptoBufSrc() { FinalizeCipher(); } + + /** + * This call isn't necessary if you loop over the stream.read until you reach EOF, if you happen to read the exact + * amount as the in memory buffers and finish the stream, but never finish the finalize call you'll need to be sure + * to call this. This is automatically called by the destructor. + */ + void Finalize() override { FinalizeCipher(); } + + protected: + pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out ) override; + pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out ) override; + + private: + int_type underflow() override; + off_type ComputeAbsSeekPosition(off_type, std::ios_base::seekdir, std::fpos); + void FinalizeCipher(); + + CryptoBuffer m_isBuf; + SymmetricCipher& m_cipher; + Aws::IStream& m_stream; + CipherMode m_cipherMode; + bool m_isFinalized; + size_t m_bufferSize; + size_t m_putBack; + }; + + /** + * Stream buf that takes it's input, encrypts or decrypts it using the cipher, and writes it to the sink stream. This is particularly useful + * when receiving an encrypted file over the internet and writing it decrypted to disk. Another case may be that you have an ofstream and you want + * to write text to it from your program but have it go encrypted to disk. + * + * This stream buf is not seekable. + */ + class AWS_CORE_API SymmetricCryptoBufSink : public CryptoBuf + { + public: + /** + * stream, sink to push the encrypted or decrypted data to. + * cipher, symmetric cipher to use to transform the input before sending it to the sink. + * cipherMode, encrypt or decrypt + * bufferSize, amount of data to encrypt/decrypt at a time. + */ + SymmetricCryptoBufSink(Aws::OStream& stream, SymmetricCipher& cipher, CipherMode cipherMode, size_t bufferSize = DEFAULT_BUF_SIZE, int16_t blockOffset = 0); + SymmetricCryptoBufSink(const SymmetricCryptoBufSink&) = delete; + SymmetricCryptoBufSink(SymmetricCryptoBufSink&&) = delete; + + SymmetricCryptoBufSink& operator=(const SymmetricCryptoBufSink&) = delete; + /** + * Not move assignable since it contains reference members + */ + SymmetricCryptoBufSink& operator=(SymmetricCryptoBufSink&&) = delete; + + virtual ~SymmetricCryptoBufSink(); + + /** + * Finalizes the cipher and pushes all remaining data to the sink. Once this has been called, this streambuf cannot be used any further. + */ + void FinalizeCiphersAndFlushSink(); + /** + * Simply calls FinalizeCiphersAndFlushSink() + */ + void Finalize() override { FinalizeCiphersAndFlushSink(); } + + private: + int_type overflow(int_type ch) override; + int sync() override; + bool writeOutput(bool finalize); + + CryptoBuffer m_osBuf; + SymmetricCipher& m_cipher; + Aws::OStream& m_stream; + CipherMode m_cipherMode; + bool m_isFinalized; + int16_t m_blockOffset; + }; + } + } +} diff --git a/include/aws/core/utils/crypto/CryptoStream.h b/include/aws/core/utils/crypto/CryptoStream.h new file mode 100644 index 0000000000000000000000000000000000000000..048d44392e3124191120f38074715430322c1472 --- /dev/null +++ b/include/aws/core/utils/crypto/CryptoStream.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + /** + * IOStream that can either take a src buffer as an input stream and create a wrapper iostream that can be used to receive encrypted or decrypted + * input. + * + * A common use case is a file that is encrypted on disk being read via ifstream and then read decrypted into memory. + * Or you could send a plain text file through an iostream and have it encrypted when the stream is read. + * + * This stream is seekable, but it is very expensive to seek backwards since we have to reset the cipher and re-encrypt everything up to that point. + * So seeking should be avoided if at all possible. + * + * Or it can be used in the opposite direction where the stream is a sink and all input to the stream will be encrypted or decrypted and then sent to the + * sink stream. + * + * This is particularly useful + * when receiving an encrypted file over the internet and writing it decrypted to disk. Another case may be that you have an ofstream and you want + * to write text to it from your program but have it go encrypted to disk. + * + * In output mode, this stream is not seekable. + */ + class AWS_CORE_API SymmetricCryptoStream : public Aws::IOStream + { + public: + /** + * src stream to read from and encrypt or decrypt in transit + * mode of operation for cipher encryption or decryption + * cipher to use on the data + */ + SymmetricCryptoStream(Aws::IStream& src, CipherMode mode, SymmetricCipher& cipher, size_t bufLen = DEFAULT_BUF_SIZE); + /** + * sink stream to write the data to and encrypt or decrypt in transit + * mode of operation for cipher encryption or decryption + * cipher to use on the data + */ + SymmetricCryptoStream(Aws::OStream& sink, CipherMode mode, SymmetricCipher& cipher, size_t bufLen = DEFAULT_BUF_SIZE, int16_t blockOffset = 0 ); + /** + * bufSrc streambuf to use + */ + SymmetricCryptoStream(Aws::Utils::Crypto::SymmetricCryptoBufSrc& bufSrc); + /** + * bufSink streambuf to use + */ + SymmetricCryptoStream(Aws::Utils::Crypto::SymmetricCryptoBufSink& bufSink); + + SymmetricCryptoStream(const SymmetricCryptoStream&) = delete; + SymmetricCryptoStream(SymmetricCryptoStream&&) = delete; + + virtual ~SymmetricCryptoStream(); + + SymmetricCryptoStream& operator=(const SymmetricCryptoStream&) = delete; + SymmetricCryptoStream& operator=(SymmetricCryptoStream&&) = delete; + + + /** + * Call this in output stream mode when you want to flush the output to file. + * It will be called by the destructor, but if you want to sync before then, call this method. + * This stream is unusable after this method has been called. + */ + void Finalize(); + + private: + CryptoBuf* m_cryptoBuf; + bool m_hasOwnership; + }; + } + } +} \ No newline at end of file diff --git a/include/aws/core/utils/crypto/EncryptionMaterials.h b/include/aws/core/utils/crypto/EncryptionMaterials.h new file mode 100644 index 0000000000000000000000000000000000000000..0fbc77c6b4bd22b7b52c27d39ecf64f7e1b848e7 --- /dev/null +++ b/include/aws/core/utils/crypto/EncryptionMaterials.h @@ -0,0 +1,46 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + enum class CryptoErrors + { + ENCRYPT_CONTENT_ENCRYPTION_KEY_FAILED, + DECRYPT_CONTENT_ENCRYPTION_KEY_FAILED, + GENERATE_CONTENT_ENCRYPTION_KEY_FAILED + }; + + typedef Outcome> CryptoOutcome; + + class AWS_CORE_API EncryptionMaterials + { + public: + virtual ~EncryptionMaterials(); + + /* + * Override this method to control how to encrypt the content encryption key (CEK). This occurs in place. + */ + virtual CryptoOutcome EncryptCEK(ContentCryptoMaterial& contentCryptoMaterial) = 0; + + /* + * Override this method to control how to decrypt the content encryption key (CEK). This occurs in place. + */ + virtual CryptoOutcome DecryptCEK(ContentCryptoMaterial& contentCryptoMaterial) = 0; + }; + }//namespace Crypto + }//namespace Utils +}//namespace Aws diff --git a/include/aws/core/utils/crypto/Factories.h b/include/aws/core/utils/crypto/Factories.h new file mode 100644 index 0000000000000000000000000000000000000000..6a770ae0b10989d3ca38fb031030fa8a191d24df --- /dev/null +++ b/include/aws/core/utils/crypto/Factories.h @@ -0,0 +1,180 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + class Hash; + class HMAC; + class SymmetricCipher; + class HashFactory; + class HMACFactory; + class SymmetricCipherFactory; + class SecureRandomBytes; + class SecureRandomFactory; + + /** + * You need to call this before using any of the cryptography libs. Should be called after setting the factories. + */ + AWS_CORE_API void InitCrypto(); + /** + * You need to call this upon program shutdown. + */ + AWS_CORE_API void CleanupCrypto(); + /** + * OpenSSL infects everything with its global state. If it is being used then we automatically initialize and clean it up. + * If this is a problem for you, set this to false. Be aware that if you don't use our init and cleanup and you are using + * crypto functionality, you are responsible for installing thread locking, and loading strings and error messages. + */ + AWS_CORE_API void SetInitCleanupOpenSSLFlag(bool initCleanupFlag); + + /** + * Create an MD5 Hash provider + */ + AWS_CORE_API std::shared_ptr CreateMD5Implementation(); + /** + * Create a CRC32 Hash provider + */ + AWS_CORE_API std::shared_ptr CreateCRC32Implementation(); + /** + * Create a CRC32C Hash provider + */ + AWS_CORE_API std::shared_ptr CreateCRC32CImplementation(); + /** + * Create a CRC32 Hash provider + */ + AWS_CORE_API std::shared_ptr CreateCRC64Implementation(); + /** + * Create a Sha1 Hash provider + */ + AWS_CORE_API std::shared_ptr CreateSha1Implementation(); + /** + * Create a Sha256 Hash provider + */ + AWS_CORE_API std::shared_ptr CreateSha256Implementation(); + /** + * Create a Sha256 HMACHash provider + */ + AWS_CORE_API std::shared_ptr CreateSha256HMACImplementation(); + + /** + * Create AES in CBC mode off of a 256 bit key. Auto Generates a 16 byte secure random IV + */ + AWS_CORE_API std::shared_ptr CreateAES_CBCImplementation(const CryptoBuffer& key); + /** + * Create AES in CBC mode off of a 256 bit key and 16 byte IV + */ + AWS_CORE_API std::shared_ptr CreateAES_CBCImplementation(const CryptoBuffer& key, const CryptoBuffer& iv); + /** + * Create AES in CBC mode off of a 256 bit key and 16 byte IV + */ + AWS_CORE_API std::shared_ptr CreateAES_CBCImplementation(CryptoBuffer&& key, CryptoBuffer&& iv); + + /** + * Create AES in CTR mode off of a 256 bit key. Auto Generates a 16 byte IV in the format + * [nonce 4bytes ] [securely random iv 8 bytes] [ CTR init 4bytes ] + */ + AWS_CORE_API std::shared_ptr CreateAES_CTRImplementation(const CryptoBuffer& key); + /** + * Create AES in CTR mode off of a 256 bit key and 16 byte IV + */ + AWS_CORE_API std::shared_ptr CreateAES_CTRImplementation(const CryptoBuffer& key, const CryptoBuffer& iv); + /** + * Create AES in CTR mode off of a 256 bit key and 16 byte IV + */ + AWS_CORE_API std::shared_ptr CreateAES_CTRImplementation(CryptoBuffer&& key, CryptoBuffer&& iv); + + /** + * Create AES in GCM mode off of a 256 bit key. Auto Generates a 12 byte secure random IV. + */ + AWS_CORE_API std::shared_ptr CreateAES_GCMImplementation(const CryptoBuffer& key); + /** + * Create AES in GCM mode off of a 256 bit key. Auto Generates a 12 byte secure random IV and aad. + */ + AWS_CORE_API std::shared_ptr CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer* aad); + /** + * Create AES in GCM mode off of a 256 bit key, a 12 byte secure random IV, and an optional 16 byte Tag. If you are using this + * cipher to decrypt an encrypted payload, you must set the tag here. + */ + AWS_CORE_API std::shared_ptr CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, + const CryptoBuffer& tag = CryptoBuffer(0), const CryptoBuffer& aad = CryptoBuffer(0)); + /** + * Create AES in GCM mode off of a 256 bit key, a 16 byte secure random IV, and an optional 16 byte Tag, as well an optional add. If you are using this + * cipher to decrypt an encrypted payload, you must set the tag here. + */ + AWS_CORE_API std::shared_ptr CreateAES_GCMImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, + CryptoBuffer&& tag = CryptoBuffer(0), CryptoBuffer&& aad = CryptoBuffer(0)); + /** + * Create AES in Key Wrap mode off of a 256 bit key. + */ + AWS_CORE_API std::shared_ptr CreateAES_KeyWrapImplementation(const CryptoBuffer& key); + + /** + * Create SecureRandomBytes instance + */ + AWS_CORE_API std::shared_ptr CreateSecureRandomBytesImplementation(); + + /** + * Set the global factory for MD5 Hash providers + */ + AWS_CORE_API void SetMD5Factory(const std::shared_ptr& factory); + /** + * Set the global factory for CRC32 Hash providers + */ + AWS_CORE_API void SetCRC32Factory(const std::shared_ptr& factory); + /** + * Set the global factory for CRC32 Hash providers + */ + AWS_CORE_API void + SetCRC64Factory(const std::shared_ptr &factory); + /** + * Set the global factory for CRC32C Hash providers + */ + AWS_CORE_API void SetCRC32CFactory(const std::shared_ptr& factory); + /** + * Set the global factory for Sha1 Hash providers + */ + AWS_CORE_API void SetSha1Factory(const std::shared_ptr& factory); + /** + * Set the global factory for Sha256 Hash providers + */ + AWS_CORE_API void SetSha256Factory(const std::shared_ptr& factory); + /** + * Set the global factory for Sha256 HMAC Hash providers + */ + AWS_CORE_API void SetSha256HMACFactory(const std::shared_ptr& factory); + /** + * Set the global factory for AES in CBC mode providers + */ + AWS_CORE_API void SetAES_CBCFactory(const std::shared_ptr& factory); + /** + * Set the global factory for AES in CTR mode providers + */ + AWS_CORE_API void SetAES_CTRFactory(const std::shared_ptr& factory); + /** + * Set the global factory for AES in GCM mode providers + */ + AWS_CORE_API void SetAES_GCMFactory(const std::shared_ptr& factory); + /** + * Set the global factory for AES in Key Wrap mode providers + */ + AWS_CORE_API void SetAES_KeyWrapFactory(const std::shared_ptr& factory); + /** + * Set the global factory for secure random bytes + */ + AWS_CORE_API void SetSecureRandomFactory(const std::shared_ptr& factory); + + } // namespace Crypto + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/crypto/HMAC.h b/include/aws/core/utils/crypto/HMAC.h new file mode 100644 index 0000000000000000000000000000000000000000..450997c7360d5cb08223fd749be004486dae6ee8 --- /dev/null +++ b/include/aws/core/utils/crypto/HMAC.h @@ -0,0 +1,68 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + /* + * Interface for Sha256 encryptor and hmac + */ +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + /** + * Interface for HMAC hash providers. To implement an HMAC provider, inherit from this class and override Calculate. + */ + class AWS_CORE_API HMAC + { + public: + HMAC() {}; + virtual ~HMAC() {}; + + /** + * Calculates an HMAC digest + */ + virtual HashResult Calculate(const Aws::Utils::ByteBuffer& toSign, const Aws::Utils::ByteBuffer& secret) = 0; + + }; + + /** + * Simple abstract factory interface. Subclass this and create a factory if you want to control + * how HMAC Hash objects are created. + */ + class AWS_CORE_API HMACFactory + { + public: + virtual ~HMACFactory() {} + + /** + * Factory method. Returns hmac hash implementation. + */ + virtual std::shared_ptr CreateImplementation() const = 0; + + /** + * Opportunity to make any static initialization calls you need to make. + * Will only be called once. + */ + virtual void InitStaticState() {} + + /** + * Opportunity to make any static cleanup calls you need to make. + * will only be called at the end of the application. + */ + virtual void CleanupStaticState() {} + }; + + } // namespace Crypto + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/Hash.h b/include/aws/core/utils/crypto/Hash.h new file mode 100644 index 0000000000000000000000000000000000000000..c39f012f4c85151366320c6a9a830e7f88e37d46 --- /dev/null +++ b/include/aws/core/utils/crypto/Hash.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + /** + * Interface for computing hash codes using various hash algorithms + */ + class AWS_CORE_API Hash + { + public: + + Hash() {} + virtual ~Hash() {} + + /** + * Calculates a Hash digest + */ + virtual HashResult Calculate(const Aws::String& str) = 0; + + /** + * Calculates a Hash digest on a stream (the entire stream is read) + */ + virtual HashResult Calculate(Aws::IStream& stream) = 0; + + /** + * Updates a Hash digest + */ + virtual void Update(unsigned char*, size_t bufferSize) = 0; + + /** + * Get the result in the current value + */ + virtual HashResult GetHash() = 0; + + // when hashing streams, this is the size of our internal buffer we read the stream into + static const uint32_t INTERNAL_HASH_STREAM_BUFFER_SIZE = 8192; + }; + + /** + * Simple abstract factory interface. Subclass this and create a factory if you want to control + * how Hash objects are created. + */ + class AWS_CORE_API HashFactory + { + public: + virtual ~HashFactory() {} + + /** + * Factory method. Returns hash implementation. + */ + virtual std::shared_ptr CreateImplementation() const = 0; + + /** + * Opportunity to make any static initialization calls you need to make. + * Will only be called once. + */ + virtual void InitStaticState() {} + + /** + * Opportunity to make any static cleanup calls you need to make. + * will only be called at the end of the application. + */ + virtual void CleanupStaticState() {} + }; + + } // namespace Crypto + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/HashResult.h b/include/aws/core/utils/crypto/HashResult.h new file mode 100644 index 0000000000000000000000000000000000000000..46b46d809558dcc9761958bba33463f7789d6e4c --- /dev/null +++ b/include/aws/core/utils/crypto/HashResult.h @@ -0,0 +1,25 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Utils + { + + template< typename R, typename E > class Outcome; + + namespace Crypto + { + using HashResult = Outcome< ByteBuffer, bool >; + + } // namespace Crypto + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/KeyWrapAlgorithm.h b/include/aws/core/utils/crypto/KeyWrapAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..0715f647400a604f8f28ab2f426cf7376df2000e --- /dev/null +++ b/include/aws/core/utils/crypto/KeyWrapAlgorithm.h @@ -0,0 +1,33 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + enum class KeyWrapAlgorithm + { + KMS, // Deprecated + KMS_CONTEXT, + AES_KEY_WRAP, // Deprecated + AES_GCM, + NONE + }; + + namespace KeyWrapAlgorithmMapper + { + AWS_CORE_API KeyWrapAlgorithm GetKeyWrapAlgorithmForName(const Aws::String& name); + + AWS_CORE_API Aws::String GetNameForKeyWrapAlgorithm(KeyWrapAlgorithm enumValue); + } + } //namespace Crypto + + }//namespace Utils +}//namespace Aws diff --git a/include/aws/core/utils/crypto/MD5.h b/include/aws/core/utils/crypto/MD5.h new file mode 100644 index 0000000000000000000000000000000000000000..3c4f4c7ac599daedab055a7f56024cfe49ad8e7a --- /dev/null +++ b/include/aws/core/utils/crypto/MD5.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + /* + * Interface for Sha256 encryptor and hmac + */ +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + /** + * Md5 hash implementation + */ + class AWS_CORE_API MD5 : public Hash + { + public: + /** + * Initializes platform crypto libs for md5 + */ + MD5(); + virtual ~MD5(); + + /** + * Calculates an MD5 hash + */ + virtual HashResult Calculate(const Aws::String& str) override; + + /** + * Calculates a Hash digest on a stream (the entire stream is read) + */ + virtual HashResult Calculate(Aws::IStream& stream) override; + + /** + * Updates a Hash digest + */ + virtual void Update(unsigned char* buffer, size_t bufferSize) override; + + /** + * Get the result in the current value + */ + virtual HashResult GetHash() override; + + private: + std::shared_ptr m_hashImpl; + }; + + } // namespace Crypto + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/PrecalculatedHash.h b/include/aws/core/utils/crypto/PrecalculatedHash.h new file mode 100644 index 0000000000000000000000000000000000000000..e3bef38d5be6de013bf50e3ede0baf325a0a3ce8 --- /dev/null +++ b/include/aws/core/utils/crypto/PrecalculatedHash.h @@ -0,0 +1,37 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws { + namespace Utils { + namespace Crypto { + /** + * A hash implementation that stores a pre-calculated hash + * behind the Hash interface. It is a read through wrapper + * around the checksum value and no hashing are actually done. + */ + class AWS_CORE_API PrecalculatedHash : public Hash { + public: + explicit PrecalculatedHash(const Aws::String &hash); + ~PrecalculatedHash() override; + HashResult Calculate(const Aws::String &str) override; + HashResult Calculate(Aws::IStream &stream) override; + void Update(unsigned char *string, size_t bufferSize) override; + HashResult GetHash() override; + + private: + Aws::String m_hashString; + HashResult m_decodedHashString; + + }; + } + } +} diff --git a/include/aws/core/utils/crypto/SecureRandom.h b/include/aws/core/utils/crypto/SecureRandom.h new file mode 100644 index 0000000000000000000000000000000000000000..2d5e56b7b02d80b3177d94a58edb4b433ae03380 --- /dev/null +++ b/include/aws/core/utils/crypto/SecureRandom.h @@ -0,0 +1,118 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + /** + * Interface for generating Random Bytes with guaranteed entropy for use with cryptographic functions. + * An instance is not guaranteed to be thread safe. This is intentional, that is needless overhead to + * pay for something you probably don't need. If you encounter a need for thread safety, you are responsible + * for memory fencing. + */ + class SecureRandomBytes + { + public: + SecureRandomBytes() : m_failure(false) + { + } + + virtual ~SecureRandomBytes() = default; + + /** + * fill in buffer of size bufferSize with random bytes + */ + virtual void GetBytes(unsigned char* buffer, size_t bufferSize) = 0; + + /** + * Always check this. If anything goes wrong, this tells you + */ + operator bool() const { return !m_failure; } + + protected: + bool m_failure; + }; + + /** + * Random Number generator for integral types. Guaranteed to have entropy or your program will crash. + */ + template + class SecureRandom + { + public: + /** + * Initialize with the results of CreateSecureRandomBytesImplementation(). + * An instance is not guaranteed to be thread safe. This is intentional, that is needless overhead to + * pay for something you probably don't need. If you encounter a need for thread safety, you are responsible + * for memory fencing. + */ + SecureRandom(const std::shared_ptr& entropySource) : m_entropy(entropySource) + { static_assert(std::is_unsigned::value, "Type DataType must be integral"); } + + virtual ~SecureRandom() = default; + + virtual void Reset() {} + + /** + * Generate a random number of DataType + */ + virtual DataType operator()() + { + DataType value(0); + unsigned char buffer[sizeof(DataType)]; + m_entropy->GetBytes(buffer, sizeof(DataType)); + + assert(*m_entropy); + if(*m_entropy) + { + for (size_t i = 0; i < sizeof(DataType); ++i) + { + value <<= 8; + value |= buffer[i]; + + } + } + + return value; + } + + operator bool() const { return *m_entropy; } + + private: + std::shared_ptr m_entropy; + }; + + class SecureRandomFactory + { + public: + virtual ~SecureRandomFactory() = default; + + /** + * Factory method. Returns SecureRandom implementation. + */ + virtual std::shared_ptr CreateImplementation() const = 0; + + /** + * Opportunity to make any static initialization calls you need to make. + * Will only be called once. + */ + virtual void InitStaticState() {} + + /** + * Opportunity to make any static cleanup calls you need to make. + * will only be called at the end of the application. + */ + virtual void CleanupStaticState() {} + }; + } + } +} diff --git a/include/aws/core/utils/crypto/Sha1.h b/include/aws/core/utils/crypto/Sha1.h new file mode 100644 index 0000000000000000000000000000000000000000..547ca65555768fefd891b39acf4da59db9ec2dc0 --- /dev/null +++ b/include/aws/core/utils/crypto/Sha1.h @@ -0,0 +1,74 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* +* Interface for Sha1 encryptor +*/ +#pragma once + +#ifdef __APPLE__ + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // __clang__ + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif // __GNUC__ + +#endif // __APPLE__ + +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + class WindowsHashImpl; + + /** + * Sha1 hash implementation. + */ + class AWS_CORE_API Sha1 : public Hash + { + public: + /** + * Initializes platform crypto libs. + */ + Sha1(); + virtual ~Sha1(); + + /** + * Calculates a SHA1 Hash digest (not hex encoded) + */ + virtual HashResult Calculate(const Aws::String& str) override; + + /** + * Calculates a SHA1 Hash digest on a stream (the entire stream is read) + */ + virtual HashResult Calculate(Aws::IStream& stream) override; + + /** + * Updates a Hash digest + */ + virtual void Update(unsigned char* buffer, size_t bufferSize) override; + + /** + * Get the result in the current value + */ + virtual HashResult GetHash() override; + private: + + std::shared_ptr< Hash > m_hashImpl; + }; + + } // namespace Crypto + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/Sha256.h b/include/aws/core/utils/crypto/Sha256.h new file mode 100644 index 0000000000000000000000000000000000000000..40782cd58ed50a967a1cc201c6178616f606c8f3 --- /dev/null +++ b/include/aws/core/utils/crypto/Sha256.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + /* + * Interface for Sha256 encryptor and hmac + */ +#pragma once + +#ifdef __APPLE__ + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // __clang__ + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif // __GNUC__ + +#endif // __APPLE__ + +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + class WindowsHashImpl; + + /** + * Sha256 hash implementation. + */ + class AWS_CORE_API Sha256 : public Hash + { + public: + /** + * Initializes platform crypto libs. + */ + Sha256(); + virtual ~Sha256(); + + /** + * Calculates a SHA256 Hash digest (not hex encoded) + */ + virtual HashResult Calculate(const Aws::String& str) override; + + /** + * Calculates a Hash digest on a stream (the entire stream is read) + */ + virtual HashResult Calculate(Aws::IStream& stream) override; + + /** + * Updates a Hash digest + */ + virtual void Update(unsigned char* buffer, size_t bufferSize) override; + + /** + * Get the result in the current value + */ + virtual HashResult GetHash() override; + + private: + + std::shared_ptr< Hash > m_hashImpl; + }; + + } // namespace Crypto + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/Sha256HMAC.h b/include/aws/core/utils/crypto/Sha256HMAC.h new file mode 100644 index 0000000000000000000000000000000000000000..d035b99da5e420685088fcfd0601dda76c8012b4 --- /dev/null +++ b/include/aws/core/utils/crypto/Sha256HMAC.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + + /* + * Interface for Sha256 encryptor and hmac + */ +#pragma once + +#ifdef __APPLE__ + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // __clang__ + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif // __GNUC__ + +#endif // __APPLE__ + +#include + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + /** + * Sha256 HMAC implementation + */ + class AWS_CORE_API Sha256HMAC : public HMAC + { + public: + /** + * initializes platform specific libs. + */ + Sha256HMAC(); + virtual ~Sha256HMAC(); + + /** + * Calculates a SHA256 HMAC digest (not hex encoded) + */ + virtual HashResult Calculate(const Aws::Utils::ByteBuffer& toSign, const Aws::Utils::ByteBuffer& secret) override; + + private: + + std::shared_ptr< HMAC > m_hmacImpl; + }; + + } // namespace Sha256 + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/crypto/crt/CRTHMAC.h b/include/aws/core/utils/crypto/crt/CRTHMAC.h new file mode 100644 index 0000000000000000000000000000000000000000..e8662a337690a4bd95d07b81a931df4d66e13e30 --- /dev/null +++ b/include/aws/core/utils/crypto/crt/CRTHMAC.h @@ -0,0 +1,25 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + class AWS_CORE_API CRTSha256Hmac : public HMAC + { + public: + HashResult Calculate(const Aws::Utils::ByteBuffer& toSign, const Aws::Utils::ByteBuffer& secret) override; + }; + } + } +} diff --git a/include/aws/core/utils/crypto/crt/CRTHash.h b/include/aws/core/utils/crypto/crt/CRTHash.h new file mode 100644 index 0000000000000000000000000000000000000000..7311c7a96d1514a69410a14247fc4cf3ffaa82a5 --- /dev/null +++ b/include/aws/core/utils/crypto/crt/CRTHash.h @@ -0,0 +1,40 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + class AWS_CORE_API CRTHash : public Hash + { + public: + ~CRTHash() override = default; + CRTHash(const CRTHash &) = delete; + CRTHash &operator=(const CRTHash &) = delete; + CRTHash(CRTHash &&) = default; + CRTHash &operator=(CRTHash &&) = default; + explicit CRTHash(Crt::Crypto::Hash &&); + + HashResult Calculate(const String &str) override; + + HashResult Calculate(IStream &stream) override; + + void Update(unsigned char *string, size_t bufferSize) override; + + HashResult GetHash() override; + private: + Crt::Crypto::Hash m_hash; + }; + } + } +} diff --git a/include/aws/core/utils/crypto/crt/CRTSecureRandom.h b/include/aws/core/utils/crypto/crt/CRTSecureRandom.h new file mode 100644 index 0000000000000000000000000000000000000000..114c9ea59408cdb9bba864cf1deec6f2de250c6c --- /dev/null +++ b/include/aws/core/utils/crypto/crt/CRTSecureRandom.h @@ -0,0 +1,28 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +* SPDX-License-Identifier: Apache-2.0. +*/ +#pragma once +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto + { + class CRTSecureRandomBytes : public SecureRandomBytes + { + public: + CRTSecureRandomBytes() = default; + ~CRTSecureRandomBytes() override = default; + + /** + * fill in buffer of size bufferSize with random bytes + */ + void GetBytes(unsigned char *buffer, std::size_t bufferSize) override; + }; + } + } +} diff --git a/include/aws/core/utils/crypto/crt/CRTSymmetricCipher.h b/include/aws/core/utils/crypto/crt/CRTSymmetricCipher.h new file mode 100644 index 0000000000000000000000000000000000000000..320508ef2ec3bb70eb00c3a491fbe5a093613b78 --- /dev/null +++ b/include/aws/core/utils/crypto/crt/CRTSymmetricCipher.h @@ -0,0 +1,46 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Crypto { + class AWS_CORE_API CRTSymmetricCipher : public SymmetricCipher { + public: + CRTSymmetricCipher(const CRTSymmetricCipher &) = delete; + + CRTSymmetricCipher &operator=(const CRTSymmetricCipher &) = delete; + + CRTSymmetricCipher(CRTSymmetricCipher &&) = default; + + CRTSymmetricCipher &operator=(CRTSymmetricCipher &&) = default; + + ~CRTSymmetricCipher() override = default; + + CryptoBuffer EncryptBuffer(const CryptoBuffer &unEncryptedData) override; + + CryptoBuffer FinalizeEncryption() override; + + CryptoBuffer DecryptBuffer(const CryptoBuffer &encryptedData) override; + + CryptoBuffer FinalizeDecryption() override; + + void Reset() override; + + bool Good() const override; + + // @private but we need make_shared support. + CRTSymmetricCipher(Crt::Crypto::SymmetricCipher &&); + private: + Crt::Crypto::SymmetricCipher m_cipher; + mutable CryptoBuffer m_lastFetchedIv; + mutable CryptoBuffer m_lastFetchedTag; + }; + } + } +} diff --git a/include/aws/core/utils/event/EventDecoderStream.h b/include/aws/core/utils/event/EventDecoderStream.h new file mode 100644 index 0000000000000000000000000000000000000000..81a8f92eb98bdf50087472e080d4375bb2c96858 --- /dev/null +++ b/include/aws/core/utils/event/EventDecoderStream.h @@ -0,0 +1,43 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Event + { + extern AWS_CORE_API const size_t DEFAULT_BUF_SIZE; + + /** + * A buffered I/O stream that binary-decodes the bits written to it according to the AWS event-stream spec. + * The decoding process will result in invoking callbacks on the handler assigned to the decoder parameter. + */ + class AWS_CORE_API EventDecoderStream : public Aws::IOStream + { + public: + /** + * Creates a stream for decoding events sent by the service. + * @param decoder decodes the stream from server side, so as to invoke related callback functions. + * @param eventStreamBufLength The length of the underlying buffer. + */ + EventDecoderStream(EventStreamDecoder& decoder, size_t bufferSize = DEFAULT_BUF_SIZE); + + private: + EventDecoderStream(const EventDecoderStream&) = delete; + EventDecoderStream(EventDecoderStream&&) = delete; + EventDecoderStream& operator=(const EventDecoderStream&) = delete; + EventDecoderStream& operator=(EventDecoderStream&&) = delete; + + EventStreamBuf m_eventStreamBuf; + }; + } + } +} diff --git a/include/aws/core/utils/event/EventEncoderStream.h b/include/aws/core/utils/event/EventEncoderStream.h new file mode 100644 index 0000000000000000000000000000000000000000..855cdd1635c55f4654e3f0f693fee043c24b2591 --- /dev/null +++ b/include/aws/core/utils/event/EventEncoderStream.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Client + { + class AWSAuthSigner; + } + + namespace Utils + { + namespace Event + { + extern AWS_CORE_API const size_t DEFAULT_BUF_SIZE; + + /** + * A buffered I/O stream that binary-encodes the bits written to it according to the AWS event-stream spec. + */ + class AWS_CORE_API EventEncoderStream : public Aws::IOStream + { + public: + + /** + * Creates a stream for encoding events sent by the client. + * @param bufferSize The length of the underlying buffer. + */ + explicit EventEncoderStream(size_t bufferSize = DEFAULT_BUF_SIZE); + + /** + * Sets the signature seed used by event-stream events. + * Every event uses its previous event's signature to calculate its own signature. + * Setting this value affects the signature calculation of the first event. + */ + void SetSignatureSeed(const Aws::String& seed) { m_encoder.SetSignatureSeed(seed); } + + /** + * Writes an event-stream message to the underlying buffer. + */ + EventEncoderStream& WriteEvent(const Aws::Utils::Event::Message& msg); + + /** + * Sets the signer implementation used for every event. + */ + void SetSigner(Aws::Client::AWSAuthSigner* signer) { m_encoder.SetSigner(signer); } + + /** + * Allows a stream writer to communicate the end of the stream to a stream reader. + * + * Any writes to the stream after this call are not guaranteed to be read by another concurrent + * read thread. + */ + void Close() { m_streambuf.SetEofInput(this); } + + /** + * Blocks the current thread until all submitted data is consumed. + * Returns false on timeout, and true if GetArea and back buffer are empty. + */ + bool WaitForDrain(int64_t timeoutMs = 1000); + + private: + Stream::ConcurrentStreamBuf m_streambuf; + EventStreamEncoder m_encoder; + }; + } + } +} diff --git a/include/aws/core/utils/event/EventHeader.h b/include/aws/core/utils/event/EventHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..19199ac462f32a9085c3c7c2af091ad62f3405ca --- /dev/null +++ b/include/aws/core/utils/event/EventHeader.h @@ -0,0 +1,352 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Event + { + static const char CLASS_TAG[] = "EventHeader"; + /** + * Interface of the header value of a message in event stream. + * Each type of header value should have it's own associated derived class based on this class. + */ + class AWS_CORE_API EventHeaderValue + { + public: + enum class EventHeaderType + { + BOOL_TRUE = 0, + BOOL_FALSE, + BYTE, + INT16, + INT32, + INT64, + BYTE_BUF, + STRING, + /* 64 bit integer (millis since epoch) */ + TIMESTAMP, + UUID, + UNKNOWN + }; + + EventHeaderValue() : m_eventHeaderType(EventHeaderType::UNKNOWN), m_eventHeaderStaticValue({0}) {} + + EventHeaderValue(aws_event_stream_header_value_pair* header) : + m_eventHeaderType(static_cast(header->header_value_type)), + m_eventHeaderStaticValue({0}) + { + switch (m_eventHeaderType) + { + case EventHeaderType::BOOL_TRUE: + case EventHeaderType::BOOL_FALSE: + m_eventHeaderStaticValue.boolValue = aws_event_stream_header_value_as_bool(header) != 0; + break; + case EventHeaderType::BYTE: + m_eventHeaderStaticValue.byteValue = aws_event_stream_header_value_as_byte(header); + break; + case EventHeaderType::INT16: + m_eventHeaderStaticValue.int16Value = aws_event_stream_header_value_as_int16(header); + break; + case EventHeaderType::INT32: + m_eventHeaderStaticValue.int32Value = aws_event_stream_header_value_as_int32(header); + break; + case EventHeaderType::INT64: + m_eventHeaderStaticValue.int64Value = aws_event_stream_header_value_as_int64(header); + break; + case EventHeaderType::BYTE_BUF: + m_eventHeaderVariableLengthValue = ByteBuffer(static_cast(aws_event_stream_header_value_as_bytebuf(header).buffer), header->header_value_len); + break; + case EventHeaderType::STRING: + m_eventHeaderVariableLengthValue = ByteBuffer(static_cast(aws_event_stream_header_value_as_string(header).buffer), header->header_value_len); + break; + case EventHeaderType::TIMESTAMP: + m_eventHeaderStaticValue.timestampValue = aws_event_stream_header_value_as_timestamp(header); + break; + case EventHeaderType::UUID: + assert(header->header_value_len == 16u); + m_eventHeaderVariableLengthValue = ByteBuffer(static_cast(aws_event_stream_header_value_as_uuid(header).buffer), header->header_value_len); + break; + default: + AWS_LOG_ERROR(CLASS_TAG, "Encountered unknown type of header."); + break; + } + }; + + EventHeaderValue(const Aws::String& s) : + m_eventHeaderType(EventHeaderType::STRING), + m_eventHeaderVariableLengthValue(reinterpret_cast(s.data()), s.length()), + m_eventHeaderStaticValue({0}) + { + } + + EventHeaderValue(const ByteBuffer& bb) : + m_eventHeaderType(EventHeaderType::BYTE_BUF), + m_eventHeaderVariableLengthValue(bb), + m_eventHeaderStaticValue({0}) + { + } + + EventHeaderValue(ByteBuffer&& bb) : + m_eventHeaderType(EventHeaderType::BYTE_BUF), + m_eventHeaderVariableLengthValue(std::move(bb)), + m_eventHeaderStaticValue({0}) + { + } + + + explicit EventHeaderValue(unsigned char byte) : + m_eventHeaderType(EventHeaderType::BYTE), + m_eventHeaderStaticValue({0}) + { + m_eventHeaderStaticValue.byteValue = byte; + } + + explicit EventHeaderValue(bool b) : + m_eventHeaderType(b ? EventHeaderType::BOOL_TRUE : EventHeaderType::BOOL_FALSE), + m_eventHeaderStaticValue({0}) + { + m_eventHeaderStaticValue.boolValue = b; + } + + explicit EventHeaderValue(int16_t n) : + m_eventHeaderType(EventHeaderType::INT16), + m_eventHeaderStaticValue({0}) + { + m_eventHeaderStaticValue.int16Value = n; + } + + explicit EventHeaderValue(int32_t n) : + m_eventHeaderType(EventHeaderType::INT32), + m_eventHeaderStaticValue({0}) + { + m_eventHeaderStaticValue.int32Value = n; + } + + explicit EventHeaderValue(int64_t n, EventHeaderType type = EventHeaderType::INT64) : + m_eventHeaderType(type), + m_eventHeaderStaticValue({0}) + { + if (type == EventHeaderType::TIMESTAMP) + { + m_eventHeaderStaticValue.timestampValue = n; + } + else + { + m_eventHeaderStaticValue.int64Value = n; + } + } + + EventHeaderType GetType() const { return m_eventHeaderType; } + + + static EventHeaderType GetEventHeaderTypeForName(const Aws::String& name); + static Aws::String GetNameForEventHeaderType(EventHeaderType value); + + /** + * Get header value as boolean. + * Log error if derived class doesn't override this function. + */ + inline bool GetEventHeaderValueAsBoolean() const + { + assert(m_eventHeaderType == EventHeaderType::BOOL_TRUE || m_eventHeaderType == EventHeaderType::BOOL_FALSE); + if (m_eventHeaderType != EventHeaderType::BOOL_TRUE && m_eventHeaderType != EventHeaderType::BOOL_FALSE) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is TRUE or FALSE, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return false; + } + return m_eventHeaderStaticValue.boolValue; + } + + /** + * Get header value as byte. + * Log error if derived class doesn't override this function. + */ + inline uint8_t GetEventHeaderValueAsByte() const + { + assert(m_eventHeaderType == EventHeaderType::BYTE); + if (m_eventHeaderType != EventHeaderType::BYTE) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is BYTE, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast(0); + } + return m_eventHeaderStaticValue.byteValue; + } + + /** + * Get header value as 16 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int16_t GetEventHeaderValueAsInt16() const + { + assert(m_eventHeaderType == EventHeaderType::INT16); + if (m_eventHeaderType != EventHeaderType::INT16) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT16, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast(0); + } + return m_eventHeaderStaticValue.int16Value; + } + + /** + * Get header value as 32 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int32_t GetEventHeaderValueAsInt32() const + { + assert(m_eventHeaderType == EventHeaderType::INT32); + if (m_eventHeaderType != EventHeaderType::INT32) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT32, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast(0); + } + return m_eventHeaderStaticValue.int32Value; + } + + /** + * Get header value as 64 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int64_t GetEventHeaderValueAsInt64() const + { + assert(m_eventHeaderType == EventHeaderType::INT64); + if (m_eventHeaderType != EventHeaderType::INT64) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT64, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast(0); + } + return m_eventHeaderStaticValue.int64Value; + } + + /** + * Get header value as ByteBuffer. + * Log error if derived class doesn't override this function. + */ + inline ByteBuffer GetEventHeaderValueAsBytebuf() const + { + assert(m_eventHeaderType == EventHeaderType::BYTE_BUF); + if (m_eventHeaderType != EventHeaderType::BYTE_BUF) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is BYTE_BUF, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return ByteBuffer(); + } + return m_eventHeaderVariableLengthValue; + } + + /** + * Get header value as String. + * Log error if derived class doesn't override this function. + */ + inline Aws::String GetEventHeaderValueAsString() const + { + assert(m_eventHeaderType == EventHeaderType::STRING); + if (m_eventHeaderType != EventHeaderType::STRING) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is STRING, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return {}; + } + return Aws::String(reinterpret_cast(m_eventHeaderVariableLengthValue.GetUnderlyingData()), m_eventHeaderVariableLengthValue.GetLength()); + } + + /** + * Get header value as timestamp in 64 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int64_t GetEventHeaderValueAsTimestamp() const + { + assert(m_eventHeaderType == EventHeaderType::TIMESTAMP); + if (m_eventHeaderType != EventHeaderType::TIMESTAMP) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is TIMESTAMP, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast(0); + } + return m_eventHeaderStaticValue.timestampValue; + } + + /** + * Get header value as UUID. + * Log error if derived class doesn't override this function. + */ + inline Aws::Utils::UUID GetEventHeaderValueAsUuid() const + { + assert(m_eventHeaderType == EventHeaderType::UUID); + assert(m_eventHeaderVariableLengthValue.GetLength() == 16u); + if (m_eventHeaderType != EventHeaderType::UUID) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is UUID, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + char uuid[32] = {0}; + return Aws::Utils::UUID(uuid); + } + return Aws::Utils::UUID(m_eventHeaderVariableLengthValue.GetUnderlyingData()); + } + + inline const ByteBuffer& GetUnderlyingBuffer() const + { + return m_eventHeaderVariableLengthValue; + } + + inline Aws::String ToString() const + { + switch (m_eventHeaderType) + { + case EventHeaderType::BOOL_TRUE: + case EventHeaderType::BOOL_FALSE: + return Utils::StringUtils::to_string(GetEventHeaderValueAsBoolean()); + case EventHeaderType::BYTE: + return Utils::StringUtils::to_string(GetEventHeaderValueAsByte()); + case EventHeaderType::INT16: + return Utils::StringUtils::to_string(GetEventHeaderValueAsInt16()); + case EventHeaderType::INT32: + return Utils::StringUtils::to_string(GetEventHeaderValueAsInt32()); + case EventHeaderType::INT64: + return Utils::StringUtils::to_string(GetEventHeaderValueAsInt64()); + case EventHeaderType::BYTE_BUF: + return Aws::String(reinterpret_cast(GetEventHeaderValueAsBytebuf().GetUnderlyingData()), GetEventHeaderValueAsBytebuf().GetLength()); + case EventHeaderType::STRING: + return GetEventHeaderValueAsString(); + case EventHeaderType::TIMESTAMP: + return Aws::Utils::DateTime(GetEventHeaderValueAsTimestamp()).ToGmtString(Aws::Utils::DateFormat::RFC822); + case EventHeaderType::UUID: + return GetEventHeaderValueAsUuid(); + case EventHeaderType::UNKNOWN: + default: + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Cannot transform EventHeader value to string: type is unknown"); + return {}; + } + } + + private: + EventHeaderType m_eventHeaderType; + ByteBuffer m_eventHeaderVariableLengthValue; + union + { + int64_t timestampValue; + int64_t int64Value; + int32_t int32Value; + int16_t int16Value; + uint8_t byteValue; + bool boolValue; + } m_eventHeaderStaticValue; + }; + + typedef std::pair EventHeaderValuePair; + typedef Aws::Map EventHeaderValueCollection; + } + } +} diff --git a/include/aws/core/utils/event/EventMessage.h b/include/aws/core/utils/event/EventMessage.h new file mode 100644 index 0000000000000000000000000000000000000000..48e13c08656a73b2b0d82918bde299ab175f8900 --- /dev/null +++ b/include/aws/core/utils/event/EventMessage.h @@ -0,0 +1,122 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Event + { + extern AWS_CORE_API const char EVENT_TYPE_HEADER[]; + extern AWS_CORE_API const char CONTENT_TYPE_HEADER[]; + extern AWS_CORE_API const char MESSAGE_TYPE_HEADER[]; + extern AWS_CORE_API const char ERROR_CODE_HEADER[]; + extern AWS_CORE_API const char ERROR_MESSAGE_HEADER[]; + extern AWS_CORE_API const char EXCEPTION_TYPE_HEADER[]; + + /** + * A typical message in event stream consists of two parts: Prelude and Data, as well as the prelude CRC and message CRC. + * Prelude consists of total byte length and headers byte length. + * Data consists of headers and payload. + */ + class AWS_CORE_API Message + { + public: + enum class MessageType + { + UNKNOWN, + EVENT, + REQUEST_LEVEL_ERROR, + REQUEST_LEVEL_EXCEPTION + }; + + enum class ContentType + { + UNKNOWN, + APPLICATION_OCTET_STREAM, + APPLICATION_JSON, + TEXT_PLAIN + }; + + static MessageType GetMessageTypeForName(const Aws::String& name); + static Aws::String GetNameForMessageType(MessageType value); + + static ContentType GetContentTypeForName(const Aws::String& name); + static Aws::String GetNameForContentType(ContentType value); + + + /** + * Clean up the message, including the metadata, headers and payload received. + */ + void Reset(); + + /** + * Get/set the total length of this message: prelude(8 bytes) + prelude CRC(4 bytes) + Data(headers length + payload length) + message CRC(4 bytes). + */ + inline void SetTotalLength(size_t length) + { + m_totalLength = length; + m_eventPayload.reserve(length); + } + + inline size_t GetTotalLength() const { return m_totalLength; } + + /** + * Get/set the length of the headers. + * Each header consists of: header name byte-length(1 byte) + header name + header value type(1 byte) + header value. + */ + inline void SetHeadersLength(size_t length) { m_headersLength = length; } + inline size_t GetHeadersLength() const { return m_headersLength; } + + /** + * Get/set the length of payload. + */ + inline void SetPayloadLength(size_t length) { m_payloadLength = length; } + inline size_t GetPayloadLength() const { return m_payloadLength; } + + /** + * Set/get event headers. + */ + inline void InsertEventHeader(const Aws::String& headerName, const EventHeaderValue& eventHeaderValue) + { + m_eventHeaders.emplace(Aws::Utils::Event::EventHeaderValuePair(headerName, eventHeaderValue)); + } + + inline const Aws::Utils::Event::EventHeaderValueCollection& GetEventHeaders() const { return m_eventHeaders; } + + /** + * Set event payload. + */ + void WriteEventPayload(const unsigned char* data, size_t length); + void WriteEventPayload(const Aws::Vector& bits); + void WriteEventPayload(const Aws::String& bits); + /** + * Get the byte array of the payload with transferring ownership. + */ + Aws::Vector&& GetEventPayloadWithOwnership() { return std::move(m_eventPayload); } + const Aws::Vector& GetEventPayload() const { return m_eventPayload; } + Aws::Vector& GetEventPayload() { return m_eventPayload; } + /** + * Convert byte array of the payload to string without transferring ownership. + */ + inline Aws::String GetEventPayloadAsString() { return Aws::String(m_eventPayload.begin(), m_eventPayload.end()); } + + private: + size_t m_totalLength = 0; + size_t m_headersLength = 0; + size_t m_payloadLength = 0; + + Aws::Utils::Event::EventHeaderValueCollection m_eventHeaders; + Aws::Vector m_eventPayload; + }; + + } + } +} diff --git a/include/aws/core/utils/event/EventStream.h b/include/aws/core/utils/event/EventStream.h new file mode 100644 index 0000000000000000000000000000000000000000..daa9cbf57d2748ae1f5d87a421f011273c6b2006 --- /dev/null +++ b/include/aws/core/utils/event/EventStream.h @@ -0,0 +1,8 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include diff --git a/include/aws/core/utils/event/EventStreamBuf.h b/include/aws/core/utils/event/EventStreamBuf.h new file mode 100644 index 0000000000000000000000000000000000000000..ad5c440323471b5d74b41e6980f64f211d0dc028 --- /dev/null +++ b/include/aws/core/utils/event/EventStreamBuf.h @@ -0,0 +1,52 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Event + { + extern AWS_CORE_API const size_t DEFAULT_BUF_SIZE; + + /** + * Derived from std::streambuf, used as the underlying buffer for EventStream. + * Handle the payload from server side and pass data to underlying decoder. + */ + class AWS_CORE_API EventStreamBuf : public std::streambuf + { + public: + /** + * @param decoder decodes the stream from server side, so as to invoke related callback functions. + * @param bufferSize The length of buffer, will be 1024 bytes by default. + */ + EventStreamBuf(EventStreamDecoder& decoder, size_t bufferLength = DEFAULT_BUF_SIZE); + virtual ~EventStreamBuf(); + + protected: + std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + + int underflow() override; + int overflow(int ch) override; + int sync() override; + + private: + void writeToDecoder(); + + ByteBuffer m_byteBuffer; + size_t m_bufferLength; + Aws::StringStream m_err; + EventStreamDecoder& m_decoder; + }; + } + } +} diff --git a/include/aws/core/utils/event/EventStreamDecoder.h b/include/aws/core/utils/event/EventStreamDecoder.h new file mode 100644 index 0000000000000000000000000000000000000000..8f737e7bc742ba9c5087de8c5148fe0b183be908 --- /dev/null +++ b/include/aws/core/utils/event/EventStreamDecoder.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Event + { + class AWS_CORE_API EventStreamDecoder + { + public: + EventStreamDecoder(EventStreamHandler* handler); + ~EventStreamDecoder(); + + /** + * Whether or not the decoder is in good state. Return false if the decoder encounters errors. + */ + inline explicit operator bool() const { return *m_eventStreamHandler; } + + /** + * A wrapper of aws_event_stream_streaming_decoder_pump in aws-c-event-stream. + * Pass data to the underlying decoder. + */ + void Pump(const ByteBuffer& data); + void Pump(const ByteBuffer& data, size_t length); + + /** + * Reset decoder and it's handler. + */ + void Reset(); + + /** + * Reset event stream handler of the decoder + */ + void ResetEventStreamHandler(EventStreamHandler* handler); + + protected: + /** + * Callback function invoked when payload data has been received. + * @param decoder The underlying decoder defined in the aws-c-event-stream. + * @param payload The payload data received, it doesn't belong to you, make a copy if necessary. + * @param isFinalSegment A flag indicates the current data is the last payload buffer for that message if it equals to 1. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onPayloadSegment( + aws_event_stream_streaming_decoder* decoder, + aws_byte_buf* payload, + int8_t isFinalSegment, + void* context); + + /** + * Callback function invoked when a new message has arrived. + * @param decoder The underlying decoder defined in the aws-c-event-stream. + * @param prelude The metadata of the message, including total message length and header length. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onPreludeReceived( + aws_event_stream_streaming_decoder* decoder, + aws_event_stream_message_prelude* prelude, + void* context); + + /** + * Callback function invoked when a header is encountered. + * @param decoder The underlying decoder defined in the aws-c-event-stream. + * @param prelude The metadata of the message, including total message length and header length. + * @param header A header of the message. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onHeaderReceived( + aws_event_stream_streaming_decoder* decoder, + aws_event_stream_message_prelude* prelude, + aws_event_stream_header_value_pair* header, + void* context); + + /** + * Callback function invoked when an error is encountered. + * @param decoder The underlying decoder defined in aws-c-event-stream. + * @param prelude The metadata of the message, including total message length and header length. + * @param errorCode Error code indicates the type of the error encountered. + * @param message Error message indicates the details of the error encountered. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onError( + aws_event_stream_streaming_decoder* decoder, + aws_event_stream_message_prelude* prelude, + int errorCode, + const char* message, + void* context); + + /** + * The underlying decoder defined in aws-c-event-stream. + * The decoder will invoke callback functions when the streaming messages received. + */ + aws_event_stream_streaming_decoder m_decoder; + EventStreamHandler* m_eventStreamHandler; + }; + } + } +} diff --git a/include/aws/core/utils/event/EventStreamEncoder.h b/include/aws/core/utils/event/EventStreamEncoder.h new file mode 100644 index 0000000000000000000000000000000000000000..656388b8e87273b6d34c0253cc72e54a146e7c1b --- /dev/null +++ b/include/aws/core/utils/event/EventStreamEncoder.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Client + { + class AWSAuthSigner; + } + + namespace Utils + { + namespace Event + { + /** + * Utility class that wraps the logic of translating event messages to their binary format according to the + * AWS streaming specification. + * This class is _not_ thread-safe. + */ + class AWS_CORE_API EventStreamEncoder + { + public: + EventStreamEncoder(Aws::Client::AWSAuthSigner* signer = nullptr); + + + void SetSignatureSeed(const Aws::String& seed) { m_signatureSeed = seed; } + + void SetSigner(Aws::Client::AWSAuthSigner* signer) { m_signer = signer; } + + /** + * Encodes the input message in the event-stream binary format and signs the resulting bits. + * The signing is done via the signer member. + */ + Aws::Vector EncodeAndSign(const Aws::Utils::Event::Message& msg); + private: + /** + * Initialize C struct based on C++ object. + * Returns true if successful. + * A successfully initialized struct must be cleaned up when you're done with it. + */ + bool InitEncodedStruct(const Aws::Utils::Event::Message& msg, aws_event_stream_message* encoded); + + /** + * Initialize signed C struct with a content of a payload message. + * Returns true if successful. + * signedmsg will contain an AWS Stream Event with a payload in a H2 frame payload section. + * A successfully initialized struct must be cleaned up when you're done with it. + */ + bool InitSignedStruct(const aws_event_stream_message* payload, aws_event_stream_message* signedmsg); + + Aws::Client::AWSAuthSigner* m_signer; + Aws::String m_signatureSeed; + }; + } + } +} diff --git a/include/aws/core/utils/event/EventStreamErrors.h b/include/aws/core/utils/event/EventStreamErrors.h new file mode 100644 index 0000000000000000000000000000000000000000..d85e4fdd1f6bdf1b96bef9b31272f29b30ca86f1 --- /dev/null +++ b/include/aws/core/utils/event/EventStreamErrors.h @@ -0,0 +1,47 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Event + { + /** + * Errors encountered in event stream. + * These errors are associated with those in aws-c-event-stream library. + */ + enum class EventStreamErrors + { + EVENT_STREAM_NO_ERROR = 0, + EVENT_STREAM_BUFFER_LENGTH_MISMATCH = 0x1000, + EVENT_STREAM_INSUFFICIENT_BUFFER_LEN, + EVENT_STREAM_MESSAGE_FIELD_SIZE_EXCEEDED, + EVENT_STREAM_PRELUDE_CHECKSUM_FAILURE, + EVENT_STREAM_MESSAGE_CHECKSUM_FAILURE, + EVENT_STREAM_MESSAGE_INVALID_HEADERS_LEN, + EVENT_STREAM_MESSAGE_UNKNOWN_HEADER_TYPE, + EVENT_STREAM_MESSAGE_PARSER_ILLEGAL_STATE, + EVENT_STREAM_UNKNOWN_ERROR + }; + + namespace EventStreamErrorsMapper + { + /** + * Get name by its error type in event stream. + */ + AWS_CORE_API const char* GetNameForError(Event::EventStreamErrors error); + /** + * Get AWSError by EventStreamError. The Error type will always be CoreErrors::UNKNOWN as an internal error in Event Stream, and it's always not retryable. + */ + AWS_CORE_API Aws::Client::AWSError GetAwsErrorForEventStreamError(Event::EventStreamErrors error); + } // namespace EventStreamErrorsMapper + } // namespace Event + } // namespace Utils +} // namespace Aws \ No newline at end of file diff --git a/include/aws/core/utils/event/EventStreamHandler.h b/include/aws/core/utils/event/EventStreamHandler.h new file mode 100644 index 0000000000000000000000000000000000000000..486656716826669e9b209456af4ff3ab85dd70ad --- /dev/null +++ b/include/aws/core/utils/event/EventStreamHandler.h @@ -0,0 +1,167 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Event + { + enum class InitialResponseType + { + ON_EVENT, + ON_RESPONSE + }; + + /** + * Handler of event stream. + * Includes context and callback function while scanning the event stream. + */ + class AWS_CORE_API EventStreamHandler + { + public: + EventStreamHandler() : + m_failure(false), m_internalError(EventStreamErrors::EVENT_STREAM_NO_ERROR), m_headersBytesReceived(0), m_payloadBytesReceived(0), m_message() + {} + + virtual ~EventStreamHandler() = default; + + /** + * Whether or not flow handler is in a good state. Return false if handler encounters errors. + */ + inline operator bool() const { return !m_failure; } + + /** + * Fail the handler from outside. + */ + inline void SetFailure() { m_failure = true; } + + /** + * Clean up current bytes of data received, as well as the latest message. + */ + inline virtual void Reset() + { + m_failure = false; + m_internalError = EventStreamErrors::EVENT_STREAM_NO_ERROR; + m_headersBytesReceived = 0; + m_payloadBytesReceived = 0; + + m_message.Reset(); + } + + /** + * Set internal Event Stream Errors, which is associated with errors in aws-c-event-stream library. + */ + inline void SetInternalError(int errorCode = 0) + { + m_internalError = static_cast(errorCode); + } + + /** + * Get internal Event Stream Errors. + */ + inline EventStreamErrors GetInternalError() + { + return m_internalError; + } + + /** + * The message is considered to completed with the following scenarios: + * 1. Message doesn't have headers or payloads. Or + * 2. Message has headers but doesn't have payloads. Or + * 3. Message has both headers and payloads. + */ + inline virtual bool IsMessageCompleted() + { + return m_message.GetHeadersLength() == m_headersBytesReceived && m_message.GetPayloadLength() == m_payloadBytesReceived; + } + + /** + * Set message metadata, including total message length, headers length and payload length. + */ + inline virtual void SetMessageMetadata(size_t totalLength, size_t headersLength, size_t payloadLength) + { + m_message.SetTotalLength(totalLength); + m_message.SetHeadersLength(headersLength); + m_message.SetPayloadLength(payloadLength); + assert(totalLength == 12/*prelude length*/ + headersLength + payloadLength + 4/*message crc length*/); + if (totalLength != headersLength + payloadLength + 16) + { + AWS_LOG_WARN("EventStreamHandler", "Message total length mismatch."); + } + } + + /** + * Write data to underlying stream, and update payload bytes received. + */ + inline virtual void WriteMessageEventPayload(const unsigned char* data, size_t dataLength) + { + m_message.WriteEventPayload(data, dataLength); + m_payloadBytesReceived += dataLength; + } + + /** + * Get underlying byte array of the message just received. + */ + inline virtual Aws::Vector&& GetEventPayloadWithOwnership() { return m_message.GetEventPayloadWithOwnership(); } + + /** + * Convert underlying byte array to string without transferring ownership. + */ + inline virtual Aws::String GetEventPayloadAsString() { return m_message.GetEventPayloadAsString(); } + + /** + * Insert event header to a underlying event header value map, and update headers bytes received. + */ + inline virtual void InsertMessageEventHeader(const String& eventHeaderName, size_t eventHeaderLength, const Aws::Utils::Event::EventHeaderValue& eventHeaderValue) + { + m_message.InsertEventHeader(eventHeaderName, eventHeaderValue); + m_headersBytesReceived += eventHeaderLength; + } + + inline virtual const Aws::Utils::Event::EventHeaderValueCollection& GetEventHeaders() { return m_message.GetEventHeaders(); } + + inline virtual const Http::HeaderValueCollection GetEventHeadersAsHttpHeaders() const + { + Http::HeaderValueCollection output; + using SrcT = Aws::Utils::Event::EventHeaderValueCollection::value_type; + using DstT = Http::HeaderValueCollection::value_type; + std::transform(m_message.GetEventHeaders().cbegin(), m_message.GetEventHeaders().cend(), + std::inserter(output, output.end()), + [](const SrcT& src) + { + return DstT(src.first, src.second.ToString()); + }); + return output; + } + + /** + * Entry point of all callback functions. + * Will trigger associated functions based on m_message. + */ + virtual void OnEvent() = 0; + + private: + bool m_failure; + EventStreamErrors m_internalError; + size_t m_headersBytesReceived; + size_t m_payloadBytesReceived; + Aws::Utils::Event::Message m_message; + }; + } + } +} diff --git a/include/aws/core/utils/json/JsonSerializer.h b/include/aws/core/utils/json/JsonSerializer.h new file mode 100644 index 0000000000000000000000000000000000000000..8b2ccc139bb5be2bffd52a648f357f7d11f5ff67 --- /dev/null +++ b/include/aws/core/utils/json/JsonSerializer.h @@ -0,0 +1,395 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include + +#include + +namespace Aws +{ + namespace Utils + { + class Document; + class DocumentView; + + namespace Json + { + class JsonView; + /** + * JSON DOM manipulation class. + * To read or serialize use @ref View function. + */ + class AWS_CORE_API JsonValue + { + public: + /** + * Constructs empty JSON DOM. + */ + JsonValue(); + + /** + * Constructs a JSON DOM by parsing the input string. + */ + JsonValue(const Aws::String& value); + + /** + * Constructs a JSON DOM by parsing the text in the input stream. + */ + JsonValue(Aws::IStream& istream); + + /** + * Performs a deep copy of the JSON DOM parameter. + * Prefer using a @ref JsonView if copying is not needed. + */ + JsonValue(const JsonValue& value); + + /** + * Moves the ownership of the internal JSON DOM. + * No copying is performed. + */ + JsonValue(JsonValue&& value); + + /** + * Performs a deep copy of the Document parameter. + */ + JsonValue(const Aws::Utils::DocumentView& value); + + ~JsonValue(); + + /** + * Performs a deep copy of the JSON DOM parameter. + */ + JsonValue& operator=(const JsonValue& other); + + /** + * Moves the ownership of the internal JSON DOM of the parameter to the current object. + * No copying is performed. + * A DOM currently owned by the object will be freed prior to copying. + * @warning This will result in invalidating any outstanding views of the current DOM. However, views + * to the moved-from DOM would still valid. + */ + JsonValue& operator=(JsonValue&& other); + + /** + * Performs a deep copy of the Document parameter. + */ + JsonValue& operator=(const Aws::Utils::DocumentView& value); + + bool operator==(const JsonValue& other) const; + bool operator!=(const JsonValue& other) const; + + /** + * Adds a string to the top level of this node with key. + */ + JsonValue& WithString(const Aws::String& key, const Aws::String& value); + JsonValue& WithString(const char* key, const Aws::String& value); + + /** + * Converts the current JSON node to a string. + */ + JsonValue& AsString(const Aws::String& value); + + /** + * Adds a bool value with key to the top level of this node. + */ + JsonValue& WithBool(const Aws::String& key, bool value); + JsonValue& WithBool(const char* key, bool value); + + /** + * Converts the current JSON node to a bool. + */ + JsonValue& AsBool(bool value); + + /** + * Adds an integer value at key at the top level of this node. + */ + JsonValue& WithInteger(const Aws::String& key, int value); + JsonValue& WithInteger(const char* key, int value); + + /** + * Converts the current JSON node to an integer. + */ + JsonValue& AsInteger(int value); + + /** + * Adds a 64-bit integer value at key to the top level of this node. + */ + JsonValue& WithInt64(const Aws::String& key, long long value); + JsonValue& WithInt64(const char* key, long long value); + + /** + * Converts the current JSON node to a 64-bit integer. + */ + JsonValue& AsInt64(long long value); + + /** + * Adds a double value at key at the top level of this node. + */ + JsonValue& WithDouble(const Aws::String& key, double value); + JsonValue& WithDouble(const char* key, double value); + + /** + * Converts the current JSON node to a double. + */ + JsonValue& AsDouble(double value); + + /** + * Adds an array of strings to the top level of this node at key. + */ + JsonValue& WithArray(const Aws::String& key, const Array& array); + JsonValue& WithArray(const char* key, const Array& array); + + /** + * Adds an array of arbitrary JSON objects to the top level of this node at key. + * The values in the array parameter will be deep-copied. + */ + JsonValue& WithArray(const Aws::String& key, const Array& array); + + /** + * Adds an array of arbitrary JSON objects to the top level of this node at key. + * The values in the array parameter will be moved-from. + */ + JsonValue& WithArray(const Aws::String& key, Array&& array); + + /** + * Converts the current JSON node to an array whose values are deep-copied from the array parameter. + */ + JsonValue& AsArray(const Array& array); + + /** + * Converts the current JSON node to an array whose values are moved from the array parameter. + */ + JsonValue& AsArray(Array&& array); + + /** + * Adds a JSON object to the top level of this node at key. + * The object parameter is deep-copied. + */ + JsonValue& WithObject(const Aws::String& key, const JsonValue& value); + JsonValue& WithObject(const char* key, const JsonValue& value); + + /** + * Adds a JSON object to the top level of this node at key. + */ + JsonValue& WithObject(const Aws::String& key, JsonValue&& value); + JsonValue& WithObject(const char* key, JsonValue&& value); + + /** + * Converts the current JSON node to a JSON object by deep-copying the parameter. + */ + JsonValue& AsObject(const JsonValue& value); + + /** + * Converts the current JSON node to a JSON object by moving from the parameter. + */ + JsonValue& AsObject(JsonValue&& value); + + /** + * Returns true if the last parse request was successful. If this returns false, + * you can call GetErrorMessage() to find the cause. + */ + inline bool WasParseSuccessful() const + { + return m_wasParseSuccessful; + } + + /** + * Returns the last error message from a failed parse attempt. Returns empty string if no error. + */ + inline const Aws::String& GetErrorMessage() const + { + return m_errorMessage; + } + + /** + * Creates a view from the current root JSON node. + */ + JsonView View() const; + + private: + void Destroy(); + JsonValue(cJSON* value); + cJSON* m_value; + bool m_wasParseSuccessful; + Aws::String m_errorMessage; + friend class JsonView; + }; + + /** + * Provides read-only view to an existing JsonValue. This allows lightweight copying without making deep + * copies of the JsonValue. + * Note: This class does not extend the lifetime of the given JsonValue. It's your responsibility to ensure + * the lifetime of the JsonValue is extended beyond the lifetime of its view. + */ + class AWS_CORE_API JsonView + { + public: + /* constructors */ + JsonView(); + JsonView(const JsonValue& v); + JsonView& operator=(const JsonValue& v); + + /** + * Gets a string from this node by its key. + */ + Aws::String GetString(const Aws::String& key) const; + + /** + * Returns the value of this node as a string. + * The behavior is undefined if the node is _not_ of type string. + */ + Aws::String AsString() const; + + /** + * Gets a boolean value from this node by its key. + */ + bool GetBool(const Aws::String& key) const; + + /** + * Returns the value of this node as a boolean. + */ + bool AsBool() const; + + /** + * Gets an integer value from this node by its key. + * The integer is of the same size as an int on the machine. + */ + int GetInteger(const Aws::String& key) const; + + /** + * Returns the value of this node as an int. + */ + int AsInteger() const; + + /** + * Gets a 64-bit integer value from this node by its key. + * The value is 64-bit regardless of the platform/machine. + */ + int64_t GetInt64(const Aws::String& key) const; + + /** + * Returns the value of this node as 64-bit integer. + */ + int64_t AsInt64() const; + + /** + * Gets a double precision floating-point value from this node by its key. + */ + double GetDouble(const Aws::String& key) const; + + /** + * Returns the value of this node as a double precision floating-point. + */ + double AsDouble() const; + + /** + * Gets an array of JsonView objects from this node by its key. + */ + Array GetArray(const Aws::String& key) const; + + /** + * Returns the value of this node as an array of JsonView objects. + */ + Array AsArray() const; + + /** + * Gets a JsonView object from this node by its key. + */ + JsonView GetObject(const Aws::String& key) const; + + /** + * Returns the value of this node as a JsonView object. + */ + JsonView AsObject() const; + + /** + * Reads all json objects at the top level of this node (does not traverse the tree any further) + * along with their keys. + */ + Aws::Map GetAllObjects() const; + + /** + * Tests whether a value exists at the current node level for the given key. + * Returns true if a value has been found and its value is not null, false otherwise. + */ + bool ValueExists(const Aws::String& key) const; + + /** + * Tests whether a key exists at the current node level. + */ + bool KeyExists(const Aws::String& key) const; + + /** + * Tests whether the current value is a JSON object. + */ + bool IsObject() const; + + /** + * Tests whether the current value is a boolean. + */ + bool IsBool() const; + + /** + * Tests whether the current value is a string. + */ + bool IsString() const; + + /** + * Tests whether the current value is an int or int64_t. + * Returns false if the value is floating-point. + */ + bool IsIntegerType() const; + + /** + * Tests whether the current value is a floating-point. + */ + bool IsFloatingPointType() const; + + /** + * Tests whether the current value is a JSON array. + */ + bool IsListType() const; + + /** + * Tests whether the current value is NULL. + */ + bool IsNull() const; + + /** + * Writes the current JSON view without whitespace characters starting at the current level to a string. + * @param treatAsObject if the current value is empty, writes out '{}' rather than an empty string. + */ + Aws::String WriteCompact(bool treatAsObject = true) const; + + /** + * Writes the current JSON view to a string in a human friendly format. + * @param treatAsObject if the current value is empty, writes out '{}' rather than an empty string. + */ + Aws::String WriteReadable(bool treatAsObject = true) const; + + /** + * Creates a deep copy of the JSON value rooted in the current JSON view. + */ + JsonValue Materialize() const; + + private: + JsonView(cJSON* val); + JsonView& operator=(cJSON* val); + cJSON* m_value; + friend class Aws::Utils::Document; + }; + + } // namespace Json + } // namespace Utils +} // namespace Aws + diff --git a/include/aws/core/utils/logging/AWSLogging.h b/include/aws/core/utils/logging/AWSLogging.h new file mode 100644 index 0000000000000000000000000000000000000000..be572ad23b213fb6464aadd723aedace280caa42 --- /dev/null +++ b/include/aws/core/utils/logging/AWSLogging.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + class LogSystemInterface; + + // Standard interface + + /** + * Call this at the beginning of your program, prior to any AWS calls. + */ + AWS_CORE_API void InitializeAWSLogging(const std::shared_ptr& logSystem); + + /** + * Call this at the exit point of your program, after all calls have finished. + */ + AWS_CORE_API void ShutdownAWSLogging(void); + + /** + * Get currently configured log system instance. + */ + AWS_CORE_API LogSystemInterface* GetLogSystem(); + + // Testing interface + + /** + * Replaces the current logger with a new one, while pushing the old one onto a 1-deep stack; primarily for testing + */ + AWS_CORE_API void PushLogger(const std::shared_ptr &logSystem); + + /** + * Pops the logger off the logger stack and replaces the current logger with it. Disables logging if the top logger is actually a nullptr + */ + AWS_CORE_API void PopLogger(); + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/CRTLogSystem.h b/include/aws/core/utils/logging/CRTLogSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..0b00c07ddbb2c3c4557865e84dd8d41bdc9a7a78 --- /dev/null +++ b/include/aws/core/utils/logging/CRTLogSystem.h @@ -0,0 +1,56 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + enum class LogLevel : int; + + /** + * Interface for CRT (common runtime libraries) logging implementations. + * A wrapper on the top of aws_logger, the logging interface used by common runtime libraries. + */ + class AWS_CORE_API CRTLogSystemInterface + { + public: + virtual ~CRTLogSystemInterface() = default; + + /** + * Gets the currently configured log level. + */ + virtual LogLevel GetLogLevel() const = 0; + /** + * Set a new log level. This has the immediate effect of changing the log output to the new level. + */ + virtual void SetLogLevel(LogLevel logLevel) = 0; + + /** + * Handle the logging information from common runtime libraries. + * Redirect them to C++ SDK logging system by default. + */ + virtual void Log(LogLevel logLevel, const char* subjectName, const char* formatStr, va_list args) = 0; + + /** + * Wrapper on top of CRT's aws_logger::clean_up method. + */ + virtual void CleanUp() {return;} + }; + } // namespace Logging + } // namespace Utils +} // namespace Aws + +// for backward compatibility +#include diff --git a/include/aws/core/utils/logging/CRTLogging.h b/include/aws/core/utils/logging/CRTLogging.h new file mode 100644 index 0000000000000000000000000000000000000000..5b0e6ac580a47823e4810de2ae17da06a41b7eed --- /dev/null +++ b/include/aws/core/utils/logging/CRTLogging.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + class CRTLogSystemInterface; + + /** + * Initialize CRT (common runtime libraries) log system to handle loggings from common runtime libraries, including aws-c-auth, aws-c-http, aws-c-event-stream and etc. + */ + AWS_CORE_API void InitializeCRTLogging(const std::shared_ptr& crtLogSystem); + + /** + * Shutdown CRT (common runtime libraries) log system. + */ + AWS_CORE_API void ShutdownCRTLogging(); + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/ConsoleLogSystem.h b/include/aws/core/utils/logging/ConsoleLogSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..b7fb714ed6284247a64db813c5e7940d1e12ea6b --- /dev/null +++ b/include/aws/core/utils/logging/ConsoleLogSystem.h @@ -0,0 +1,45 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + /** + * Log system interface that logs to std::cout + */ + class AWS_CORE_API ConsoleLogSystem : public FormattedLogSystem + { + public: + + using Base = FormattedLogSystem; + + ConsoleLogSystem(LogLevel logLevel) : + Base(logLevel) + {} + + virtual ~ConsoleLogSystem() {} + + /** + * Flushes buffered messages to stdout. + */ + void Flush() override; + + protected: + + virtual void ProcessFormattedStatement(Aws::String&& statement) override; + }; + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/DefaultCRTLogSystem.h b/include/aws/core/utils/logging/DefaultCRTLogSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..9f78b865b1b6b366327d9e6877726dae8db1d4bd --- /dev/null +++ b/include/aws/core/utils/logging/DefaultCRTLogSystem.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + /** + * The default CRT log system will just do a redirection of all logs from common runtime libraries to C++ SDK. + */ + class AWS_CORE_API DefaultCRTLogSystem : public CRTLogSystemInterface + { + public: + DefaultCRTLogSystem(LogLevel logLevel); + virtual ~DefaultCRTLogSystem() = default; + + DefaultCRTLogSystem(DefaultCRTLogSystem&&) = delete; + DefaultCRTLogSystem(const DefaultCRTLogSystem&) = delete; + + /** + * Gets the currently configured log level. + */ + LogLevel GetLogLevel() const override; + /** + * Set a new log level. This has the immediate effect of changing the log output to the new level. + */ + void SetLogLevel(LogLevel logLevel) override; + + /** + * Handle the logging information from common runtime libraries. + * Redirect them to C++ SDK logging system by default. + */ + virtual void Log(LogLevel logLevel, const char* subjectName, const char* formatStr, va_list args) override; + }; + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/DefaultLogSystem.h b/include/aws/core/utils/logging/DefaultLogSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..a5a762bacb8803944c5ed7824674916156eef819 --- /dev/null +++ b/include/aws/core/utils/logging/DefaultLogSystem.h @@ -0,0 +1,96 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + /** + * Default behavior logger. It has a background thread that reads a log queue and prints the messages + * out to file as quickly as possible. This implementation also rolls the file every hour. + */ + class AWS_CORE_API DefaultLogSystem : public FormattedLogSystem + { + public: + using Base = FormattedLogSystem; + + /** + * Initialize the logging system to write to the supplied logfile output. Creates logging thread on construction. + */ + DefaultLogSystem(LogLevel logLevel, const std::shared_ptr& logFile); + /** + * Initialize the logging system to write to a computed file path filenamePrefix + "timestamp.log". Creates logging thread + * on construction. + */ + DefaultLogSystem(LogLevel logLevel, const Aws::String& filenamePrefix); + + virtual ~DefaultLogSystem(); + + /** + * Flushes buffered messages to the file system. + * This method is thread-safe. + */ + void Flush() override; + + /** + * Stops logging on this logger without destroying the object. + */ + void Stop() override; + + /** + * Structure containing semaphores, queue etc... + */ + struct LogSynchronizationData + { + public: + LogSynchronizationData() : m_stopLogging(false), m_loggingThreadStopped(false) {} + + std::mutex m_logQueueMutex; + std::condition_variable m_queueSignal; + Aws::Vector m_queuedLogMessages; + bool m_stopLogging = false; + bool m_loggingThreadStopped = false; + + private: + LogSynchronizationData(const LogSynchronizationData& rhs) = delete; + LogSynchronizationData& operator =(const LogSynchronizationData& rhs) = delete; + }; + + protected: + /** + * Pushes log onto the queue and notifies the background thread. + */ + virtual void ProcessFormattedStatement(Aws::String&& statement) override; + + private: + DefaultLogSystem(const DefaultLogSystem& rhs) = delete; + DefaultLogSystem& operator =(const DefaultLogSystem& rhs) = delete; + + LogSynchronizationData m_syncData; + + std::thread m_loggingThread; + }; + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/ErrorMacros.h b/include/aws/core/utils/logging/ErrorMacros.h new file mode 100644 index 0000000000000000000000000000000000000000..dbfd75e82d7ac3b12b389140fbb9586640fcc1e4 --- /dev/null +++ b/include/aws/core/utils/logging/ErrorMacros.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include + +#include + +#define AWS_OPERATION_CHECK_PTR(PTR, OPERATION, ERROR_TYPE, ERROR) \ +do { \ + if (PTR == nullptr) \ + { \ + AWS_LOGSTREAM_FATAL(#OPERATION, "Unexpected nullptr: " #PTR); \ + return OPERATION##Outcome(Aws::Client::AWSError(ERROR, #ERROR, "Unexpected nullptr: " #PTR, false)); \ + } \ +} while (0) + +#define AWS_CHECK(LOG_TAG, CONDITION, ERROR_MESSAGE, RETURN) \ +do { \ + if (!(CONDITION)) \ + { \ + AWS_LOGSTREAM_ERROR(LOG_TAG, ERROR_MESSAGE); \ + return RETURN; \ + } \ +} while (0) + +#define AWS_CHECK_PTR(LOG_TAG, PTR) \ +do { \ + if (PTR == nullptr) \ + { \ + AWS_LOGSTREAM_FATAL(LOG_TAG, "Unexpected nullptr: " #PTR); \ + return; \ + } \ +} while (0) + +#define AWS_OPERATION_CHECK_SUCCESS(OUTCOME, OPERATION, ERROR_TYPE, ERROR, ERROR_MESSAGE) \ +do { \ + if (!OUTCOME.IsSuccess()) \ + { \ + AWS_LOGSTREAM_ERROR(#OPERATION, ERROR_MESSAGE); \ + return OPERATION##Outcome(Aws::Client::AWSError(ERROR, #ERROR, ERROR_MESSAGE, false)); \ + } \ +} while (0) + +#define AWS_OPERATION_CHECK_PARAMETER_PRESENT(REQUEST, FIELD, OPERATION, CLIENT_NAMESPACE) \ +do { \ + if (!REQUEST##.##FIELD##HasBeenSet()) \ + { \ + AWS_LOGSTREAM_ERROR(#OPERATION, "Required field: "#FIELD" is not set"); \ + return OPERATION##Outcome(Aws::Client::AWSError(CLIENT_NAMESPACE##Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field ["#FIELD"]", false)); \ + } \ +} while (0) + +#define AWS_OPERATION_GUARD(OPERATION) \ +if(!m_isInitialized) \ +{ \ + AWS_LOGSTREAM_ERROR(#OPERATION, "Unable to call " #OPERATION ": client is not initialized (or already terminated)"); \ + return Aws::Client::AWSError(CoreErrors::NOT_INITIALIZED, "NOT_INITIALIZED", "Client is not initialized or already terminated", false); \ +} \ +Aws::Utils::RAIICounter(this->m_operationsProcessed, &this->m_shutdownSignal) + +#define AWS_ASYNC_OPERATION_GUARD(OPERATION) \ +if(!m_isInitialized) \ +{ \ + AWS_LOGSTREAM_ERROR(#OPERATION, "Unable to call " #OPERATION ": client is not initialized (or already terminated)"); \ + return handler(this, request, Aws::Client::AWSError(CoreErrors::NOT_INITIALIZED, "NOT_INITIALIZED", "Client is not initialized or already terminated", false), handlerContext); \ +} \ +Aws::Utils::RAIICounter(this->m_operationsProcessed, &this->m_shutdownSignal) diff --git a/include/aws/core/utils/logging/FormattedLogSystem.h b/include/aws/core/utils/logging/FormattedLogSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..93b30d4aa50c4cd9e72c94ce74eb20e804cc325d --- /dev/null +++ b/include/aws/core/utils/logging/FormattedLogSystem.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + /** + * Logger that formats log messages into [LEVEL] timestamp [threadid] message + */ + class AWS_CORE_API FormattedLogSystem : public LogSystemInterface + { + public: + using Base = LogSystemInterface; + + /** + * Initializes log system with logLevel + */ + FormattedLogSystem(LogLevel logLevel); + virtual ~FormattedLogSystem() = default; + + /** + * Gets the currently configured log level. + */ + virtual LogLevel GetLogLevel(void) const override { return m_logLevel; } + /** + * Set a new log level. This has the immediate effect of changing the log output to the new level. + */ + void SetLogLevel(LogLevel logLevel) { m_logLevel.store(logLevel); } + + /** + * Does a printf style output to ProcessFormattedStatement. Don't use this, it's unsafe. See LogStream + */ + virtual void Log(LogLevel logLevel, const char* tag, const char* formatStr, ...) override; + + /** + * Does a printf style output to ProcessFormattedStatement. Don't use this, it's unsafe. See LogStream + */ + virtual void vaLog(LogLevel logLevel, const char* tag, const char* formatStr, va_list args) override; + + /** + * Writes the stream to ProcessFormattedStatement. + */ + virtual void LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream) override; + + /** + * Stops logging on this logger without destroying the object. + */ + virtual void Stop() override { return SetLogLevel(Aws::Utils::Logging::LogLevel::Off); }; + protected: + /** + * This is the method that most logger implementations will want to override. + * At this point the message is formatted and is ready to go to the output stream + */ + virtual void ProcessFormattedStatement(Aws::String&& statement) = 0; + + private: + std::atomic m_logLevel; + }; + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/LogLevel.h b/include/aws/core/utils/logging/LogLevel.h new file mode 100644 index 0000000000000000000000000000000000000000..ff1dd36c0ed2e6e727203316cbe0fc399049efae --- /dev/null +++ b/include/aws/core/utils/logging/LogLevel.h @@ -0,0 +1,37 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + + /** + * LogLevel used to control verbosity of logging system. + */ + enum class LogLevel : int + { + Off = 0, + Fatal = 1, + Error = 2, + Warn = 3, + Info = 4, + Debug = 5, + Trace = 6 + }; + + AWS_CORE_API Aws::String GetLogLevelName(LogLevel logLevel); + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/LogMacros.h b/include/aws/core/utils/logging/LogMacros.h new file mode 100644 index 0000000000000000000000000000000000000000..3c8119837429685ad6b2c4a28dd6356b1171f2fd --- /dev/null +++ b/include/aws/core/utils/logging/LogMacros.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +// While macros are usually grotty, using them here lets us have a simple function call interface for logging that +// +// (1) Can be compiled out completely, so you don't even have to pay the cost to check the log level (which will be a virtual function call and a std::atomic<> read) if you don't want any AWS logging +// (2) If you use logging and the log statement doesn't pass the conditional log filter level, not only do you not pay the cost of building the log string, you don't pay the cost for allocating or +// getting any of the values used in building the log string, as they're in a scope (if-statement) that never gets entered. + +#ifdef DISABLE_AWS_LOGGING + + #define AWS_LOG(level, tag, ...) + #define AWS_LOG_FATAL(tag, ...) + #define AWS_LOG_ERROR(tag, ...) + #define AWS_LOG_WARN(tag, ...) + #define AWS_LOG_INFO(tag, ...) + #define AWS_LOG_DEBUG(tag, ...) + #define AWS_LOG_TRACE(tag, ...) + #define AWS_LOG_FLUSH() + + #define AWS_LOGSTREAM(level, tag, streamExpression) + #define AWS_LOGSTREAM_FATAL(tag, streamExpression) + #define AWS_LOGSTREAM_ERROR(tag, streamExpression) + #define AWS_LOGSTREAM_WARN(tag, streamExpression) + #define AWS_LOGSTREAM_INFO(tag, streamExpression) + #define AWS_LOGSTREAM_DEBUG(tag, streamExpression) + #define AWS_LOGSTREAM_TRACE(tag, streamExpression) + #define AWS_LOGSTREAM_FLUSH() + +#else + + #define AWS_LOG_FLUSH() \ + { \ + Aws::Utils::Logging::LogSystemInterface* logSystem = Aws::Utils::Logging::GetLogSystem(); \ + if ( logSystem ) \ + { \ + logSystem->Flush(); \ + } \ + } + + #define AWS_LOG(level, tag, ...) \ + { \ + Aws::Utils::Logging::LogSystemInterface* logSystem = Aws::Utils::Logging::GetLogSystem(); \ + if ( logSystem && logSystem->GetLogLevel() >= level ) \ + { \ + logSystem->Log(level, tag, __VA_ARGS__); \ + } \ + } + + #define AWS_LOG_FATAL(tag, ...) AWS_LOG(Aws::Utils::Logging::LogLevel::Fatal, tag, __VA_ARGS__) + #define AWS_LOG_ERROR(tag, ...) AWS_LOG(Aws::Utils::Logging::LogLevel::Error, tag, __VA_ARGS__) + #define AWS_LOG_WARN(tag, ...) AWS_LOG(Aws::Utils::Logging::LogLevel::Warn, tag, __VA_ARGS__) + #define AWS_LOG_INFO(tag, ...) AWS_LOG(Aws::Utils::Logging::LogLevel::Info, tag, __VA_ARGS__) + #define AWS_LOG_DEBUG(tag, ...) AWS_LOG(Aws::Utils::Logging::LogLevel::Debug, tag, __VA_ARGS__) + #define AWS_LOG_TRACE(tag, ...) AWS_LOG(Aws::Utils::Logging::LogLevel::Trace, tag, __VA_ARGS__) + + #define AWS_LOGSTREAM(level, tag, streamExpression) \ + { \ + Aws::Utils::Logging::LogSystemInterface* logSystem = Aws::Utils::Logging::GetLogSystem(); \ + if ( logSystem && logSystem->GetLogLevel() >= level ) \ + { \ + Aws::OStringStream logStream; \ + logStream << streamExpression; \ + logSystem->LogStream( level, tag, logStream ); \ + } \ + } + + #define AWS_LOGSTREAM_FATAL(tag, streamExpression) \ + do { \ + AWS_LOGSTREAM(Aws::Utils::Logging::LogLevel::Fatal, tag, streamExpression) \ + AWS_LOG_FLUSH() \ + } while(0) + #define AWS_LOGSTREAM_ERROR(tag, streamExpression) AWS_LOGSTREAM(Aws::Utils::Logging::LogLevel::Error, tag, streamExpression) + #define AWS_LOGSTREAM_WARN(tag, streamExpression) AWS_LOGSTREAM(Aws::Utils::Logging::LogLevel::Warn, tag, streamExpression) + #define AWS_LOGSTREAM_INFO(tag, streamExpression) AWS_LOGSTREAM(Aws::Utils::Logging::LogLevel::Info, tag, streamExpression) + #define AWS_LOGSTREAM_DEBUG(tag, streamExpression) AWS_LOGSTREAM(Aws::Utils::Logging::LogLevel::Debug, tag, streamExpression) + #define AWS_LOGSTREAM_TRACE(tag, streamExpression) AWS_LOGSTREAM(Aws::Utils::Logging::LogLevel::Trace, tag, streamExpression) + #define AWS_LOGSTREAM_FLUSH() AWS_LOG_FLUSH() + +#endif // DISABLE_AWS_LOGGING diff --git a/include/aws/core/utils/logging/LogSystemInterface.h b/include/aws/core/utils/logging/LogSystemInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..dfba96a7bbaa4af4b622600163185af7f293fb5b --- /dev/null +++ b/include/aws/core/utils/logging/LogSystemInterface.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + enum class LogLevel : int; + + /** + * Interface for logging implementations. If you want to write your own logger, you can start here, though you may have more + * luck going down one more level to FormattedLogSystem. It does a bit more of the work for you and still gives you the ability + * to override the IO portion. + */ + class AWS_CORE_API LogSystemInterface + { + public: + virtual ~LogSystemInterface() = default; + + /** + * Gets the currently configured log level for this logger. + */ + virtual LogLevel GetLogLevel(void) const = 0; + /** + * Does a printf style output to the output stream. Don't use this, it's unsafe. See LogStream + */ + virtual void Log(LogLevel logLevel, const char* tag, const char* formatStr, ...) = 0; + /** + * va_list overload for Log, avoid using this as well. + */ + virtual void vaLog(LogLevel logLevel, const char* tag, const char* formatStr, va_list args) = 0; + /** + * Writes the stream to the output stream. + */ + virtual void LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream) = 0; + /** + * Writes any buffered messages to the underlying device if the logger supports buffering. + */ + virtual void Flush() = 0; + /** + * Stops logging on this logger without destroying the object. + */ + virtual void Stop() { return; }; + }; + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/logging/NullLogSystem.h b/include/aws/core/utils/logging/NullLogSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..92f82033e20e816f491d919cd58d839ef9381814 --- /dev/null +++ b/include/aws/core/utils/logging/NullLogSystem.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Logging + { + /** + * Do nothing logger. + */ + class AWS_CORE_API NullLogSystem : public LogSystemInterface + { + public: + + NullLogSystem() {} + virtual ~NullLogSystem() {} + + virtual LogLevel GetLogLevel(void) const override { return LogLevel::Off; } + + virtual void Log(LogLevel logLevel, const char* tag, const char* formatStr, ...) override + { + AWS_UNREFERENCED_PARAM(logLevel); + AWS_UNREFERENCED_PARAM(tag); + AWS_UNREFERENCED_PARAM(formatStr); + } + + virtual void vaLog(LogLevel logLevel, const char* tag, const char* formatStr, va_list args) override + { + AWS_UNREFERENCED_PARAM(logLevel); + AWS_UNREFERENCED_PARAM(tag); + AWS_UNREFERENCED_PARAM(formatStr); + AWS_UNREFERENCED_PARAM(args); + } + + virtual void LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream) override + { + AWS_UNREFERENCED_PARAM(logLevel); + AWS_UNREFERENCED_PARAM(tag); + AWS_UNREFERENCED_PARAM(messageStream); + } + + virtual void Flush() override {} + }; + + } // namespace Logging + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/memory/AWSMemory.h b/include/aws/core/utils/memory/AWSMemory.h new file mode 100644 index 0000000000000000000000000000000000000000..16960f0a4659a98ac5ef8ca345e056610e063ade --- /dev/null +++ b/include/aws/core/utils/memory/AWSMemory.h @@ -0,0 +1,351 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include +#include + +struct aws_allocator; + +namespace Aws +{ + namespace Utils + { + namespace Memory + { + /** + *InitializeAWSMemory should be called at the very start of your program + */ + AWS_CORE_API void InitializeAWSMemorySystem(MemorySystemInterface& memorySystem); + + /** + * ShutdownAWSMemory should be called the very end of your program + */ + AWS_CORE_API void ShutdownAWSMemorySystem(void); + + /** + * Get the globally install memory system, if it has been installed. + */ + AWS_CORE_API MemorySystemInterface* GetMemorySystem(); + + /** + * Get the pointer to the SDK default memory system + */ + AWS_CORE_API MemorySystemInterface& GetDefaultMemorySystem(); + + } // namespace Memory + } // namespace Utils + + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + AWS_CORE_API void* Malloc(const char* allocationTag, size_t allocationSize); + + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + AWS_CORE_API void Free(void* memoryPtr); + + AWS_CORE_API aws_allocator* get_aws_allocator(); + + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + template + T* New(const char* allocationTag, ArgTypes&&... args) + { + void *rawMemory = Malloc(allocationTag, sizeof(T)); + // http://stackoverflow.com/questions/6783993/placement-new-and-delete + T *constructedMemory = new (rawMemory) T(std::forward(args)...); + return constructedMemory; + } +/* + * dynamic_cast of all sorts do not work on MSVC if RTTI is turned off. + * This means that deleting an object via a pointer to one of its polymorphic base types that do not point to the + * address of their concrete class will result in undefined behavior. + * Example: + * struct Foo : InterfaceA, InterfaceB {}; + * Aws::Delete(pointerToInterfaceB); + */ +#if defined(_MSC_VER) && !defined(_CPPRTTI) + template + void Delete(T* pointerToT) + { + if (pointerToT == nullptr) + { + return; + } + pointerToT->~T(); + Free(pointerToT); + } +#else + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + template + typename std::enable_if::value>::type Delete(T* pointerToT) + { + if (pointerToT == nullptr) + { + return; + } + //http://stackoverflow.com/questions/6783993/placement-new-and-delete + pointerToT->~T(); + Free(pointerToT); + } + + template + typename std::enable_if::value>::type Delete(T* pointerToT) + { + if (pointerToT == nullptr) + { + return; + } + // deal with deleting objects that implement multiple interfaces + // see casting to pointer to void in http://en.cppreference.com/w/cpp/language/dynamic_cast + // https://stackoverflow.com/questions/8123776/are-there-practical-uses-for-dynamic-casting-to-void-pointer + // NOTE: on some compilers, calling the destructor before doing the dynamic_cast affects how calculation of + // the address of the most derived class. + void* mostDerivedT = dynamic_cast(pointerToT); + pointerToT->~T(); + Free(mostDerivedT); + } +#endif // _CPPRTTI + + template + bool ShouldConstructArrayMembers() + { + return std::is_class::value; + } + + template + bool ShouldDestroyArrayMembers() + { + return !std::is_trivially_destructible::value; + } + + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + template + T* NewArray(std::size_t amount, const char* allocationTag) + { + if (amount > 0) + { + bool constructMembers = ShouldConstructArrayMembers(); + bool trackMemberCount = ShouldDestroyArrayMembers(); + + // if we need to remember the # of items in the array (because we need to call their destructors) then allocate extra memory and keep the # of items in the extra slot + std::size_t allocationSize = amount * sizeof(T); +#if defined(_MSC_VER) && _MSC_VER < 1900 + std::size_t headerSize = (std::max)(sizeof(std::size_t), __alignof(T)); +#else + std::size_t headerSize = (std::max)(sizeof(std::size_t), alignof(T)); +#endif + + if (trackMemberCount) + { + allocationSize += headerSize; + } + + void* rawMemory = Malloc(allocationTag, allocationSize); + T* pointerToT = nullptr; + + if (trackMemberCount) + { + std::size_t* pointerToAmount = reinterpret_cast(rawMemory); + *pointerToAmount = amount; + pointerToT = reinterpret_cast(reinterpret_cast(pointerToAmount) + headerSize); + + } + else + { + pointerToT = reinterpret_cast(rawMemory); + } + + if (constructMembers) + { + for (std::size_t i = 0; i < amount; ++i) + { + new (pointerToT + i) T; + } + } + + return pointerToT; + } + + return nullptr; + } + + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + template + void DeleteArray(T* pointerToTArray) + { + if (pointerToTArray == nullptr) + { + return; + } + + bool destroyMembers = ShouldDestroyArrayMembers(); + void* rawMemory = nullptr; + + if (destroyMembers) + { +#if defined(_MSC_VER) && _MSC_VER < 1900 + std::size_t headerSize = (std::max)(sizeof(std::size_t), __alignof(T)); +#else + std::size_t headerSize = (std::max)(sizeof(std::size_t), alignof(T)); +#endif + + std::size_t *pointerToAmount = reinterpret_cast(reinterpret_cast(pointerToTArray) - headerSize); + std::size_t amount = *pointerToAmount; + + for (std::size_t i = amount; i > 0; --i) + { + (pointerToTArray + i - 1)->~T(); + } + rawMemory = reinterpret_cast(pointerToAmount); + } + else + { + rawMemory = reinterpret_cast(pointerToTArray); + } + + Free(rawMemory); + } + + /** + * modeled from std::default_delete + */ + template + struct Deleter + { + Deleter() {} + + template::value, void>::type> + Deleter(const Deleter&) + { + } + + void operator()(T *pointerToT) const + { + static_assert(0 < sizeof(T), "can't delete an incomplete type"); + Aws::Delete(pointerToT); + } + }; + + template< typename T, typename D = Deleter< T > > using UniquePtr = std::unique_ptr< T, D >; + + /* + * A UniquePtr that ensures that underlying pointer is set to null on destruction. + * ...thanks to the legacy design, UniquePtr is used as a static global variable that may be destructed twice. + */ + template< typename T, typename D = Deleter< T > > + class UniquePtrSafeDeleted : public UniquePtr< T, D > + { + public: + using UniquePtr::UniquePtr; + UniquePtrSafeDeleted(const UniquePtrSafeDeleted&) noexcept = delete; + UniquePtrSafeDeleted(UniquePtrSafeDeleted&&) noexcept = default; + UniquePtrSafeDeleted& operator=( const UniquePtrSafeDeleted& r ) noexcept = delete; + UniquePtrSafeDeleted& operator=( UniquePtrSafeDeleted&& r ) noexcept + { + if(&r != this) { + UniquePtr::operator=(std::move(r)); + r.forceReset(); + } + return *this; + } + UniquePtrSafeDeleted& operator=( std::nullptr_t ) noexcept + { + forceReset(); + return *this; + } + + void forceReset() + { + if(!this->get()) + return; + this->reset(nullptr); + T volatile* newVal = this->get(); // volatile to prohibit optimizing out setting ptr to null + AWS_UNREFERENCED_PARAM(newVal); + // issue happens in Release where asserts are not enabled, so the next statement is for you, my dear reader + assert(newVal == nullptr && this->get() == nullptr); + } + + ~UniquePtrSafeDeleted() + { + forceReset(); + } + }; + + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + template + UniquePtr MakeUnique(const char* allocationTag, ArgTypes&&... args) + { + static_assert(!std::is_array::value || std::is_trivial::value, + "This wrapper/function is not designed to support non-trivial arrays."); + return UniquePtr(Aws::New(allocationTag, std::forward(args)...)); + } + + template, typename ...ArgTypes> + UniquePtrSafeDeleted MakeUniqueSafeDeleted(const char* allocationTag, ArgTypes&&... args) + { + static_assert(!std::is_array::value || std::is_trivial::value, + "This wrapper/function is not designed to support non-trivial arrays."); + + return UniquePtrSafeDeleted(Aws::New(allocationTag, std::forward(args)...), D()); + } + + template + struct ArrayDeleter + { + ArrayDeleter() {} + + template::value, void>::type> + ArrayDeleter(const ArrayDeleter&) + { + } + + void operator()(T *pointerToTArray) const + { + static_assert(0 < sizeof(T), "can't delete an incomplete type"); + Aws::DeleteArray(pointerToTArray); + } + }; + + template< typename T > using UniqueArrayPtr = std::unique_ptr< T, ArrayDeleter< T > >; + + /** + * ::new, ::delete, ::malloc, ::free, std::make_shared, and std::make_unique should not be used in SDK code + * use these functions instead or Aws::MakeShared + */ + template + UniqueArrayPtr MakeUniqueArray(std::size_t amount, const char* allocationTag, ArgTypes&&... args) + { + return UniqueArrayPtr(Aws::NewArray(amount, allocationTag, std::forward(args)...)); + } + +} // namespace Aws + diff --git a/include/aws/core/utils/memory/MemorySystemInterface.h b/include/aws/core/utils/memory/MemorySystemInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..0a8341ff86cea20c5045e47ec02082cbd1c1b520 --- /dev/null +++ b/include/aws/core/utils/memory/MemorySystemInterface.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Memory + { + /** + * Central interface for memory management customizations. To create a custom memory manager, implement this interface and then + * call InitializeAWSMemorySystem(). + */ + class AWS_CORE_API MemorySystemInterface + { + public: + virtual ~MemorySystemInterface() = default; + + /** + * This is for initializing your memory manager in a static context. This can be empty if you don't need to do that. + */ + virtual void Begin() = 0; + /** + * This is for cleaning up your memory manager in a static context. This can be empty if you don't need to do that. + */ + virtual void End() = 0; + + /** + * Allocate your memory inside this method. blocksize and alignment are exactly the same as the std::allocator interfaces. + * The allocationTag parameter is for memory tracking; you don't have to handle it. + */ + virtual void* AllocateMemory(std::size_t blockSize, std::size_t alignment, const char *allocationTag = nullptr) = 0; + + /** + * Free the memory pointed to by memoryPtr. + */ + virtual void FreeMemory(void* memoryPtr) = 0; + }; + + } // namespace Memory + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSAllocator.h b/include/aws/core/utils/memory/stl/AWSAllocator.h new file mode 100644 index 0000000000000000000000000000000000000000..efa1c8340f848920c5f840aa4961932a4c41f716 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSAllocator.h @@ -0,0 +1,121 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +#include +#include + +namespace Aws +{ +#ifdef USE_AWS_MEMORY_MANAGEMENT + /** + * Std allocator interface that is used for all STL types in CRT library + * in the event that Custom Memory Management is being used. + * + * Both SDK and CRT STL allocators are going to call the same SDK memory allocation methods. + * However, we should keep them separated + * to allow SDK to use the allocator when CRT is not initialized or already terminated. + */ + template< typename T > using CrtAllocator = Aws::Crt::StlAllocator; + + /** + * Std allocator interface that is used for all STL types in the SDK + * in the event that Custom Memory Management is being used. + */ + template + class Allocator : public std::allocator + { + public: + + typedef std::allocator Base; + + Allocator() throw() : + Base() + {} + + Allocator(const Allocator& a) throw() : + Base(a) + {} + + template + Allocator(const Allocator& a) throw() : + Base(a) + {} + + ~Allocator() throw() {} + + typedef std::size_t size_type; + + template + struct rebind + { + typedef Allocator other; + }; + + using RawPointer = typename std::allocator_traits>::pointer; + + RawPointer allocate(size_type n, const void *hint = nullptr) + { + AWS_UNREFERENCED_PARAM(hint); + + return reinterpret_cast(Malloc("AWSSTL", n * sizeof(T))); + } + + void deallocate(RawPointer p, size_type n) + { + AWS_UNREFERENCED_PARAM(n); + + Free(p); + } + + }; + +#ifdef __ANDROID__ +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + template< typename T > + bool operator ==(const Allocator< T >& lhs, const Allocator< T >& rhs) + { + AWS_UNREFERENCED_PARAM(lhs); + AWS_UNREFERENCED_PARAM(rhs); + + return false; + } +#endif // _GLIBCXX_FULLY_DYNAMIC_STRING == 0 +#endif // __ANDROID__ + +#else + + template< typename T > using Allocator = std::allocator; + +#endif // USE_AWS_MEMORY_MANAGEMENT + /** + * Creates a shared_ptr using AWS Allocator hooks. + * allocationTag is for memory tracking purposes. + */ + template + std::shared_ptr MakeShared(const char* allocationTag, ArgTypes&&... args) + { +#ifdef USE_AWS_MEMORY_MANAGEMENT + Aws::Utils::Memory::MemorySystemInterface* memorySystem = Aws::Utils::Memory::GetMemorySystem(); + // Was InitAPI forgotten or ShutdownAPI already called or Aws:: class used as static? + // TODO: enforce to non-conditional assert + AWS_ASSERT(memorySystem && "Memory system is not initialized."); + AWS_UNREFERENCED_PARAM(memorySystem); +#endif + AWS_UNREFERENCED_PARAM(allocationTag); + + return std::allocate_shared>(Aws::Allocator(), std::forward(args)...); + } + + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSArray.h b/include/aws/core/utils/memory/stl/AWSArray.h new file mode 100644 index 0000000000000000000000000000000000000000..f80be9e4a5ee5e1912431e782d08616c79181afd --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSArray.h @@ -0,0 +1,12 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ + template< typename T, std::size_t N > using Array = std::array< T, N >; +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSDeque.h b/include/aws/core/utils/memory/stl/AWSDeque.h new file mode 100644 index 0000000000000000000000000000000000000000..ed63b8e9394f438a490bede2c1b31b5f4c77e907 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSDeque.h @@ -0,0 +1,19 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include + +namespace Aws +{ + +template< typename T > using Deque = std::deque< T, Aws::Allocator< T > >; + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSList.h b/include/aws/core/utils/memory/stl/AWSList.h new file mode 100644 index 0000000000000000000000000000000000000000..49341325a8f66dd2ed044e1c2ba3efd20d002363 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSList.h @@ -0,0 +1,19 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include + +namespace Aws +{ + +template< typename T > using List = std::list< T, Aws::Allocator< T > >; + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSMap.h b/include/aws/core/utils/memory/stl/AWSMap.h new file mode 100644 index 0000000000000000000000000000000000000000..b3809990f93acba58887484a8e693a80a779782a --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSMap.h @@ -0,0 +1,54 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include +#include +#include +#include + +namespace Aws +{ + +template< typename K, typename V > using Map = std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > >; +template< typename K, typename V > using UnorderedMap = std::unordered_map< K, V, std::hash< K >, std::equal_to< K >, Aws::Allocator< std::pair< const K, V > > >; +template< typename K, typename V > using MultiMap = std::multimap< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > >; + +struct CompareStrings +{ + bool operator()(const char* a, const char* b) const + { + return std::strcmp(a, b) < 0; + } +}; + +template using CStringMap = std::map > >; + +template +void TransformAndInsert(const Aws::UnorderedMap &src, + Aws::Map &dst, + std::function mappingFunc) +{ + for (const auto& srcPair: src) + { + dst.emplace(srcPair.first, mappingFunc(srcPair.second)); + } +} + +template +V GetWithDefault(const Aws::Map &map, const K &key, V &&defaultValue) { + typename Aws::Map::const_iterator it = map.find(key); + if ( it == map.end() ) { + return std::forward(defaultValue); + } + return it->second; +} + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSMultiMap.h b/include/aws/core/utils/memory/stl/AWSMultiMap.h new file mode 100644 index 0000000000000000000000000000000000000000..169738237b5069005881d9db9b5a34daec220513 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSMultiMap.h @@ -0,0 +1,19 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include + +namespace Aws +{ + +template< typename K, typename V > using MultiMap = std::multimap< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > >; + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSQueue.h b/include/aws/core/utils/memory/stl/AWSQueue.h new file mode 100644 index 0000000000000000000000000000000000000000..d45b245ad03dd8109bdb5bc7895e3b4f92a5d4a2 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSQueue.h @@ -0,0 +1,21 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +#include +#include + +namespace Aws +{ + +template< typename T > using Queue = std::queue< T, Deque< T > >; + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSSet.h b/include/aws/core/utils/memory/stl/AWSSet.h new file mode 100644 index 0000000000000000000000000000000000000000..e3ee9a0c6d7658e5df369cb154b8226b4abac82d --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSSet.h @@ -0,0 +1,21 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include +#include + +namespace Aws +{ + +template< typename T > using Set = std::set< T, std::less< T >, Aws::Allocator< T > >; +template< typename T > using UnorderedSet = std::unordered_set< T, std::hash< T >, std::equal_to< T >, Aws::Allocator< T > >; + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSStack.h b/include/aws/core/utils/memory/stl/AWSStack.h new file mode 100644 index 0000000000000000000000000000000000000000..7a3f561244332c6f0d9b4d9ec22055a1c599a3f3 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSStack.h @@ -0,0 +1,21 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +#include +#include + +namespace Aws +{ + +template< typename T > using Stack = std::stack< T, Deque< T > >; + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSStreamFwd.h b/include/aws/core/utils/memory/stl/AWSStreamFwd.h new file mode 100644 index 0000000000000000000000000000000000000000..335346a31b1fba45b88e1d3b93709d7ec761b007 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSStreamFwd.h @@ -0,0 +1,28 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + +// Serves no purpose other than to help my conversion process +typedef std::basic_ifstream< char, std::char_traits< char > > IFStream; +typedef std::basic_ofstream< char, std::char_traits< char > > OFStream; +typedef std::basic_fstream< char, std::char_traits< char > > FStream; +typedef std::basic_istream< char, std::char_traits< char > > IStream; +typedef std::basic_ostream< char, std::char_traits< char > > OStream; +typedef std::basic_iostream< char, std::char_traits< char > > IOStream; +typedef std::istreambuf_iterator< char, std::char_traits< char > > IStreamBufIterator; + +using IOStreamFactory = std::function< Aws::IOStream*(void) >; + + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSString.h b/include/aws/core/utils/memory/stl/AWSString.h new file mode 100644 index 0000000000000000000000000000000000000000..8b6b691b84894b1a9812b0dda65d54b60a4fcb40 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSString.h @@ -0,0 +1,121 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include +#include + +namespace Aws +{ + +#if defined(_GLIBCXX_FULLY_DYNAMIC_STRING) && _GLIBCXX_FULLY_DYNAMIC_STRING == 0 && defined(__ANDROID__) + +/* +using std::string with shared libraries is broken on android when using gnustl +due to the platform-level decision to set _GLIBCXX_FULLY_DYNAMIC_STRING to 0 + +The problem: + +(1) _GLIBCXX_FULLY_DYNAMIC_STRING is set to 0 in Android's c++config.h for gnustl +(2) The optimization that this enables is completely broken if using shared libraries and there is no way to opt out of using it. + An optimization that uses a comparison to a static memory address is death for shared libraries. + +Supposing you have a shared library B that depends on another shared library A. There are a variety of innocuous scenarios where you end up crashing +in the std::basic_string destructor because it's attempting to free a static memory address (&std::string::_Rep_Base::_S_empty_rep_storage -- you'll need to temporarily +flip the struct to "public:" in order to take this address from your code). +If you take the address of this location, you will get two +different answers depending on whether you query it in library A or library B (oddly enough, if you look the symbol itself up, it only shows up as public weak in +libgnustl_shared.so). When the string destructor is run from the context of library B, the _Rep::_M_dispose function will end up attempting to free +an address that is static memory (from library A). + + +Lessons (with the empty string optimization forced on you): + (1) You can't move std::strings across shared libraries (as a part of another class, Outcome in our case) + (2) If you default initialize a std::string member variable, you can't have a mismatched constructor/destructor pair such that one is in a cpp file and the other + is missing/implicit or defined in the header file + +Solutions: + +Use libc++ rather than gnustl + +For those who must use gnustl, we have provided a working solution by cobbling together a set of hacks: + +We prevent the empty string optimization from ever being run on our strings by: + (1) Make Aws::Allocator always fail equality checks with itself; this check is part of the empty string optimization in several std::basic_string constructors + (2) All other cases are prevented by turning Aws::String into a subclass whose default constructor and move operations go to baseclass versions which will not + perform the empty string optimization + +Those changes prevent crashes, but lead to very poor performance when using a string stream; every character added will result in multiple copies of the entire +string (ie, quadratic). + +To fix the performance problems, we have put together a set of replacement classes, SimpleStreamBuf and SimpleStringStream, that +replace std::stringstream and std::stringbuf in SDK code. These replacements use raw buffers rather than strings in order to +avoid the performance issues. + +This solution is only enabled if using gnustl on Android. In all other situations, normal STL types are used. +*/ + +using AndroidBasicString = std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > >; + +class String : public AndroidBasicString +{ + public: + using Base = AndroidBasicString; + + String() : Base("") {} // allocator comparison failure will cause empty string optimisation to be skipped + String(const String& rhs ) : Base(rhs) {} + String(String&& rhs) : Base(rhs) {} // DO NOT CALL std::move, let this go to the const ref constructor + String(const AndroidBasicString& rhs) : Base(rhs) {} + String(AndroidBasicString&& rhs) : Base(rhs) {} // DO NOT CALL std::move, let this go to the const ref constructor + String(const char* str) : Base(str) {} + String(const char* str_begin, const char* str_end) : Base(str_begin, str_end) {} + String(const AndroidBasicString& str, size_type pos, size_type count) : Base(str, pos, count) {} + String(const String& str, size_type pos, size_type count) : Base(str, pos, count) {} + String(const char* str, size_type count) : Base(str, count) {} + String(size_type count, char c) : Base(count, c) {} + String(std::initializer_list __l) : Base(__l) {} + + template + String(_InputIterator __beg, _InputIterator __end) : Base(__beg, __end) {} + + String& operator=(const String& rhs) { Base::operator=(rhs); return *this; } + String& operator=(String&& rhs) { Base::operator=(rhs); return *this; } // might be ok to use std::move (base class uses swap) but let's be safe + String& operator=(const AndroidBasicString& rhs) { Base::operator=(rhs); return *this; } + String& operator=(AndroidBasicString&& rhs) { Base::operator=(rhs); return *this; } // might be ok to use std::move (base class uses swap) but let's be safe + String& operator=(const char* str) { Base::operator=(str); return *this; } +}; + +#else + +using String = std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > >; + +#ifdef _WIN32 +using WString = std::basic_string< wchar_t, std::char_traits< wchar_t >, Aws::Allocator< wchar_t > >; +#endif + +#endif // __ANDROID + +} // namespace Aws + +#ifdef USE_AWS_MEMORY_MANAGEMENT +#include + +/* Inject hash method for an Aws::String with a custom allocator to workaround original C++ defect: + * "hash support for std::basic_string with customized allocators was not enabled" + * see LWG 3705: https://en.cppreference.com/w/cpp/string/basic_string/hash */ +namespace std +{ + template<> + struct hash + { + size_t operator()(const Aws::String& t) const { return Aws::Crt::HashString(t.c_str()); } + }; +} +#endif diff --git a/include/aws/core/utils/memory/stl/AWSStringStream.h b/include/aws/core/utils/memory/stl/AWSStringStream.h new file mode 100644 index 0000000000000000000000000000000000000000..a5e6f4ae485ee79df9ef41c6689141f113c2eecd --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSStringStream.h @@ -0,0 +1,42 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#if defined(_GLIBCXX_FULLY_DYNAMIC_STRING) && _GLIBCXX_FULLY_DYNAMIC_STRING == 0 && defined(__ANDROID__) + +#include + +#else + +#include + +#include + +#endif + +namespace Aws +{ + +#if defined(_GLIBCXX_FULLY_DYNAMIC_STRING) && _GLIBCXX_FULLY_DYNAMIC_STRING == 0 && defined(__ANDROID__) + +// see the large comment block in AWSString.h for an explanation +typedef Aws::SimpleStringStream StringStream; +typedef Aws::SimpleIStringStream IStringStream; +typedef Aws::SimpleOStringStream OStringStream; +typedef Aws::Utils::Stream::SimpleStreamBuf StringBuf; + +#else + +typedef std::basic_stringstream< char, std::char_traits< char >, Aws::Allocator< char > > StringStream; +typedef std::basic_istringstream< char, std::char_traits< char >, Aws::Allocator< char > > IStringStream; +typedef std::basic_ostringstream< char, std::char_traits< char >, Aws::Allocator< char > > OStringStream; +typedef std::basic_stringbuf< char, std::char_traits< char >, Aws::Allocator< char > > StringBuf; + +#endif + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/AWSVector.h b/include/aws/core/utils/memory/stl/AWSVector.h new file mode 100644 index 0000000000000000000000000000000000000000..d9f67825c771f3cfc3db86f6843bd88095cc7898 --- /dev/null +++ b/include/aws/core/utils/memory/stl/AWSVector.h @@ -0,0 +1,19 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include + +namespace Aws +{ + +template< typename T > using Vector = std::vector< T, Aws::Allocator< T > >; + +} // namespace Aws diff --git a/include/aws/core/utils/memory/stl/SimpleStringStream.h b/include/aws/core/utils/memory/stl/SimpleStringStream.h new file mode 100644 index 0000000000000000000000000000000000000000..45c4d0a448d741f6dc2b905ab1c0ea111bea85a5 --- /dev/null +++ b/include/aws/core/utils/memory/stl/SimpleStringStream.h @@ -0,0 +1,126 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include + +namespace Aws +{ + +class AWS_CORE_API SimpleStringStream : public std::iostream +{ + public: + + using char_type = char; + using traits_type = std::char_traits; + using allocator_type = Aws::Allocator; + using int_type = int; + using pos_type = std::streampos; + using off_type = std::streamoff; + + using base = std::iostream; + + SimpleStringStream(); + SimpleStringStream(const Aws::String& value); + + virtual ~SimpleStringStream() {} + + // disabling copies of course + SimpleStringStream(const SimpleStringStream& rhs) = delete; + SimpleStringStream& operator=(const SimpleStringStream& rhs) = delete; + + // also disabling moves until there's a valid need + SimpleStringStream(SimpleStringStream&& rhs) = delete; + SimpleStringStream& operator=(SimpleStringStream&& rhs) = delete; + + Aws::Utils::Stream::SimpleStreamBuf* rdbuf() const { return const_cast(&m_streamBuffer); } + + Aws::String str() const { return m_streamBuffer.str(); } + void str(const Aws::String& value); + + private: + + Aws::Utils::Stream::SimpleStreamBuf m_streamBuffer; +}; + +class AWS_CORE_API SimpleIStringStream : public std::istream +{ + public: + + using char_type = char; + using traits_type = std::char_traits; + using allocator_type = Aws::Allocator; + using int_type = int; + using pos_type = std::streampos; + using off_type = std::streamoff; + + using base = std::istream; + + SimpleIStringStream(); + SimpleIStringStream(const Aws::String& value); + + virtual ~SimpleIStringStream() {} + + // disabling copies of course + SimpleIStringStream(const SimpleIStringStream& rhs) = delete; + SimpleIStringStream& operator=(const SimpleIStringStream& rhs) = delete; + + // also disabling moves until there's a valid need + SimpleIStringStream(SimpleIStringStream&& rhs) = delete; + SimpleIStringStream& operator=(SimpleIStringStream&& rhs) = delete; + + Aws::Utils::Stream::SimpleStreamBuf* rdbuf() const { return const_cast(&m_streamBuffer); } + + Aws::String str() const { return m_streamBuffer.str(); } + void str(const Aws::String& value); + + private: + + Aws::Utils::Stream::SimpleStreamBuf m_streamBuffer; +}; + +class AWS_CORE_API SimpleOStringStream : public std::ostream +{ + public: + + using char_type = char; + using traits_type = std::char_traits; + using allocator_type = Aws::Allocator; + using int_type = int; + using pos_type = std::streampos; + using off_type = std::streamoff; + + using base = std::ostream; + + SimpleOStringStream(); + SimpleOStringStream(const Aws::String& value); + + virtual ~SimpleOStringStream() {} + + // disabling copies of course + SimpleOStringStream(const SimpleOStringStream& rhs) = delete; + SimpleOStringStream& operator=(const SimpleOStringStream& rhs) = delete; + + // also disabling moves until there's a valid need + SimpleOStringStream(SimpleOStringStream&& rhs) = delete; + SimpleOStringStream& operator=(SimpleOStringStream&& rhs) = delete; + + Aws::Utils::Stream::SimpleStreamBuf* rdbuf() const { return const_cast(&m_streamBuffer); } + + Aws::String str() const { return m_streamBuffer.str(); } + void str(const Aws::String& value); + + private: + + Aws::Utils::Stream::SimpleStreamBuf m_streamBuffer; +}; + +} // namespace Aws + diff --git a/include/aws/core/utils/ratelimiter/DefaultRateLimiter.h b/include/aws/core/utils/ratelimiter/DefaultRateLimiter.h new file mode 100644 index 0000000000000000000000000000000000000000..974dbefb0218502d0e1ce1ed942f72fb5eeb6143 --- /dev/null +++ b/include/aws/core/utils/ratelimiter/DefaultRateLimiter.h @@ -0,0 +1,205 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace RateLimits + { + /** + * High precision rate limiter. If you need to limit your bandwidth by a budget, this is very likely the implementation you want. + */ + template + class DefaultRateLimiter : public RateLimiterInterface + { + public: + using Base = RateLimiterInterface; + + using InternalTimePointType = std::chrono::time_point; + using ElapsedTimeFunctionType = std::function< InternalTimePointType() >; + + /** + * Initializes state, starts counts, does some basic validation. + */ + DefaultRateLimiter(int64_t maxRate, ElapsedTimeFunctionType elapsedTimeFunction = CLOCK::now) : + m_elapsedTimeFunction(elapsedTimeFunction), + m_maxRate(0), + m_accumulatorLock(), + m_accumulator(0), + m_accumulatorFraction(0), + m_accumulatorUpdated(), + m_replenishNumerator(0), + m_replenishDenominator(0), + m_delayNumerator(0), + m_delayDenominator(0) + { + // verify we're not going to divide by zero due to goofy type parameterization + static_assert(DUR::period::num > 0, "Rate duration must have positive numerator"); + static_assert(DUR::period::den > 0, "Rate duration must have positive denominator"); + static_assert(CLOCK::duration::period::num > 0, "RateLimiter clock duration must have positive numerator"); + static_assert(CLOCK::duration::period::den > 0, "RateLimiter clock duration must have positive denominator"); + + DefaultRateLimiter::SetRate(maxRate, true); + } + + virtual ~DefaultRateLimiter() = default; + + /** + * Calculates time in milliseconds that should be delayed before letting anymore data through. + */ + virtual DelayType ApplyCost(int64_t cost) override + { + std::lock_guard lock(m_accumulatorLock); + + auto now = m_elapsedTimeFunction(); + auto elapsedTime = (now - m_accumulatorUpdated).count(); + + // replenish the accumulator based on how much time has passed + auto temp = elapsedTime * m_replenishNumerator + m_accumulatorFraction; + m_accumulator += temp / m_replenishDenominator; + m_accumulatorFraction = temp % m_replenishDenominator; + + // the accumulator is capped based on the maximum rate + m_accumulator = (std::min)(m_accumulator, m_maxRate); + if (m_accumulator == m_maxRate) + { + m_accumulatorFraction = 0; + } + + // if the accumulator is still negative, then we'll have to wait + DelayType delay(0); + if (m_accumulator < 0) + { + delay = DelayType(-m_accumulator * m_delayDenominator / m_delayNumerator); + } + + // apply the cost to the accumulator after the delay has been calculated; the next call will end up paying for our cost + m_accumulator -= cost; + m_accumulatorUpdated = now; + + return delay; + } + + /** + * Same as ApplyCost() but then goes ahead and sleeps the current thread. + */ + virtual void ApplyAndPayForCost(int64_t cost) override + { + auto costInMilliseconds = ApplyCost(cost); + if(costInMilliseconds.count() > 0) + { + std::this_thread::sleep_for(costInMilliseconds); + } + } + + /** + * Update the bandwidth rate to allow. + */ + virtual void SetRate(int64_t rate, bool resetAccumulator = false) override + { + std::lock_guard lock(m_accumulatorLock); + + // rate must always be positive + rate = (std::max)(static_cast(1), rate); + + if (resetAccumulator) + { + m_accumulator = rate; + m_accumulatorFraction = 0; + m_accumulatorUpdated = m_elapsedTimeFunction(); + } + else + { + // sync the accumulator to current time + ApplyCost(0); // this call is why we need a recursive mutex + + if (ShouldRenormalizeAccumulatorOnRateChange()) + { + // now renormalize the accumulator and its fractional part against the new rate + // the idea here is we want to preserve the desired wait based on the previous rate + // + // As an example: + // Say we had a rate of 100/s and our accumulator was -500 (ie the next ApplyCost would incur a 5 second delay) + // If we change the rate to 1000/s and want to preserve that delay, we need to scale the accumulator to -5000 + m_accumulator = m_accumulator * rate / m_maxRate; + m_accumulatorFraction = m_accumulatorFraction * rate / m_maxRate; + } + } + + m_maxRate = rate; + + // Helper constants that represent the amount replenished per CLOCK time period; use the gcd to reduce them in order to try and minimize the chance of integer overflow + m_replenishNumerator = m_maxRate * DUR::period::den * CLOCK::duration::period::num; + m_replenishDenominator = DUR::period::num * CLOCK::duration::period::den; + auto gcd = ComputeGCD(m_replenishNumerator, m_replenishDenominator); + m_replenishNumerator /= gcd; + m_replenishDenominator /= gcd; + + // Helper constants that represent the delay per unit of costAccumulator; use the gcd to reduce them in order to try and minimize the chance of integer overflow + m_delayNumerator = m_maxRate * DelayType::period::num * DUR::period::den; + m_delayDenominator = DelayType::period::den * DUR::period::num; + gcd = ComputeGCD(m_delayNumerator, m_delayDenominator); + m_delayNumerator /= gcd; + m_delayDenominator /= gcd; + } + + private: + + int64_t ComputeGCD(int64_t num1, int64_t num2) const + { + // Euclid's + while (num2 != 0) + { + int64_t rem = num1 % num2; + num1 = num2; + num2 = rem; + } + + return num1; + } + + bool ShouldRenormalizeAccumulatorOnRateChange() const { return RENORMALIZE_RATE_CHANGES; } + + /// Function that returns the current time + ElapsedTimeFunctionType m_elapsedTimeFunction; + + /// The rate we want to limit to + int64_t m_maxRate; + + /// We need to pretty much lock everything while either setting the rate or applying a cost + std::recursive_mutex m_accumulatorLock; + + /// Tracks how much "rate" we currently have to give; if this drops below zero then we start having to wait in order to perform operations and maintain the rate + /// Replenishes over time based on m_maxRate + int64_t m_accumulator; + + /// Updates can occur at any time, leading to a fractional accumulation; represents the fraction (m_accumulatorFraction / m_replenishDenominator) + int64_t m_accumulatorFraction; + + /// Last time point the accumulator was updated + InternalTimePointType m_accumulatorUpdated; + + /// Some helper constants that represents fixed (per m_maxRate) ratios used in the delay and replenishment calculations + int64_t m_replenishNumerator; + int64_t m_replenishDenominator; + int64_t m_delayNumerator; + int64_t m_delayDenominator; + }; + + } // namespace RateLimits + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/ratelimiter/RateLimiterInterface.h b/include/aws/core/utils/ratelimiter/RateLimiterInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..578c9ed8446c692cd969ce474c8cc804c80c0540 --- /dev/null +++ b/include/aws/core/utils/ratelimiter/RateLimiterInterface.h @@ -0,0 +1,45 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace RateLimits + { + /** + * Interface for bandwidth limiters. You likely don't want to implement your own as DefaultRateLimiter is probably what you need. + * If you need to implement one, then this is the interface to implement. + */ + class RateLimiterInterface + { + public: + using DelayType = std::chrono::milliseconds; + + virtual ~RateLimiterInterface() {} + /** + * Calculates time in milliseconds that should be delayed before letting anymore data through. + */ + virtual DelayType ApplyCost(int64_t cost) = 0; + /** + * Same as ApplyCost() but then goes ahead and sleeps the current thread. + */ + virtual void ApplyAndPayForCost(int64_t cost) = 0; + /** + * Update the bandwidth rate to allow. + */ + virtual void SetRate(int64_t rate, bool resetAccumulator = false) = 0; + }; + + } // namespace RateLimits + } // namespace Utils +} // namespace Aws \ No newline at end of file diff --git a/include/aws/core/utils/stream/AwsChunkedStream.h b/include/aws/core/utils/stream/AwsChunkedStream.h new file mode 100644 index 0000000000000000000000000000000000000000..af12d2572faa681d452a11bdbdf42422e5773613 --- /dev/null +++ b/include/aws/core/utils/stream/AwsChunkedStream.h @@ -0,0 +1,97 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include + +namespace Aws { +namespace Utils { +namespace Stream { + +static const size_t AWS_DATA_BUFFER_SIZE = 65536; + +template +class AwsChunkedStream { + public: + AwsChunkedStream(Http::HttpRequest *request, const std::shared_ptr &stream) + : m_chunkingStream{Aws::MakeShared("AwsChunkedStream")}, m_request(request), m_stream(stream) { + assert(m_stream != nullptr); + if (m_stream == nullptr) { + AWS_LOGSTREAM_ERROR("AwsChunkedStream", "stream is null"); + } + assert(request != nullptr); + if (request == nullptr) { + AWS_LOGSTREAM_ERROR("AwsChunkedStream", "request is null"); + } + } + + size_t BufferedRead(char *dst, size_t amountToRead) { + assert(dst != nullptr); + + // only read and write to chunked stream if the underlying stream + // is still in a valid state + if (m_stream->good()) { + // Try to read in a 64K chunk, if we cant we know the stream is over + m_stream->read(m_data.GetUnderlyingData(), DataBufferSize); + size_t bytesRead = static_cast(m_stream->gcount()); + writeChunk(bytesRead); + + // if we've read everything from the stream, we want to add the trailer + // to the underlying stream + if ((m_stream->peek() == EOF || m_stream->eof()) && !m_stream->bad()) { + writeTrailerToUnderlyingStream(); + } + } + + // if the underlying stream is empty there is nothing to read + if ((m_chunkingStream->peek() == EOF || m_chunkingStream->eof()) && !m_chunkingStream->bad()) { + return 0; + } + + // Read to destination buffer, return how much was read + m_chunkingStream->read(dst, amountToRead); + return static_cast(m_chunkingStream->gcount()); + } + + private: + void writeTrailerToUnderlyingStream() { + Aws::StringStream chunkedTrailerStream; + chunkedTrailerStream << "0\r\n"; + if (m_request->GetRequestHash().second != nullptr) { + chunkedTrailerStream << "x-amz-checksum-" << m_request->GetRequestHash().first << ":" + << HashingUtils::Base64Encode(m_request->GetRequestHash().second->GetHash().GetResult()) << "\r\n"; + } + chunkedTrailerStream << "\r\n"; + const auto chunkedTrailer = chunkedTrailerStream.str(); + if (m_chunkingStream->eof()) { + m_chunkingStream->clear(); + } + *m_chunkingStream << chunkedTrailer; + } + + void writeChunk(size_t bytesRead) { + if (m_request->GetRequestHash().second != nullptr) { + m_request->GetRequestHash().second->Update(reinterpret_cast(m_data.GetUnderlyingData()), bytesRead); + } + + if (bytesRead > 0 && m_chunkingStream != nullptr && !m_chunkingStream->bad()) { + if (m_chunkingStream->eof()) { + m_chunkingStream->clear(); + } + *m_chunkingStream << Aws::Utils::StringUtils::ToHexString(bytesRead) << "\r\n"; + m_chunkingStream->write(m_data.GetUnderlyingData(), bytesRead); + *m_chunkingStream << "\r\n"; + } + } + + Aws::Utils::Array m_data{DataBufferSize}; + std::shared_ptr m_chunkingStream; + Http::HttpRequest *m_request{nullptr}; + std::shared_ptr m_stream; +}; +} // namespace Stream +} // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/stream/ConcurrentStreamBuf.h b/include/aws/core/utils/stream/ConcurrentStreamBuf.h new file mode 100644 index 0000000000000000000000000000000000000000..307178becc82dee385503bc0fe515630e8e5162b --- /dev/null +++ b/include/aws/core/utils/stream/ConcurrentStreamBuf.h @@ -0,0 +1,68 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Stream + { + /** + * A thread-safe streambuf implementation that allows simultaneous reading and writing. + * NOTE: iostreams maintain state for readers and writers. This means that you can have at most two + * concurrent threads, one for reading and one for writing. Multiple readers or multiple writers are not + * thread-safe and will result in race-conditions. + */ + class AWS_CORE_API ConcurrentStreamBuf : public std::streambuf + { + public: + + explicit ConcurrentStreamBuf(size_t bufferLength = 8 * 1024); + + void SetEofInput(Aws::IOStream* pStreamToClose = nullptr); + void CloseStream(); + + /** + * Blocks the current thread until all submitted data is consumed. + * Returns false on timeout, and true if GetArea and back buffer are empty. + */ + bool WaitForDrain(int64_t timeoutMs); + + protected: + std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + + int underflow() override; + int uflow() override; + int overflow(int ch) override; + int sync() override; + std::streamsize showmanyc() override; + + void FlushPutArea(); + + private: + Aws::Vector m_getArea; + Aws::Vector m_putArea; + Aws::Vector m_backbuf; // used to shuttle data from the put area to the get area + std::mutex m_lock; // synchronize access to the common backbuffer + std::condition_variable m_signal; + bool m_eofInput = false; + bool m_eofOutput = false; + Aws::IOStream* m_pStreamToClose = nullptr; + }; + } + } +} diff --git a/include/aws/core/utils/stream/PreallocatedStreamBuf.h b/include/aws/core/utils/stream/PreallocatedStreamBuf.h new file mode 100644 index 0000000000000000000000000000000000000000..ad9dc2a929b0acb769d440884dfafe80a629e619 --- /dev/null +++ b/include/aws/core/utils/stream/PreallocatedStreamBuf.h @@ -0,0 +1,56 @@ + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Stream + { + /** + * this is a stream buf to use with std::iostream that uses a preallocated buffer under the hood. + */ + class AWS_CORE_API PreallocatedStreamBuf : public std::streambuf + { + public: + /** + * Initialize the stream buffer with a pointer to your buffer. This class never takes ownership + * of the buffer. It is your responsibility to delete it once the stream is no longer in use. + * @param buffer buffer to initialize from. + * @param lengthToRead length in bytes to actually use in the buffer (e.g. you have a 1kb buffer, but only want the stream + * to see 500 b of it. + */ + PreallocatedStreamBuf(unsigned char* buffer, uint64_t lengthToRead); + + PreallocatedStreamBuf(const PreallocatedStreamBuf&) = delete; + PreallocatedStreamBuf& operator=(const PreallocatedStreamBuf&) = delete; + + PreallocatedStreamBuf(PreallocatedStreamBuf&& toMove) = delete; + PreallocatedStreamBuf& operator=(PreallocatedStreamBuf&&) = delete; + + /** + * Get the buffer that is being used by the stream buffer. + * @return Pointer to the underlying buffer (probably for a Aws::Delete() call). + */ + unsigned char* GetBuffer() { return m_underlyingBuffer; } + + protected: + pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + + private: + unsigned char* m_underlyingBuffer; + const uint64_t m_lengthToRead; + }; + } + } +} diff --git a/include/aws/core/utils/stream/ResponseStream.h b/include/aws/core/utils/stream/ResponseStream.h new file mode 100644 index 0000000000000000000000000000000000000000..b4488a7636f405978d913a01616ef0a0c5a615d3 --- /dev/null +++ b/include/aws/core/utils/stream/ResponseStream.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Stream + { + /** + * Encapsulates and manages ownership of custom response streams. This is a move only type. + */ + class AWS_CORE_API ResponseStream + { + public: + /** + * sets underlying stream to nullptr + */ + ResponseStream(); + /** + * moves the underlying stream + */ + ResponseStream(ResponseStream&&); + /** + * Uses factory to allocate underlying stream + */ + ResponseStream(const Aws::IOStreamFactory& factory); + /** + * Takes ownership of an underlying stream. + */ + ResponseStream(IOStream* underlyingStreamToManage); + ResponseStream(const ResponseStream&) = delete; + ~ResponseStream(); + + /** + * moves the underlying stream + */ + ResponseStream& operator=(ResponseStream&&); + ResponseStream& operator=(const ResponseStream&) = delete; + + /** + * Gives access to underlying stream, but keep in mind that this changes state of the stream + */ + Aws::IOStream& GetUnderlyingStream() const; + + private: + void ReleaseStream(); + void RegisterStream(); + void DeregisterStream(); + + Aws::IOStream* m_underlyingStream = nullptr; + + static const int xindex; + static void StreamCallback(Aws::IOStream::event evt, std::ios_base& str, int idx); + }; + + /** + * A default IOStream for ResponseStream. + */ + class AWS_CORE_API DefaultUnderlyingStream : public Aws::IOStream + { + public: + using Base = Aws::IOStream; + + DefaultUnderlyingStream(); + DefaultUnderlyingStream(Aws::UniquePtr buf); + virtual ~DefaultUnderlyingStream(); + }; + + AWS_CORE_API Aws::IOStream* DefaultResponseStreamFactoryMethod(); + + } //namespace Stream + } //namespace Utils +} //namespace Aws diff --git a/include/aws/core/utils/stream/SimpleStreamBuf.h b/include/aws/core/utils/stream/SimpleStreamBuf.h new file mode 100644 index 0000000000000000000000000000000000000000..ef12c60ba390825184d7b6b0bcb634856f2f44fd --- /dev/null +++ b/include/aws/core/utils/stream/SimpleStreamBuf.h @@ -0,0 +1,64 @@ + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Stream +{ + /** + * A replacement for std::stringbuf when using Android and gnustl together + */ + class AWS_CORE_API SimpleStreamBuf : public std::streambuf + { + public: + + using base = std::streambuf; + + SimpleStreamBuf(); + explicit SimpleStreamBuf(const Aws::String& value); + + SimpleStreamBuf(const SimpleStreamBuf&) = delete; + SimpleStreamBuf& operator=(const SimpleStreamBuf&) = delete; + + SimpleStreamBuf(SimpleStreamBuf&& toMove) = delete; + SimpleStreamBuf& operator=(SimpleStreamBuf&&) = delete; + + virtual ~SimpleStreamBuf(); + + Aws::String str() const; + void str(const Aws::String& value); + + void swap(SimpleStreamBuf& rhs); + + protected: + virtual std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + virtual std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + + virtual int overflow (int c = EOF) override; + virtual int underflow() override; + + virtual std::streamsize xsputn(const char* s, std::streamsize n) override; + + private: + + bool GrowBuffer(); + + char* m_buffer; + size_t m_bufferSize; + }; + +} +} +} diff --git a/include/aws/core/utils/stream/StreamBufProtectedWriter.h b/include/aws/core/utils/stream/StreamBufProtectedWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..d4d8c3d9f3fdb1d9b33a0e8606672ba414e3447a --- /dev/null +++ b/include/aws/core/utils/stream/StreamBufProtectedWriter.h @@ -0,0 +1,120 @@ + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Stream + { + /** + * This is a wrapper to perform a hack to write directly to the put area of the underlying streambuf + */ + class AWS_CORE_API StreamBufProtectedWriter : public std::streambuf + { + public: + StreamBufProtectedWriter() = delete; + + using WriterFunc = std::function; + + static uint64_t WriteToBuffer(Aws::IOStream& ioStream, const WriterFunc& writerFunc) + { + uint64_t totalRead = 0; + + while (true) + { + StreamBufProtectedWriter* pBufferCasted = static_cast(ioStream.rdbuf()); + bool bufferPresent = pBufferCasted && pBufferCasted->pptr() && (pBufferCasted->pptr() < pBufferCasted->epptr()); + uint64_t read = 0; + bool success = false; + if (bufferPresent) + { + // have access to underlying put ptr. + success = WriteDirectlyToPtr(pBufferCasted, writerFunc, read); + } + else + { + // can't access underlying buffer, stream buffer maybe be customized to not use put ptr. + // or underlying put buffer is simply not initialized yet. + success = WriteWithHelperBuffer(ioStream, writerFunc, read); + } + totalRead += read; + if (!success) + { + break; + } + + if (pBufferCasted && pBufferCasted->pptr() && (pBufferCasted->pptr() >= pBufferCasted->epptr())) + { + if(!ForceOverflow(ioStream, writerFunc)) + { + break; + } else { + totalRead++; + } + } + } + return totalRead; + } + protected: + static bool ForceOverflow(Aws::IOStream& ioStream, const WriterFunc& writerFunc) + { + char dstChar; + uint64_t read = 0; + if (writerFunc(&dstChar, 1, read) && read > 0) + { + ioStream.write(&dstChar, 1); + if (ioStream.fail()) { + AWS_LOGSTREAM_ERROR("StreamBufProtectedWriter", "Failed to write 1 byte (eof: " + << ioStream.eof() << ", bad: " << ioStream.bad() << ")"); + return false; + } + return true; + } + return false; + } + + static uint64_t WriteWithHelperBuffer(Aws::IOStream& ioStream, const WriterFunc& writerFunc, uint64_t& read) + { + char tmpBuf[1024]; + uint64_t tmpBufSz = sizeof(tmpBuf); + + if(writerFunc(tmpBuf, tmpBufSz, read) && read > 0) + { + ioStream.write(tmpBuf, read); + if (ioStream.fail()) { + AWS_LOGSTREAM_ERROR("StreamBufProtectedWriter", "Failed to write " << tmpBufSz + << " (eof: " << ioStream.eof() << ", bad: " << ioStream.bad() << ")"); + return false; + } + return true; + } + return false; + } + + static uint64_t WriteDirectlyToPtr(StreamBufProtectedWriter* pBuffer, const WriterFunc& writerFunc, uint64_t& read) + { + auto dstBegin = pBuffer->pptr(); + uint64_t dstSz = pBuffer->epptr() - dstBegin; + if(writerFunc(dstBegin, dstSz, read) && read > 0) + { + assert(read <= dstSz); + pBuffer->pbump((int) read); + return true; + } + return false; + } + }; + } + } +} diff --git a/include/aws/core/utils/threading/DefaultExecutor.h b/include/aws/core/utils/threading/DefaultExecutor.h new file mode 100644 index 0000000000000000000000000000000000000000..cdf3c4db6f52487ec2d50789b798d096f859bde0 --- /dev/null +++ b/include/aws/core/utils/threading/DefaultExecutor.h @@ -0,0 +1,44 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +#include + +namespace Aws { +namespace Utils { +namespace Threading { +/** + * Default Executor implementation. Simply spawns a thread and detaches it. + */ +class AWS_CORE_API DefaultExecutor : public Executor { + // API contract + public: + DefaultExecutor(); + DefaultExecutor(const DefaultExecutor& other); + DefaultExecutor& operator=(const DefaultExecutor&); + DefaultExecutor(DefaultExecutor&& other) = default; + DefaultExecutor& operator=(DefaultExecutor&&) = default; + + virtual ~DefaultExecutor(); + + void WaitUntilStopped() override; + + protected: + bool SubmitToThread(std::function&&) override; + + // implementation details + public: + struct impl; + + private: + std::shared_ptr pImpl; +}; +} // namespace Threading +} // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/threading/Executor.h b/include/aws/core/utils/threading/Executor.h new file mode 100644 index 0000000000000000000000000000000000000000..ac93ce76322742d3547ff4cefe269f26456ce6fc --- /dev/null +++ b/include/aws/core/utils/threading/Executor.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#if !defined(AWS_EXECUTOR_H) +#define AWS_EXECUTOR_H + +#include + +#include + +namespace Aws +{ + namespace Utils + { + namespace Threading + { + /** + * Interface for implementing an Executor, to implement a custom thread execution strategy, inherit from this class + * and override SubmitToThread(). + */ + class AWS_CORE_API Executor + { + public: + virtual ~Executor() = default; + + /** + * Send function and its arguments to the SubmitToThread function. + */ + template + bool Submit(Fn&& fn, Args&& ... args) + { + std::function callable{ std::bind(std::forward(fn), std::forward(args)...) }; + return SubmitToThread(std::move(callable)); + } + + /* explicit _overload_ of the template function above to avoid template bloat */ + bool Submit(std::function&& callable) + { + return SubmitToThread(std::move(callable)); + } + + /** + * Call to wait until all tasks have finished. + */ + virtual void WaitUntilStopped() { return; }; + + protected: + /** + * To implement your own executor implementation, then simply subclass Executor and implement this method. + */ + virtual bool SubmitToThread(std::function&&) = 0; + }; + } // namespace Threading + } // namespace Utils +} // namespace Aws + +// TODO: remove on a next minor API bump from 1.11.x +#endif // !defined(AWS_EXECUTOR_H) +#include +#include \ No newline at end of file diff --git a/include/aws/core/utils/threading/PooledThreadExecutor.h b/include/aws/core/utils/threading/PooledThreadExecutor.h new file mode 100644 index 0000000000000000000000000000000000000000..88bfed20bfaa652ccaf07b1d418b91d7bd949c6a --- /dev/null +++ b/include/aws/core/utils/threading/PooledThreadExecutor.h @@ -0,0 +1,76 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Threading + { + class ThreadTask; + + enum class OverflowPolicy + { + QUEUE_TASKS_EVENLY_ACROSS_THREADS, + REJECT_IMMEDIATELY + }; + + /** + * Thread Pool Executor implementation. + */ + class AWS_CORE_API PooledThreadExecutor : public Executor + { + public: + PooledThreadExecutor(size_t poolSize, OverflowPolicy overflowPolicy = OverflowPolicy::QUEUE_TASKS_EVENLY_ACROSS_THREADS); + ~PooledThreadExecutor(); + + /** + * Rule of 5 stuff. + * Don't copy or move + */ + PooledThreadExecutor(const PooledThreadExecutor&) = delete; + PooledThreadExecutor& operator =(const PooledThreadExecutor&) = delete; + PooledThreadExecutor(PooledThreadExecutor&&) = delete; + PooledThreadExecutor& operator =(PooledThreadExecutor&&) = delete; + + /** + * Call to ensure the threadpool can be safely destroyed. It blocks until all threads finished. + */ + void WaitUntilStopped() override; + + protected: + bool SubmitToThread(std::function&&) override; + + private: + Aws::Queue*> m_tasks; + mutable std::mutex m_queueLock; + Aws::Utils::Threading::Semaphore m_sync; + Aws::Vector m_threadTaskHandles; + size_t m_poolSize = 0; + OverflowPolicy m_overflowPolicy = OverflowPolicy::QUEUE_TASKS_EVENLY_ACROSS_THREADS; + bool m_stopped{false}; + + /** + * Once you call this, you are responsible for freeing the memory pointed to by task. + */ + std::function* PopTask(); + bool HasTasks() const; + + friend class ThreadTask; + }; + } // namespace Threading + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/threading/ReaderWriterLock.h b/include/aws/core/utils/threading/ReaderWriterLock.h new file mode 100644 index 0000000000000000000000000000000000000000..5d757dcecbfa359aa56b100eb34a86acfd18bda9 --- /dev/null +++ b/include/aws/core/utils/threading/ReaderWriterLock.h @@ -0,0 +1,116 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Threading + { + /** + * This lock is optimized for frequent reads and infrequent writes. + * However, writers get priority to the lock. + */ + class AWS_CORE_API ReaderWriterLock + { + public: + ReaderWriterLock(); + /** + * Enters the lock in Reader-mode. + * This call blocks until no writers are acquiring the lock. + */ + void LockReader(); + + /** + * Decrements the readers count by one and if the count is zero, signals any waiting writers to acquire + * the lock. + * NOTE: Calling this function without a matching LockReader results in undefined behavior. + */ + void UnlockReader(); + + /** + * Enters the lock in Writer-mode. + * This call blocks until no readers nor writers are acquiring the lock. + */ + void LockWriter(); + + /** + * Decrements the number of writers by one and signals any waiting readers or writers to acquire the + * lock. + * NOTE: Calling this function without a matching LockWriter results in undefined behavior. + */ + void UnlockWriter(); + private: + std::atomic m_readers; + std::atomic m_holdouts; + Semaphore m_readerSem; + Semaphore m_writerSem; + std::mutex m_writerLock; + }; + + class AWS_CORE_API ReaderLockGuard + { + public: + explicit ReaderLockGuard(ReaderWriterLock& rwl) : m_rwlock(rwl), m_upgraded(false) + { + m_rwlock.LockReader(); + } + + void UpgradeToWriterLock() + { + m_rwlock.UnlockReader(); + m_rwlock.LockWriter(); + m_upgraded = true; + } + + ~ReaderLockGuard() + { + if(m_upgraded) + { + m_rwlock.UnlockWriter(); + } + else + { + m_rwlock.UnlockReader(); + } + } + // for VS2013 + ReaderLockGuard(const ReaderLockGuard&) = delete; + ReaderLockGuard& operator=(const ReaderLockGuard&) = delete; + private: + ReaderWriterLock& m_rwlock; + bool m_upgraded; + }; + + class AWS_CORE_API WriterLockGuard + { + public: + explicit WriterLockGuard(ReaderWriterLock& rwl) : m_rwlock(rwl) + { + m_rwlock.LockWriter(); + } + + ~WriterLockGuard() + { + m_rwlock.UnlockWriter(); + } + // for VS2013 + WriterLockGuard(const WriterLockGuard&) = delete; + WriterLockGuard& operator=(const WriterLockGuard&) = delete; + private: + ReaderWriterLock& m_rwlock; + }; + } + } +} diff --git a/include/aws/core/utils/threading/SameThreadExecutor.h b/include/aws/core/utils/threading/SameThreadExecutor.h new file mode 100644 index 0000000000000000000000000000000000000000..b5b57e5d55c1e1fd7eb03e892c341a98adebc1b5 --- /dev/null +++ b/include/aws/core/utils/threading/SameThreadExecutor.h @@ -0,0 +1,36 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Threading + { + /** + * An executor that does not spawn any thread, instead, tasks are executed in the current thread + * TODO: add await functionality to avoid deadlocking if thread waits for another async task. + */ + class AWS_CORE_API SameThreadExecutor : public Executor + { + public: + virtual ~SameThreadExecutor(); + void WaitUntilStopped() override; + protected: + bool SubmitToThread(std::function&& task) override; + + using TaskFunc = std::function; + Aws::List m_tasks; + }; + } // namespace Threading + } // namespace Utils +} // namespace Aws diff --git a/include/aws/core/utils/threading/Semaphore.h b/include/aws/core/utils/threading/Semaphore.h new file mode 100644 index 0000000000000000000000000000000000000000..be416f77646a21f3475664aa1e5f264074bb21a2 --- /dev/null +++ b/include/aws/core/utils/threading/Semaphore.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Threading + { + class AWS_CORE_API Semaphore { + public: + /** + * Initializes a new instance of Semaphore class specifying the initial number of entries and + * the maximum number of concurrent entries. + */ + Semaphore(size_t initialCount, size_t maxCount); + /** + * Blocks the current thread until it receives a signal. + */ + void WaitOne(); + /** + * Blocks the current thread until it receives a signal or timeout is reached. + * Returns false on timeout, and true if a signal is received + */ + bool WaitOneFor(size_t timeoutMs); + /** + * Exits the semaphore once. + */ + void Release(); + /** + * Exit the semaphore up to the maximum number of entries available. + */ + void ReleaseAll(); + private: + size_t m_count; + const size_t m_maxCount; + std::mutex m_mutex; + std::condition_variable m_syncPoint; + }; + } + } +} diff --git a/include/aws/core/utils/threading/ThreadTask.h b/include/aws/core/utils/threading/ThreadTask.h new file mode 100644 index 0000000000000000000000000000000000000000..1a5234b4a578a04077e3e0a28f50f872366b1250 --- /dev/null +++ b/include/aws/core/utils/threading/ThreadTask.h @@ -0,0 +1,51 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + namespace Threading + { + class PooledThreadExecutor; + + class AWS_CORE_API ThreadTask + { + public: + ThreadTask(PooledThreadExecutor& executor); + ~ThreadTask(); + + /** + * Rule of 5 stuff. + * Don't copy or move + */ + ThreadTask(const ThreadTask&) = delete; + ThreadTask& operator =(const ThreadTask&) = delete; + ThreadTask(ThreadTask&&) = delete; + ThreadTask& operator =(ThreadTask&&) = delete; + + void StopProcessingWork(); + + std::thread::id GetThreadId() const; + void DetachFromExecutor(); + protected: + void MainTaskRunner(); + + private: + std::atomic m_continue; + PooledThreadExecutor& m_executor; + std::thread m_thread; + bool m_detached = false; + }; + } + } +} diff --git a/include/aws/core/utils/xml/XmlSerializer.h b/include/aws/core/utils/xml/XmlSerializer.h new file mode 100644 index 0000000000000000000000000000000000000000..8d410479976f8f1de375825c8897fd5d9292a8b9 --- /dev/null +++ b/include/aws/core/utils/xml/XmlSerializer.h @@ -0,0 +1,217 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include + +#include +#include +#include + +namespace Aws +{ + namespace External + { + namespace tinyxml2 + { + class XMLNode; + + class XMLDocument; + } // namespace tinyxml2 + } // namespace External +} // namespace Aws + +namespace Aws +{ + template + class AmazonWebServiceResult; + namespace Client + { + enum class CoreErrors; + template + class AWSError; + class AWSXMLClient; + } // namespace Client + namespace Utils + { + namespace Xml + { + /** + * Converts escaped xml text back to the original characters (e.g. < ! > = etc...) + */ + AWS_CORE_API Aws::String DecodeEscapedXmlText(const Aws::String& textToDecode); + + class XmlDocument; + + /** + * Node in an Xml Document + */ + class AWS_CORE_API XmlNode + { + public: + /** + * copies node and document over. + */ + XmlNode(const XmlNode& other); + /** + * copies node and document over. + */ + XmlNode& operator=(const XmlNode& other); + /** + * Get the name of the node. + */ + const Aws::String GetName() const; + /** + * Set the name of the node. + */ + void SetName(const Aws::String& name); + /** + * Get Value of an attribute specified by name. + */ + const Aws::String GetAttributeValue(const Aws::String& name) const; + /** + * Set an attribute at name to value + */ + void SetAttributeValue(const Aws::String& name, const Aws::String& value); + /** + * Get the inner text of the node (potentially includes other nodes) + */ + Aws::String GetText() const; + /** + * Set the inner text of the node + */ + void SetText(const Aws::String& textValue); + /** + * returns true if this node has another sibling. + */ + bool HasNextNode() const; + /** + * returns the next sibling. + */ + XmlNode NextNode() const; + /** + * returns the next sibling that matches node name. + */ + XmlNode NextNode(const char* name) const; + /** + * returns the next sibling that matches node name. + */ + XmlNode NextNode(const Aws::String& name) const; + /** + * return the first child node of this node. + */ + XmlNode FirstChild() const; + /** + * returns the first child node of this node that has name. + */ + XmlNode FirstChild(const char* name) const; + /** + * returns the first child node of this node that has name. + */ + XmlNode FirstChild(const Aws::String& name) const; + /** + * returns true if this node has child nodes. + */ + bool HasChildren() const; + /** + * returns the parent of this node. + */ + XmlNode Parent() const; + /** + * Creates a new child element to this with name + */ + XmlNode CreateChildElement(const Aws::String& name); + /** + * Creates a new child element to this with name + */ + XmlNode CreateSiblingElement(const Aws::String& name); + /** + * If current node is valid. + */ + bool IsNull(); + + private: + XmlNode(Aws::External::tinyxml2::XMLNode* node, const XmlDocument& document) : + m_node(node), m_doc(&document) + { + } + + //we do not own these.... I just had to change it from ref because the compiler was + //confused about which assignment operator to call. Do not... I repeat... do not delete + //these pointers in your destructor. + Aws::External::tinyxml2::XMLNode* m_node = nullptr; + const XmlDocument* m_doc = nullptr; + + friend class XmlDocument; + }; + + /** + * Container for Xml Document as a whole. All nodes have a reference to their parent document. Any changes + * you make to the nodes will be reflected here. + */ + class AWS_CORE_API XmlDocument + { + public: + /** + * move document memory + */ + XmlDocument(const XmlDocument& other); + XmlDocument(XmlDocument&& doc); + XmlDocument(); + + XmlDocument& operator=(const XmlDocument& other); + XmlDocument& operator=(XmlDocument&& other); + + ~XmlDocument(); + + /** + * Get root element of the document + */ + XmlNode GetRootElement() const; + /** + * Convert entire document to string. Use this if you for example, want to save the document to a file. + */ + Aws::String ConvertToString() const; + /** + * Returns true if the call to CreateFromXml* was successful, otherwise false. + * if this returns false, you can call GetErrorMessage() to see details. + */ + bool WasParseSuccessful() const; + /** + * Returns the error message if the call to CreateFromXml* failed. + */ + Aws::String GetErrorMessage() const; + /** + * Parses the stream into an XMLDocument + */ + static XmlDocument CreateFromXmlStream(Aws::IOStream&); + /** + * Parses the string into an XMLDocument + */ + static XmlDocument CreateFromXmlString(const Aws::String&); + /** + * Creates an empty document with root node name + */ + static XmlDocument CreateWithRootNode(const Aws::String&); + + private: + void InitDoc(); + + Aws::External::tinyxml2::XMLDocument* m_doc = nullptr; + + friend class XmlNode; + + //allow outcome call the default constructor to handle it's error case. + friend class Aws::Utils::Outcome, Aws::Client::AWSError>; + friend class Aws::AmazonWebServiceResult; + template + friend class Client::AWSError; + friend class Client::AWSXMLClient; + }; + + } // namespace Xml + } // namespace Utils +} // namespace Aws diff --git a/include/aws/io/async_stream.h b/include/aws/io/async_stream.h new file mode 100644 index 0000000000000000000000000000000000000000..2e76bdd7ec48f2eebd92f0c4a2c0b362832d999b --- /dev/null +++ b/include/aws/io/async_stream.h @@ -0,0 +1,117 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#ifndef AWS_IO_ASYNC_STREAM_H +#define AWS_IO_ASYNC_STREAM_H + +/** + * THIS IS AN EXPERIMENTAL AND UNSTABLE API + * TODO: logging + * TODO: modify API to return byte-bufs, instead of filling in the provided byte-buf? + * this would avoid a copy in the use-cases we know of, but it's more complex + * TODO: vtable acquire()/release()? + * TODO: protect against simultaneous reads? + * TODO: check results of vtable->read() (i.e. 0 byte reads not allowed)? + * this would require 1 or 2 additional allocations per read + */ + +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_async_input_stream; +struct aws_byte_buf; +struct aws_future_bool; +struct aws_input_stream; + +struct aws_async_input_stream { + const struct aws_async_input_stream_vtable *vtable; + struct aws_allocator *alloc; + struct aws_ref_count ref_count; + void *impl; +}; + +struct aws_async_input_stream_vtable { + /** + * Destroy the stream, its refcount has reached 0. + */ + void (*destroy)(struct aws_async_input_stream *stream); + + /** + * Read once into the buffer. + * Complete the read when at least 1 byte is read, the buffer is full, or EOF is reached. + * Do not resize the buffer (do not use "aws_byte_buf_xyz_dynamic()" functions) + * Do not assume that buffer len starts at 0. + * You may assume that read() won't be called again until the current one completes. + * You may assume that the buffer has some space available. + * Return a future, which will contain an error code if something went wrong, + * or a result bool indicating whether EOF has been reached. + */ + struct aws_future_bool *(*read)(struct aws_async_input_stream *stream, struct aws_byte_buf *dest); +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initialize aws_async_input_stream "base class" + */ +AWS_IO_API +void aws_async_input_stream_init_base( + struct aws_async_input_stream *stream, + struct aws_allocator *alloc, + const struct aws_async_input_stream_vtable *vtable, + void *impl); + +/** + * Increment reference count. + * You may pass in NULL (has no effect). + * Returns whatever pointer was passed in. + */ +AWS_IO_API +struct aws_async_input_stream *aws_async_input_stream_acquire(struct aws_async_input_stream *stream); + +/** + * Decrement reference count. + * You may pass in NULL (has no effect). + * Always returns NULL. + */ +AWS_IO_API +struct aws_async_input_stream *aws_async_input_stream_release(struct aws_async_input_stream *stream); + +/** + * Read once from the async stream into the buffer. + * The read completes when at least 1 byte is read, the buffer is full, or EOF is reached. + * Depending on implementation, the read could complete at any time. + * It may complete synchronously. It may complete on another thread. + * Returns a future, which will contain an error code if something went wrong, + * or a result bool indicating whether EOF has been reached. + * + * WARNING: The buffer must have space available. + * WARNING: Do not read again until the previous read is complete. + */ +AWS_IO_API +struct aws_future_bool *aws_async_input_stream_read(struct aws_async_input_stream *stream, struct aws_byte_buf *dest); + +/** + * Read repeatedly from the async stream until the buffer is full, or EOF is reached. + * Depending on implementation, this could complete at any time. + * It may complete synchronously. It may complete on another thread. + * Returns a future, which will contain an error code if something went wrong, + * or a result bool indicating whether EOF has been reached. + * + * WARNING: The buffer must have space available. + * WARNING: Do not read again until the previous read is complete. + */ +AWS_IO_API +struct aws_future_bool *aws_async_input_stream_read_to_fill( + struct aws_async_input_stream *stream, + struct aws_byte_buf *dest); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_ASYNC_STREAM_H */ diff --git a/include/aws/io/channel.h b/include/aws/io/channel.h new file mode 100644 index 0000000000000000000000000000000000000000..dc48cd05436e0522f689f14a25b81cc4e6597bae --- /dev/null +++ b/include/aws/io/channel.h @@ -0,0 +1,515 @@ +#ifndef AWS_IO_CHANNEL_H +#define AWS_IO_CHANNEL_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum aws_channel_direction { + AWS_CHANNEL_DIR_READ, + AWS_CHANNEL_DIR_WRITE, +}; + +struct aws_channel; +struct aws_channel_slot; +struct aws_channel_handler; +struct aws_event_loop; +struct aws_event_loop_local_object; + +typedef void(aws_channel_on_setup_completed_fn)(struct aws_channel *channel, int error_code, void *user_data); + +/* Callback called when a channel is completely shutdown. error_code refers to the reason the channel was closed. */ +typedef void(aws_channel_on_shutdown_completed_fn)(struct aws_channel *channel, int error_code, void *user_data); + +struct aws_channel_slot { + struct aws_allocator *alloc; + struct aws_channel *channel; + struct aws_channel_slot *adj_left; + struct aws_channel_slot *adj_right; + struct aws_channel_handler *handler; + size_t window_size; + size_t upstream_message_overhead; + size_t current_window_update_batch_size; +}; + +struct aws_channel_task; +typedef void(aws_channel_task_fn)(struct aws_channel_task *channel_task, void *arg, enum aws_task_status status); + +struct aws_channel_task { + struct aws_task wrapper_task; + aws_channel_task_fn *task_fn; + void *arg; + const char *type_tag; + struct aws_linked_list_node node; +}; + +struct aws_channel_handler_vtable { + /** + * Called by the channel when a message is available for processing in the read direction. It is your + * responsibility to call aws_mem_release(message->allocator, message); on message when you are finished with it. + * You must only call `aws_mem_release(message->allocator, message);` if the `process_read_message` + * returns AWS_OP_SUCCESS. In case of an error, you must not clean up the message and should just raise the error. + * + * Also keep in mind that your slot's internal window has been decremented. You'll want to call + * aws_channel_slot_increment_read_window() at some point in the future if you want to keep receiving data. + */ + int (*process_read_message)( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + struct aws_io_message *message); + /** + * Called by the channel when a message is available for processing in the write direction. It is your + * responsibility to call aws_mem_release(message->allocator, message); on message when you are finished with it. + * You must only call `aws_mem_release(message->allocator, message);` if the `process_read_message` + * returns AWS_OP_SUCCESS. In case of an error, you must not clean up the message and should just raise the error. + */ + int (*process_write_message)( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + struct aws_io_message *message); + /** + * Called by the channel when a downstream handler has issued a window increment. You'll want to update your + * internal state and likely propagate a window increment message of your own by calling + * 'aws_channel_slot_increment_read_window()' + */ + int (*increment_read_window)(struct aws_channel_handler *handler, struct aws_channel_slot *slot, size_t size); + + /** + * The channel calls shutdown on all handlers twice, once to shut down reading, and once to shut down writing. + * Shutdown always begins with the left-most handler, and proceeds to the right with dir set to + * AWS_CHANNEL_DIR_READ. Then shutdown is called on handlers from right to left with dir set to + * AWS_CHANNEL_DIR_WRITE. + * + * The shutdown process does not need to complete immediately and may rely on scheduled tasks. + * The handler must call aws_channel_slot_on_handler_shutdown_complete() when it is finished, + * which propagates shutdown to the next handler. If 'free_scarce_resources_immediately' is true, + * then resources vulnerable to denial-of-service attacks (such as sockets and file handles) + * must be closed immediately before the shutdown() call returns. + */ + int (*shutdown)( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + enum aws_channel_direction dir, + int error_code, + bool free_scarce_resources_immediately); + + /** + * Called by the channel when the handler is added to a slot, to get the initial window size. + */ + size_t (*initial_window_size)(struct aws_channel_handler *handler); + + /** Called by the channel anytime a handler is added or removed, provides a hint for downstream + * handlers to avoid message fragmentation due to message overhead. */ + size_t (*message_overhead)(struct aws_channel_handler *handler); + + /** + * Clean up any resources and deallocate yourself. The shutdown process will already be completed before this + * function is called. + */ + void (*destroy)(struct aws_channel_handler *handler); + + /** + * Directs the channel handler to reset all of the internal statistics it tracks about itself. + */ + void (*reset_statistics)(struct aws_channel_handler *handler); + + /** + * Adds a pointer to the handler's internal statistics (if they exist) to a list of statistics structures + * associated with the channel's handler chain. + */ + void (*gather_statistics)(struct aws_channel_handler *handler, struct aws_array_list *stats_list); + + /* + * If this handler represents a source of data (like the socket_handler), then this will trigger a read + * from the data source. + */ + void (*trigger_read)(struct aws_channel_handler *handler); +}; + +struct aws_channel_handler { + struct aws_channel_handler_vtable *vtable; + struct aws_allocator *alloc; + struct aws_channel_slot *slot; + void *impl; +}; + +/** + * Args for creating a new channel. + * event_loop to use for IO and tasks. on_setup_completed will be invoked when + * the setup process is finished It will be executed in the event loop's thread. + * on_shutdown_completed will be executed upon channel shutdown. + * + * enable_read_back_pressure toggles whether or not back pressure will be applied in the channel. + * Leave this option off unless you're using something like reactive-streams, since it is a slight throughput + * penalty. + * + * Unless otherwise + * specified all functions for channels and channel slots must be executed within that channel's event-loop's thread. + **/ +struct aws_channel_options { + struct aws_event_loop *event_loop; + aws_channel_on_setup_completed_fn *on_setup_completed; + aws_channel_on_shutdown_completed_fn *on_shutdown_completed; + void *setup_user_data; + void *shutdown_user_data; + bool enable_read_back_pressure; +}; + +AWS_EXTERN_C_BEGIN + +extern AWS_IO_API size_t g_aws_channel_max_fragment_size; + +/** + * Initializes channel_task for use. + */ +AWS_IO_API +void aws_channel_task_init( + struct aws_channel_task *channel_task, + aws_channel_task_fn *task_fn, + void *arg, + const char *type_tag); + +/** + * Allocates new channel, Unless otherwise specified all functions for channels and channel slots must be executed + * within that channel's event-loop's thread. channel_options are copied. + */ +AWS_IO_API +struct aws_channel *aws_channel_new(struct aws_allocator *allocator, const struct aws_channel_options *creation_args); + +/** + * Mark the channel, along with all slots and handlers, for destruction. + * Must be called after shutdown has completed. + * Can be called from any thread assuming 'aws_channel_shutdown()' has completed. + * Note that memory will not be freed until all users which acquired holds on the channel via + * aws_channel_acquire_hold(), release them via aws_channel_release_hold(). + */ +AWS_IO_API +void aws_channel_destroy(struct aws_channel *channel); + +/** + * Initiates shutdown of the channel. Shutdown will begin with the left-most slot. Each handler will invoke + * 'aws_channel_slot_on_handler_shutdown_complete' once they've finished their shutdown process for the read direction. + * Once the right-most slot has shutdown in the read direction, the process will start shutting down starting on the + * right-most slot. Once the left-most slot has shutdown in the write direction, 'callbacks->shutdown_completed' will be + * invoked in the event loop's thread. + * + * This function can be called from any thread. + */ +AWS_IO_API +int aws_channel_shutdown(struct aws_channel *channel, int error_code); + +/** + * Prevent a channel's memory from being freed. + * Any number of users may acquire a hold to prevent a channel and its handlers from being unexpectedly freed. + * Any user which acquires a hold must release it via aws_channel_release_hold(). + * Memory will be freed once all holds are released and aws_channel_destroy() has been called. + */ +AWS_IO_API +void aws_channel_acquire_hold(struct aws_channel *channel); + +/** + * Release a hold on the channel's memory, allowing it to be freed. + * This may be called before or after aws_channel_destroy(). + */ +AWS_IO_API +void aws_channel_release_hold(struct aws_channel *channel); + +/** + * Allocates and initializes a new slot for use with the channel. If this is the first slot in the channel, it will + * automatically be added to the channel as the first slot. For all subsequent calls on a given channel, the slot will + * need to be added to the channel via. the aws_channel_slot_insert_right(), aws_channel_slot_insert_end(), and + * aws_channel_slot_insert_left() APIs. + */ +AWS_IO_API +struct aws_channel_slot *aws_channel_slot_new(struct aws_channel *channel); + +/** + * Fetches the event loop the channel is a part of. + */ +AWS_IO_API +struct aws_event_loop *aws_channel_get_event_loop(struct aws_channel *channel); + +/** + * Fetches the current timestamp from the event-loop's clock, in nanoseconds. + */ +AWS_IO_API +int aws_channel_current_clock_time(struct aws_channel *channel, uint64_t *time_nanos); + +/** + * Retrieves an object by key from the event loop's local storage. + */ +AWS_IO_API +int aws_channel_fetch_local_object( + struct aws_channel *channel, + const void *key, + struct aws_event_loop_local_object *obj); + +/** + * Stores an object by key in the event loop's local storage. + */ +AWS_IO_API +int aws_channel_put_local_object( + struct aws_channel *channel, + const void *key, + const struct aws_event_loop_local_object *obj); + +/** + * Removes an object by key from the event loop's local storage. + */ +AWS_IO_API +int aws_channel_remove_local_object( + struct aws_channel *channel, + const void *key, + struct aws_event_loop_local_object *removed_obj); + +/** + * Acquires a message from the event loop's message pool. size_hint is merely a hint, it may be smaller than you + * requested and you are responsible for checking the bounds of it. If the returned message is not large enough, you + * must send multiple messages. This cannot fail, it never returns NULL. + */ +AWS_IO_API +struct aws_io_message *aws_channel_acquire_message_from_pool( + struct aws_channel *channel, + enum aws_io_message_type message_type, + size_t size_hint); + +/** + * Schedules a task to run on the event loop as soon as possible. + * This is the ideal way to move a task into the correct thread. It's also handy for context switches. + * This function is safe to call from any thread. + * + * If called from the channel's event loop, the task will get directly added to the run-now list. + * If called from outside the channel's event loop, the task will go into a cross-thread task queue. + * + * If tasks must be serialized relative to some source synchronization, you may not want to use this API + * because tasks submitted from the event loop thread can "jump ahead" of tasks submitted from external threads + * due to this optimization. If this is a problem, you can either refactor your submission logic or use + * the aws_channel_schedule_task_now_serialized variant which does not perform this optimization. + * + * The task should not be cleaned up or modified until its function is executed. + */ +AWS_IO_API +void aws_channel_schedule_task_now(struct aws_channel *channel, struct aws_channel_task *task); + +/** + * Schedules a task to run on the event loop as soon as possible. + * + * This variant always uses the cross thread queue rather than conditionally skipping it when already in + * the destination event loop. While not "optimal", this allows us to serialize task execution no matter where + * the task was submitted from: if you are submitting tasks from a critical section, the serialized order that you + * submit is guaranteed to be the order that they execute on the event loop. + * + * The task should not be cleaned up or modified until its function is executed. + */ +AWS_IO_API +void aws_channel_schedule_task_now_serialized(struct aws_channel *channel, struct aws_channel_task *task); + +/** + * Schedules a task to run on the event loop at the specified time. + * This is the ideal way to move a task into the correct thread. It's also handy for context switches. + * Use aws_channel_current_clock_time() to get the current time in nanoseconds. + * This function is safe to call from any thread. + * + * The task should not be cleaned up or modified until its function is executed. + */ +AWS_IO_API +void aws_channel_schedule_task_future( + struct aws_channel *channel, + struct aws_channel_task *task, + uint64_t run_at_nanos); + +/** + * Instrument a channel with a statistics handler. While instrumented with a statistics handler, the channel + * will periodically report per-channel-handler-specific statistics about handler performance and state. + * + * Assigning a statistics handler to a channel is a transfer of ownership -- the channel will clean up + * the handler appropriately. Statistics handlers may be changed dynamically (for example, the upgrade + * from a vanilla http channel to a websocket channel), but this function may only be called from the + * event loop thread that the channel is a part of. + * + * The first possible hook to set a statistics handler is the channel's creation callback. + */ +AWS_IO_API +int aws_channel_set_statistics_handler(struct aws_channel *channel, struct aws_crt_statistics_handler *handler); + +/** + * Returns true if the caller is on the event loop's thread. If false, you likely need to use + * aws_channel_schedule_task(). This function is safe to call from any thread. + */ +AWS_IO_API +bool aws_channel_thread_is_callers_thread(struct aws_channel *channel); + +/** + * Sets the handler for a slot, the slot will also call get_current_window_size() and propagate a window update + * upstream. + */ +AWS_IO_API +int aws_channel_slot_set_handler(struct aws_channel_slot *slot, struct aws_channel_handler *handler); + +/** + * Removes slot from the channel and deallocates the slot and its handler. + */ +AWS_IO_API +int aws_channel_slot_remove(struct aws_channel_slot *slot); + +/** + * Replaces remove with new_slot. Deallocates remove and its handler. + */ +AWS_IO_API +int aws_channel_slot_replace(struct aws_channel_slot *remove, struct aws_channel_slot *new_slot); + +/** + * inserts 'to_add' to the position immediately to the right of slot. Note that the first call to + * aws_channel_slot_new() adds it to the channel implicitly. + */ +AWS_IO_API +int aws_channel_slot_insert_right(struct aws_channel_slot *slot, struct aws_channel_slot *to_add); + +/** + * Inserts to 'to_add' the end of the channel. Note that the first call to + * aws_channel_slot_new() adds it to the channel implicitly. + */ +AWS_IO_API +int aws_channel_slot_insert_end(struct aws_channel *channel, struct aws_channel_slot *to_add); + +/** + * inserts 'to_add' to the position immediately to the left of slot. Note that the first call to + * aws_channel_slot_new() adds it to the channel implicitly. + */ +AWS_IO_API +int aws_channel_slot_insert_left(struct aws_channel_slot *slot, struct aws_channel_slot *to_add); + +/** + * Sends a message to the adjacent slot in the channel based on dir. Also does window size checking. + * + * NOTE: if this function returns an error code, it is the caller's responsibility to release message + * back to the pool. If this function returns AWS_OP_SUCCESS, the recipient of the message has taken + * ownership of the message. So, for example, don't release a message to the pool and then return an error. + * If you encounter an error condition in this case, shutdown the channel with the appropriate error code. + */ +AWS_IO_API +int aws_channel_slot_send_message( + struct aws_channel_slot *slot, + struct aws_io_message *message, + enum aws_channel_direction dir); + +/** + * Convenience function that invokes aws_channel_acquire_message_from_pool(), + * asking for the largest reasonable DATA message that can be sent in the write direction, + * with upstream overhead accounted for. This cannot fail, it never returns NULL. + */ +AWS_IO_API +struct aws_io_message *aws_channel_slot_acquire_max_message_for_write(struct aws_channel_slot *slot); + +/** + * Issues a window update notification upstream (to the left.) + */ +AWS_IO_API +int aws_channel_slot_increment_read_window(struct aws_channel_slot *slot, size_t window); + +/** + * Called by handlers once they have finished their shutdown in the 'dir' direction. Propagates the shutdown process + * to the next handler in the channel. + */ +AWS_IO_API +int aws_channel_slot_on_handler_shutdown_complete( + struct aws_channel_slot *slot, + enum aws_channel_direction dir, + int err_code, + bool free_scarce_resources_immediately); + +/** + * Initiates shutdown on slot. callbacks->on_shutdown_completed will be called + * once the shutdown process is completed. + */ +AWS_IO_API +int aws_channel_slot_shutdown( + struct aws_channel_slot *slot, + enum aws_channel_direction dir, + int err_code, + bool free_scarce_resources_immediately); + +/** + * Fetches the downstream read window. This gives you the information necessary to honor the read window. If you call + * send_message() and it exceeds this window, the message will be rejected. + */ +AWS_IO_API +size_t aws_channel_slot_downstream_read_window(struct aws_channel_slot *slot); + +/** Fetches the current overhead of upstream handlers. This provides a hint to avoid fragmentation if you care. */ +AWS_IO_API +size_t aws_channel_slot_upstream_message_overhead(struct aws_channel_slot *slot); + +/** + * Calls destroy on handler's vtable + */ +AWS_IO_API +void aws_channel_handler_destroy(struct aws_channel_handler *handler); + +/** + * Calls process_read_message on handler's vtable + */ +AWS_IO_API +int aws_channel_handler_process_read_message( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + struct aws_io_message *message); + +/** + * Calls process_write_message on handler's vtable. + */ +AWS_IO_API +int aws_channel_handler_process_write_message( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + struct aws_io_message *message); + +/** + * Calls on_window_update on handler's vtable. + */ +AWS_IO_API +int aws_channel_handler_increment_read_window( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + size_t size); + +/** + * calls shutdown_direction on handler's vtable. + */ +AWS_IO_API +int aws_channel_handler_shutdown( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + enum aws_channel_direction dir, + int error_code, + bool free_scarce_resources_immediately); + +/** + * Calls initial_window_size on handler's vtable. + */ +AWS_IO_API +size_t aws_channel_handler_initial_window_size(struct aws_channel_handler *handler); + +AWS_IO_API +struct aws_channel_slot *aws_channel_get_first_slot(struct aws_channel *channel); + +/** + * A way for external processes to force a read by the data-source channel handler. Necessary in certain cases, like + * when a server channel finishes setting up its initial handlers, a read may have already been triggered on the + * socket (the client's CLIENT_HELLO tls payload, for example) and absent further data/notifications, this data + * would never get processed. + */ +AWS_IO_API +int aws_channel_trigger_read(struct aws_channel *channel); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_CHANNEL_H */ diff --git a/include/aws/io/channel_bootstrap.h b/include/aws/io/channel_bootstrap.h new file mode 100644 index 0000000000000000000000000000000000000000..b1e6149c078383ca2c010890e66008d01f17ec2a --- /dev/null +++ b/include/aws/io/channel_bootstrap.h @@ -0,0 +1,324 @@ +#ifndef AWS_IO_CHANNEL_BOOTSTRAP_H +#define AWS_IO_CHANNEL_BOOTSTRAP_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_client_bootstrap; +struct aws_socket; +struct aws_socket_options; +struct aws_socket_endpoint; + +/** + * Generic event function for channel lifecycle events. + * + * Callbacks are provided for: + * (1) Channel creation + * (2) Channel setup - If TLS is being used, this function is called once the socket has connected, the channel has + * been initialized, and TLS has been successfully negotiated. A TLS handler has already been added to the channel. If + * TLS negotiation fails, this function will be called with the corresponding error code. If TLS is not being used, this + * function is called once the socket has connected and the channel has been initialized. + * (3) Channel shutdown + * + * These callbacks are always invoked within the thread of the event-loop that the channel is assigned to. + * + * This function does NOT always imply "success" -- if error_code is AWS_OP_SUCCESS then everything was successful, + * otherwise an error condition occurred. + */ +typedef void(aws_client_bootstrap_on_channel_event_fn)( + struct aws_client_bootstrap *bootstrap, + int error_code, + struct aws_channel *channel, + void *user_data); + +/** + * If ALPN is being used this function will be invoked by the channel once an ALPN message is received. The returned + * channel_handler will be added to, and managed by, the channel. + */ +typedef struct aws_channel_handler *(aws_channel_on_protocol_negotiated_fn)(struct aws_channel_slot *new_slot, + struct aws_byte_buf *protocol, + void *user_data); + +struct aws_tls_connection_options; + +struct aws_event_loop_group; + +/** + * Called after client bootstrap has been completely cleaned up, after its last refcount is released. + */ +typedef void aws_client_bootstrap_shutdown_complete_fn(void *user_data); + +/** + * aws_client_bootstrap handles creation and setup of channels that communicate via socket with a specific endpoint. + */ +struct aws_client_bootstrap { + struct aws_allocator *allocator; + struct aws_event_loop_group *event_loop_group; + struct aws_host_resolver *host_resolver; + struct aws_host_resolution_config host_resolver_config; + aws_channel_on_protocol_negotiated_fn *on_protocol_negotiated; + struct aws_ref_count ref_count; + aws_client_bootstrap_shutdown_complete_fn *on_shutdown_complete; + void *user_data; +}; + +/** + * aws_client_bootstrap creation options. + */ +struct aws_client_bootstrap_options { + + /* Required. Must outlive the client bootstrap. */ + struct aws_event_loop_group *event_loop_group; + + /* Required. Must outlive the client bootstrap. */ + struct aws_host_resolver *host_resolver; + + /* Optional. If none is provided then default settings are used. + * This object is deep-copied by bootstrap. + * */ + const struct aws_host_resolution_config *host_resolution_config; + + /* Optional. If provided, callback is invoked when client bootstrap has completely shut down. */ + aws_client_bootstrap_shutdown_complete_fn *on_shutdown_complete; + + /* Optional. Passed to callbacks */ + void *user_data; +}; + +struct aws_server_bootstrap; + +/** + * If TLS is being used, this function is called once the socket has received an incoming connection, the channel has + * been initialized, and TLS has been successfully negotiated. A TLS handler has already been added to the channel. If + * TLS negotiation fails, this function will be called with the corresponding error code. + * + * If TLS is not being used, this function is called once the socket has received an incoming connection and the channel + * has been initialized. + * + * This function is always called within the thread of the event-loop that the new channel is assigned to upon success. + * + * On failure, the channel might not be assigned to an event loop yet, and will thus be invoked on the listener's + * event-loop thread. + * + * This function does NOT mean "success", if error_code is AWS_OP_SUCCESS then everything was successful, otherwise an + * error condition occurred. + * + * If an error occurred, you do not need to shutdown the channel. The `aws_channel_client_shutdown_callback` will be + * invoked once the channel has finished shutting down. + */ +typedef void(aws_server_bootstrap_on_accept_channel_setup_fn)( + struct aws_server_bootstrap *bootstrap, + int error_code, + struct aws_channel *channel, + void *user_data); + +/** + * Once the channel shuts down, this function will be invoked within the thread of + * the event-loop that the channel is assigned to. + * + * Note: this function is only invoked if the channel was successfully setup, + * e.g. aws_server_bootstrap_on_accept_channel_setup_fn() was invoked without an error code. + */ +typedef void(aws_server_bootstrap_on_accept_channel_shutdown_fn)( + struct aws_server_bootstrap *bootstrap, + int error_code, + struct aws_channel *channel, + void *user_data); + +/** + * This function is only used for async listener (Apple Network Framework in this case). + * Once the server listener socket is finished setup and starting listening, this fuction + * will be invoked. + */ +typedef void( + aws_server_bootstrap_on_listener_setup_fn)(struct aws_server_bootstrap *bootstrap, int error_code, void *user_data); + +/** + * Once the server listener socket is finished destroying, and all the existing connections are closed, this fuction + * will be invoked. + */ +typedef void( + aws_server_bootstrap_on_server_listener_destroy_fn)(struct aws_server_bootstrap *bootstrap, void *user_data); + +/** + * aws_server_bootstrap manages listening sockets, creating and setting up channels to handle each incoming connection. + */ +struct aws_server_bootstrap { + struct aws_allocator *allocator; + struct aws_event_loop_group *event_loop_group; + aws_channel_on_protocol_negotiated_fn *on_protocol_negotiated; + struct aws_ref_count ref_count; +}; + +/** + * Socket-based channel creation options. + * + * bootstrap - configs name resolution and which event loop group the connection will be seated into + * host_name - host to connect to; if a dns address, will be resolved prior to connecting + * port - port to connect to + * socket_options - socket properties, including type (tcp vs. udp vs. unix domain) and connect timeout. TLS + * connections are currently restricted to tcp (AWS_SOCKET_STREAM) only. + * tls_options - (optional) tls context to apply after connection establishment. If NULL, the connection will + * not be protected by TLS. + * creation_callback - (optional) callback invoked when the channel is first created. This is always right after + * the connection was successfully established. *Does NOT* get called if the initial connect failed. + * setup_callback - callback invoked once the channel is ready for use and TLS has been negotiated or if an error + * is encountered + * shutdown_callback - callback invoked once the channel has shutdown. + * enable_read_back_pressure - controls whether or not back pressure will be applied in the channel + * user_data - arbitrary data to pass back to the various callbacks + * requested_event_loop - if set, the connection will be placed on the requested event loop rather than one + * chosen internally from the bootstrap's associated event loop group. It is an error to pass in an event loop + * that is not associated with the bootstrap's event loop group. + * + * Immediately after the `shutdown_callback` returns, the channel is cleaned up automatically. All callbacks are invoked + * in the thread of the event-loop that the new channel is assigned to. + * + */ +struct aws_socket_channel_bootstrap_options { + struct aws_client_bootstrap *bootstrap; + const char *host_name; + uint32_t port; + const struct aws_socket_options *socket_options; + const struct aws_tls_connection_options *tls_options; + aws_client_bootstrap_on_channel_event_fn *creation_callback; + aws_client_bootstrap_on_channel_event_fn *setup_callback; + aws_client_bootstrap_on_channel_event_fn *shutdown_callback; + bool enable_read_back_pressure; + void *user_data; + struct aws_event_loop *requested_event_loop; + const struct aws_host_resolution_config *host_resolution_override_config; +}; + +/** + * Arguments to setup a server socket listener which will also negotiate and configure TLS. + * This creates a socket listener bound to `host` and 'port' using socket options `options`, and TLS options + * `tls_options`. `incoming_callback` will be invoked once an incoming channel is ready for use and TLS is + * finished negotiating, or if an error is encountered. `shutdown_callback` will be invoked once the channel has + * shutdown. `destroy_callback` will be invoked after the server socket listener is destroyed, and all associated + * connections and channels have finished shutting down. Immediately after the `shutdown_callback` returns, the channel + * is cleaned up automatically. All callbacks are invoked in the thread of the event-loop that listener is assigned to. + * + * Upon shutdown of your application, you'll want to call `aws_server_bootstrap_destroy_socket_listener` with the return + * value from this function. + * + * The socket type in `options` must be AWS_SOCKET_STREAM if tls_options is set. + * DTLS is not currently supported for tls. + */ +struct aws_server_socket_channel_bootstrap_options { + struct aws_server_bootstrap *bootstrap; + const char *host_name; + uint32_t port; + const struct aws_socket_options *socket_options; + const struct aws_tls_connection_options *tls_options; + aws_server_bootstrap_on_listener_setup_fn *setup_callback; + aws_server_bootstrap_on_accept_channel_setup_fn *incoming_callback; + aws_server_bootstrap_on_accept_channel_shutdown_fn *shutdown_callback; + aws_server_bootstrap_on_server_listener_destroy_fn *destroy_callback; + bool enable_read_back_pressure; + void *user_data; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Create the client bootstrap. + */ +AWS_IO_API struct aws_client_bootstrap *aws_client_bootstrap_new( + struct aws_allocator *allocator, + const struct aws_client_bootstrap_options *options); + +/** + * Increments a client bootstrap's ref count, allowing the caller to take a reference to it. + * + * Returns the same client bootstrap passed in. + */ +AWS_IO_API struct aws_client_bootstrap *aws_client_bootstrap_acquire(struct aws_client_bootstrap *bootstrap); + +/** + * Decrements a client bootstrap's ref count. When the ref count drops to zero, the bootstrap will be destroyed. + */ +AWS_IO_API void aws_client_bootstrap_release(struct aws_client_bootstrap *bootstrap); + +/** + * When using TLS, if ALPN is used, this callback will be invoked from the channel. The returned handler will be added + * to the channel. + */ +AWS_IO_API int aws_client_bootstrap_set_alpn_callback( + struct aws_client_bootstrap *bootstrap, + aws_channel_on_protocol_negotiated_fn *on_protocol_negotiated); + +/** + * Sets up a client socket channel. + */ +AWS_IO_API int aws_client_bootstrap_new_socket_channel(struct aws_socket_channel_bootstrap_options *options); + +/** + * Initializes the server bootstrap with `allocator` and `el_group`. This object manages listeners, server connections, + * and channels. + */ +AWS_IO_API struct aws_server_bootstrap *aws_server_bootstrap_new( + struct aws_allocator *allocator, + struct aws_event_loop_group *el_group); + +/** + * Increments a server bootstrap's ref count, allowing the caller to take a reference to it. + * + * Returns the same server bootstrap passed in. + */ +AWS_IO_API struct aws_server_bootstrap *aws_server_bootstrap_acquire(struct aws_server_bootstrap *bootstrap); + +/** + * Decrements a server bootstrap's ref count. When the ref count drops to zero, the bootstrap will be destroyed. + */ +AWS_IO_API void aws_server_bootstrap_release(struct aws_server_bootstrap *bootstrap); + +/** + * When using TLS, if ALPN is used, this callback will be invoked from the channel. The returned handler will be added + * to the channel. + */ +AWS_IO_API int aws_server_bootstrap_set_alpn_callback( + struct aws_server_bootstrap *bootstrap, + aws_channel_on_protocol_negotiated_fn *on_protocol_negotiated); + +/** + * Sets up a server socket listener. If you are planning on using TLS, use + * `aws_server_bootstrap_new_tls_socket_listener` instead. This creates a socket listener bound to `local_endpoint` + * using socket options `options`. `incoming_callback` will be invoked once an incoming channel is ready for use or if + * an error is encountered. `shutdown_callback` will be invoked once the channel has shutdown. `destroy_callback` will + * be invoked after the server socket listener is destroyed, and all associated connections and channels have finished + * shutting down. Immediately after the `shutdown_callback` returns, the channel is cleaned up automatically. All + * callbacks are invoked the thread of the event-loop that the listening socket is assigned to + * + * `setup_callback`. If set, the callback will be asynchronously invoked when the listener is ready for use. For Apple + * Network Framework, the listener is not usable until the callback is invoked. If the listener creation failed + * (return NULL), the `setup_callback` will not be invoked. + * + * Upon shutdown of your application, you'll want to call `aws_server_bootstrap_destroy_socket_listener` with the return + * value from this function. + * + * bootstrap_options is copied. + */ +AWS_IO_API struct aws_socket *aws_server_bootstrap_new_socket_listener( + const struct aws_server_socket_channel_bootstrap_options *bootstrap_options); + +/** + * Shuts down 'listener' and cleans up any resources associated with it. Any incoming channels on `listener` will still + * be active. `destroy_callback` will be invoked after the server socket listener is destroyed, and all associated + * connections and channels have finished shutting down. + */ +AWS_IO_API void aws_server_bootstrap_destroy_socket_listener( + struct aws_server_bootstrap *bootstrap, + struct aws_socket *listener); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_CHANNEL_BOOTSTRAP_H */ diff --git a/include/aws/io/event_loop.h b/include/aws/io/event_loop.h new file mode 100644 index 0000000000000000000000000000000000000000..7bcea49f5245f10e4a02d57e3a0d10fddabf646d --- /dev/null +++ b/include/aws/io/event_loop.h @@ -0,0 +1,297 @@ +#ifndef AWS_IO_EVENT_LOOP_H +#define AWS_IO_EVENT_LOOP_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_event_loop; +struct aws_event_loop_group; +struct aws_event_loop_options; +struct aws_shutdown_callback_options; +struct aws_task; + +/** + * @internal + */ +typedef void(aws_event_loop_on_event_fn)( + struct aws_event_loop *event_loop, + struct aws_io_handle *handle, + int events, + void *user_data); + +/** + * @internal + */ +struct aws_event_loop_vtable { + void (*start_destroy)(struct aws_event_loop *event_loop); + void (*complete_destroy)(struct aws_event_loop *event_loop); + int (*run)(struct aws_event_loop *event_loop); + int (*stop)(struct aws_event_loop *event_loop); + int (*wait_for_stop_completion)(struct aws_event_loop *event_loop); + void (*schedule_task_now)(struct aws_event_loop *event_loop, struct aws_task *task); + void (*schedule_task_future)(struct aws_event_loop *event_loop, struct aws_task *task, uint64_t run_at_nanos); + void (*cancel_task)(struct aws_event_loop *event_loop, struct aws_task *task); + int (*connect_to_io_completion_port)(struct aws_event_loop *event_loop, struct aws_io_handle *handle); + int (*subscribe_to_io_events)( + struct aws_event_loop *event_loop, + struct aws_io_handle *handle, + int events, + aws_event_loop_on_event_fn *on_event, + void *user_data); + int (*unsubscribe_from_io_events)(struct aws_event_loop *event_loop, struct aws_io_handle *handle); + void (*free_io_event_resources)(void *user_data); + bool (*is_on_callers_thread)(struct aws_event_loop *event_loop); +}; + +/** + * Event Loop Type. If set to `AWS_EVENT_LOOP_PLATFORM_DEFAULT`, the event loop will automatically use the platform’s + * default. + * + * Default Event Loop Type + * Linux | AWS_EVENT_LOOP_EPOLL + * Windows | AWS_EVENT_LOOP_IOCP + * BSD Variants| AWS_EVENT_LOOP_KQUEUE + * macOS | AWS_EVENT_LOOP_KQUEUE + * iOS | AWS_EVENT_LOOP_DISPATCH_QUEUE + */ +enum aws_event_loop_type { + AWS_EVENT_LOOP_PLATFORM_DEFAULT = 0, + AWS_EVENT_LOOP_EPOLL, + AWS_EVENT_LOOP_IOCP, + AWS_EVENT_LOOP_KQUEUE, + AWS_EVENT_LOOP_DISPATCH_QUEUE, +}; + +/** + * Event loop group configuration options + */ +struct aws_event_loop_group_options { + + /** + * How many event loops that event loop group should contain. For most group types, this implies + * the creation and management of an analagous amount of managed threads + */ + uint16_t loop_count; + + /** + * Event loop type. If the event loop type is set to AWS_EVENT_LOOP_PLATFORM_DEFAULT, the + * creation function will automatically use the platform’s default event loop type. + */ + enum aws_event_loop_type type; + + /** + * Optional callback to invoke when the event loop group finishes destruction. + */ + const struct aws_shutdown_callback_options *shutdown_options; + + /** + * Optional configuration to control how the event loop group's threads bind to CPU groups + */ + const uint16_t *cpu_group; + + /** + * Override for the clock function that event loops should use. Defaults to the system's high resolution + * timer. + * + * Do not bind this value to managed code; it is only used in timing-sensitive tests. + */ + aws_io_clock_fn *clock_override; +}; + +AWS_EXTERN_C_BEGIN + +/** + * The event loop will schedule the task and run it on the event loop thread as soon as possible. + * Note that cancelled tasks may execute outside the event loop thread. + * This function may be called from outside or inside the event loop thread. + * + * The task should not be cleaned up or modified until its function is executed. + */ +AWS_IO_API +void aws_event_loop_schedule_task_now(struct aws_event_loop *event_loop, struct aws_task *task); + +/** + * The event loop will schedule the task and run it at the specified time. + * Use aws_event_loop_current_clock_time() to query the current time in nanoseconds. + * Note that cancelled tasks may execute outside the event loop thread. + * This function may be called from outside or inside the event loop thread. + * + * The task should not be cleaned up or modified until its function is executed. + */ +AWS_IO_API +void aws_event_loop_schedule_task_future( + struct aws_event_loop *event_loop, + struct aws_task *task, + uint64_t run_at_nanos); + +/** + * Cancels task. + * This function must be called from the event loop's thread, and is only guaranteed + * to work properly on tasks scheduled from within the event loop's thread. + * The task will be executed with the AWS_TASK_STATUS_CANCELED status inside this call. + */ +AWS_IO_API +void aws_event_loop_cancel_task(struct aws_event_loop *event_loop, struct aws_task *task); + +/** + * Returns true if the event loop's thread is the same thread that called this function, otherwise false. + */ +AWS_IO_API +bool aws_event_loop_thread_is_callers_thread(struct aws_event_loop *event_loop); + +/** + * Gets the current timestamp for the event loop's clock, in nanoseconds. This function is thread-safe. + */ +AWS_IO_API +int aws_event_loop_current_clock_time(const struct aws_event_loop *event_loop, uint64_t *time_nanos); + +/** + * Creation function for event loop groups. + */ +AWS_IO_API +struct aws_event_loop_group *aws_event_loop_group_new( + struct aws_allocator *allocator, + const struct aws_event_loop_group_options *options); + +/** + * Increments the reference count on the event loop group, allowing the caller to take a reference to it. + * + * Returns the same event loop group passed in. + */ +AWS_IO_API +struct aws_event_loop_group *aws_event_loop_group_acquire(struct aws_event_loop_group *el_group); + +/** + * Decrements an event loop group's ref count. When the ref count drops to zero, the event loop group will be + * destroyed. + */ +AWS_IO_API +void aws_event_loop_group_release(struct aws_event_loop_group *el_group); + +/** + * Increments the reference count on the event loop group from event loop, allowing the caller to take a reference to + * it. + * + * Returns the base event loop group of the event loop, or null if the event loop does not belong to a group. + */ +AWS_IO_API +struct aws_event_loop_group *aws_event_loop_group_acquire_from_event_loop(struct aws_event_loop *event_loop); + +/** + * Decrements the ref count of the event loop's base event loop group. When the ref count drops to zero, the event loop + * group will be destroyed. + */ +AWS_IO_API +void aws_event_loop_group_release_from_event_loop(struct aws_event_loop *event_loop); + +/** + * Returns the event loop at a particular index. If the index is out of bounds, null is returned. + */ +AWS_IO_API +struct aws_event_loop *aws_event_loop_group_get_loop_at(struct aws_event_loop_group *el_group, size_t index); + +/** + * Gets the number of event loops managed by an event loop group. + */ +AWS_IO_API +size_t aws_event_loop_group_get_loop_count(const struct aws_event_loop_group *el_group); + +/** + * Fetches the next loop for use. The purpose is to enable load balancing across loops. You should not depend on how + * this load balancing is done as it is subject to change in the future. Currently it uses the "best-of-two" algorithm + * based on the load factor of each loop. + */ +AWS_IO_API +struct aws_event_loop *aws_event_loop_group_get_next_loop(struct aws_event_loop_group *el_group); + +/** + * @deprecated - use aws_event_loop_group_new() instead + */ +AWS_IO_API +struct aws_event_loop_group *aws_event_loop_group_new_default( + struct aws_allocator *alloc, + uint16_t max_threads, + const struct aws_shutdown_callback_options *shutdown_options); + +/** + * @deprecated - use aws_event_loop_group_new() instead + */ +AWS_IO_API +struct aws_event_loop_group *aws_event_loop_group_new_default_pinned_to_cpu_group( + struct aws_allocator *alloc, + uint16_t max_threads, + uint16_t cpu_group, + const struct aws_shutdown_callback_options *shutdown_options); + +/** + * @internal - Don't use outside of testing. + * + * Returns the opaque internal user data of an event loop. Can be cast into a specific implementation by + * privileged consumers. + */ +AWS_IO_API +void *aws_event_loop_get_impl(struct aws_event_loop *event_loop); + +/** + * @internal - Don't use outside of testing. + * + * Initializes the base structure used by all event loop implementations with test-oriented overrides. + */ +AWS_IO_API +struct aws_event_loop *aws_event_loop_new_base( + struct aws_allocator *allocator, + aws_io_clock_fn *clock, + struct aws_event_loop_vtable *vtable, + void *impl); + +/** + * @internal - Don't use outside of testing. + * + * Common cleanup code for all implementations. + * This is only called from the *destroy() function of event loop implementations. + */ +AWS_IO_API +void aws_event_loop_clean_up_base(struct aws_event_loop *event_loop); + +/** + * @internal - Don't use outside of testing. + * + * Destroys an event loop implementation. + * If the event loop is still in a running state, this function will block waiting on the event loop to shutdown. + * If the event loop is shared by multiple threads then destroy must be called by exactly one thread. All other threads + * must ensure their API calls to the event loop happen-before the call to destroy. + * + * Internally, this calls aws_event_loop_start_destroy() followed by aws_event_loop_complete_destroy() + */ +AWS_IO_API +void aws_event_loop_destroy(struct aws_event_loop *event_loop); + +/** + * @internal + * + * Signals an event loop to begin its destruction process. If an event loop's implementation of this API does anything, + * it must be quick and non-blocking. Most event loop implementations have an empty implementation for this function. + */ +AWS_IO_API +void aws_event_loop_start_destroy(struct aws_event_loop *event_loop); + +/** + * @internal + * + * Waits for an event loop to complete its destruction process. aws_event_loop_start_destroy() must have been called + * previously for this function to not deadlock. + */ +AWS_IO_API +void aws_event_loop_complete_destroy(struct aws_event_loop *event_loop); + +AWS_EXTERN_C_END + +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_EVENT_LOOP_H */ diff --git a/include/aws/io/exports.h b/include/aws/io/exports.h new file mode 100644 index 0000000000000000000000000000000000000000..49b88f00b92ea3f33328788c584519d75c31ee56 --- /dev/null +++ b/include/aws/io/exports.h @@ -0,0 +1,29 @@ +#ifndef AWS_IO_EXPORTS_H +#define AWS_IO_EXPORTS_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#if defined(AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined(_WIN32) +# ifdef AWS_IO_USE_IMPORT_EXPORT +# ifdef AWS_IO_EXPORTS +# define AWS_IO_API __declspec(dllexport) +# else +# define AWS_IO_API __declspec(dllimport) +# endif /* AWS_IO_EXPORTS */ +# else +# define AWS_IO_API +# endif /* USE_IMPORT_EXPORT */ + +#else +# if defined(AWS_IO_USE_IMPORT_EXPORT) && defined(AWS_IO_EXPORTS) +# define AWS_IO_API __attribute__((visibility("default"))) +# else +# define AWS_IO_API +# endif + +#endif /* defined(AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined(_WIN32) */ + +#endif /* AWS_IO_EXPORTS_H */ diff --git a/include/aws/io/file_utils.h b/include/aws/io/file_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..81cf387bd6a33ee97ee777254caedb705d6b9e9c --- /dev/null +++ b/include/aws/io/file_utils.h @@ -0,0 +1,12 @@ +#ifndef AWS_IO_FILE_UTILS_H +#define AWS_IO_FILE_UTILS_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* Just shim the code that's in to common, maintain the public interface */ +#include + +#endif /* AWS_IO_FILE_UTILS_H */ diff --git a/include/aws/io/future.h b/include/aws/io/future.h new file mode 100644 index 0000000000000000000000000000000000000000..d8ced51d078d866cda2edbcd2ff71eabf7092306 --- /dev/null +++ b/include/aws/io/future.h @@ -0,0 +1,686 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#ifndef AWS_IO_FUTURE_H +#define AWS_IO_FUTURE_H + +/* + +-------------------------------------------------------------------------------- +INTRO +-------------------------------------------------------------------------------- +An aws_future is used to deliver the result of an asynchronous function. + +When an async function is called, it creates a future and returns it to the caller. +When the async work is finished, it completes the future by setting an error or result value. +The caller waits until the future is done, checks for error, and then gets +the result if everything was OK. Typically, the caller waits by registering +a callback that the future invokes when it's done. There are many different +ways to register callbacks, depending on what thread you want it to fire on. + +If result type T has a "destructor" (clean_up(), destroy(), or release() function), +then the future has set_result_by_move() and get_result_by_move() functions +that explicitly transfer ownership to and from the future. +If the future dies, and still "owns" the resource, it calls the destructor. +If T has no destructor, then the future has set_result() and get_result() +functions that simply copy T by value. + +Macros are used to define a type-safe API for each result type T, +similar to C++ templates. This makes the API hard to browse, so functions +are documented in comments below. + +-------------------------------------------------------------------------------- +API (common to all aws_future) + The set/get result functions are mildly different based on T's + destructor type, and are documented later. +-------------------------------------------------------------------------------- + +// Create a new future, with refcount of 1. +struct aws_future_T *aws_future_T_new(struct aws_allocator *alloc); + +// Increment the refcount. +// You can pass NULL (has no effect). +// Returns the same pointer that was passed in. +struct aws_future_T *aws_future_T_acquire(struct aws_future_T *future); + +// Decrement the refcount. +// You can pass NULL (has no effect). +// Always returns NULL. +struct aws_future_T *aws_future_T_release(struct aws_future_T *future); + +// Set future as done, with an error_code. +// If the future is already done this call is ignored. +void aws_future_T_set_error(struct aws_future_T *future, int error_code); + +// Return whether the future is done. +bool aws_future_T_is_done(const struct aws_future_T *future); + +// Get the error-code of a completed future. +// If 0 is returned, then the future completed successfully, +// you may now get the result. +// +// WARNING: You MUST NOT call this until the future is done. +int aws_future_T_get_error(const struct aws_future_T *future); + +// Register callback to be invoked when the future completes. +// +// If the future is already done, the callback runs synchronously on the calling thread. +// If the future isn't done yet, the callback is registered, and it +// will run synchronously on whatever thread completes the future. +// +// WARNING: You MUST NOT register more than one callback. +void aws_future_T_register_callback(struct aws_future_T *future, aws_future_callback_fn *on_done, void *user_data); + +// If the future isn't done yet, then register the completion callback. +// +// Returns true if the callback was registered, +// or false if the future is already done. +// +// Use this when you can't risk the callback running synchronously. +// For example: If you're calling an async function repeatedly, +// and synchronous completion could lead to stack overflow due to recursion. +// Or if you are holding a non-recursive mutex, and the callback also +// needs the mutex, and an immediate callback would deadlock. +// +// WARNING: You MUST NOT register more than one callback. +bool aws_future_T_register_callback_if_not_done( + struct aws_future_T *future, + aws_future_callback_fn *on_done, + void *user_data); + +// Register completion callback to run async on an event-loop thread. +// +// When the future completes, the callback is scheduled to run as an event-loop task. +// +// Use this when you want the callback to run on the event-loop's thread, +// or to ensure the callback runs async even if the future completed synchronously. +// +// WARNING: You MUST NOT register more than one callback. +void aws_future_T_register_event_loop_callback( + struct aws_future_T *future, + struct aws_event_loop *event_loop, + aws_future_callback_fn *on_done, + void *user_data); + +// Register completion callback to run async on an aws_channel's thread. +// +// When the future completes, the callback is scheduled to run as a channel task. +// +// Use this when you want the callback to run on the channel's thread, +// or to ensure the callback runs async even if the future completed synchronously. +// +// WARNING: You MUST NOT register more than one callback. +void aws_future_T_register_channel_callback( + struct aws_future_T *future, + struct aws_channel *channel, + aws_future_callback_fn *on_done, + void *user_data); + +// Wait (up to timeout_ns) for future to complete. +// Returns true if future completes in this time. +// This blocks the current thread. It is dangerous to use anywhere except +// the main thread of simple programs or tests. +bool aws_future_T_wait(struct aws_future_T *future, uint64_t timeout_ns); + +-------------------------------------------------------------------------------- +AWS_FUTURE_T_BY_VALUE set/get API + Where T is stored by value, with no destructor. + Use with simple types like bool, size_t, enums, etc. +-------------------------------------------------------------------------------- + +// Set the result. +// +// If the future is already done this call is ignored. +void aws_future_T_set_result(const struct aws_future_T *future, T result); + +// Get the result of a completed future. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +T aws_future_T_get_result(const struct aws_future_T *future); + +-------------------------------------------------------------------------------- +AWS_FUTURE_T_BY_VALUE_WITH_CLEAN_UP set/get API + Where T is stored by value, with destructor like: void aws_T_clean_up(T*) + Use with types like aws_byte_buf. +-------------------------------------------------------------------------------- + +// Set the result, transferring ownership. +// +// The memory at `value_address` is memcpy'd into the future, +// and then zeroed out to help prevent accidental reuse. +// It is safe to call this multiple times. If the future is already done, +// the new result is destroyed instead of saved. +void aws_future_T_set_result_by_move(struct aws_future_T *future, T *value_address); + +// Get the result, transferring ownership. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +// WARNING: You MUST NOT call this multiple times. +T aws_future_T_get_result_by_move(struct aws_future_T *future); + +// Get the result, without transferring ownership. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +// WARNING: You MUST NOT call this multiple times. +T* aws_future_T_peek_result(const struct aws_future_T *future); + +-------------------------------------------------------------------------------- +AWS_FUTURE_T_POINTER_WITH_DESTROY set/get API + Where T is stored by pointer, with destructor like: void aws_T_destroy(T*) + Use with types like aws_string. +-------------------------------------------------------------------------------- + +// Set the result, transferring ownership. +// +// The value at `pointer_address` is copied into the future, +// and then set NULL to prevent accidental reuse. +// If the future is already done, this new result is destroyed instead of saved. +void aws_future_T_set_result_by_move(struct aws_future_T *future, T **pointer_address); + +// Get the result, transferring ownership. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +// WARNING: You MUST NOT call this multiple times. +T* aws_future_T_get_result_by_move(struct aws_future_T *future); + +// Get the result, without transferring ownership. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +// WARNING: You MUST NOT call this multiple times. +T* aws_future_T_peek_result(const struct aws_future_T *future); + +-------------------------------------------------------------------------------- +AWS_FUTURE_T_POINTER_WITH_RELEASE set/get API + Where T is stored by pointer, with destructor like: T* aws_T_release(T*) + Use with types like aws_http_message +-------------------------------------------------------------------------------- + +// Set the result, transferring ownership. +// +// The value at `pointer_address` is copied into the future, +// and then set NULL to prevent accidental reuse. +// If the future is already done, this new result is destroyed instead of saved. +void aws_future_T_set_result_by_move(struct aws_future_T *future, T **pointer_address); + +// Get the result, transferring ownership. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +// WARNING: You MUST NOT call this multiple times. +T* aws_future_T_get_result_by_move(struct aws_future_T *future); + +// Get the result, without transferring ownership. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +// WARNING: You MUST NOT call this multiple times. +T* aws_future_T_peek_result(const struct aws_future_T *future); + +-------------------------------------------------------------------------------- +AWS_FUTURE_T_POINTER set/get API + Where T is stored by pointer, with no destructor. + No known use cases, but it's here for completeness. +-------------------------------------------------------------------------------- + +// Set the result. +// +// If the future is already done this call is ignored. +void aws_future_T_set_result(const struct aws_future_T *future, T *result); + +// Get the result of a completed future. +// +// WARNING: You MUST NOT call this until the future is done. +// WARNING: You MUST NOT call this unless get_error() returned 0. +T* aws_future_T_get_result(const struct aws_future_T *future); + +-------------------------------------------------------------------------------- +DEFINING NEW aws_future +-------------------------------------------------------------------------------- + +Macros are used to define a type-safe API for each result type T, similar to C++ templates. + +Use the _DECLARATION() macro in the same header where T's API is declared. +Use the _IMPLEMENTATION() macro in the corresponding .c file. +The macros can only be used once for each type T, +so it makes sense to put it where T is declared. +If T lives in a single .c file and has no header, you can simply use the +_IMPLEMENTATION() macro without a _DECLARATION(). + +You must pick the right macros for your particular T, based on whether T is stored +by value or by pointer, and which type of "destructor" function it has: + +- AWS_FUTURE_T_BY_VALUE: A future that holds a simple T by value, that needs no destructor. + Use with types like bool, size_t, enums, etc. + Example: + AWS_FUTURE_T_BY_VALUE_DECLARATION(aws_future_size, size_t, AWS_IO_API) + AWS_FUTURE_T_BY_VALUE_IMPLEMENTATION(aws_future_size, size_t) + +- AWS_FUTURE_T_BY_VALUE_WITH_CLEAN_UP: A future that holds T by value, with destructor like: void aws_T_clean_up(T*) + Use with types like aws_byte_buf. + Example: + AWS_FUTURE_T_BY_VALUE_WITH_CLEAN_UP_DECLARATION(aws_future_byte_buf, aws_byte_buf, AWS_IO_API) + AWS_FUTURE_T_BY_VALUE_WITH_CLEAN_UP_IMPLEMENTATION(aws_future_byte_buf, aws_byte_buf, + aws_byte_buf_clean_up); +- AWS_FUTURE_T_POINTER_WITH_DESTROY: A future that holds T*, with destructor like: void aws_T_destroy(T*) + Use with types like aws_string. + Example: + AWS_FUTURE_T_POINTER_WITH_DESTROY_DECLARATION(aws_future_string, aws_string, AWS_IO_API) + AWS_FUTURE_T_POINTER_WITH_DESTROY_DECLARATION(aws_future_string, aws_string, AWS_IO_API) + +- AWS_FUTURE_T_POINTER_WITH_RELEASE: A future that holds T*, with destructor like: T* aws_T_release(T*) + Use with types like aws_http_message + Example: + AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(aws_future_http_message, struct aws_http_message, + AWS_HTTP_API) + AWS_FUTURE_T_POINTER_WITH_RELEASE_IMPLEMENTATION(aws_future_http_message, struct aws_http_message, + aws_http_message_release) + +- AWS_FUTURE_T_POINTER: A future that holds T*, with no destructor. + No known use cases, but it's here for completeness. + Example: + AWS_FUTURE_T_POINTER_DECLARATION(aws_future_file. FILE, AWS_IO_API) + AWS_FUTURE_T_POINTER_IMPLEMENTATION(aws_future_file. FILE) + +-------------------------------------------------------------------------------- +DESIGN (if you're curious) +-------------------------------------------------------------------------------- +This class was developed to give the user more control over how the completion +callback is invoked. In the past, we passed completion callbacks to the async +function. But this could lead to issues when an async function "sometimes" +completed synchronously and "sometimes" completed async. The async function +would need to stress about how to schedule the callback so it was always async, +or more typically just invoke it whenever and leave the caller to figure it out. + +This class is also an experiment with "templates/generics in C". +In order to make the class type-safe, we use macros to define a unique +API for each result type T we need to store in a future. +If we refer to aws_future, we mean a struct named +aws_future_byte_buf, which stores an aws_byte_buf by value. +This could lead to code bloat, but the type-safety seems worth it. + +future is defined in aws-c-io, instead of aws-c-common, so it can +easily integrate with aws_event_loop and aws_channel. + +It's legal to call set_error() or set_result() multiple times. +If the future is already done, it ignores the call. +If result T has a destructor, the new result is immediately freed instead of saved. +This design lets us deal with ambiguity where it's not 100% certain whether a handoff occurred. +For example: if we call from C->Java and an exception is thrown, +it's not clear whether Java got the handoff. In this case, we can safely +call set_error(), completing the future if necessary, +or being ignored if the future was already done. + +*/ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_channel; +struct aws_event_loop; +struct aws_future_impl; + +/** Completion callback for aws_future */ +typedef void(aws_future_callback_fn)(void *user_data); + +typedef void(aws_future_impl_result_clean_up_fn)(void *result_addr); +typedef void(aws_future_impl_result_destroy_fn)(void *result); +typedef void *(aws_future_impl_result_release_fn)(void *result); + +AWS_EXTERN_C_BEGIN + +AWS_IO_API +struct aws_future_impl *aws_future_impl_new_by_value(struct aws_allocator *alloc, size_t sizeof_result); + +AWS_IO_API +struct aws_future_impl *aws_future_impl_new_by_value_with_clean_up( + struct aws_allocator *alloc, + size_t sizeof_result, + aws_future_impl_result_clean_up_fn *result_clean_up); + +AWS_IO_API +struct aws_future_impl *aws_future_impl_new_pointer(struct aws_allocator *alloc); + +AWS_IO_API +struct aws_future_impl *aws_future_impl_new_pointer_with_destroy( + struct aws_allocator *alloc, + aws_future_impl_result_destroy_fn *result_destroy); + +AWS_IO_API +struct aws_future_impl *aws_future_impl_new_pointer_with_release( + struct aws_allocator *alloc, + aws_future_impl_result_release_fn *result_release); + +AWS_IO_API +struct aws_future_impl *aws_future_impl_release(struct aws_future_impl *promise); + +AWS_IO_API +struct aws_future_impl *aws_future_impl_acquire(struct aws_future_impl *promise); + +AWS_IO_API +void aws_future_impl_set_error(struct aws_future_impl *promise, int error_code); + +AWS_IO_API +void aws_future_impl_set_result_by_move(struct aws_future_impl *promise, void *src_address); + +AWS_IO_API +bool aws_future_impl_is_done(const struct aws_future_impl *future); + +AWS_IO_API +void aws_future_impl_register_callback( + struct aws_future_impl *future, + aws_future_callback_fn *on_done, + void *user_data); + +AWS_IO_API +bool aws_future_impl_register_callback_if_not_done( + struct aws_future_impl *future, + aws_future_callback_fn *on_done, + void *user_data); + +AWS_IO_API +void aws_future_impl_register_event_loop_callback( + struct aws_future_impl *future, + struct aws_event_loop *event_loop, + aws_future_callback_fn *on_done, + void *user_data); + +AWS_IO_API +void aws_future_impl_register_channel_callback( + struct aws_future_impl *future, + struct aws_channel *channel, + aws_future_callback_fn *on_done, + void *user_data); + +AWS_IO_API +bool aws_future_impl_wait(const struct aws_future_impl *future, uint64_t timeout_ns); + +AWS_IO_API +int aws_future_impl_get_error(const struct aws_future_impl *future); + +AWS_IO_API +void *aws_future_impl_get_result_address(const struct aws_future_impl *future); + +AWS_IO_API +void aws_future_impl_get_result_by_move(struct aws_future_impl *future, void *dst_address); + +/* Common beginning to all aws_future declarations */ +#define AWS_FUTURE_T_DECLARATION_BEGIN(FUTURE, API) struct FUTURE; + +/* Common beginning to all aws_future implementations */ +#define AWS_FUTURE_T_IMPLEMENTATION_BEGIN(FUTURE) + +/* Common end to all aws_future declarations */ +#define AWS_FUTURE_T_DECLARATION_END(FUTURE, API) \ + API struct FUTURE *FUTURE##_acquire(struct FUTURE *future); \ + API struct FUTURE *FUTURE##_release(struct FUTURE *future); \ + API void FUTURE##_set_error(struct FUTURE *future, int error_code); \ + API bool FUTURE##_is_done(const struct FUTURE *future); \ + API int FUTURE##_get_error(const struct FUTURE *future); \ + API void FUTURE##_register_callback(struct FUTURE *future, aws_future_callback_fn *on_done, void *user_data); \ + API bool FUTURE##_register_callback_if_not_done( \ + struct FUTURE *future, aws_future_callback_fn *on_done, void *user_data); \ + API void FUTURE##_register_event_loop_callback( \ + struct FUTURE *future, struct aws_event_loop *event_loop, aws_future_callback_fn *on_done, void *user_data); \ + API void FUTURE##_register_channel_callback( \ + struct FUTURE *future, struct aws_channel *channel, aws_future_callback_fn *on_done, void *user_data); \ + API bool FUTURE##_wait(struct FUTURE *future, uint64_t timeout_ns); + +/* Common end to all aws_future implementations */ +#define AWS_FUTURE_T_IMPLEMENTATION_END(FUTURE) \ + struct FUTURE *FUTURE##_acquire(struct FUTURE *future) { \ + return (struct FUTURE *)aws_future_impl_acquire((struct aws_future_impl *)future); \ + } \ + \ + struct FUTURE *FUTURE##_release(struct FUTURE *future) { \ + return (struct FUTURE *)aws_future_impl_release((struct aws_future_impl *)future); \ + } \ + \ + void FUTURE##_set_error(struct FUTURE *future, int error_code) { \ + aws_future_impl_set_error((struct aws_future_impl *)future, error_code); \ + } \ + \ + bool FUTURE##_is_done(const struct FUTURE *future) { \ + return aws_future_impl_is_done((const struct aws_future_impl *)future); \ + } \ + \ + int FUTURE##_get_error(const struct FUTURE *future) { \ + return aws_future_impl_get_error((const struct aws_future_impl *)future); \ + } \ + \ + void FUTURE##_register_callback(struct FUTURE *future, aws_future_callback_fn *on_done, void *user_data) { \ + aws_future_impl_register_callback((struct aws_future_impl *)future, on_done, user_data); \ + } \ + \ + bool FUTURE##_register_callback_if_not_done( \ + struct FUTURE *future, aws_future_callback_fn *on_done, void *user_data) { \ + \ + return aws_future_impl_register_callback_if_not_done((struct aws_future_impl *)future, on_done, user_data); \ + } \ + \ + void FUTURE##_register_event_loop_callback( \ + struct FUTURE *future, struct aws_event_loop *event_loop, aws_future_callback_fn *on_done, void *user_data) { \ + \ + aws_future_impl_register_event_loop_callback( \ + (struct aws_future_impl *)future, event_loop, on_done, user_data); \ + } \ + \ + void FUTURE##_register_channel_callback( \ + struct FUTURE *future, struct aws_channel *channel, aws_future_callback_fn *on_done, void *user_data) { \ + \ + aws_future_impl_register_channel_callback((struct aws_future_impl *)future, channel, on_done, user_data); \ + } \ + \ + bool FUTURE##_wait(struct FUTURE *future, uint64_t timeout_ns) { \ + return aws_future_impl_wait((struct aws_future_impl *)future, timeout_ns); \ + } + +/** + * Declare a future that holds a simple T by value, that needs no destructor. + * Use with types like bool, size_t, etc. + * + * See top of future.h for docs. + */ +#define AWS_FUTURE_T_BY_VALUE_DECLARATION(FUTURE, T, API) \ + AWS_FUTURE_T_DECLARATION_BEGIN(FUTURE, API) \ + API struct FUTURE *FUTURE##_new(struct aws_allocator *alloc); \ + API void FUTURE##_set_result(struct FUTURE *future, T result); \ + API T FUTURE##_get_result(const struct FUTURE *future); \ + AWS_FUTURE_T_DECLARATION_END(FUTURE, API) + +#define AWS_FUTURE_T_BY_VALUE_IMPLEMENTATION(FUTURE, T) \ + AWS_FUTURE_T_IMPLEMENTATION_BEGIN(FUTURE) \ + struct FUTURE *FUTURE##_new(struct aws_allocator *alloc) { \ + return (struct FUTURE *)aws_future_impl_new_by_value(alloc, sizeof(T)); \ + } \ + \ + void FUTURE##_set_result(struct FUTURE *future, T result) { \ + aws_future_impl_set_result_by_move((struct aws_future_impl *)future, &result); \ + } \ + \ + T FUTURE##_get_result(const struct FUTURE *future) { \ + return *(T *)aws_future_impl_get_result_address((const struct aws_future_impl *)future); \ + } \ + AWS_FUTURE_T_IMPLEMENTATION_END(FUTURE) + +/** + * Declares a future that holds T by value, with destructor like: void aws_T_clean_up(T*) + * Use with types like aws_byte_buf. + * + * See top of future.h for docs. + */ +#define AWS_FUTURE_T_BY_VALUE_WITH_CLEAN_UP_DECLARATION(FUTURE, T, API) \ + AWS_FUTURE_T_DECLARATION_BEGIN(FUTURE, API) \ + API struct FUTURE *FUTURE##_new(struct aws_allocator *alloc); \ + API void FUTURE##_set_result_by_move(struct FUTURE *future, T *value_address); \ + API T *FUTURE##_peek_result(const struct FUTURE *future); \ + API T FUTURE##_get_result_by_move(struct FUTURE *future); \ + AWS_FUTURE_T_DECLARATION_END(FUTURE, API) + +#define AWS_FUTURE_T_BY_VALUE_WITH_CLEAN_UP_IMPLEMENTATION(FUTURE, T, CLEAN_UP_FN) \ + AWS_FUTURE_T_IMPLEMENTATION_BEGIN(FUTURE) \ + \ + struct FUTURE *FUTURE##_new(struct aws_allocator *alloc) { \ + void (*clean_up_fn)(T *) = CLEAN_UP_FN; /* check clean_up() function signature */ \ + return (struct FUTURE *)aws_future_impl_new_by_value_with_clean_up( \ + alloc, sizeof(T), (aws_future_impl_result_clean_up_fn)clean_up_fn); \ + } \ + \ + void FUTURE##_set_result_by_move(struct FUTURE *future, T *value_address) { \ + aws_future_impl_set_result_by_move((struct aws_future_impl *)future, value_address); \ + } \ + \ + T *FUTURE##_peek_result(const struct FUTURE *future) { \ + return aws_future_impl_get_result_address((const struct aws_future_impl *)future); \ + } \ + \ + T FUTURE##_get_result_by_move(struct FUTURE *future) { \ + T value; \ + aws_future_impl_get_result_by_move((struct aws_future_impl *)future, &value); \ + return value; \ + } \ + \ + AWS_FUTURE_T_IMPLEMENTATION_END(FUTURE) + +/** + * Declares a future that holds T*, with no destructor. + * + * See top of future.h for docs. + */ +#define AWS_FUTURE_T_POINTER_DECLARATION(FUTURE, T, API) \ + AWS_FUTURE_T_DECLARATION_BEGIN(FUTURE, API) \ + API struct FUTURE *FUTURE##_new(struct aws_allocator *alloc); \ + API void FUTURE##_set_result(struct FUTURE *future, T *result); \ + API T *FUTURE##_get_result(const struct FUTURE *future); \ + AWS_FUTURE_T_DECLARATION_END(FUTURE, API) + +#define AWS_FUTURE_T_POINTER_IMPLEMENTATION(FUTURE, T) \ + AWS_FUTURE_T_IMPLEMENTATION_BEGIN(FUTURE) \ + \ + struct FUTURE *FUTURE##_new(struct aws_allocator *alloc) { \ + return (struct FUTURE *)aws_future_impl_new_pointer(alloc); \ + } \ + \ + void FUTURE##_set_result(struct FUTURE *future, T *result) { \ + aws_future_impl_set_result_by_move((struct aws_future_impl *)future, &result); \ + } \ + \ + T *FUTURE##_get_result(const struct FUTURE *future) { \ + return *(T **)aws_future_impl_get_result_address((const struct aws_future_impl *)future); \ + } \ + \ + AWS_FUTURE_T_IMPLEMENTATION_END(FUTURE) + +/** + * Declares a future that holds T*, with destructor like: void aws_T_destroy(T*) + * Use with types like aws_string. + * + * See top of future.h for docs. + */ +#define AWS_FUTURE_T_POINTER_WITH_DESTROY_DECLARATION(FUTURE, T, API) \ + AWS_FUTURE_T_DECLARATION_BEGIN(FUTURE, API) \ + API struct FUTURE *FUTURE##_new(struct aws_allocator *alloc); \ + API void FUTURE##_set_result_by_move(struct FUTURE *future, T **pointer_address); \ + API T *FUTURE##_get_result_by_move(struct FUTURE *future); \ + API T *FUTURE##_peek_result(const struct FUTURE *future); \ + AWS_FUTURE_T_DECLARATION_END(FUTURE, API) + +#define AWS_FUTURE_T_POINTER_WITH_DESTROY_IMPLEMENTATION(FUTURE, T, DESTROY_FN) \ + AWS_FUTURE_T_IMPLEMENTATION_BEGIN(FUTURE) \ + \ + struct FUTURE *FUTURE##_new(struct aws_allocator *alloc) { \ + void (*destroy_fn)(T *) = DESTROY_FN; /* check destroy() function signature */ \ + return (struct FUTURE *)aws_future_impl_new_pointer_with_destroy( \ + alloc, (aws_future_impl_result_destroy_fn *)destroy_fn); \ + } \ + \ + void FUTURE##_set_result_by_move(struct FUTURE *future, T **pointer_address) { \ + aws_future_impl_set_result_by_move((struct aws_future_impl *)future, pointer_address); \ + } \ + \ + T *FUTURE##_get_result_by_move(struct FUTURE *future) { \ + T *pointer; \ + aws_future_impl_get_result_by_move((struct aws_future_impl *)future, &pointer); \ + return pointer; \ + } \ + \ + T *FUTURE##_peek_result(const struct FUTURE *future) { \ + return *(T **)aws_future_impl_get_result_address((const struct aws_future_impl *)future); \ + } \ + \ + AWS_FUTURE_T_IMPLEMENTATION_END(FUTURE) + +/** + * Declares a future that holds T*, with destructor like: T* aws_T_release(T*) + * Use with types like aws_http_message + * + * See top of future.h for docs. + */ +#define AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(FUTURE, T, API) \ + AWS_FUTURE_T_DECLARATION_BEGIN(FUTURE, API) \ + API struct FUTURE *FUTURE##_new(struct aws_allocator *alloc); \ + API void FUTURE##_set_result_by_move(struct FUTURE *future, T **pointer_address); \ + API T *FUTURE##_get_result_by_move(struct FUTURE *future); \ + API T *FUTURE##_peek_result(const struct FUTURE *future); \ + AWS_FUTURE_T_DECLARATION_END(FUTURE, API) + +#define AWS_FUTURE_T_POINTER_WITH_RELEASE_IMPLEMENTATION(FUTURE, T, RELEASE_FN) \ + AWS_FUTURE_T_IMPLEMENTATION_BEGIN(FUTURE) \ + \ + struct FUTURE *FUTURE##_new(struct aws_allocator *alloc) { \ + T *(*release_fn)(T *) = RELEASE_FN; /* check release() function signature */ \ + return (struct FUTURE *)aws_future_impl_new_pointer_with_release( \ + alloc, (aws_future_impl_result_release_fn *)release_fn); \ + } \ + \ + void FUTURE##_set_result_by_move(struct FUTURE *future, T **pointer_address) { \ + aws_future_impl_set_result_by_move((struct aws_future_impl *)future, pointer_address); \ + } \ + \ + T *FUTURE##_get_result_by_move(struct FUTURE *future) { \ + T *pointer; \ + aws_future_impl_get_result_by_move((struct aws_future_impl *)future, &pointer); \ + return pointer; \ + } \ + \ + T *FUTURE##_peek_result(const struct FUTURE *future) { \ + return *(T **)aws_future_impl_get_result_address((const struct aws_future_impl *)future); \ + } \ + \ + AWS_FUTURE_T_IMPLEMENTATION_END(FUTURE) + +/** + * aws_future + * See top of future.h for docs. + */ +AWS_FUTURE_T_BY_VALUE_DECLARATION(aws_future_size, size_t, AWS_IO_API) + +/** + * aws_future + * See top of future.h for docs. + */ +AWS_FUTURE_T_BY_VALUE_DECLARATION(aws_future_bool, bool, AWS_IO_API) + +/** + * aws_future + * See top of future.h for docs. + */ +AWS_FUTURE_T_DECLARATION_BEGIN(aws_future_void, AWS_IO_API) + +AWS_IO_API struct aws_future_void *aws_future_void_new(struct aws_allocator *alloc); + +AWS_IO_API void aws_future_void_set_result(struct aws_future_void *future); + +AWS_FUTURE_T_DECLARATION_END(aws_future_void, AWS_IO_API) + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_FUTURE_H */ diff --git a/include/aws/io/host_resolver.h b/include/aws/io/host_resolver.h new file mode 100644 index 0000000000000000000000000000000000000000..213729c1833886780961e75a432808804a512181 --- /dev/null +++ b/include/aws/io/host_resolver.h @@ -0,0 +1,275 @@ +#ifndef AWS_IO_HOST_RESOLVER_H +#define AWS_IO_HOST_RESOLVER_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_event_loop_group; + +enum aws_address_record_type { + /* ipv4 address. */ + AWS_ADDRESS_RECORD_TYPE_A, + /* ipv6 address. */ + AWS_ADDRESS_RECORD_TYPE_AAAA +}; + +enum aws_get_host_address_flags { + /* get number of ipv4 addresses. */ + AWS_GET_HOST_ADDRESS_COUNT_RECORD_TYPE_A = 0x00000001, + /* get number of ipv6 addresses. */ + AWS_GET_HOST_ADDRESS_COUNT_RECORD_TYPE_AAAA = 0x00000002 +}; + +struct aws_string; + +struct aws_host_address { + struct aws_allocator *allocator; + const struct aws_string *host; + const struct aws_string *address; + enum aws_address_record_type record_type; + uint64_t expiry; + /* This next section is strictly for mitigating the impact of sticky hosts that aren't performing well. */ + /*for use in DNS-based load balancing.*/ + size_t use_count; + /* give a hint on when to remove a bad host from service. */ + size_t connection_failure_count; + /* we don't implement this yet, but we will asap. */ + uint8_t weight; +}; + +struct aws_host_resolver; +/** + * Invoked once an address has been resolved for host. The type in host_addresses is struct aws_host_address (by-value). + * The caller does not own this memory and you must copy the host address before returning from this function if you + * plan to use it later. For convenience, we've provided the aws_host_address_copy() and aws_host_address_clean_up() + * functions. + */ +typedef void(aws_on_host_resolved_result_fn)( + struct aws_host_resolver *resolver, + const struct aws_string *host_name, + int err_code, + const struct aws_array_list *host_addresses, + void *user_data); + +/** + * Function signature for configuring your own resolver (the default just uses getaddrinfo()). The type in + * output_addresses is struct aws_host_address (by-value). We assume this function blocks, hence this absurdly + * complicated design. + */ +typedef int(aws_resolve_host_implementation_fn)( + struct aws_allocator *allocator, + const struct aws_string *host_name, + struct aws_array_list *output_addresses, + void *user_data); + +struct aws_host_resolution_config { + aws_resolve_host_implementation_fn *impl; + size_t max_ttl; + void *impl_data; + uint64_t resolve_frequency_ns; /* 0 defaults to 1 second interval */ +}; + +struct aws_host_resolver_purge_host_options { + /* the host to purge the cache for */ + const struct aws_string *host; + /* Callback to invoke when the purge is complete */ + aws_simple_completion_callback *on_host_purge_complete_callback; + /* user_data will be passed as it is in the callback. */ + void *user_data; +}; + +/** should you absolutely disdain the default implementation, feel free to implement your own. */ +struct aws_host_resolver_vtable { + /** clean up everything you allocated, but not resolver itself. */ + void (*destroy)(struct aws_host_resolver *resolver); + + /** resolve the host by host_name, the user owns host_name, so it needs to be copied if you persist it, + * invoke res with the result. This function should never block. */ + int (*resolve_host)( + struct aws_host_resolver *resolver, + const struct aws_string *host_name, + aws_on_host_resolved_result_fn *res, + const struct aws_host_resolution_config *config, + void *user_data); + + /** gives your implementation a hint that an address has some failed connections occuring. Do whatever you want (or + * nothing) about it. + */ + int (*record_connection_failure)(struct aws_host_resolver *resolver, const struct aws_host_address *address); + + /** + * @Deprecated Use purge_cache_with_callback instead + * wipe out anything you have cached. */ + int (*purge_cache)(struct aws_host_resolver *resolver); + + /** wipe out anything you have cached. */ + int (*purge_cache_with_callback)( + struct aws_host_resolver *resolver, + aws_simple_completion_callback *on_purge_cache_complete_callback, + void *user_data); + + /** wipe out anything cached for a specific host */ + int (*purge_host_cache)( + struct aws_host_resolver *resolver, + const struct aws_host_resolver_purge_host_options *options); + + /** get number of addresses for a given host. */ + size_t (*get_host_address_count)( + struct aws_host_resolver *resolver, + const struct aws_string *host_name, + uint32_t flags); +}; + +struct aws_host_resolver { + struct aws_allocator *allocator; + void *impl; + struct aws_host_resolver_vtable *vtable; + struct aws_ref_count ref_count; + struct aws_shutdown_callback_options shutdown_options; +}; + +struct aws_host_resolver_default_options { + size_t max_entries; + struct aws_event_loop_group *el_group; + const struct aws_shutdown_callback_options *shutdown_options; + aws_io_clock_fn *system_clock_override_fn; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Copies `from` to `to`. + */ +AWS_IO_API int aws_host_address_copy(const struct aws_host_address *from, struct aws_host_address *to); + +/** + * Moves `from` to `to`. After this call, from is no longer usable. Though, it could be resused for another + * move or copy operation. + */ +AWS_IO_API void aws_host_address_move(struct aws_host_address *from, struct aws_host_address *to); + +/** + * Cleans up the memory for `address` + */ +AWS_IO_API void aws_host_address_clean_up(struct aws_host_address *address); + +/** WARNING! do not call this function directly (getaddrinfo()): it blocks. Provide a pointer to this function for other + * resolution functions. */ +AWS_IO_API int aws_default_dns_resolve( + struct aws_allocator *allocator, + const struct aws_string *host_name, + struct aws_array_list *output_addresses, + void *user_data); + +/** + * Creates a host resolver with the default behavior. Here's the behavior: + * + * Since there's not a reliable way to do non-blocking DNS without a ton of risky work that would need years of testing + * on every Unix system in existence, we work around it by doing a threaded implementation. + * + * When you request an address, it checks the cache. If the entry isn't in the cache it creates a new one. + * Each entry has a potentially short lived back-ground thread based on ttl for the records. Once we've populated the + * cache and you keep the resolver active, the resolution callback will be invoked immediately. When it's idle, it will + * take a little while in the background thread to fetch more, evaluate TTLs etc... In that case your callback will be + * invoked from the background thread. + * + * -------------------------------------------------------------------------------------------------------------------- + * + * A few things to note about TTLs and connection failures. + * + * We attempt to honor your max ttl but will not honor it if dns queries are failing or all of your connections are + * marked as failed. Once we are able to query dns again, we will re-evaluate the TTLs. + * + * Upon notification connection failures, we move them to a separate list. Eventually we retry them when it's likely + * that the endpoint is healthy again or we don't really have another choice, but we try to keep them out of your + * hot path. + * + * --------------------------------------------------------------------------------------------------------------------- + * + * Finally, this entire design attempts to prevent problems where developers have to choose between large TTLs and thus + * sticky hosts or short TTLs and good fleet utilization but now higher latencies. In this design, we resolve every + * second in the background (only while you're actually using the record), but we do not expire the earlier resolved + * addresses until max ttl has passed. + * + * This for example, should enable you to hit thousands of hosts in the Amazon S3 fleet instead of just one or two. + */ +AWS_IO_API struct aws_host_resolver *aws_host_resolver_new_default( + struct aws_allocator *allocator, + const struct aws_host_resolver_default_options *options); + +/** + * Increments the reference count on the host resolver, allowing the caller to take a reference to it. + * + * Returns the same host resolver passed in. + */ +AWS_IO_API struct aws_host_resolver *aws_host_resolver_acquire(struct aws_host_resolver *resolver); + +/** + * Decrements a host resolver's ref count. When the ref count drops to zero, the resolver will be destroyed. + */ +AWS_IO_API void aws_host_resolver_release(struct aws_host_resolver *resolver); + +/** + * calls resolve_host on the vtable. config will be copied. + */ +AWS_IO_API int aws_host_resolver_resolve_host( + struct aws_host_resolver *resolver, + const struct aws_string *host_name, + aws_on_host_resolved_result_fn *res, + const struct aws_host_resolution_config *config, + void *user_data); + +/** + * calls record_connection_failure on the vtable. + */ +AWS_IO_API int aws_host_resolver_record_connection_failure( + struct aws_host_resolver *resolver, + const struct aws_host_address *address); + +/** + * @Deprecated Use purge_cache_with_callback instead + * calls purge_cache on the vtable. + */ +AWS_IO_API int aws_host_resolver_purge_cache(struct aws_host_resolver *resolver); + +/** + * Calls aws_host_resolver_purge_cache_with_callback on the vtable which will wipe out everything host resolver has + * cached. + */ +AWS_IO_API int aws_host_resolver_purge_cache_with_callback( + struct aws_host_resolver *resolver, + aws_simple_completion_callback *on_purge_cache_complete_callback, + void *user_data); + +/** + * Removes the cache for a host asynchronously. + */ +AWS_IO_API int aws_host_resolver_purge_host_cache( + struct aws_host_resolver *resolver, + const struct aws_host_resolver_purge_host_options *options); + +/** + * get number of addresses for a given host. + */ +AWS_IO_API size_t aws_host_resolver_get_host_address_count( + struct aws_host_resolver *resolver, + const struct aws_string *host_name, + uint32_t flags); + +/** + * Returns the default host resolution config used internally if none specified. + * + * @return default host resolution config + */ +AWS_IO_API struct aws_host_resolution_config aws_host_resolver_init_default_resolution_config(void); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_HOST_RESOLVER_H */ diff --git a/include/aws/io/io.h b/include/aws/io/io.h new file mode 100644 index 0000000000000000000000000000000000000000..9d958939b18d4bc1e45a6fc4ca2eca7d0d31aa4a --- /dev/null +++ b/include/aws/io/io.h @@ -0,0 +1,302 @@ +#ifndef AWS_IO_IO_H +#define AWS_IO_IO_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_C_IO_PACKAGE_ID 1 + +struct aws_io_handle; +typedef void aws_io_set_queue_on_handle_fn(struct aws_io_handle *handle, void *queue); + +struct aws_io_handle { + union { + int fd; + /* on Apple systems, handle is of type nw_connection_t. On Windows, it's a SOCKET handle. */ + void *handle; + } data; + void *additional_data; + aws_io_set_queue_on_handle_fn *set_queue; +}; + +enum aws_io_message_type { + AWS_IO_MESSAGE_APPLICATION_DATA, +}; + +struct aws_io_message; +struct aws_channel; + +typedef void(aws_channel_on_message_write_completed_fn)( + struct aws_channel *channel, + struct aws_io_message *message, + int err_code, + void *user_data); + +struct aws_io_message { + /** + * Allocator used for the message and message data. If this is null, the message belongs to a pool or some other + * message manager. + */ + struct aws_allocator *allocator; + + /** + * Buffer containing the data for message + */ + struct aws_byte_buf message_data; + + /** + * type of the message. This is used for framework control messages. Currently the only type is + * AWS_IO_MESSAGE_APPLICATION_DATA + */ + enum aws_io_message_type message_type; + + /** + * Conveys information about the contents of message_data (e.g. cast the ptr to some type). If 0, it's just opaque + * data. + */ + int message_tag; + + /** + * In order to avoid excess allocations/copies, on a partial read or write, the copy mark is set to indicate how + * much of this message has already been processed or copied. + */ + size_t copy_mark; + + /** + * The channel that the message is bound to. + */ + struct aws_channel *owning_channel; + + /** + * Invoked by the channel once the entire message has been written to the data sink. + */ + aws_channel_on_message_write_completed_fn *on_completion; + + /** + * arbitrary user data for the on_completion callback + */ + void *user_data; + + /** it's incredibly likely something is going to need to queue this, + * go ahead and make sure the list info is part of the original allocation. + */ + struct aws_linked_list_node queueing_handle; +}; + +typedef int(aws_io_clock_fn)(uint64_t *timestamp); + +enum aws_io_errors { + AWS_IO_CHANNEL_ERROR_ERROR_CANT_ACCEPT_INPUT = AWS_ERROR_ENUM_BEGIN_RANGE(AWS_C_IO_PACKAGE_ID), + AWS_IO_CHANNEL_UNKNOWN_MESSAGE_TYPE, + AWS_IO_CHANNEL_READ_WOULD_EXCEED_WINDOW, + AWS_IO_EVENT_LOOP_ALREADY_ASSIGNED, + AWS_IO_EVENT_LOOP_SHUTDOWN, + AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE, + AWS_IO_TLS_ERROR_NOT_NEGOTIATED, + AWS_IO_TLS_ERROR_WRITE_FAILURE, + AWS_IO_TLS_ERROR_ALERT_RECEIVED, + AWS_IO_TLS_CTX_ERROR, + AWS_IO_TLS_VERSION_UNSUPPORTED, + AWS_IO_TLS_CIPHER_PREF_UNSUPPORTED, + AWS_IO_MISSING_ALPN_MESSAGE, + AWS_IO_UNHANDLED_ALPN_PROTOCOL_MESSAGE, + AWS_IO_FILE_VALIDATION_FAILURE, + AWS_ERROR_IO_EVENT_LOOP_THREAD_ONLY, + AWS_ERROR_IO_ALREADY_SUBSCRIBED, + AWS_ERROR_IO_NOT_SUBSCRIBED, + AWS_ERROR_IO_OPERATION_CANCELLED, + AWS_IO_READ_WOULD_BLOCK, + AWS_IO_BROKEN_PIPE, + AWS_IO_SOCKET_UNSUPPORTED_ADDRESS_FAMILY, + AWS_IO_SOCKET_INVALID_OPERATION_FOR_TYPE, + AWS_IO_SOCKET_CONNECTION_REFUSED, + AWS_IO_SOCKET_TIMEOUT, + AWS_IO_SOCKET_NO_ROUTE_TO_HOST, + AWS_IO_SOCKET_NETWORK_DOWN, + AWS_IO_SOCKET_CLOSED, + AWS_IO_SOCKET_NOT_CONNECTED, + AWS_IO_SOCKET_INVALID_OPTIONS, + AWS_IO_SOCKET_ADDRESS_IN_USE, + AWS_IO_SOCKET_INVALID_ADDRESS, + AWS_IO_SOCKET_ILLEGAL_OPERATION_FOR_STATE, + AWS_IO_SOCKET_CONNECT_ABORTED, + AWS_IO_DNS_QUERY_FAILED, + AWS_IO_DNS_INVALID_NAME, + AWS_IO_DNS_NO_ADDRESS_FOR_HOST, + AWS_IO_DNS_HOST_REMOVED_FROM_CACHE, + AWS_IO_STREAM_INVALID_SEEK_POSITION, + AWS_IO_STREAM_READ_FAILED, + DEPRECATED_AWS_IO_INVALID_FILE_HANDLE, + AWS_IO_SHARED_LIBRARY_LOAD_FAILURE, + AWS_IO_SHARED_LIBRARY_FIND_SYMBOL_FAILURE, + AWS_IO_TLS_NEGOTIATION_TIMEOUT, + AWS_IO_TLS_ALERT_NOT_GRACEFUL, + AWS_IO_MAX_RETRIES_EXCEEDED, + AWS_IO_RETRY_PERMISSION_DENIED, + AWS_IO_TLS_DIGEST_ALGORITHM_UNSUPPORTED, + AWS_IO_TLS_SIGNATURE_ALGORITHM_UNSUPPORTED, + + AWS_ERROR_PKCS11_VERSION_UNSUPPORTED, + AWS_ERROR_PKCS11_TOKEN_NOT_FOUND, + AWS_ERROR_PKCS11_KEY_NOT_FOUND, + AWS_ERROR_PKCS11_KEY_TYPE_UNSUPPORTED, + AWS_ERROR_PKCS11_UNKNOWN_CRYPTOKI_RETURN_VALUE, + + /* PKCS#11 "CKR_" (Cryptoki Return Value) as AWS error-codes */ + AWS_ERROR_PKCS11_CKR_CANCEL, + AWS_ERROR_PKCS11_CKR_HOST_MEMORY, + AWS_ERROR_PKCS11_CKR_SLOT_ID_INVALID, + AWS_ERROR_PKCS11_CKR_GENERAL_ERROR, + AWS_ERROR_PKCS11_CKR_FUNCTION_FAILED, + AWS_ERROR_PKCS11_CKR_ARGUMENTS_BAD, + AWS_ERROR_PKCS11_CKR_NO_EVENT, + AWS_ERROR_PKCS11_CKR_NEED_TO_CREATE_THREADS, + AWS_ERROR_PKCS11_CKR_CANT_LOCK, + AWS_ERROR_PKCS11_CKR_ATTRIBUTE_READ_ONLY, + AWS_ERROR_PKCS11_CKR_ATTRIBUTE_SENSITIVE, + AWS_ERROR_PKCS11_CKR_ATTRIBUTE_TYPE_INVALID, + AWS_ERROR_PKCS11_CKR_ATTRIBUTE_VALUE_INVALID, + AWS_ERROR_PKCS11_CKR_ACTION_PROHIBITED, + AWS_ERROR_PKCS11_CKR_DATA_INVALID, + AWS_ERROR_PKCS11_CKR_DATA_LEN_RANGE, + AWS_ERROR_PKCS11_CKR_DEVICE_ERROR, + AWS_ERROR_PKCS11_CKR_DEVICE_MEMORY, + AWS_ERROR_PKCS11_CKR_DEVICE_REMOVED, + AWS_ERROR_PKCS11_CKR_ENCRYPTED_DATA_INVALID, + AWS_ERROR_PKCS11_CKR_ENCRYPTED_DATA_LEN_RANGE, + AWS_ERROR_PKCS11_CKR_FUNCTION_CANCELED, + AWS_ERROR_PKCS11_CKR_FUNCTION_NOT_PARALLEL, + AWS_ERROR_PKCS11_CKR_FUNCTION_NOT_SUPPORTED, + AWS_ERROR_PKCS11_CKR_KEY_HANDLE_INVALID, + AWS_ERROR_PKCS11_CKR_KEY_SIZE_RANGE, + AWS_ERROR_PKCS11_CKR_KEY_TYPE_INCONSISTENT, + AWS_ERROR_PKCS11_CKR_KEY_NOT_NEEDED, + AWS_ERROR_PKCS11_CKR_KEY_CHANGED, + AWS_ERROR_PKCS11_CKR_KEY_NEEDED, + AWS_ERROR_PKCS11_CKR_KEY_INDIGESTIBLE, + AWS_ERROR_PKCS11_CKR_KEY_FUNCTION_NOT_PERMITTED, + AWS_ERROR_PKCS11_CKR_KEY_NOT_WRAPPABLE, + AWS_ERROR_PKCS11_CKR_KEY_UNEXTRACTABLE, + AWS_ERROR_PKCS11_CKR_MECHANISM_INVALID, + AWS_ERROR_PKCS11_CKR_MECHANISM_PARAM_INVALID, + AWS_ERROR_PKCS11_CKR_OBJECT_HANDLE_INVALID, + AWS_ERROR_PKCS11_CKR_OPERATION_ACTIVE, + AWS_ERROR_PKCS11_CKR_OPERATION_NOT_INITIALIZED, + AWS_ERROR_PKCS11_CKR_PIN_INCORRECT, + AWS_ERROR_PKCS11_CKR_PIN_INVALID, + AWS_ERROR_PKCS11_CKR_PIN_LEN_RANGE, + AWS_ERROR_PKCS11_CKR_PIN_EXPIRED, + AWS_ERROR_PKCS11_CKR_PIN_LOCKED, + AWS_ERROR_PKCS11_CKR_SESSION_CLOSED, + AWS_ERROR_PKCS11_CKR_SESSION_COUNT, + AWS_ERROR_PKCS11_CKR_SESSION_HANDLE_INVALID, + AWS_ERROR_PKCS11_CKR_SESSION_PARALLEL_NOT_SUPPORTED, + AWS_ERROR_PKCS11_CKR_SESSION_READ_ONLY, + AWS_ERROR_PKCS11_CKR_SESSION_EXISTS, + AWS_ERROR_PKCS11_CKR_SESSION_READ_ONLY_EXISTS, + AWS_ERROR_PKCS11_CKR_SESSION_READ_WRITE_SO_EXISTS, + AWS_ERROR_PKCS11_CKR_SIGNATURE_INVALID, + AWS_ERROR_PKCS11_CKR_SIGNATURE_LEN_RANGE, + AWS_ERROR_PKCS11_CKR_TEMPLATE_INCOMPLETE, + AWS_ERROR_PKCS11_CKR_TEMPLATE_INCONSISTENT, + AWS_ERROR_PKCS11_CKR_TOKEN_NOT_PRESENT, + AWS_ERROR_PKCS11_CKR_TOKEN_NOT_RECOGNIZED, + AWS_ERROR_PKCS11_CKR_TOKEN_WRITE_PROTECTED, + AWS_ERROR_PKCS11_CKR_UNWRAPPING_KEY_HANDLE_INVALID, + AWS_ERROR_PKCS11_CKR_UNWRAPPING_KEY_SIZE_RANGE, + AWS_ERROR_PKCS11_CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT, + AWS_ERROR_PKCS11_CKR_USER_ALREADY_LOGGED_IN, + AWS_ERROR_PKCS11_CKR_USER_NOT_LOGGED_IN, + AWS_ERROR_PKCS11_CKR_USER_PIN_NOT_INITIALIZED, + AWS_ERROR_PKCS11_CKR_USER_TYPE_INVALID, + AWS_ERROR_PKCS11_CKR_USER_ANOTHER_ALREADY_LOGGED_IN, + AWS_ERROR_PKCS11_CKR_USER_TOO_MANY_TYPES, + AWS_ERROR_PKCS11_CKR_WRAPPED_KEY_INVALID, + AWS_ERROR_PKCS11_CKR_WRAPPED_KEY_LEN_RANGE, + AWS_ERROR_PKCS11_CKR_WRAPPING_KEY_HANDLE_INVALID, + AWS_ERROR_PKCS11_CKR_WRAPPING_KEY_SIZE_RANGE, + AWS_ERROR_PKCS11_CKR_WRAPPING_KEY_TYPE_INCONSISTENT, + AWS_ERROR_PKCS11_CKR_RANDOM_SEED_NOT_SUPPORTED, + AWS_ERROR_PKCS11_CKR_RANDOM_NO_RNG, + AWS_ERROR_PKCS11_CKR_DOMAIN_PARAMS_INVALID, + AWS_ERROR_PKCS11_CKR_CURVE_NOT_SUPPORTED, + AWS_ERROR_PKCS11_CKR_BUFFER_TOO_SMALL, + AWS_ERROR_PKCS11_CKR_SAVED_STATE_INVALID, + AWS_ERROR_PKCS11_CKR_INFORMATION_SENSITIVE, + AWS_ERROR_PKCS11_CKR_STATE_UNSAVEABLE, + AWS_ERROR_PKCS11_CKR_CRYPTOKI_NOT_INITIALIZED, + AWS_ERROR_PKCS11_CKR_CRYPTOKI_ALREADY_INITIALIZED, + AWS_ERROR_PKCS11_CKR_MUTEX_BAD, + AWS_ERROR_PKCS11_CKR_MUTEX_NOT_LOCKED, + AWS_ERROR_PKCS11_CKR_NEW_PIN_MODE, + AWS_ERROR_PKCS11_CKR_NEXT_OTP, + AWS_ERROR_PKCS11_CKR_EXCEEDED_MAX_ITERATIONS, + AWS_ERROR_PKCS11_CKR_FIPS_SELF_TEST_FAILED, + AWS_ERROR_PKCS11_CKR_LIBRARY_LOAD_FAILED, + AWS_ERROR_PKCS11_CKR_PIN_TOO_WEAK, + AWS_ERROR_PKCS11_CKR_PUBLIC_KEY_INVALID, + AWS_ERROR_PKCS11_CKR_FUNCTION_REJECTED, + + AWS_ERROR_IO_PINNED_EVENT_LOOP_MISMATCH, + + AWS_ERROR_PKCS11_ENCODING_ERROR, + AWS_IO_TLS_ERROR_DEFAULT_TRUST_STORE_NOT_FOUND, + + AWS_IO_STREAM_SEEK_FAILED, + AWS_IO_STREAM_GET_LENGTH_FAILED, + AWS_IO_STREAM_SEEK_UNSUPPORTED, + AWS_IO_STREAM_GET_LENGTH_UNSUPPORTED, + AWS_IO_TLS_ERROR_READ_FAILURE, + + AWS_ERROR_PEM_MALFORMED, + + AWS_IO_SOCKET_MISSING_EVENT_LOOP, + AWS_IO_TLS_UNKNOWN_ROOT_CERTIFICATE, + AWS_IO_TLS_NO_ROOT_CERTIFICATE_FOUND, + AWS_IO_TLS_CERTIFICATE_EXPIRED, + AWS_IO_TLS_CERTIFICATE_NOT_YET_VALID, + AWS_IO_TLS_BAD_CERTIFICATE, + AWS_IO_TLS_PEER_CERTIFICATE_EXPIRED, + AWS_IO_TLS_BAD_PEER_CERTIFICATE, + AWS_IO_TLS_PEER_CERTIFICATE_REVOKED, + AWS_IO_TLS_PEER_CERTIFICATE_UNKNOWN, + AWS_IO_TLS_INTERNAL_ERROR, + AWS_IO_TLS_CLOSED_GRACEFUL, + AWS_IO_TLS_CLOSED_ABORT, + AWS_IO_TLS_INVALID_CERTIFICATE_CHAIN, + AWS_IO_TLS_HOST_NAME_MISMATCH, + + AWS_IO_ERROR_END_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_IO_PACKAGE_ID), + AWS_IO_INVALID_FILE_HANDLE = AWS_ERROR_INVALID_FILE_HANDLE, +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes internal datastructures used by aws-c-io. + * Must be called before using any functionality in aws-c-io. + */ +AWS_IO_API +void aws_io_library_init(struct aws_allocator *allocator); + +/** + * Shuts down the internal datastructures used by aws-c-io. + */ +AWS_IO_API +void aws_io_library_clean_up(void); + +AWS_IO_API +void aws_io_fatal_assert_library_initialized(void); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_IO_H */ diff --git a/include/aws/io/logging.h b/include/aws/io/logging.h new file mode 100644 index 0000000000000000000000000000000000000000..a3bbee2fa6e4006d6dd993458b83ae48ecc498e1 --- /dev/null +++ b/include/aws/io/logging.h @@ -0,0 +1,40 @@ +#ifndef AWS_IO_LOGGING_H +#define AWS_IO_LOGGING_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_log_channel; +struct aws_log_formatter; +struct aws_log_writer; + +enum aws_io_log_subject { + AWS_LS_IO_GENERAL = AWS_LOG_SUBJECT_BEGIN_RANGE(AWS_C_IO_PACKAGE_ID), + AWS_LS_IO_EVENT_LOOP, + AWS_LS_IO_SOCKET, + AWS_LS_IO_SOCKET_HANDLER, + AWS_LS_IO_TLS, + AWS_LS_IO_ALPN, + AWS_LS_IO_DNS, + AWS_LS_IO_PKI, + AWS_LS_IO_CHANNEL, + AWS_LS_IO_CHANNEL_BOOTSTRAP, + AWS_LS_IO_FILE_UTILS, + AWS_LS_IO_SHARED_LIBRARY, + AWS_LS_IO_EXPONENTIAL_BACKOFF_RETRY_STRATEGY, + AWS_LS_IO_STANDARD_RETRY_STRATEGY, + AWS_LS_IO_PKCS11, + AWS_LS_IO_PEM, + AWS_IO_LS_LAST = AWS_LOG_SUBJECT_END_RANGE(AWS_C_IO_PACKAGE_ID) +}; +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_LOGGING_H */ diff --git a/include/aws/io/message_pool.h b/include/aws/io/message_pool.h new file mode 100644 index 0000000000000000000000000000000000000000..738627a39974cc8b19aca401dd9d734d7e0a411f --- /dev/null +++ b/include/aws/io/message_pool.h @@ -0,0 +1,89 @@ +#ifndef AWS_IO_MESSAGE_POOL_H +#define AWS_IO_MESSAGE_POOL_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_memory_pool { + struct aws_allocator *alloc; + struct aws_array_list stack; + uint16_t ideal_segment_count; + size_t segment_size; + void *data_ptr; +}; + +struct aws_message_pool { + struct aws_allocator *alloc; + struct aws_memory_pool application_data_pool; + struct aws_memory_pool small_block_pool; +}; + +struct aws_message_pool_creation_args { + size_t application_data_msg_data_size; + uint8_t application_data_msg_count; + size_t small_block_msg_data_size; + uint8_t small_block_msg_count; +}; + +AWS_EXTERN_C_BEGIN + +AWS_IO_API +int aws_memory_pool_init( + struct aws_memory_pool *mempool, + struct aws_allocator *alloc, + uint16_t ideal_segment_count, + size_t segment_size); + +AWS_IO_API +void aws_memory_pool_clean_up(struct aws_memory_pool *mempool); + +/** + * Acquires memory from the pool if available, otherwise, it attempts to allocate and returns the result. + */ +AWS_IO_API +void *aws_memory_pool_acquire(struct aws_memory_pool *mempool); + +/** + * Releases memory to the pool if space is available, otherwise frees `to_release` + */ +AWS_IO_API +void aws_memory_pool_release(struct aws_memory_pool *mempool, void *to_release); + +/** + * Initializes message pool using 'msg_pool' as the backing pool, 'args' is copied. + */ +AWS_IO_API +int aws_message_pool_init( + struct aws_message_pool *msg_pool, + struct aws_allocator *alloc, + struct aws_message_pool_creation_args *args); + +AWS_IO_API +void aws_message_pool_clean_up(struct aws_message_pool *msg_pool); + +/** + * Acquires a message from the pool if available, otherwise, it attempts to allocate. If a message is acquired, + * note that size_hint is just a hint. the return value's capacity will be set to the actual buffer size. + */ +AWS_IO_API +struct aws_io_message *aws_message_pool_acquire( + struct aws_message_pool *msg_pool, + enum aws_io_message_type message_type, + size_t size_hint); + +/** + * Releases message to the pool if space is available, otherwise frees `message` + * @param message + */ +AWS_IO_API +void aws_message_pool_release(struct aws_message_pool *msg_pool, struct aws_io_message *message); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_MESSAGE_POOL_H */ diff --git a/include/aws/io/pem.h b/include/aws/io/pem.h new file mode 100644 index 0000000000000000000000000000000000000000..48e7edd3ef4bacabb36c1b85ffff850e53d4b2f4 --- /dev/null +++ b/include/aws/io/pem.h @@ -0,0 +1,99 @@ +#ifndef AWS_IO_PEM_H +#define AWS_IO_PEM_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +AWS_EXTERN_C_BEGIN + +/* + * Naming follows OpenSSL convention for PEM types. + * Refer to comment after each enum value for the type string it represents. + */ +enum aws_pem_object_type { + AWS_PEM_TYPE_UNKNOWN = 0, + AWS_PEM_TYPE_X509_OLD, /* X509 CERTIFICATE */ + AWS_PEM_TYPE_X509, /* CERTIFICATE */ + AWS_PEM_TYPE_X509_TRUSTED, /* TRUSTED CERTIFICATE */ + AWS_PEM_TYPE_X509_REQ_OLD, /* NEW CERTIFICATE REQUEST */ + AWS_PEM_TYPE_X509_REQ, /* CERTIFICATE REQUEST */ + AWS_PEM_TYPE_X509_CRL, /* X509 CRL */ + AWS_PEM_TYPE_EVP_PKEY, /* ANY PRIVATE KEY */ + AWS_PEM_TYPE_PUBLIC_KEY, /* PUBLIC KEY */ + AWS_PEM_TYPE_PRIVATE_RSA_PKCS1, /* RSA PRIVATE KEY */ + AWS_PEM_TYPE_PUBLIC_RSA_PKCS1, /* RSA PUBLIC KEY */ + AWS_PEM_TYPE_PRIVATE_DSA_PKCS1, /* RSA PRIVATE KEY */ + AWS_PEM_TYPE_PUBLIC_DSA_PKCS1, /* RSA PUBLIC KEY */ + AWS_PEM_TYPE_PKCS7, /* PKCS7 */ + AWS_PEM_TYPE_PKCS7_SIGNED_DATA, /* PKCS #7 SIGNED DATA */ + AWS_PEM_TYPE_PRIVATE_PKCS8_ENCRYPTED, /* ENCRYPTED PRIVATE KEY */ + AWS_PEM_TYPE_PRIVATE_PKCS8, /* PRIVATE KEY */ + AWS_PEM_TYPE_DH_PARAMETERS, /* X9.42 DH PARAMETERS */ + AWS_PEM_TYPE_DH_PARAMETERS_X942, /* X9.42 DH PARAMETERS */ + AWS_PEM_TYPE_SSL_SESSION_PARAMETERS, /* SSL SESSION PARAMETERS */ + AWS_PEM_TYPE_DSA_PARAMETERS, /* DSA PARAMETERS */ + AWS_PEM_TYPE_ECDSA_PUBLIC, /* ECDSA PUBLIC KEY */ + AWS_PEM_TYPE_EC_PARAMETERS, /* EC PARAMETERS */ + AWS_PEM_TYPE_EC_PRIVATE, /* EC PRIVATE KEY */ + AWS_PEM_TYPE_PARAMETERS, /* PARAMETERS */ + AWS_PEM_TYPE_CMS, /* CMS */ + AWS_PEM_TYPE_SM2_PARAMETERS /* SM2 PARAMETERS */ +}; + +/* + * Describes PEM object decoded from file. + * data points to raw data bytes of object (decoding will do additional base 64 + * decoding for each object). + * type will be set to object type or to AWS_PEM_TYPE_UNKNOWN if it could not + * figure out type. + * type_string is the string between -----BEGIN and ----- + */ +struct aws_pem_object { + enum aws_pem_object_type type; + struct aws_string *type_string; + struct aws_byte_buf data; +}; + +/** + * Cleans up elements of pem_objects list 'aws_pem_objects_init_from_file_contents()' + * and 'aws_pem_objects_init_from_file_path()'. + */ +AWS_IO_API void aws_pem_objects_clean_up(struct aws_array_list *pem_objects); + +/** + * Decodes PEM data and reads objects sequentially adding them to pem_objects. + * If it comes across an object it cannot read, list of all object read until + * that point is returned. + * If no objects can be read from PEM or objects could not be base 64 decoded, + * AWS_ERROR_PEM_MALFORMED is raised. + * out_pem_objects stores aws_pem_object struct by value. + * Function will initialize pem_objects list. + * This code is slow, and it allocates, so please try + * not to call this in the middle of something that needs to be fast or resource sensitive. + */ +AWS_IO_API int aws_pem_objects_init_from_file_contents( + struct aws_array_list *pem_objects, + struct aws_allocator *alloc, + struct aws_byte_cursor pem_cursor); + +/** + * Decodes PEM data from file and reads objects sequentially adding them to pem_objects. + * If it comes across an object it cannot read, list of all object read until + * that point is returned. + * If no objects can be read from PEM or objects could not be base 64 decoded, + * AWS_ERROR_PEM_MALFORMED is raised. + * out_pem_objects stores aws_pem_object struct by value. + * Function will initialize pem_objects list. + * This code is slow, and it allocates, so please try + * not to call this in the middle of something that needs to be fast or resource sensitive. + */ +AWS_IO_API int aws_pem_objects_init_from_file_path( + struct aws_array_list *pem_objects, + struct aws_allocator *allocator, + const char *filename); + +AWS_EXTERN_C_END +#endif /* AWS_IO_PEM_H */ diff --git a/include/aws/io/pipe.h b/include/aws/io/pipe.h new file mode 100644 index 0000000000000000000000000000000000000000..ab9746cc42112a8f89e58d92176883f8adc5ed69 --- /dev/null +++ b/include/aws/io/pipe.h @@ -0,0 +1,151 @@ +#ifndef AWS_IO_PIPE_H +#define AWS_IO_PIPE_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_event_loop; + +struct aws_pipe_read_end { + void *impl_data; +}; + +struct aws_pipe_write_end { + void *impl_data; +}; + +/** + * Callback for when the pipe is readable (edge-triggered), or an error has occurred. + * Afer subscribing, the callback is invoked when the pipe has data to read, or the pipe has an error. + * The readable callback is invoked again any time the user reads all data, and then more data arrives. + * Note that it will not be invoked again if the pipe still has unread data when more data arrives. + * `error_code` of AWS_ERROR_SUCCESS indicates a readable event, and otherwise contains the value of the error. + * `user_data` corresponds to the `user_data` passed into aws_pipe_subscribe_to_read_events(). + * This callback is always invoked on the read-end's event-loop thread. + */ +typedef void(aws_pipe_on_readable_fn)(struct aws_pipe_read_end *read_end, int error_code, void *user_data); + +/** + * Callback for when the asynchronous aws_pipe_write() operation has either completed or failed. + * `write_end` will be NULL if this callback is invoked after the the write-end has been cleaned up, + * this does not necessarily mean that the write operation failed. + * `error_code` will be AWS_ERROR_SUCCESS if all data was written, or a code corresponding to the error. + * `src_buffer` corresponds to the buffer passed into aws_pipe_write() + * `user_data` corresponds to the `user_data` passed into aws_pipe_write(). + * This callback is always invoked on the write-end's event-loop thread. + */ +typedef void(aws_pipe_on_write_completed_fn)( + struct aws_pipe_write_end *write_end, + int error_code, + struct aws_byte_cursor src_buffer, + void *user_data); + +AWS_EXTERN_C_BEGIN + +/** + * Opens an OS specific bidirectional pipe. + * The read direction is stored in read_end. Write direction is stored in write_end. + * Each end must be connected to an event-loop, and further calls to each end must happen on that event-loop's thread. + */ +AWS_IO_API +int aws_pipe_init( + struct aws_pipe_read_end *read_end, + struct aws_event_loop *read_end_event_loop, + struct aws_pipe_write_end *write_end, + struct aws_event_loop *write_end_event_loop, + struct aws_allocator *allocator); + +/** + * Clean up the read-end of the pipe. + * This must be called on the thread of the connected event-loop. + */ +AWS_IO_API +int aws_pipe_clean_up_read_end(struct aws_pipe_read_end *read_end); + +/** + * Clean up the write-end of the pipe. + * This must be called on the thread of the connected event-loop. + */ +AWS_IO_API +int aws_pipe_clean_up_write_end(struct aws_pipe_write_end *write_end); + +/** + * Get the event-loop connected to the read-end of the pipe. + * This may be called on any thread. + */ +AWS_IO_API +struct aws_event_loop *aws_pipe_get_read_end_event_loop(const struct aws_pipe_read_end *read_end); + +/** + * Get the event-loop connected to the write-end of the pipe. + * This may be called on any thread. + */ +AWS_IO_API +struct aws_event_loop *aws_pipe_get_write_end_event_loop(const struct aws_pipe_write_end *write_end); + +/** + * Initiates an asynchrous write from the source buffer to the pipe. + * The data referenced by `src_buffer` must remain in memory until the operation completes. + * `on_complete` is called on the event-loop thread when the operation has either completed or failed. + * The callback's pipe argument will be NULL if the callback is invoked after the pipe has been cleaned up. + * This must be called on the thread of the connected event-loop. + */ +AWS_IO_API +int aws_pipe_write( + struct aws_pipe_write_end *write_end, + struct aws_byte_cursor src_buffer, + aws_pipe_on_write_completed_fn *on_completed, + void *user_data); + +/** + * Read data from the pipe into the destination buffer. + * Attempts to read enough to fill all remaining space in the buffer, from `dst_buffer->len` to `dst_buffer->capacity`. + * `dst_buffer->len` is updated to reflect the buffer's new length. + * `num_bytes_read` (optional) is set to the total number of bytes read. + * This function never blocks. If no bytes could be read without blocking, then AWS_OP_ERR is returned and + * aws_last_error() code will be AWS_IO_READ_WOULD_BLOCK. + * This must be called on the thread of the connected event-loop. + */ +AWS_IO_API +int aws_pipe_read(struct aws_pipe_read_end *read_end, struct aws_byte_buf *dst_buffer, size_t *num_bytes_read); + +/** + * Subscribe to be notified when the pipe becomes readable (edge-triggered), or an error occurs. + * `on_readable` is invoked on the event-loop's thread when the pipe has data to read, or the pipe has an error. + * `on_readable` is invoked again any time the user reads all data, and then more data arrives. + * Note that it will not be invoked again if the pipe still has unread data when more data arrives. + * This must be called on the thread of the connected event-loop. + */ +AWS_IO_API +int aws_pipe_subscribe_to_readable_events( + struct aws_pipe_read_end *read_end, + aws_pipe_on_readable_fn *on_readable, + void *user_data); + +/** + * Stop receiving notifications about events on the read-end of the pipe. + * This must be called on the thread of the connected event-loop. + */ +AWS_IO_API +int aws_pipe_unsubscribe_from_readable_events(struct aws_pipe_read_end *read_end); + +#if defined(_WIN32) +/** + * Generate a unique pipe name. + * The suggested dst_size is 256. + */ +AWS_IO_API +int aws_pipe_get_unique_name(char *dst, size_t dst_size); +#endif + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_PIPE_H */ diff --git a/include/aws/io/pkcs11.h b/include/aws/io/pkcs11.h new file mode 100644 index 0000000000000000000000000000000000000000..e23192f1f3c8d951bc1a7258edf0a0a705b71176 --- /dev/null +++ b/include/aws/io/pkcs11.h @@ -0,0 +1,97 @@ +#ifndef AWS_IO_PKCS11_H +#define AWS_IO_PKCS11_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_allocator; + +/** + * Handle to a loaded PKCS#11 library. + */ +struct aws_pkcs11_lib; + +/** + * Controls how aws_pkcs11_lib calls C_Initialize() and C_Finalize() on the PKCS#11 library. + */ +enum aws_pkcs11_lib_behavior { + /** + * Default behavior that accommodates most use cases. + * C_Initialize() is called on creation, and "already-initialized" errors are ignored. + * C_Finalize() is never called, just in case another part of your + * application is still using the PKCS#11 library. + */ + AWS_PKCS11_LIB_DEFAULT_BEHAVIOR, + + /** + * Skip calling C_Initialize() and C_Finalize(). + * Use this if your application has already initialized the PKCS#11 library, + * and you do not want C_Initialize() called again. + */ + AWS_PKCS11_LIB_OMIT_INITIALIZE, + + /** + * C_Initialize() is called on creation and C_Finalize() is called on cleanup. + * If C_Initialize() reports that's it's already initialized, this is treated as an error. + * Use this if you need perfect cleanup (ex: running valgrind with --leak-check). + */ + AWS_PKCS11_LIB_STRICT_INITIALIZE_FINALIZE, +}; + +/* The enum above was misspelled, and later got fixed (pcks11 -> pkcs11). + * This macro maintain backwards compatibility with the old spelling */ +#define aws_pcks11_lib_behavior aws_pkcs11_lib_behavior + +/** + * Options for aws_pkcs11_lib_new() + */ +struct aws_pkcs11_lib_options { + /** + * Name of PKCS#11 library file to load (UTF-8). + * Zero out if your application is compiled with PKCS#11 symbols linked in. + */ + struct aws_byte_cursor filename; + + /** + * Behavior for calling C_Initialize() and C_Finalize() on the PKCS#11 library. + */ + enum aws_pkcs11_lib_behavior initialize_finalize_behavior; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Load and initialize a PKCS#11 library. + * See `aws_pkcs11_lib_options` for options. + * + * If successful a valid pointer is returned. You must call aws_pkcs11_lib_release() when you are done with it. + * If unsuccessful, NULL is returned and an error is set. + */ +AWS_IO_API +struct aws_pkcs11_lib *aws_pkcs11_lib_new( + struct aws_allocator *allocator, + const struct aws_pkcs11_lib_options *options); + +/** + * Acquire a reference to a PKCS#11 library, preventing it from being cleaned up. + * You must call aws_pkcs11_lib_release() when you are done with it. + * This function returns whatever was passed in. It cannot fail. + */ +AWS_IO_API +struct aws_pkcs11_lib *aws_pkcs11_lib_acquire(struct aws_pkcs11_lib *pkcs11_lib); + +/** + * Release a reference to the PKCS#11 library. + * When the last reference is released, the library is cleaned up. + */ +AWS_IO_API +void aws_pkcs11_lib_release(struct aws_pkcs11_lib *pkcs11_lib); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_PKCS11_H */ diff --git a/include/aws/io/retry_strategy.h b/include/aws/io/retry_strategy.h new file mode 100644 index 0000000000000000000000000000000000000000..ff9d530158494f5b5724e0fd532ac9ec12f63422 --- /dev/null +++ b/include/aws/io/retry_strategy.h @@ -0,0 +1,259 @@ +#ifndef AWS_IO_CLIENT_RETRY_STRATEGY_H +#define AWS_IO_CLIENT_RETRY_STRATEGY_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_retry_strategy; +struct aws_retry_token; +struct aws_event_loop_group; + +/** + * Invoked upon the acquisition, or failure to acquire a retry token. This function will always be invoked if and only + * if aws_retry_strategy_acquire_retry_token() returns AWS_OP_SUCCESS. It will never be invoked synchronously from + * aws_retry_strategy_acquire_retry_token(). Token will always be NULL if error_code is non-zero, and vice-versa. If + * token is non-null, it will have a reference count of 1, and you must call aws_retry_token_release() on it later. See + * the comments for aws_retry_strategy_on_retry_ready_fn for more info. + */ +typedef void(aws_retry_strategy_on_retry_token_acquired_fn)( + struct aws_retry_strategy *retry_strategy, + int error_code, + struct aws_retry_token *token, + void *user_data); + +/** + * Invoked after a successful call to aws_retry_strategy_schedule_retry(). This function will always be invoked if and + * only if aws_retry_strategy_schedule_retry() returns AWS_OP_SUCCESS. It will never be invoked synchronously from + * aws_retry_strategy_schedule_retry(). After attempting the operation, either call aws_retry_strategy_schedule_retry() + * with an aws_retry_error_type or call aws_retry_token_record_success() and then release the token via. + * aws_retry_token_release(). + */ +typedef void(aws_retry_strategy_on_retry_ready_fn)(struct aws_retry_token *token, int error_code, void *user_data); + +/** + * Optional function to supply your own generate random implementation + */ +typedef uint64_t(aws_generate_random_fn)(void *user_data); + +enum aws_retry_error_type { + /** This is a connection level error such as a socket timeout, socket connect error, tls negotiation timeout etc... + * Typically these should never be applied for non-idempotent request types since in this scenario, it's impossible + * to know whether the operation had a side effect on the server. */ + AWS_RETRY_ERROR_TYPE_TRANSIENT, + /** This is an error where the server explicitly told the client to back off, such as a 429 or 503 Http error. */ + AWS_RETRY_ERROR_TYPE_THROTTLING, + /** This is a server error that isn't explicitly throttling but is considered by the client + * to be something that should be retried. */ + AWS_RETRY_ERROR_TYPE_SERVER_ERROR, + /** Doesn't count against any budgets. This could be something like a 401 challenge in Http. */ + AWS_RETRY_ERROR_TYPE_CLIENT_ERROR, +}; + +struct aws_retry_strategy_vtable { + void (*destroy)(struct aws_retry_strategy *retry_strategy); + int (*acquire_token)( + struct aws_retry_strategy *retry_strategy, + const struct aws_byte_cursor *partition_id, + aws_retry_strategy_on_retry_token_acquired_fn *on_acquired, + void *user_data, + uint64_t timeout_ms); + int (*schedule_retry)( + struct aws_retry_token *token, + enum aws_retry_error_type error_type, + aws_retry_strategy_on_retry_ready_fn *retry_ready, + void *user_data); + int (*record_success)(struct aws_retry_token *token); + void (*release_token)(struct aws_retry_token *token); +}; + +struct aws_retry_strategy { + struct aws_allocator *allocator; + struct aws_retry_strategy_vtable *vtable; + struct aws_atomic_var ref_count; + void *impl; +}; + +struct aws_retry_token { + struct aws_allocator *allocator; + struct aws_retry_strategy *retry_strategy; + struct aws_atomic_var ref_count; + void *impl; +}; + +/** + * Jitter mode for exponential backoff. + * + * For a great writeup on these options see: + * https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ + */ +enum aws_exponential_backoff_jitter_mode { + /* Uses AWS_EXPONENTIAL_BACKOFF_JITTER_FULL */ + AWS_EXPONENTIAL_BACKOFF_JITTER_DEFAULT, + AWS_EXPONENTIAL_BACKOFF_JITTER_NONE, + AWS_EXPONENTIAL_BACKOFF_JITTER_FULL, + AWS_EXPONENTIAL_BACKOFF_JITTER_DECORRELATED, +}; + +/** + * Options for exponential backoff retry strategy. el_group must be set, any other option, if set to 0 will signify + * "use defaults" + */ +struct aws_exponential_backoff_retry_options { + /* Event loop group to use for scheduling tasks. */ + struct aws_event_loop_group *el_group; + /* Max retries to allow. The default value is 10 */ + size_t max_retries; + /* Scaling factor to add for the backoff. Default is 500ms */ + uint32_t backoff_scale_factor_ms; + /* Max retry backoff in seconds. Default is 20 seconds */ + uint32_t max_backoff_secs; + /** Jitter mode to use, see comments for aws_exponential_backoff_jitter_mode. + * Default is AWS_EXPONENTIAL_BACKOFF_JITTER_DEFAULT */ + enum aws_exponential_backoff_jitter_mode jitter_mode; + + /** Deprecated. Use generate_random_impl instead + * By default this will be set to use aws_device_random. If you want something else, set it here. + * */ + uint64_t (*generate_random)(void); + + /* + * By default this will be set to use aws_device_random. If you want something else, set it here. + */ + aws_generate_random_fn *generate_random_impl; + /** + * Optional user data for the generate random generate_random_impl. + */ + void *generate_random_user_data; + + /** + * Optional shutdown callback that gets invoked, with appropriate user data, + * when the resources used by the retry_strategy are no longer in use. + */ + const struct aws_shutdown_callback_options *shutdown_options; +}; + +struct aws_no_retry_options { + /** + * Optional shutdown callback that gets invoked, with appropriate user data, + * when the resources used by the retry_strategy are no longer in use. + */ + const struct aws_shutdown_callback_options *shutdown_options; +}; + +struct aws_standard_retry_options { + struct aws_exponential_backoff_retry_options backoff_retry_options; + /** capacity for partitions. Defaults to 500 */ + size_t initial_bucket_capacity; +}; + +AWS_EXTERN_C_BEGIN +/** + * Acquire a reference count on retry_strategy. + */ +AWS_IO_API void aws_retry_strategy_acquire(struct aws_retry_strategy *retry_strategy); +/** + * Releases a reference count on retry_strategy. + */ +AWS_IO_API void aws_retry_strategy_release(struct aws_retry_strategy *retry_strategy); +/** + * Attempts to acquire a retry token for use with retries. On success, on_acquired will be invoked when a token is + * available, or an error will be returned if the timeout expires. partition_id identifies operations that should be + * grouped together. This allows for more sophisticated strategies such as AIMD and circuit breaker patterns. Pass NULL + * to use the global partition. + */ +AWS_IO_API int aws_retry_strategy_acquire_retry_token( + struct aws_retry_strategy *retry_strategy, + const struct aws_byte_cursor *partition_id, + aws_retry_strategy_on_retry_token_acquired_fn *on_acquired, + void *user_data, + uint64_t timeout_ms); + +/** + * Schedules a retry based on the backoff and token based strategies. retry_ready is invoked when the retry is either + * ready for execution or if it has been canceled due to application shutdown. + * + * This function can return an error to reject the retry attempt if, for example, a circuit breaker has opened. If this + * occurs users should fail their calls back to their callers. + * + * error_type is used for book keeping. See the comments above for aws_retry_error_type. + */ +AWS_IO_API int aws_retry_strategy_schedule_retry( + struct aws_retry_token *token, + enum aws_retry_error_type error_type, + aws_retry_strategy_on_retry_ready_fn *retry_ready, + void *user_data); +/** + * Records a successful retry. This is used for making future decisions to open up token buckets, AIMD breakers etc... + * some strategies such as exponential backoff will ignore this, but you should always call it after a successful + * operation or your system will never recover during an outage. + */ +AWS_IO_API int aws_retry_token_record_success(struct aws_retry_token *token); + +/** + * Increments reference count for token. This should be called any time you seat the token to a pointer you own. + */ +AWS_IO_API void aws_retry_token_acquire(struct aws_retry_token *token); + +/** + * Releases the reference count for token. This should always be invoked after either calling + * aws_retry_strategy_schedule_retry() and failing, or after calling aws_retry_token_record_success(). + */ +AWS_IO_API void aws_retry_token_release(struct aws_retry_token *token); +/** + * Creates a retry strategy using exponential backoff. This strategy does not perform any bookkeeping on error types and + * success. There is no circuit breaker functionality in here. See the comments above for + * aws_exponential_backoff_retry_options. + */ +AWS_IO_API struct aws_retry_strategy *aws_retry_strategy_new_exponential_backoff( + struct aws_allocator *allocator, + const struct aws_exponential_backoff_retry_options *config); + +/** + * This is a retry implementation that cuts off traffic if it's + * detected that an endpoint partition is having availability + * problems. This is necessary to keep from making outages worse + * by scheduling work that's unlikely to succeed yet increases + * load on an already ailing system. + * + * We do this by creating a bucket for each partition. A partition + * is an arbitrary specifier. It can be anything: a region, a service, + * a combination of region and service, a literal dns name.... doesn't matter. + * + * Each bucket has a budget for maximum allowed retries. Different types of events + * carry different weights. Things that indicate an unhealthy partition such as + * transient errors (timeouts, unhealthy connection etc...) cost more. + * A retry for any other reason (service sending a 5xx response code) cost a bit less. + * When a retry is attempted this capacity is leased out to the retry. On success it is + * released back to the capacity pool. On failure, it remains leased. + * Operations that succeed without a retry slowly restore the capacity pool. + * + * If a partition runs out of capacity it is assumed unhealthy and retries will be blocked + * until capacity returns to the pool. To prevent a partition from staying unhealthy after + * an outage has recovered, new requests that succeed without a retry will increase the capacity + * slowly ( a new request gets a payback lease of 1, but the lease is never actually deducted from the capacity pool). + */ +AWS_IO_API struct aws_retry_strategy *aws_retry_strategy_new_standard( + struct aws_allocator *allocator, + const struct aws_standard_retry_options *config); + +/** + * This retry strategy is used to disable retries. Passed config can be null. + * Calling `aws_retry_strategy_acquire_retry_token` will raise error `AWS_IO_RETRY_PERMISSION_DENIED`. + * Calling any function apart from the `aws_retry_strategy_acquire_retry_token` and `aws_retry_strategy_release` will + * result in a fatal error. + */ +AWS_IO_API struct aws_retry_strategy *aws_retry_strategy_new_no_retry( + struct aws_allocator *allocator, + const struct aws_no_retry_options *config); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_CLIENT_RETRY_STRATEGY_H */ diff --git a/include/aws/io/shared_library.h b/include/aws/io/shared_library.h new file mode 100644 index 0000000000000000000000000000000000000000..c00eb98af371c4836531c11a305299951294d692 --- /dev/null +++ b/include/aws/io/shared_library.h @@ -0,0 +1,51 @@ +#ifndef AWS_COMMON_SHARED_LIBRARY_H +#define AWS_COMMON_SHARED_LIBRARY_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_byte_cursor; + +/* + * A simple platform wrapper for dynamically loading and examining shared libraries + */ +struct aws_shared_library { + void *library_handle; +}; + +typedef void (*aws_generic_function)(void); + +AWS_EXTERN_C_BEGIN + +/* + * Initializes a dynamically-loaded shared library from its file path location + */ +AWS_IO_API +int aws_shared_library_init(struct aws_shared_library *library, const char *library_path); + +/* + * Closes a dynamically-loaded shared library + */ +AWS_IO_API +void aws_shared_library_clean_up(struct aws_shared_library *library); + +/* + * Finds a function symbol within a shared library. function_address may be + * safely cast into any other function type as appropriate. + */ +AWS_IO_API +int aws_shared_library_find_function( + struct aws_shared_library *library, + const char *symbol_name, + aws_generic_function *function_address); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_COMMON_SHARED_LIBRARY_H */ diff --git a/include/aws/io/socket.h b/include/aws/io/socket.h new file mode 100644 index 0000000000000000000000000000000000000000..c03c880e772e754338023461b7b45f8e5820b86c --- /dev/null +++ b/include/aws/io/socket.h @@ -0,0 +1,434 @@ +#ifndef AWS_IO_SOCKET_H +#define AWS_IO_SOCKET_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum aws_socket_domain { + AWS_SOCKET_IPV4, + AWS_SOCKET_IPV6, + /* Unix domain sockets (or at least something like them) */ + AWS_SOCKET_LOCAL, + /* VSOCK used in inter-VM communication */ + AWS_SOCKET_VSOCK, +}; + +enum aws_socket_type { + /* A streaming socket sends reliable messages over a two-way connection. + * This means TCP when used with IPV4/6, and Unix domain sockets, when used with + * AWS_SOCKET_LOCAL*/ + AWS_SOCKET_STREAM, + /* A datagram socket is connectionless and sends unreliable messages. + * This means UDP when used with IPV4/6. + * LOCAL and VSOCK sockets are not compatible with DGRAM.*/ + AWS_SOCKET_DGRAM, +}; + +/** + * Socket Implementation type. Decides which socket implementation is used. If set to + * `AWS_SOCKET_IMPL_PLATFORM_DEFAULT`, it will automatically use the platform’s default. + * + * PLATFORM DEFAULT SOCKET IMPLEMENTATION TYPE + * Linux | AWS_SOCKET_IMPL_POSIX + * Windows | AWS_SOCKET_IMPL_WINSOCK + * BSD Variants| AWS_SOCKET_IMPL_POSIX + * MacOS | AWS_SOCKET_IMPL_POSIX + * iOS | AWS_SOCKET_IMPL_APPLE_NETWORK_FRAMEWORK + */ +enum aws_socket_impl_type { + AWS_SOCKET_IMPL_PLATFORM_DEFAULT = 0, + AWS_SOCKET_IMPL_POSIX, + AWS_SOCKET_IMPL_WINSOCK, + AWS_SOCKET_IMPL_APPLE_NETWORK_FRAMEWORK, +}; + +#define AWS_NETWORK_INTERFACE_NAME_MAX 16 + +typedef void(aws_socket_on_shutdown_complete_fn)(void *user_data); + +struct aws_socket_options { + enum aws_socket_type type; + enum aws_socket_domain domain; + enum aws_socket_impl_type impl_type; + uint32_t connect_timeout_ms; + /* Keepalive properties are TCP only. + * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + * If interval or timeout are zero, then default values are used. */ + uint16_t keep_alive_interval_sec; + uint16_t keep_alive_timeout_sec; + /* If set, sets the number of keep alive probes allowed to fail before the connection is considered + * lost. If zero OS defaults are used. On Windows, this option is meaningless until Windows 10 1703.*/ + uint16_t keep_alive_max_failed_probes; + bool keepalive; + + /** + * THIS IS AN EXPERIMENTAL AND UNSTABLE API + * (Optional) + * This property is used to bind the socket to a particular network interface by name, such as eth0 and ens32. + * If this is empty, the socket will not be bound to any interface and will use OS defaults. If the provided name + * is invalid, `aws_socket_init()` will error out with AWS_IO_SOCKET_INVALID_OPTIONS. This option is only + * supported on Linux, macOS(bsd socket), and platforms that have either SO_BINDTODEVICE or IP_BOUND_IF. It is not + * supported on Windows and Apple Network Framework. `AWS_ERROR_PLATFORM_NOT_SUPPORTED` will be raised on + * unsupported platforms. + */ + char network_interface_name[AWS_NETWORK_INTERFACE_NAME_MAX]; +}; + +struct aws_socket; + +/** + * Called in client mode when an outgoing connection has succeeded or an error has occurred. + * If the connection was successful error_code will be AWS_ERROR_SUCCESS and the socket has already been assigned + * to the event loop specified in aws_socket_connect(). + * + * If an error occurred error_code will be non-zero. + */ +typedef void(aws_socket_on_connection_result_fn)(struct aws_socket *socket, int error_code, void *user_data); + +/** + * Called by a listening socket when a listener accept has successfully initialized or an error has occurred. + * If the listener was successful error_code will be AWS_ERROR_SUCCESS and the socket has already been assigned + * to the event loop specified in aws_socket_start_accept(). + * + * If an error occurred error_code will be non-zero. + */ +typedef void(aws_socket_on_accept_started_fn)(struct aws_socket *socket, int error_code, void *user_data); + +/** + * Called by a listening socket when either an incoming connection has been received or an error occurred. + * + * In the normal use-case, this function will be called multiple times over the lifetime of a single listening socket. + * new_socket is already connected and initialized, and is using the same options and allocator as the listening socket. + * A user may want to call aws_socket_set_options() on the new socket if different options are desired. + * + * new_socket is not yet assigned to an event-loop. The user should call aws_socket_assign_to_event_loop() before + * performing IO operations. The user must call `aws_socket_clean_up()` and "aws_mem_release()" when they're done with + * the new_socket, to free it. + * + * When error_code is AWS_ERROR_SUCCESS, new_socket is the recently accepted connection. + * If error_code is non-zero, an error occurred and you should aws_socket_close() the socket. + * + * Do not call aws_socket_clean_up() from this callback. + */ +typedef void(aws_socket_on_accept_result_fn)( + struct aws_socket *socket, + int error_code, + struct aws_socket *new_socket, + void *user_data); + +/** + * Callback for when the data passed to a call to aws_socket_write() has either completed or failed. + * On success, error_code will be AWS_ERROR_SUCCESS. + * + * `socket` may be NULL in the callback if the socket is released and cleaned up before the callback is triggered. + */ +typedef void( + aws_socket_on_write_completed_fn)(struct aws_socket *socket, int error_code, size_t bytes_written, void *user_data); +/** + * Callback for when socket is either readable (edge-triggered) or when an error has occurred. If the socket is + * readable, error_code will be AWS_ERROR_SUCCESS. + * + * `socket` may be NULL in the callback if the socket is released and cleaned up before the callback is triggered. + */ +typedef void(aws_socket_on_readable_fn)(struct aws_socket *socket, int error_code, void *user_data); + +#ifdef _WIN32 +# define AWS_ADDRESS_MAX_LEN 256 +#else +# include +# define AWS_ADDRESS_MAX_LEN sizeof(((struct sockaddr_un *)0)->sun_path) +#endif +struct aws_socket_endpoint { + char address[AWS_ADDRESS_MAX_LEN]; + uint32_t port; +}; + +struct aws_socket { + struct aws_socket_vtable *vtable; + struct aws_allocator *allocator; + struct aws_socket_endpoint local_endpoint; + struct aws_socket_endpoint remote_endpoint; + struct aws_socket_options options; + struct aws_io_handle io_handle; + struct aws_event_loop *event_loop; + struct aws_channel_handler *handler; + int state; + aws_socket_on_readable_fn *readable_fn; + void *readable_user_data; + aws_socket_on_connection_result_fn *connection_result_fn; + aws_socket_on_accept_result_fn *accept_result_fn; + void *connect_accept_user_data; + void *impl; +}; + +struct aws_socket_connect_options { + const struct aws_socket_endpoint *remote_endpoint; + struct aws_event_loop *event_loop; + aws_socket_on_connection_result_fn *on_connection_result; + void *user_data; + + /* + * This is only set when using Apple SecItem for TLS negotiation. + * Apple Network Connections using SecItem require all TLS configuration options at the point of + * creating the socket slot as it handles both the TCP and TLS negotiation before returning a + * valid socket for use. + */ + struct aws_tls_connection_options *tls_connection_options; +}; + +struct aws_socket_listener_options { + aws_socket_on_accept_result_fn *on_accept_result; + void *on_accept_result_user_data; + + // This callback is invoked when the listener starts accepting incoming connections. + // If the callback set, the socket must not be released before the callback invoked. + aws_socket_on_accept_started_fn *on_accept_start; + void *on_accept_start_user_data; +}; + +struct aws_socket_bind_options { + const struct aws_socket_endpoint *local_endpoint; + void *user_data; + + /* + * This is only set when using Apple SecItem for TLS negotiation. + * Apple Network Connections using SecItem require all TLS configuration options at the point of + * creating the socket slot as it handles both the TCP and TLS negotiation before returning a + * valid socket for use. + * Socket bind also needs an event loop to run its verification block. + */ + struct aws_event_loop *event_loop; + struct aws_tls_connection_options *tls_connection_options; +}; + +struct aws_byte_buf; +struct aws_byte_cursor; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes a socket object with socket options. options will be copied. + */ +AWS_IO_API int aws_socket_init( + struct aws_socket *socket, + struct aws_allocator *alloc, + const struct aws_socket_options *options); + +/** + * Shuts down any pending operations on the socket, and cleans up state. The socket object can be re-initialized after + * this operation. This function calls aws_socket_close. If you have not already called aws_socket_close() on the + * socket, all of the rules for aws_socket_close() apply here. In this case it will not fail if you use the function + * improperly, but on some platforms you will certainly leak memory. + * + * If the socket has already been closed, you can safely, call this from any thread. + */ +AWS_IO_API void aws_socket_clean_up(struct aws_socket *socket); + +/** + * Connects to a remote endpoint. In UDP, this simply binds the socket to a remote address for use with + * `aws_socket_write()`, and if the operation is successful, the socket can immediately be used for write operations. + * + * In TCP, LOCAL and VSOCK this function will not block. If the return value is successful, then you must wait on the + * `on_connection_result()` callback to be invoked before using the socket. + * + * If an event_loop is provided for UDP sockets, a notification will be sent on + * on_connection_result in the event-loop's thread. Upon completion, the socket will already be assigned + * an event loop. If NULL is passed for UDP, it will immediately return upon success, but you must call + * aws_socket_assign_to_event_loop before use. + */ +AWS_IO_API int aws_socket_connect(struct aws_socket *socket, struct aws_socket_connect_options *socket_connect_options); + +/** + * Binds the socket to a local address. In UDP mode, the socket is ready for `aws_socket_read()` operations. In + * connection oriented modes, you still must call `aws_socket_listen()` and `aws_socket_start_accept()` before using the + * socket. local_endpoint is copied. + */ +AWS_IO_API int aws_socket_bind(struct aws_socket *socket, struct aws_socket_bind_options *socket_bind_options); + +/** + * Get the local address which the socket is bound to. + * Raises an error if no address is bound. + */ +AWS_IO_API int aws_socket_get_bound_address(const struct aws_socket *socket, struct aws_socket_endpoint *out_address); + +/** + * TCP, LOCAL and VSOCK only. Sets up the socket to listen on the address bound to in `aws_socket_bind()`. + */ +AWS_IO_API int aws_socket_listen(struct aws_socket *socket, int backlog_size); + +/** + * TCP, LOCAL and VSOCK only. The socket will begin accepting new connections. This is an asynchronous operation. New + * connections or errors will arrive via the `on_accept_result` callback. + * + * aws_socket_bind() and aws_socket_listen() must be called before calling this function. + * + */ +AWS_IO_API int aws_socket_start_accept( + struct aws_socket *socket, + struct aws_event_loop *accept_loop, + struct aws_socket_listener_options options); + +/** + * TCP, LOCAL and VSOCK only. The listening socket will stop accepting new connections. + * It is safe to call `aws_socket_start_accept()` again after + * this operation. This can be called from any thread but be aware, + * on some platforms, if you call this from outside of the current event loop's thread, it will block + * until the event loop finishes processing the request for unsubscribe in it's own thread. + */ +AWS_IO_API int aws_socket_stop_accept(struct aws_socket *socket); + +/** + * Calls `close()` on the socket and unregisters all io operations from the event loop. This function must be called + * from the event-loop's thread unless this is a listening socket. If it's a listening socket it can be called from any + * non-event-loop thread or the event-loop the socket is currently assigned to. If called from outside the event-loop, + * this function will block waiting on the socket to close. If this is called from an event-loop thread other than + * the one it's assigned to, it presents the possibility of a deadlock, so don't do it. + * + * If you are using Apple Network Framework, you should always call this function from an event-loop thread regardless + * it is a server or client socket. + */ +AWS_IO_API int aws_socket_close(struct aws_socket *socket); + +/** + * Calls `shutdown()` on the socket based on direction. + */ +AWS_IO_API int aws_socket_shutdown_dir(struct aws_socket *socket, enum aws_channel_direction dir); + +/** + * Sets new socket options on the underlying socket. + */ +AWS_IO_API int aws_socket_set_options(struct aws_socket *socket, const struct aws_socket_options *options); + +/** + * Assigns the socket to the event-loop. The socket will begin receiving read/write/error notifications after this call. + * + * Note: If you called connect for TCP or Unix Domain Sockets and received a connection_success callback, this has + * already happened. You only need to call this function when: + * + * a.) This socket is a server socket (e.g. a result of a call to start_accept()) + * b.) This socket is a UDP socket. + */ +AWS_IO_API int aws_socket_assign_to_event_loop(struct aws_socket *socket, struct aws_event_loop *event_loop); + +/** + * Gets the event-loop the socket is assigned to. + */ +AWS_IO_API struct aws_event_loop *aws_socket_get_event_loop(struct aws_socket *socket); + +/** + * Subscribes on_readable to notifications when the socket goes readable (edge-triggered). Errors will also be received + * in the callback. + * + * Note! This function is technically not thread safe, but we do not enforce which thread you call from. + * It's your responsibility to either call this in safely (e.g. just don't call it in parallel from multiple threads) or + * schedule a task to call it. If you call it before your first call to read, it will be fine. + */ +AWS_IO_API int aws_socket_subscribe_to_readable_events( + struct aws_socket *socket, + aws_socket_on_readable_fn *on_readable, + void *user_data); + +/** + * Reads from the socket. This call is non-blocking and will return `AWS_IO_SOCKET_READ_WOULD_BLOCK` if no data is + * available. `read` is the amount of data read into `buffer`. + * + * Attempts to read enough to fill all remaining space in the buffer, from `buffer->len` to `buffer->capacity`. + * `buffer->len` is updated to reflect the buffer's new length. + * + * + * Use aws_socket_subscribe_to_readable_events() to receive notifications of when the socket goes readable. + * + * NOTE! This function must be called from the event-loop used in aws_socket_assign_to_event_loop + */ +AWS_IO_API int aws_socket_read(struct aws_socket *socket, struct aws_byte_buf *buffer, size_t *amount_read); + +/** + * Writes to the socket. This call is non-blocking and will attempt to write as much as it can, but will queue any + * remaining portion of the data for write when available. written_fn will be invoked once the entire cursor has been + * written, or the write failed or was cancelled. + * + * NOTE! This function must be called from the event-loop used in aws_socket_assign_to_event_loop + * + * For client sockets, connect() and aws_socket_assign_to_event_loop() must be called before calling this. + * + * For incoming sockets from a listener, aws_socket_assign_to_event_loop() must be called first. + */ +AWS_IO_API int aws_socket_write( + struct aws_socket *socket, + const struct aws_byte_cursor *cursor, + aws_socket_on_write_completed_fn *written_fn, + void *user_data); + +/** + * Apple Network Framework only. The callback that will triggered when aws_socket_close() finished. The callback + * will be called from the socket event loop. + */ +AWS_IO_API int aws_socket_set_close_complete_callback( + struct aws_socket *socket, + aws_socket_on_shutdown_complete_fn fn, + void *user_data); + +/** + * Apple Network Framework only. The callback that will triggered when aws_socket_cleanup() finished. And + * it is only safe to release the socket afterwards. The callback will be called from the socket event loop. + */ +AWS_IO_API int aws_socket_set_cleanup_complete_callback( + struct aws_socket *socket, + aws_socket_on_shutdown_complete_fn fn, + void *user_data); + +/** + * Gets the latest error from the socket. If no error has occurred AWS_OP_SUCCESS will be returned. This function does + * not raise any errors to the installed error handlers. + */ +AWS_IO_API int aws_socket_get_error(struct aws_socket *socket); + +/** + * Returns true if the socket is still open (doesn't mean connected or listening, only that it hasn't had close() + * called. + */ +AWS_IO_API bool aws_socket_is_open(struct aws_socket *socket); + +/** + * Raises AWS_IO_SOCKET_INVALID_ADDRESS and logs an error if connecting to this port is illegal. + * For example, port must be in range 1-65535 to connect with IPv4. + * These port values would fail eventually in aws_socket_connect(), + * but you can use this function to validate earlier. + */ +AWS_IO_API int aws_socket_validate_port_for_connect(uint32_t port, enum aws_socket_domain domain); + +/** + * Raises AWS_IO_SOCKET_INVALID_ADDRESS and logs an error if binding to this port is illegal. + * For example, port must in range 0-65535 to bind with IPv4. + * These port values would fail eventually in aws_socket_bind(), + * but you can use this function to validate earlier. + */ +AWS_IO_API int aws_socket_validate_port_for_bind(uint32_t port, enum aws_socket_domain domain); + +/** + * Assigns a random address (UUID) for use with AWS_SOCKET_LOCAL (Unix Domain Sockets). + * For use in internal tests only. + */ +AWS_IO_API void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint *endpoint); + +/** + * Validates whether the network interface name is valid. On Windows, it will always return false since we don't support + * network_interface_name on Windows */ +AWS_IO_API bool aws_is_network_interface_name_valid(const char *interface_name); + +/** + * Get default impl type based on the platform. + * For user in internal tests only. + */ +AWS_IO_API enum aws_socket_impl_type aws_socket_get_default_impl_type(void); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_SOCKET_H */ diff --git a/include/aws/io/socket_channel_handler.h b/include/aws/io/socket_channel_handler.h new file mode 100644 index 0000000000000000000000000000000000000000..a9f6a23cb89c3e36f6fcbf9c2ec847d91204016b --- /dev/null +++ b/include/aws/io/socket_channel_handler.h @@ -0,0 +1,35 @@ +#ifndef AWS_IO_SOCKET_CHANNEL_HANDLER_H +#define AWS_IO_SOCKET_CHANNEL_HANDLER_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_socket; +struct aws_channel_handler; +struct aws_channel_slot; +struct aws_event_loop; + +AWS_EXTERN_C_BEGIN +/** + * Socket handlers should be the first slot/handler in a channel. It interacts directly with the channel's event loop + * for read and write notifications. max_read_size is the maximum amount of data it will read from the socket + * before a context switch (a continuation task will be scheduled). + */ +AWS_IO_API struct aws_channel_handler *aws_socket_handler_new( + struct aws_allocator *allocator, + struct aws_socket *socket, + struct aws_channel_slot *slot, + size_t max_read_size); + +/* Get aws_socket from socket channel handler */ +AWS_IO_API const struct aws_socket *aws_socket_handler_get_socket(const struct aws_channel_handler *handler); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_SOCKET_CHANNEL_HANDLER_H */ diff --git a/include/aws/io/statistics.h b/include/aws/io/statistics.h new file mode 100644 index 0000000000000000000000000000000000000000..62217e1764f66844f19e4c7866ac7ccf39d098d9 --- /dev/null +++ b/include/aws/io/statistics.h @@ -0,0 +1,81 @@ +#ifndef AWS_IO_STATISTICS_H +#define AWS_IO_STATISTICS_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +enum aws_crt_io_statistics_category { + AWSCRT_STAT_CAT_SOCKET = AWS_CRT_STATISTICS_CATEGORY_BEGIN_RANGE(AWS_C_IO_PACKAGE_ID), + AWSCRT_STAT_CAT_TLS, +}; + +/** + * Socket channel handler statistics record + */ +struct aws_crt_statistics_socket { + aws_crt_statistics_category_t category; + uint64_t bytes_read; + uint64_t bytes_written; +}; + +/** + * Tls channel handler statistics record + */ +struct aws_crt_statistics_tls { + aws_crt_statistics_category_t category; + uint64_t handshake_start_ns; + uint64_t handshake_end_ns; + enum aws_tls_negotiation_status handshake_status; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Initializes socket channel handler statistics + */ +AWS_IO_API +int aws_crt_statistics_socket_init(struct aws_crt_statistics_socket *stats); + +/** + * Cleans up socket channel handler statistics + */ +AWS_IO_API +void aws_crt_statistics_socket_cleanup(struct aws_crt_statistics_socket *stats); + +/** + * Resets socket channel handler statistics for the next gather interval. Calculate-once results are left alone. + */ +AWS_IO_API +void aws_crt_statistics_socket_reset(struct aws_crt_statistics_socket *stats); + +/** + * Initializes tls channel handler statistics + */ +AWS_IO_API +int aws_crt_statistics_tls_init(struct aws_crt_statistics_tls *stats); + +/** + * Cleans up tls channel handler statistics + */ +AWS_IO_API +void aws_crt_statistics_tls_cleanup(struct aws_crt_statistics_tls *stats); + +/** + * Resets tls channel handler statistics for the next gather interval. Calculate-once results are left alone. + */ +AWS_IO_API +void aws_crt_statistics_tls_reset(struct aws_crt_statistics_tls *stats); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_STATISTICS_H */ diff --git a/include/aws/io/stream.h b/include/aws/io/stream.h new file mode 100644 index 0000000000000000000000000000000000000000..711537d02a6fdb197d80906ee7a9cfaa1c247a55 --- /dev/null +++ b/include/aws/io/stream.h @@ -0,0 +1,136 @@ +#ifndef AWS_IO_STREAM_H +#define AWS_IO_STREAM_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +struct aws_input_stream; +struct aws_byte_buf; + +/* + * For seek calls, where in the stream to seek from. + * CUR support can come later + * Intentionally mirror libc constants + */ +enum aws_stream_seek_basis { AWS_SSB_BEGIN = 0, AWS_SSB_END = 2 }; + +struct aws_stream_status { + bool is_end_of_stream; + bool is_valid; +}; + +struct aws_input_stream_vtable { + int (*seek)(struct aws_input_stream *stream, int64_t offset, enum aws_stream_seek_basis basis); + /** + * Stream as much data as will fit into the destination buffer and update its length. + * The destination buffer's capacity MUST NOT be changed. + * + * Return AWS_OP_SUCCESS if the read is successful. + * If AWS_OP_ERR is returned, the stream is assumed to be invalid and any data written to the buffer is ignored. + * + * If no more data is currently available, or the end of the stream has been reached, simply return AWS_OP_SUCCESS + * without touching the destination buffer. + */ + int (*read)(struct aws_input_stream *stream, struct aws_byte_buf *dest); + int (*get_status)(struct aws_input_stream *stream, struct aws_stream_status *status); + int (*get_length)(struct aws_input_stream *stream, int64_t *out_length); + + /** + * Optional. + * If not set, the default aws_ref_count_acquire/release will be used. + * Set for high level language binding that has its own refcounting implementation and needs to be kept alive from + * C. + * If set, ref_count member will not be used. + */ + void (*acquire)(struct aws_input_stream *stream); + void (*release)(struct aws_input_stream *stream); +}; + +/** + * Base class for input streams. + * Note: when you implement one input stream, the ref_count needs to be initialized to clean up the resource when + * reaches to zero. + */ +struct aws_input_stream { + /* point to the impl only set if needed. */ + void *impl; + const struct aws_input_stream_vtable *vtable; + struct aws_ref_count ref_count; +}; + +AWS_EXTERN_C_BEGIN + +/** + * Increments the reference count on the input stream, allowing the caller to take a reference to it. + * + * Returns the same input stream passed in. + */ +AWS_IO_API struct aws_input_stream *aws_input_stream_acquire(struct aws_input_stream *stream); + +/** + * Decrements a input stream's ref count. When the ref count drops to zero, the input stream will be destroyed. + * + * Returns NULL always. + */ +AWS_IO_API struct aws_input_stream *aws_input_stream_release(struct aws_input_stream *stream); + +/* + * Seek to a position within a stream; analagous to fseek() and its relatives + */ +AWS_IO_API int aws_input_stream_seek(struct aws_input_stream *stream, int64_t offset, enum aws_stream_seek_basis basis); + +/* + * Read data from a stream. If data is available, will read up to the (capacity - len) open bytes + * in the destination buffer. If AWS_OP_ERR is returned, the destination buffer will be unchanged. + */ +AWS_IO_API int aws_input_stream_read(struct aws_input_stream *stream, struct aws_byte_buf *dest); + +/* + * Queries miscellaneous properties of the stream + */ +AWS_IO_API int aws_input_stream_get_status(struct aws_input_stream *stream, struct aws_stream_status *status); + +/* + * Returns the total stream length, if able, regardless of current stream position. Under certain conditions, + * a valid stream may return an error instead when there is not a good answer (socket stream, for example). + * + */ +AWS_IO_API int aws_input_stream_get_length(struct aws_input_stream *stream, int64_t *out_length); + +/* DEPRECATED + * Tears down the stream. Equivalent to aws_input_stream_release() + */ +AWS_IO_API void aws_input_stream_destroy(struct aws_input_stream *stream); + +/* + * Creates a stream that operates on a range of bytes + */ +AWS_IO_API struct aws_input_stream *aws_input_stream_new_from_cursor( + struct aws_allocator *allocator, + const struct aws_byte_cursor *cursor); + +/* + * Creates a stream that operates on a (not-yet-opened) file. + * Destruction closes the file. + */ +AWS_IO_API struct aws_input_stream *aws_input_stream_new_from_file( + struct aws_allocator *allocator, + const char *file_name); + +/* + * Creates an input stream that reads from an already opened file. + * Destruction does not close the file. + */ +AWS_IO_API struct aws_input_stream *aws_input_stream_new_from_open_file(struct aws_allocator *allocator, FILE *file); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_STREAM_H */ diff --git a/include/aws/io/tls_channel_handler.h b/include/aws/io/tls_channel_handler.h new file mode 100644 index 0000000000000000000000000000000000000000..686b06f63d9010c414fdb177ee366580fb30fd15 --- /dev/null +++ b/include/aws/io/tls_channel_handler.h @@ -0,0 +1,963 @@ +#ifndef AWS_IO_TLS_CHANNEL_HANDLER_H +#define AWS_IO_TLS_CHANNEL_HANDLER_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include + +AWS_PUSH_SANE_WARNING_LEVEL + +#define AWS_TLS_NEGOTIATED_PROTOCOL_MESSAGE 0x01 + +struct aws_channel_slot; +struct aws_channel_handler; +struct aws_pkcs11_session; +struct aws_string; + +enum aws_tls_versions { + AWS_IO_SSLv3, + AWS_IO_TLSv1, + AWS_IO_TLSv1_1, + AWS_IO_TLSv1_2, + AWS_IO_TLSv1_3, + AWS_IO_TLS_VER_SYS_DEFAULTS = 128, +}; + +enum aws_tls_cipher_pref { + AWS_IO_TLS_CIPHER_PREF_SYSTEM_DEFAULT = 0, + + /* Deprecated */ AWS_IO_TLS_CIPHER_PREF_KMS_PQ_TLSv1_0_2019_06 = 1, + /* Deprecated */ AWS_IO_TLS_CIPHER_PREF_KMS_PQ_SIKE_TLSv1_0_2019_11 = 2, + /* Deprecated */ AWS_IO_TLS_CIPHER_PREF_KMS_PQ_TLSv1_0_2020_02 = 3, + /* Deprecated */ AWS_IO_TLS_CIPHER_PREF_KMS_PQ_SIKE_TLSv1_0_2020_02 = 4, + /* Deprecated */ AWS_IO_TLS_CIPHER_PREF_KMS_PQ_TLSv1_0_2020_07 = 5, + /* Deprecated */ AWS_IO_TLS_CIPHER_PREF_PQ_TLSv1_0_2021_05 = 6, + + /* + * This TLS cipher preference list contains post-quantum key exchange algorithms that have been standardized by + * NIST. PQ algorithms in this preference list will be used in hybrid mode, and always combined with a classical + * ECDHE key exchange. + */ + AWS_IO_TLS_CIPHER_PREF_PQ_TLSV1_2_2024_10 = 7, + + /* Recommended default policy with post-quantum algorithm support. This policy may change over time. */ + AWS_IO_TLS_CIPHER_PREF_PQ_DEFAULT = 8, + + /* This security policy is based on AWS-CRT-SDK-TLSv1.2-2023 (the default when a minimum TLS version is TLS 1.2), + * with tightened security. This security policy is FIPS-complaint. + */ + AWS_IO_TLS_CIPHER_PREF_TLSV1_2_2025_07 = 9, + + AWS_IO_TLS_CIPHER_PREF_END_RANGE = 0xFFFF +}; + +/** + * The hash algorithm of a TLS private key operation. Any custom private key operation handlers are expected to perform + * operations on the input TLS data using the correct hash algorithm or fail the operation. + */ +enum aws_tls_hash_algorithm { + AWS_TLS_HASH_UNKNOWN, + AWS_TLS_HASH_SHA1, + AWS_TLS_HASH_SHA224, + AWS_TLS_HASH_SHA256, + AWS_TLS_HASH_SHA384, + AWS_TLS_HASH_SHA512, +}; + +/** + * The signature of a TLS private key operation. Any custom private key operation handlers are expected to perform + * operations on the input TLS data using the correct signature algorithm or fail the operation. + */ +enum aws_tls_signature_algorithm { + AWS_TLS_SIGNATURE_UNKNOWN, + AWS_TLS_SIGNATURE_RSA, + AWS_TLS_SIGNATURE_ECDSA, +}; + +/** + * The TLS private key operation that needs to be performed by a custom private key operation handler when making + * a connection using mutual TLS. + */ +enum aws_tls_key_operation_type { + AWS_TLS_KEY_OPERATION_UNKNOWN, + AWS_TLS_KEY_OPERATION_SIGN, + AWS_TLS_KEY_OPERATION_DECRYPT, +}; + +struct aws_tls_ctx { + struct aws_allocator *alloc; + void *impl; + struct aws_ref_count ref_count; +}; + +/** + * Invoked upon completion of the TLS handshake. If successful error_code will be AWS_OP_SUCCESS, otherwise + * the negotiation failed and immediately after this function is invoked, the channel will be shutting down. + * + * NOTE: When using SecItem the handler and slot arguments will be pointers to the socket slot and socket handler. This + * is due to TLS negotiaion being handled by the Apple Network Framework connection in the socket slot/handler. + */ +typedef void(aws_tls_on_negotiation_result_fn)( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + int error_code, + void *user_data); + +/** + * Only used if the TLS handler is the last handler in the channel. This allows you to read any data that + * was read and decrypted by the handler. If you have application protocol channel handlers, this function + * is not necessary and certainly not recommended. + */ +typedef void(aws_tls_on_data_read_fn)( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + struct aws_byte_buf *buffer, + void *user_data); + +/** + * Invoked when an error occurs in the TLS state machine AFTER the handshake has completed. This function should only + * be used in conjunction with the rules of aws_tls_on_data_read_fn. + */ +typedef void(aws_tls_on_error_fn)( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + int err, + const char *message, + void *user_data); + +struct aws_tls_connection_options { + /** semi-colon delimited list of protocols. Example: + * h2;http/1.1 + */ + struct aws_string *alpn_list; + /** + * Serves two purposes. If SNI is supported (hint... it is), + * this sets the SNI extension. + * + * For X.509 validation this also sets the name that will be used + * for verifying the subj alt name and common name of the peer's certificate. + */ + struct aws_string *server_name; + aws_tls_on_negotiation_result_fn *on_negotiation_result; + aws_tls_on_data_read_fn *on_data_read; + aws_tls_on_error_fn *on_error; + void *user_data; + struct aws_tls_ctx *ctx; + bool advertise_alpn_message; + uint32_t timeout_ms; +}; + +/** + * A struct containing all of the data needed for a private key operation when + * making a mutual TLS connection. This struct contains the data that needs + * to be operated on, like performing a sign operation or a decrypt operation. + */ +struct aws_tls_key_operation; + +/** + * A struct containing parameters used during import of Certificate and Private Key into a + * data protection keychain using Apple's SecItem API. + */ +struct aws_secitem_options { + /** + * Human-Readable identifier tag for certificate being used in keychain. + * Value will be used with kSecAttrLabel Key in SecItem functions. + * If one is not provided, we generate it ourselves. + */ + struct aws_string *cert_label; + + /** + * Human-Readable identifier tag for private key being used in keychain. + * Value will be used with kSecAttrLabel Key in SecItem functions. + * If one is not provided, we generate it ourselves. + */ + struct aws_string *key_label; +}; + +struct aws_tls_ctx_options { + struct aws_allocator *allocator; + + /** + * minimum tls version to use. If you just want us to use the + * system defaults, you can set: AWS_IO_TLS_VER_SYS_DEFAULTS. This + * has the added benefit of automatically picking up new TLS versions + * as your OS or distribution adds support. + */ + enum aws_tls_versions minimum_tls_version; + + /** + * The Cipher Preference List to use + */ + enum aws_tls_cipher_pref cipher_pref; + + /** + * A PEM armored PKCS#7 collection of CAs you want to trust as a string. + * Only use this if it's a CA not currently installed on your system. + */ + struct aws_byte_buf ca_file; + /** + * Only used on Unix systems using an openssl style trust API. + * this is typically something like /etc/pki/tls/certs/" + */ + struct aws_string *ca_path; + /** + * Sets ctx wide alpn string. This is most useful for servers. + * This is a semi-colon delimited list. example: + * h2;http/1.1 + */ + struct aws_string *alpn_list; + /** + * A PEM armored PKCS#7 certificate as a string. + * It is supported on every operating system. + */ + struct aws_byte_buf certificate; + +#ifdef _WIN32 + /** The path to a system + * installed certficate/private key pair. Example: + * CurrentUser\\MY\\ + */ + const char *system_certificate_path; +#endif + + /** + * A PEM armored PKCS#7 private key as a string. + * + * On windows, this field should be NULL only if you are + * using a system installed certficate. + */ + struct aws_byte_buf private_key; + +#ifdef __APPLE__ + /** + * Apple Only! + * + * On Apple OS you can also use a pkcs#12 for your certificate + * and private key. This is the contents the certificate. + */ + struct aws_byte_buf pkcs12; + + /** + * Password for the pkcs12 data in pkcs12. + */ + struct aws_byte_buf pkcs12_password; + + /** + * On iOS/tvOS the available settings when adding items to the keychain using + * SecItem are contained within this struct. This is NOT supported on MacOS. + */ + struct aws_secitem_options secitem_options; + + /** + * On MacOS you can also use a custom keychain instead of + * the default keychain of the account. This is NOT supported on iOS. + */ + struct aws_string *keychain_path; + +#endif /* __APPLE__ */ + + /** max tls fragment size. Default is the value of g_aws_channel_max_fragment_size. */ + size_t max_fragment_size; + + /** + * default is true for clients and false for servers. + * You should not change this default for clients unless + * you're testing and don't want to fool around with CA trust stores. + * Before you release to production, you'll want to turn this back on + * and add your custom CA to the aws_tls_ctx_options. + * + * If you set this in server mode, it enforces client authentication. + */ + bool verify_peer; + + /** + * For use when adding BYO_CRYPTO implementations. You can set extra data in here for use with your TLS + * implementation. + */ + void *ctx_options_extension; + + /** + * Set if using custom private key operations. + * See aws_custom_key_op_handler for more details + * + * Note: Custom key operations (and PKCS#11 integration) hasn't been tested with TLS 1.3, so don't use + * cipher preferences that allow TLS 1.3. If this is set, we will always use non TLS 1.3 preferences. + */ + struct aws_custom_key_op_handler *custom_key_op_handler; +}; + +struct aws_tls_negotiated_protocol_message { + struct aws_byte_buf protocol; +}; + +typedef struct aws_channel_handler *( + *aws_tls_on_protocol_negotiated)(struct aws_channel_slot *new_slot, struct aws_byte_buf *protocol, void *user_data); + +/** + * An enum for the current state of tls negotiation within a tls channel handler + */ +enum aws_tls_negotiation_status { + AWS_TLS_NEGOTIATION_STATUS_NONE, + AWS_TLS_NEGOTIATION_STATUS_ONGOING, + AWS_TLS_NEGOTIATION_STATUS_SUCCESS, + AWS_TLS_NEGOTIATION_STATUS_FAILURE +}; + +#ifdef BYO_CRYPTO +/** + * Callback for creating a TLS handler. If you're using this you're using BYO_CRYPTO. This function should return + * a fully implemented aws_channel_handler instance for TLS. Note: the aws_tls_options passed to your + * aws_tls_handler_new_fn contains multiple callbacks. Namely: aws_tls_on_negotiation_result_fn. You are responsible for + * invoking this function when TLs session negotiation has completed. + */ +typedef struct aws_channel_handler *(aws_tls_handler_new_fn)(struct aws_allocator *allocator, + struct aws_tls_connection_options *options, + struct aws_channel_slot *slot, + void *user_data); + +/** + * Invoked when it's time to start TLS negotiation. Note: the aws_tls_options passed to your aws_tls_handler_new_fn + * contains multiple callbacks. Namely: aws_tls_on_negotiation_result_fn. You are responsible for invoking this function + * when TLS session negotiation has completed. + */ +typedef int(aws_tls_client_handler_start_negotiation_fn)(struct aws_channel_handler *handler, void *user_data); + +struct aws_tls_byo_crypto_setup_options { + aws_tls_handler_new_fn *new_handler_fn; + /* ignored for server implementations, required for clients. */ + aws_tls_client_handler_start_negotiation_fn *start_negotiation_fn; + void *user_data; +}; + +#endif /* BYO_CRYPTO */ + +AWS_EXTERN_C_BEGIN + +/******************************** tls options init stuff ***********************/ +/** + * Initializes options with default client options + */ +AWS_IO_API void aws_tls_ctx_options_init_default_client( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator); +/** + * Cleans up resources allocated by init_* functions + */ +AWS_IO_API void aws_tls_ctx_options_clean_up(struct aws_tls_ctx_options *options); + +/** + * Initializes options for use with mutual tls in client mode. + * cert_path and pkey_path are paths to files on disk. cert_path + * and pkey_path are treated as PKCS#7 PEM armored. They are loaded + * from disk and stored in buffers internally. + */ +AWS_IO_API int aws_tls_ctx_options_init_client_mtls_from_path( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const char *cert_path, + const char *pkey_path); + +/** + * Initializes options for use with mutual tls in client mode. + * cert and pkey are copied. cert and pkey are treated as PKCS#7 PEM + * armored. + */ +AWS_IO_API int aws_tls_ctx_options_init_client_mtls( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const struct aws_byte_cursor *cert, + const struct aws_byte_cursor *pkey); + +/** + * vtable for aws_custom_key_op_handler. + */ +struct aws_custom_key_op_handler_vtable { + /** + * Called when the a TLS handshake has an operation it needs the custom key operation handler to perform. + * NOTE: You must call aws_tls_key_operation_complete() or aws_tls_key_operation_complete_with_error() + * otherwise the TLS handshake will stall the TLS connection indefinitely and leak memory. + */ + void (*on_key_operation)(struct aws_custom_key_op_handler *key_op_handler, struct aws_tls_key_operation *operation); +}; + +/** + * The custom key operation that is used when performing a mutual TLS handshake. This can + * be extended to provide custom private key operations, like PKCS11 or similar. + */ +struct aws_custom_key_op_handler { + /** + * A void* intended to be populated with a reference to whatever class is extending this class. For example, + * if you have extended aws_custom_key_op_handler with a custom struct, you would put a pointer to this struct + * to *impl so you can retrieve it back in the vtable functions. + */ + void *impl; + + /** + * A vtable containing all of the functions the aws_custom_key_op_handler implements. Is intended to be extended. + * NOTE: Use "aws_custom_key_op_handler_" to access vtable functions. + */ + const struct aws_custom_key_op_handler_vtable *vtable; + + /** + * A reference count for handling memory usage. + * Use aws_custom_key_op_handler_acquire and aws_custom_key_op_handler_release to increase/decrease count. + */ + struct aws_ref_count ref_count; +}; + +/** + * Increases the reference count for the passed-in aws_custom_key_op_handler and returns it. + */ +AWS_IO_API struct aws_custom_key_op_handler *aws_custom_key_op_handler_acquire( + struct aws_custom_key_op_handler *key_op_handler); + +/** + * Decreases the reference count for the passed-in aws_custom_key_op_handler and returns NULL. + */ +AWS_IO_API struct aws_custom_key_op_handler *aws_custom_key_op_handler_release( + struct aws_custom_key_op_handler *key_op_handler); + +/** + * Calls the on_key_operation vtable function. See aws_custom_key_op_handler_vtable for function details. + */ +AWS_IO_API void aws_custom_key_op_handler_perform_operation( + struct aws_custom_key_op_handler *key_op_handler, + struct aws_tls_key_operation *operation); + +/** + * Initializes options for use with mutual TLS in client mode, + * where private key operations are handled by custom code. + * + * Note: cert_file_contents will be copied into a new buffer after this + * function is called, so you do not need to keep that data alive + * after calling this function. + * + * @param options aws_tls_ctx_options to be initialized. + * @param allocator Allocator to use. + * @param custom Options for custom key operations. + * @param cert_file_contents The contents of a certificate file. + */ +AWS_IO_API int aws_tls_ctx_options_init_client_mtls_with_custom_key_operations( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + struct aws_custom_key_op_handler *custom, + const struct aws_byte_cursor *cert_file_contents); + +/** + * This struct exists as a graceful way to pass many arguments when + * calling init-with-pkcs11 functions on aws_tls_ctx_options (this also makes + * it easy to introduce optional arguments in the future). + * Instances of this struct should only exist briefly on the stack. + * + * Instructions for binding this to high-level languages: + * - Python: The members of this struct should be the keyword args to the init-with-pkcs11 functions. + * - JavaScript: This should be an options map passed to init-with-pkcs11 functions. + * - Java: This should be an options class passed to init-with-pkcs11 functions. + * - C++: Same as Java + * + * Notes on integer types: + * PKCS#11 uses `unsigned long` for IDs, handles, etc but we expose them as `uint64_t` in public APIs. + * We do this because sizeof(long) is inconsistent across platform/arch/language + * (ex: always 64bit in Java, always 32bit in C on Windows, matches CPU in C on Linux and Apple). + * By using uint64_t in our public API, we can keep the careful bounds-checking all in one + * place, instead of expecting each high-level language binding to get it just right. + */ +struct aws_tls_ctx_pkcs11_options { + /** + * The PKCS#11 library to use. + * This field is required. + */ + struct aws_pkcs11_lib *pkcs11_lib; + + /** + * User PIN, for logging into the PKCS#11 token (UTF-8). + * Zero out to log into a token with a "protected authentication path". + */ + struct aws_byte_cursor user_pin; + + /** + * ID of slot containing PKCS#11 token. + * If set to NULL, the token will be chosen based on other criteria + * (such as token label). + */ + const uint64_t *slot_id; + + /** + * Label of PKCS#11 token to use. + * If zeroed out, the token will be chosen based on other criteria + * (such as slot ID). + */ + struct aws_byte_cursor token_label; + + /** + * Label of private key object on PKCS#11 token (UTF-8). + * If zeroed out, the private key will be chosen based on other criteria + * (such as being the only available private key on the token). + */ + struct aws_byte_cursor private_key_object_label; + + /** + * Certificate's file path on disk (UTF-8). + * The certificate must be PEM formatted and UTF-8 encoded. + * Zero out if passing in certificate by some other means (such as file contents). + */ + struct aws_byte_cursor cert_file_path; + + /** + * Certificate's file contents (UTF-8). + * The certificate must be PEM formatted and UTF-8 encoded. + * Zero out if passing in certificate by some other means (such as file path). + */ + struct aws_byte_cursor cert_file_contents; +}; + +/** + * Initializes options for use with mutual TLS in client mode, + * where a PKCS#11 library provides access to the private key. + * + * NOTE: This only works on Unix devices. + * + * @param options aws_tls_ctx_options to be initialized. + * @param allocator Allocator to use. + * @param pkcs11_options Options for using PKCS#11 (contents are copied) + */ +AWS_IO_API int aws_tls_ctx_options_init_client_mtls_with_pkcs11( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const struct aws_tls_ctx_pkcs11_options *pkcs11_options); + +/** + * @Deprecated + * + * Sets a custom keychain path for storing the cert and pkey with mutual tls in client mode. + * + * NOTE: This only works on MacOS. + */ +AWS_IO_API int aws_tls_ctx_options_set_keychain_path( + struct aws_tls_ctx_options *options, + struct aws_byte_cursor *keychain_path_cursor); + +/** + * Applies provided SecItem options to certificate and private key being + * added to the iOS/tvOS KeyChain. + * + * NOTE: Currently only supported on iOS and tvOS using SecItem. + * + * @param options aws_tls_ctx_options to be modified. + * @param secitem_options Options for SecItems + */ +AWS_IO_API int aws_tls_ctx_options_set_secitem_options( + struct aws_tls_ctx_options *tls_ctx_options, + const struct aws_secitem_options *secitem_options); + +/** + * Cleans up resources in secitem_options. + */ +AWS_IO_API void aws_tls_secitem_options_clean_up(struct aws_secitem_options *secitem_options); + +/** + * Initializes options for use with in server mode. + * cert_path and pkey_path are paths to files on disk. cert_path + * and pkey_path are treated as PKCS#7 PEM armored. They are loaded + * from disk and stored in buffers internally. + */ +AWS_IO_API int aws_tls_ctx_options_init_default_server_from_path( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const char *cert_path, + const char *pkey_path); + +/** + * Initializes options for use with in server mode. + * cert and pkey are copied. cert and pkey are treated as PKCS#7 PEM + * armored. + */ +AWS_IO_API int aws_tls_ctx_options_init_default_server( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + struct aws_byte_cursor *cert, + struct aws_byte_cursor *pkey); + +/** + * Initializes options for use with mutual tls in client mode. + * cert_reg_path is the path to a system + * installed certficate/private key pair. Example: + * CurrentUser\\MY\\ + * + * NOTE: This only works on Windows. + */ +AWS_IO_API int aws_tls_ctx_options_init_client_mtls_from_system_path( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const char *cert_reg_path); + +/** + * Initializes options for use with server mode. + * cert_reg_path is the path to a system + * installed certficate/private key pair. Example: + * CurrentUser\\MY\\ + * + * NOTE: This only works on Windows. + */ +AWS_IO_API int aws_tls_ctx_options_init_default_server_from_system_path( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const char *cert_reg_path); + +/** + * Initializes options for use with mutual tls in client mode. + * pkcs12_path is a path to a file on disk containing a pkcs#12 file. The file is loaded + * into an internal buffer. pkcs_pwd is the corresponding password for the pkcs#12 file; it is copied. + * + * NOTE: This only works on Apple devices. + */ +AWS_IO_API int aws_tls_ctx_options_init_client_mtls_pkcs12_from_path( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const char *pkcs12_path, + const struct aws_byte_cursor *pkcs_pwd); + +/** + * Initializes options for use with mutual tls in client mode. + * pkcs12 is a buffer containing a pkcs#12 certificate and private key; it is copied. + * pkcs_pwd is the corresponding password for the pkcs#12 buffer; it is copied. + * + * NOTE: This only works on Apple devices. + */ +AWS_IO_API int aws_tls_ctx_options_init_client_mtls_pkcs12( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + struct aws_byte_cursor *pkcs12, + struct aws_byte_cursor *pkcs_pwd); + +/** + * Initializes options for use in server mode. + * pkcs12_path is a path to a file on disk containing a pkcs#12 file. The file is loaded + * into an internal buffer. pkcs_pwd is the corresponding password for the pkcs#12 file; it is copied. + * + * NOTE: This only works on Apple devices. + */ +AWS_IO_API int aws_tls_ctx_options_init_server_pkcs12_from_path( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + const char *pkcs12_path, + struct aws_byte_cursor *pkcs_password); + +/** + * Initializes options for use in server mode. + * pkcs12 is a buffer containing a pkcs#12 certificate and private key; it is copied. + * pkcs_pwd is the corresponding password for the pkcs#12 buffer; it is copied. + * + * NOTE: This only works on Apple devices. + */ +AWS_IO_API int aws_tls_ctx_options_init_server_pkcs12( + struct aws_tls_ctx_options *options, + struct aws_allocator *allocator, + struct aws_byte_cursor *pkcs12, + struct aws_byte_cursor *pkcs_password); + +/** + * Sets alpn list in the form . A maximum of 4 protocols are supported. + * alpn_list is copied. + */ +AWS_IO_API int aws_tls_ctx_options_set_alpn_list(struct aws_tls_ctx_options *options, const char *alpn_list); + +/** + * Enables or disables x.509 validation. Disable this only for testing. To enable mutual TLS in server mode, + * set verify_peer to true. + */ +AWS_IO_API void aws_tls_ctx_options_set_verify_peer(struct aws_tls_ctx_options *options, bool verify_peer); + +/** + * Sets preferred TLS Cipher List + */ +AWS_IO_API void aws_tls_ctx_options_set_tls_cipher_preference( + struct aws_tls_ctx_options *options, + enum aws_tls_cipher_pref cipher_pref); + +/** + * Sets the minimum TLS version to allow. + */ +AWS_IO_API void aws_tls_ctx_options_set_minimum_tls_version( + struct aws_tls_ctx_options *options, + enum aws_tls_versions minimum_tls_version); + +/** + * Override the default trust store. ca_file is a buffer containing a PEM armored chain of trusted CA certificates. + * ca_file is copied. + */ +AWS_IO_API int aws_tls_ctx_options_override_default_trust_store( + struct aws_tls_ctx_options *options, + const struct aws_byte_cursor *ca_file); + +/** + * Override the default trust store. ca_path is a path to a directory on disk containing trusted certificates. This is + * only supported on Unix systems (otherwise this parameter is ignored). ca_file is a path to a file on disk containing + * trusted certificates. ca_file is loaded from disk and stored in an internal buffer. + */ +AWS_IO_API int aws_tls_ctx_options_override_default_trust_store_from_path( + struct aws_tls_ctx_options *options, + const char *ca_path, + const char *ca_file); + +/** + * When implementing BYO_CRYPTO, if you need extra data to pass to your tls implementation, set it here. The lifetime of + * extension_data must outlive the options object and be cleaned up after options is cleaned up. + */ +AWS_IO_API void aws_tls_ctx_options_set_extension_data(struct aws_tls_ctx_options *options, void *extension_data); + +/** + * Initializes default connection options from an instance ot aws_tls_ctx. + */ +AWS_IO_API void aws_tls_connection_options_init_from_ctx( + struct aws_tls_connection_options *conn_options, + struct aws_tls_ctx *ctx); + +/** + * Cleans up resources in aws_tls_connection_options. This can be called immediately after initializing + * a tls handler, or if using the bootstrap api, immediately after asking for a channel. + */ +AWS_IO_API void aws_tls_connection_options_clean_up(struct aws_tls_connection_options *connection_options); + +/** + * Cleans up 'to' and copies 'from' to 'to'. + * 'to' must be initialized. + */ +AWS_IO_API int aws_tls_connection_options_copy( + struct aws_tls_connection_options *to, + const struct aws_tls_connection_options *from); + +/** + * Sets callbacks for use with a tls connection. + */ +AWS_IO_API void aws_tls_connection_options_set_callbacks( + struct aws_tls_connection_options *conn_options, + aws_tls_on_negotiation_result_fn *on_negotiation_result, + aws_tls_on_data_read_fn *on_data_read, + aws_tls_on_error_fn *on_error, + void *user_data); + +/** + * Sets server name to use for the SNI extension (supported everywhere), as well as x.509 validation. If you don't + * set this, your x.509 validation will likely fail. + */ +AWS_IO_API int aws_tls_connection_options_set_server_name( + struct aws_tls_connection_options *conn_options, + struct aws_allocator *allocator, + const struct aws_byte_cursor *server_name); + +/** + * Sets alpn list in the form . A maximum of 4 protocols are supported. + * alpn_list is copied. This value is already inherited from aws_tls_ctx, but the aws_tls_ctx is expensive, + * and should be used across as many connections as possible. If you want to set this per connection, set it here. + */ +AWS_IO_API int aws_tls_connection_options_set_alpn_list( + struct aws_tls_connection_options *conn_options, + struct aws_allocator *allocator, + const char *alpn_list); + +/********************************* TLS context and state management *********************************/ + +/** + * Returns true if alpn is available in the underlying tls implementation. + * This function should always be called before setting an alpn list. + */ +AWS_IO_API bool aws_tls_is_alpn_available(void); + +/** + * Returns true if this Cipher Preference is available in the underlying TLS implementation. + * This function should always be called before setting a Cipher Preference + */ +AWS_IO_API bool aws_tls_is_cipher_pref_supported(enum aws_tls_cipher_pref cipher_pref); + +/** + * Creates a new tls channel handler in client mode. Options will be copied. + * You must call aws_tls_client_handler_start_negotiation and wait on the + * aws_tls_on_negotiation_result_fn callback before the handler can begin processing + * application data. + */ +AWS_IO_API struct aws_channel_handler *aws_tls_client_handler_new( + struct aws_allocator *allocator, + struct aws_tls_connection_options *options, + struct aws_channel_slot *slot); + +/** + * Creates a new tls channel handler in server mode. Options will be copied. + * You must wait on the aws_tls_on_negotiation_result_fn callback before the handler can begin processing + * application data. + */ +AWS_IO_API struct aws_channel_handler *aws_tls_server_handler_new( + struct aws_allocator *allocator, + struct aws_tls_connection_options *options, + struct aws_channel_slot *slot); + +#ifdef BYO_CRYPTO +/** + * If using BYO_CRYPTO, you need to call this function prior to creating any client channels in the application. + */ +AWS_IO_API void aws_tls_byo_crypto_set_client_setup_options(const struct aws_tls_byo_crypto_setup_options *options); +/** + * If using BYO_CRYPTO, you need to call this function prior to creating any server channels in the application. + */ +AWS_IO_API void aws_tls_byo_crypto_set_server_setup_options(const struct aws_tls_byo_crypto_setup_options *options); + +#endif /* BYO_CRYPTO */ + +/** + * Creates a channel handler, for client or server mode, that handles alpn. This isn't necessarily required + * since you can always call aws_tls_handler_protocol in the aws_tls_on_negotiation_result_fn callback, but + * this makes channel bootstrap easier to handle. + */ +AWS_IO_API struct aws_channel_handler *aws_tls_alpn_handler_new( + struct aws_allocator *allocator, + aws_tls_on_protocol_negotiated on_protocol_negotiated, + void *user_data); + +/** + * Kicks off the negotiation process. This function must be called when in client mode to initiate the + * TLS handshake. Once the handshake has completed the aws_tls_on_negotiation_result_fn will be invoked. + */ +AWS_IO_API int aws_tls_client_handler_start_negotiation(struct aws_channel_handler *handler); + +#ifndef BYO_CRYPTO +/** + * Creates a new server ctx. This ctx can be used for the lifetime of the application assuming you want the same + * options for every incoming connection. Options will be copied. + */ +AWS_IO_API struct aws_tls_ctx *aws_tls_server_ctx_new( + struct aws_allocator *alloc, + const struct aws_tls_ctx_options *options); + +/** + * Creates a new client ctx. This ctx can be used for the lifetime of the application assuming you want the same + * options for every outgoing connection. Options will be copied. + */ +AWS_IO_API struct aws_tls_ctx *aws_tls_client_ctx_new( + struct aws_allocator *alloc, + const struct aws_tls_ctx_options *options); +#endif /* BYO_CRYPTO */ + +/** + * Increments the reference count on the tls context, allowing the caller to take a reference to it. + * + * Returns the same tls context passed in. + */ +AWS_IO_API struct aws_tls_ctx *aws_tls_ctx_acquire(struct aws_tls_ctx *ctx); + +/** + * Decrements a tls context's ref count. When the ref count drops to zero, the object will be destroyed. + */ +AWS_IO_API void aws_tls_ctx_release(struct aws_tls_ctx *ctx); + +/** + * Returns a byte buffer by copy of the negotiated protocols. If there is no agreed upon protocol, len will be 0 and + * buffer will be NULL. + */ +AWS_IO_API struct aws_byte_buf aws_tls_handler_protocol(struct aws_channel_handler *handler); + +/** + * Client mode only. This is the server name that was used for SNI and host name validation. + */ +AWS_IO_API struct aws_byte_buf aws_tls_handler_server_name(struct aws_channel_handler *handler); + +/**************************** TLS KEY OPERATION *******************************/ + +/* Note: Currently this assumes the user knows what key is being used for key/cert pairs + but s2n supports multiple cert/key pairs. This functionality is not used in the + CRT currently, but in the future, we may need to implement this */ + +/** + * Complete a successful TLS private key operation by providing its output. + * The output is copied into the TLS connection. + * The operation is freed by this call. + * + * You MUST call this or aws_tls_key_operation_complete_with_error(). + * Failure to do so will stall the TLS connection indefinitely and leak memory. + */ +AWS_IO_API +void aws_tls_key_operation_complete(struct aws_tls_key_operation *operation, struct aws_byte_cursor output); + +/** + * Complete an failed TLS private key operation. + * The TLS connection will fail. + * The operation is freed by this call. + * + * You MUST call this or aws_tls_key_operation_complete(). + * Failure to do so will stall the TLS connection indefinitely and leak memory. + */ +AWS_IO_API +void aws_tls_key_operation_complete_with_error(struct aws_tls_key_operation *operation, int error_code); + +/** + * Returns the input data that needs to be operated on by the custom key operation. + */ +AWS_IO_API +struct aws_byte_cursor aws_tls_key_operation_get_input(const struct aws_tls_key_operation *operation); + +/** + * Returns the type of operation that needs to be performed by the custom key operation. + * If the implementation cannot perform the operation, + * use aws_tls_key_operation_complete_with_error() to preventing stalling the TLS connection. + */ +AWS_IO_API +enum aws_tls_key_operation_type aws_tls_key_operation_get_type(const struct aws_tls_key_operation *operation); + +/** + * Returns the algorithm the operation is expected to be operated with. + * If the implementation does not support the signature algorithm, + * use aws_tls_key_operation_complete_with_error() to preventing stalling the TLS connection. + */ +AWS_IO_API +enum aws_tls_signature_algorithm aws_tls_key_operation_get_signature_algorithm( + const struct aws_tls_key_operation *operation); + +/** + * Returns the algorithm the operation digest is signed with. + * If the implementation does not support the digest algorithm, + * use aws_tls_key_operation_complete_with_error() to preventing stalling the TLS connection. + */ +AWS_IO_API +enum aws_tls_hash_algorithm aws_tls_key_operation_get_digest_algorithm(const struct aws_tls_key_operation *operation); + +/********************************* Misc TLS related *********************************/ + +/* + * Injects a tls handler/slot into a channel and begins tls negotiation. + * If desired, ALPN must be handled separately + * + * right_of_slot must be an existing slot in a channel + */ +AWS_IO_API int aws_channel_setup_client_tls( + struct aws_channel_slot *right_of_slot, + struct aws_tls_connection_options *tls_options); + +/** + * Given enum, return string like: AWS_TLS_HASH_SHA256 -> "SHA256" + */ +AWS_IO_API +const char *aws_tls_hash_algorithm_str(enum aws_tls_hash_algorithm hash); + +/** + * Given enum, return string like: AWS_TLS_SIGNATURE_RSA -> "RSA" + */ +AWS_IO_API +const char *aws_tls_signature_algorithm_str(enum aws_tls_signature_algorithm signature); + +/** + * Given enum, return string like: AWS_TLS_SIGNATURE_RSA -> "RSA" + */ +AWS_IO_API +const char *aws_tls_key_operation_type_str(enum aws_tls_key_operation_type operation_type); + +/** + * Returns true if error_code is a TLS Negotiation related error. + */ +AWS_IO_API bool aws_error_code_is_tls(int error_code); + +AWS_EXTERN_C_END +AWS_POP_SANE_WARNING_LEVEL + +#endif /* AWS_IO_TLS_CHANNEL_HANDLER_H */ diff --git a/include/aws/io/uri.h b/include/aws/io/uri.h new file mode 100644 index 0000000000000000000000000000000000000000..1153abb4d248468aa09c79e5ac6bea8b41953600 --- /dev/null +++ b/include/aws/io/uri.h @@ -0,0 +1,11 @@ +#ifndef AWS_IO_URI_H +#define AWS_IO_URI_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include + +#endif /* AWS_IO_URI_H */ diff --git a/include/aws/iot/Mqtt5Client.h b/include/aws/iot/Mqtt5Client.h new file mode 100644 index 0000000000000000000000000000000000000000..bfee3d82713f968afbf99d82980d8d622998529f --- /dev/null +++ b/include/aws/iot/Mqtt5Client.h @@ -0,0 +1,670 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include +#include + +#if !BYO_CRYPTO + +namespace Aws +{ + using namespace Crt::Mqtt5; + + namespace Io + { + class ClientBootstrap; + class SocketOptions; + class TlsContextOptions; + class WebsocketConfig; + } // namespace Io + + namespace Iot + { + + /** + * Class encapsulating configuration for establishing an Aws IoT Mqtt5 Connectin with custom authorizer + */ + class AWS_CRT_CPP_API Mqtt5CustomAuthConfig + { + public: + /** + * Create a custom authorizer configuration + */ + Mqtt5CustomAuthConfig(Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + virtual ~Mqtt5CustomAuthConfig(); + + Mqtt5CustomAuthConfig(const Mqtt5CustomAuthConfig &rhs); + Mqtt5CustomAuthConfig(Mqtt5CustomAuthConfig &&rhs) = delete; + + Mqtt5CustomAuthConfig &operator=(const Mqtt5CustomAuthConfig &rhs); + Mqtt5CustomAuthConfig &operator=(Mqtt5CustomAuthConfig &&rhs) = delete; + + Mqtt5CustomAuthConfig &WithAuthorizerName(Crt::String authName); + Mqtt5CustomAuthConfig &WithUsername(Crt::String username); + Mqtt5CustomAuthConfig &WithPassword(Crt::ByteCursor password); + Mqtt5CustomAuthConfig &WithTokenKeyName(Crt::String tokenKeyName); + Mqtt5CustomAuthConfig &WithTokenValue(Crt::String tokenValue); + Mqtt5CustomAuthConfig &WithTokenSignature(Crt::String tokenSignature); + + const Crt::Optional &GetAuthorizerName(); + const Crt::Optional &GetUsername(); + const Crt::Optional &GetPassword(); + const Crt::Optional &GetTokenKeyName(); + const Crt::Optional &GetTokenValue(); + const Crt::Optional &GetTokenSignature(); + + private: + /** + * Name of the custom authorizer to use. + * + * Required if the endpoint does not have a default custom authorizer associated with it. It is strongly + * suggested to URL-encode this value; the SDK will not do so for you. + */ + Crt::Optional m_authorizerName; + + /** + * The username to use with the custom authorizer. Query-string elements of this property value will be + * unioned with the query-string elements implied by other properties in this object. + * + * For example, if you set this to: + * + * 'MyUsername?someKey=someValue' + * + * and use {@link authorizerName} to specify the authorizer, the final username would look like: + * + * `MyUsername?someKey=someValue&x-amz-customauthorizer-name=&...` + */ + Crt::Optional m_username; + + /** + * The password to use with the custom authorizer. Becomes the MQTT5 CONNECT packet's password property. + * AWS IoT Core will base64 encode this binary data before passing it to the authorizer's lambda function. + */ + Crt::Optional m_password; + + /** + * Key used to extract the custom authorizer token from MQTT username query-string properties. + * + * Required if the custom authorizer has signing enabled. It is strongly suggested to URL-encode this + * value; the SDK will not do so for you. + */ + Crt::Optional m_tokenKeyName; + + /** + * An opaque token value. This value must be signed by the private key associated with the custom authorizer + * and the result placed in the {@link tokenSignature} property. + * + * Required if the custom authorizer has signing enabled. + */ + Crt::Optional m_tokenValue; + + /** + * The digital signature of the token value in the {@link tokenValue} property. The signature must be based + * on the private key associated with the custom authorizer. The signature must be base64 encoded. + * + * Required if the custom authorizer has signing enabled. + */ + Crt::Optional m_tokenSignature; + + Crt::ByteBuf m_passwordStorage; + Crt::Allocator *m_allocator; + }; + + /** + * Represents a unique configuration for mqtt5 client and connection. Helps to setup Mqtt5ClientOptionsBuilder + * for mqtt5 client. + */ + class AWS_CRT_CPP_API Mqtt5ClientBuilder final + { + public: + /** + * Set the builder up for MTLS using certPath and pkeyPath. These are files on disk and must be in the + * PEM format. + * + * @param hostName - AWS IoT endpoint to connect to + * @param certPath path to the X509 certificate (pem file) to use + * @param pkeyPath path to the private key (pem file) to use + * @param allocator memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithMtlsFromPath( + const Crt::String &hostName, + const char *certPath, + const char *pkeyPath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS using cert and pkey. These are in-memory buffers and must be in the PEM + * format. + * + * @param hostName - AWS IoT endpoint to connect to + * @param cert buffer containing the X509 certificate in a PEM format + * @param pkey buffer containing the private key in a PEM format + * @param allocator memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithMtlsFromMemory( + const Crt::String &hostName, + const Crt::ByteCursor &cert, + const Crt::ByteCursor &pkey, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS, using a PKCS#11 library for private key operations. + * + * NOTE: This only works on Unix devices. + * + * @param hostName - AWS IoT endpoint to connect to + * @param pkcs11Options PKCS#11 options + * @param allocator memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithMtlsPkcs11( + const Crt::String &hostName, + const Crt::Io::TlsContextPkcs11Options &pkcs11Options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS, using a PKCS#12 file for private key operations. + * + * NOTE: This only works on MacOS devices. + * + * @param hostName - AWS IoT endpoint to connect to + * @param options The PKCS12 options to use. + * @param allocator - memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithMtlsPkcs12( + const Crt::String &hostName, + const struct Pkcs12Options &options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS, using a certificate in a Windows certificate store. + * + * NOTE: This only works on Windows. + * + * @param hostName - AWS IoT endpoint to connect to + * @param windowsCertStorePath Path to certificate in a Windows certificate store. + * The path must use backslashes and end with the certificate's thumbprint. + * Example: `CurrentUser\MY\A11F8A9B5DF5B98BA3508FBCA575D09570E0D2C6` + * @param allocator memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithWindowsCertStorePath( + const Crt::String &hostName, + const char *windowsCertStorePath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for Websocket connection. + * + * @param hostName - AWS IoT endpoint to connect to + * @param config websocket configuration information + * @param allocator memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithWebsocket( + const Crt::String &hostName, + const WebsocketConfig &config, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for connection using authorization configuration. + * + * @param hostName - AWS IoT endpoint to connect to + * @param customAuthConfig custom authorization configuration information + * @param allocator memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithCustomAuthorizer( + const Crt::String &hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + Crt::Allocator *allocator) noexcept; + + /** + * Sets the builder up for connection using authorization configuration using Websockets. + * + * @param hostName - AWS IoT endpoint to connect to + * @param customAuthConfig custom authorization configuration information + * @param config websocket configuration information + * @param allocator memory allocator to use + * + * @return std::shared_ptr of Mqtt5ClientBuilder. + */ + static std::shared_ptr CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + const Crt::String &hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + const WebsocketConfig &config, + Crt::Allocator *allocator) noexcept; + + /** + * Sets the host to connect to. + * + * @param hostname endpoint to connect to + * + * @return this option object + */ + Mqtt5ClientBuilder &WithHostName(Crt::String hostname); + + /** + * Set port to connect to + * + * @param port port to connect to + * + * @return this option object + */ + Mqtt5ClientBuilder &WithPort(uint32_t port) noexcept; + + /** + * Set booststrap for mqtt5 client + * + * @param bootStrap bootstrap used for mqtt5 client. The default ClientBootstrap see + * Aws::Crt::ApiHandle::GetOrCreateStaticDefaultClientBootstrap. + * + * @return this option object + */ + Mqtt5ClientBuilder &WithBootstrap(Crt::Io::ClientBootstrap *bootStrap) noexcept; + + /** + * Sets the certificate authority for the endpoint you're connecting to. This is a path to a file on disk + * and must be in PEM format. + * + * @param caPath path to the CA file in PEM format + * + * @return this builder object + */ + Mqtt5ClientBuilder &WithCertificateAuthority(const char *caPath) noexcept; + + /** + * Sets the certificate authority for the endpoint you're connecting to. This is an in-memory buffer and + * must be in PEM format. + * + * @param cert buffer containing the CA certificate in a PEM format + * + * @return this builder object + */ + Mqtt5ClientBuilder &WithCertificateAuthority(const Crt::ByteCursor &cert) noexcept; + + /** + * Overrides the socket properties of the underlying MQTT connections made by the client. Leave undefined + * to use defaults (no TCP keep alive, 10 second socket timeout). + * + * @param socketOptions - The socket properties of the underlying MQTT connections made by the client + * @return - The Mqtt5ClientBuilder + */ + Mqtt5ClientBuilder &WithSocketOptions(Crt::Io::SocketOptions socketOptions) noexcept; + + /** + * Sets http proxy options. + * + * @param proxyOptions http proxy configuration for connection establishment + * + * @return this option object + */ + Mqtt5ClientBuilder &WithHttpProxyOptions( + const Crt::Http::HttpClientConnectionProxyOptions &proxyOptions) noexcept; + + /** + * Sets the custom authorizer settings. This function will modify the username, port, and TLS options. + * + * @return this builder object + */ + Mqtt5ClientBuilder &WithCustomAuthorizer(const Iot::Mqtt5CustomAuthConfig &config) noexcept; + + /** + * Sets mqtt5 connection options + * + * @param packetConnect package connection options + * + * @return this option object + */ + Mqtt5ClientBuilder &WithConnectOptions(std::shared_ptr packetConnect) noexcept; + + /** + * Sets session behavior. Overrides how the MQTT5 client should behave with respect to MQTT sessions. + * + * @param sessionBehavior how the MQTT5 client should behave with respect to MQTT sessions. + * + * @return this option object + */ + Mqtt5ClientBuilder &WithSessionBehavior(ClientSessionBehaviorType sessionBehavior) noexcept; + + /** + * Sets client extended validation and flow control, additional controls for client behavior with + * respect to operation validation and flow control; these checks go beyond the base MQTT5 spec to + * respect limits of specific MQTT brokers. + * + * @param clientExtendedValidationAndFlowControl + * + * @return this option object + */ + Mqtt5ClientBuilder &WithClientExtendedValidationAndFlowControl( + ClientExtendedValidationAndFlowControl clientExtendedValidationAndFlowControl) noexcept; + + /** + * Sets OfflineQueueBehavior, controls how disconnects affect the queued and in-progress operations + * tracked by the client. Also controls how new operations are handled while the client is not + * connected. In particular, if the client is not connected, then any operation that would be failed + * on disconnect (according to these rules) will also be rejected. + * + * @param offlineQueueBehavior + * + * @return this option object + */ + Mqtt5ClientBuilder &WithOfflineQueueBehavior( + ClientOperationQueueBehaviorType offlineQueueBehavior) noexcept; + + /** + * Sets ReconnectOptions. Reconnect options includes retryJitterMode, min reconnect delay time and + * max reconnect delay time + * + * @param reconnectOptions + * + * @return this option object + */ + Mqtt5ClientBuilder &WithReconnectOptions(ReconnectOptions reconnectOptions) noexcept; + + /** + * Sets the topic aliasing behavior that the client should use. + * + * @param topicAliasingOptions topic aliasing behavior options to use + * @return this builder object + */ + Mqtt5ClientBuilder &WithTopicAliasingOptions(TopicAliasingOptions topicAliasingOptions) noexcept; + + /** + * Sets minConnectedTimeToResetReconnectDelayMs, amount of time that must elapse with an established + * connection before the reconnect delay is reset to the minimum. This helps alleviate bandwidth-waste + * in fast reconnect cycles due to permission failures on operations. + * + * @param minConnectedTimeToResetReconnectDelayMs + * + * @return this option object + */ + Mqtt5ClientBuilder &WithMinConnectedTimeToResetReconnectDelayMs( + uint64_t minConnectedTimeToResetReconnectDelayMs) noexcept; + + /** + * Sets ping timeout (ms). Time interval to wait after sending a PINGREQ for a PINGRESP to arrive. + * If one does not arrive, the client will close the current connection. + * + * @param pingTimeoutMs + * + * @return this option object + */ + Mqtt5ClientBuilder &WithPingTimeoutMs(uint32_t pingTimeoutMs) noexcept; + + /** + * Sets Connack Timeout (ms). Time interval to wait after sending a CONNECT request for a CONNACK + * to arrive. If one does not arrive, the connection will be shut down. + * + * @param connackTimeoutMs + * + * @return this option object + */ + Mqtt5ClientBuilder &WithConnackTimeoutMs(uint32_t connackTimeoutMs) noexcept; + + /** + * Sets Operation Timeout(Seconds). Time interval to wait for an ack after sending a QoS 1+ PUBLISH, + * SUBSCRIBE, or UNSUBSCRIBE before failing the operation. + * + * @param ackTimeoutSec + * + * @return this option object + */ + Mqtt5ClientBuilder &WithAckTimeoutSec(uint32_t ackTimeoutSec) noexcept; + + /** + * @deprecated the function is deprecated, please use `Mqtt5ClientBuilder::WithAckTimeoutSec(uint32_t)` + * + * Sets Operation Timeout(Seconds). Time interval to wait for an ack after sending a QoS 1+ PUBLISH, + * SUBSCRIBE, or UNSUBSCRIBE before failing the operation. + * + * @param ackTimeoutSec + * + * @return this option object + */ + Mqtt5ClientBuilder &WithAckTimeoutSeconds(uint32_t ackTimeoutSec) noexcept; + + /** + * Overrides the default SDK Name to send as a metric in the MQTT CONNECT packet. + * + * @param sdkName string to use as the SDK name parameter in the connection string + * + * @return this builder object + */ + Mqtt5ClientBuilder &WithSdkName(const Crt::String &sdkName); + + /** + * Overrides the default SDK Version to send as a metric in the MQTT CONNECT packet. + * + * @param sdkVersion string to use as the SDK version parameter in the connection string + * + * @return this builder object + */ + Mqtt5ClientBuilder &WithSdkVersion(const Crt::String &sdkVersion); + + /** + * Builds a client configuration object from the set options. + * + * @return a new client connection config instance + */ + std::shared_ptr Build() noexcept; + + /** + * @return true if the instance is in a valid state, false otherwise. + */ + explicit operator bool() const noexcept { return m_lastError == 0; } + + /** + * @return the value of the last aws error encountered by operations on this instance. + */ + int LastError() const noexcept { return m_lastError ? m_lastError : AWS_ERROR_UNKNOWN; } + + ~Mqtt5ClientBuilder() + { + if (m_options) + { + delete m_options; + } + }; + Mqtt5ClientBuilder(const Mqtt5ClientBuilder &) = delete; + Mqtt5ClientBuilder(Mqtt5ClientBuilder &&) = delete; + Mqtt5ClientBuilder &operator=(const Mqtt5ClientBuilder &) = delete; + Mqtt5ClientBuilder &operator=(Mqtt5ClientBuilder &&) = delete; + + /** + * Setup callback trigged when client successfully establishes an MQTT connection + * + * @param callback + * + * @return this option object + */ + Mqtt5ClientBuilder &WithClientConnectionSuccessCallback(OnConnectionSuccessHandler callback) noexcept; + + /** + * Setup callback trigged when client fails to establish an MQTT connection + * + * @param callback + * + * @return this option object + */ + Mqtt5ClientBuilder &WithClientConnectionFailureCallback(OnConnectionFailureHandler callback) noexcept; + + /** + * Setup callback handler trigged when client's current MQTT connection is closed + * + * @param callback + * + * @return this option object + */ + Mqtt5ClientBuilder &WithClientDisconnectionCallback(OnDisconnectionHandler callback) noexcept; + + /** + * Setup callback handler trigged when client reaches the "Stopped" state + * + * @param callback + * + * @return this option object + */ + Mqtt5ClientBuilder &WithClientStoppedCallback(OnStoppedHandler callback) noexcept; + + /** + * Setup callback handler trigged when client begins an attempt to connect to the remote endpoint. + * + * @param callback + * + * @return this option object + */ + Mqtt5ClientBuilder &WithClientAttemptingConnectCallback(OnAttemptingConnectHandler callback) noexcept; + + /** + * Setup callback handler trigged when an MQTT PUBLISH packet is received by the client + * + * @param callback + * + * @return this option object + */ + Mqtt5ClientBuilder &WithPublishReceivedCallback(OnPublishReceivedHandler callback) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsFromPath( + const Crt::String hostName, + const char *certPath, + const char *pkeyPath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromMemory instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsFromMemory( + const Crt::String hostName, + const Crt::ByteCursor &cert, + const Crt::ByteCursor &pkey, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs11 instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsPkcs11( + const Crt::String hostName, + const Crt::Io::TlsContextPkcs11Options &pkcs11Options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs12 instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsPkcs12( + const Crt::String hostName, + const struct Pkcs12Options &options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWindowsCertStorePath instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithWindowsCertStorePath( + const Crt::String hostName, + const char *windowsCertStorePath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithWebsocket( + const Crt::String hostName, + const WebsocketConfig &config, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithCustomAuthorizer( + const Crt::String hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + Crt::Allocator *allocator) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + const Crt::String hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + const WebsocketConfig &config, + Crt::Allocator *allocator) noexcept; + + private: + // Common setup shared by all valid constructors + Mqtt5ClientBuilder(Crt::Allocator *allocator) noexcept; + // Common setup shared by all valid constructors + Mqtt5ClientBuilder(int error, Crt::Allocator *allocator) noexcept; + + /* + * Creates a new Mqtt5ClientBuilder instance with default values. + */ + static std::shared_ptr CreateMqtt5ClientBuilder( + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + Crt::Allocator *m_allocator; + + /** + * Network port of the MQTT server to connect to. + */ + uint32_t m_port; + + /** + * TLS context for secure socket connections. + * If undefined, a plaintext connection will be used. + */ + Crt::Optional m_tlsConnectionOptions; + + /** + * Configures (tunneling) HTTP proxy usage when establishing MQTT connections + */ + Crt::Optional m_proxyOptions; + + /** + * Websocket related options. The clinet with use websocket for connection when set. + */ + Crt::Optional m_websocketConfig; + + /** + * Custom Authorizer Configuration + */ + Crt::Optional m_customAuthConfig; + + /** + * All configurable options with respect to the CONNECT packet sent by the client, including the will. + * These connect properties will be used for every connection attempt made by the client. + */ + std::shared_ptr m_connectOptions; + + Crt::Mqtt5::Mqtt5ClientOptions *m_options; + + /* Error */ + int m_lastError; + + bool m_enableMetricsCollection; + + Crt::String m_sdkName = "CPPv2"; + Crt::String m_sdkVersion = AWS_CRT_CPP_VERSION; + }; + + } // namespace Iot +} // namespace Aws + +#endif // !BYO_CRYPTO diff --git a/include/aws/iot/MqttClient.h b/include/aws/iot/MqttClient.h new file mode 100644 index 0000000000000000000000000000000000000000..966d039b3c086274fd4f0ca04c866210d2f2317a --- /dev/null +++ b/include/aws/iot/MqttClient.h @@ -0,0 +1,497 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include +#include + +#if !BYO_CRYPTO + +namespace Aws +{ + namespace Iot + { + class MqttClient; + + /** + * Represents a unique configuration for connecting to a single AWS IoT endpoint. You can use a single instance + * of this class PER endpoint you want to connect to. This object must live through the lifetime of your + * connection. + */ + class AWS_CRT_CPP_API MqttClientConnectionConfig final + { + public: + static MqttClientConnectionConfig CreateInvalid(int lastError) noexcept; + + /** + * Creates a client configuration for use with making new AWS Iot specific MQTT Connections with MTLS. + * + * @param endpoint endpoint to connect to + * @param port port to connect to + * @param socketOptions socket options to use when establishing the connection + * @param tlsContext tls context that should be used for all connections sourced from this config + */ + MqttClientConnectionConfig( + const Crt::String &endpoint, + uint32_t port, + const Crt::Io::SocketOptions &socketOptions, + Crt::Io::TlsContext &&tlsContext); + + /** + * Creates a client configuration for use with making new AWS Iot specific MQTT Connections with web + * sockets. interceptor: a callback invoked during web socket handshake giving you the opportunity to mutate + * the request for authorization/signing purposes. If not specified, it's assumed you don't need to sign the + * request. proxyOptions: optional, if you want to use a proxy with websockets, specify the configuration + * options here. + * + * If proxy options are used, the tlsContext is applied to the connection to the remote endpoint, NOT the + * proxy. To make a tls connection to the proxy itself, you'll want to specify tls options in proxyOptions. + * + * @param endpoint endpoint to connect to + * @param port port to connect to + * @param socketOptions socket options to use when establishing the connection + * @param tlsContext tls context that should be used for all connections sourced from this config + * @param interceptor websocket upgrade handshake transformation function + * @param proxyOptions proxy configuration options + */ + MqttClientConnectionConfig( + const Crt::String &endpoint, + uint32_t port, + const Crt::Io::SocketOptions &socketOptions, + Crt::Io::TlsContext &&tlsContext, + Crt::Mqtt::OnWebSocketHandshakeIntercept &&interceptor, + const Crt::Optional &proxyOptions); + + /** + * @return true if the instance is in a valid state, false otherwise. + */ + explicit operator bool() const noexcept { return m_context ? true : false; } + + /** + * @return the value of the last aws error encountered by operations on this instance. + */ + int LastError() const noexcept { return m_lastError; } + + private: + MqttClientConnectionConfig(int lastError) noexcept; + + MqttClientConnectionConfig( + const Crt::String &endpoint, + uint32_t port, + const Crt::Io::SocketOptions &socketOptions, + Crt::Io::TlsContext &&tlsContext, + const Crt::Optional &proxyOptions); + + Crt::String m_endpoint; + uint32_t m_port; + Crt::Io::TlsContext m_context; + Crt::Io::SocketOptions m_socketOptions; + Crt::Mqtt::OnWebSocketHandshakeIntercept m_webSocketInterceptor; + Crt::String m_username; + Crt::String m_password; + Crt::Optional m_proxyOptions; + int m_lastError; + + friend class MqttClient; + friend class MqttClientConnectionConfigBuilder; + }; + + /** + * Represents configuration parameters for building a MqttClientConnectionConfig object. You can use a single + * instance of this class PER MqttClientConnectionConfig you want to generate. If you want to generate a config + * for a different endpoint or port etc... you need a new instance of this class. + */ + class AWS_CRT_CPP_API MqttClientConnectionConfigBuilder final + { + public: + MqttClientConnectionConfigBuilder(); + + /** + * Sets the builder up for MTLS using certPath and pkeyPath. These are files on disk and must be in the PEM + * format. + * + * @param certPath path to the X509 certificate (pem file) to use + * @param pkeyPath path to the private key (pem file) to use + * @param allocator memory allocator to use + */ + MqttClientConnectionConfigBuilder( + const char *certPath, + const char *pkeyPath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS using cert and pkey. These are in-memory buffers and must be in the PEM + * format. + * + * @param cert buffer containing the X509 certificate in a PEM format + * @param pkey buffer containing the private key in a PEM format + * @param allocator memory allocator to use + */ + MqttClientConnectionConfigBuilder( + const Crt::ByteCursor &cert, + const Crt::ByteCursor &pkey, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS, using a PKCS#11 library for private key operations. + * + * NOTE: This only works on Unix devices. + * + * @param pkcs11Options PKCS#11 options + * @param allocator memory allocator to use + */ + MqttClientConnectionConfigBuilder( + const Crt::Io::TlsContextPkcs11Options &pkcs11Options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS using a PKCS12 file and password. These are files on disk and must be in the + * PEM format. + * + * NOTE: This only works on MacOS devices. + * + * @param options The PKCS12 options to use. Has to contain a PKCS12 filepath and password. + * @param allocator memory allocator to use + */ + MqttClientConnectionConfigBuilder( + const struct Pkcs12Options &options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for MTLS, using a certificate in a Windows certificate store. + * + * NOTE: This only works on Windows. + * + * @param windowsCertStorePath Path to certificate in a Windows certificate store. + * The path must use backslashes and end with the certificate's thumbprint. + * Example: `CurrentUser\MY\A11F8A9B5DF5B98BA3508FBCA575D09570E0D2C6` + * @param allocator memory allocator to use + */ + MqttClientConnectionConfigBuilder( + const char *windowsCertStorePath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Sets the builder up for Websocket connection. + * + * @param config websocket configuration information + * @param allocator memory allocator to use + */ + MqttClientConnectionConfigBuilder( + const WebsocketConfig &config, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Creates a new builder with default Tls options. This requires setting the connection details manually. + * + * @return a new builder with default Tls options + */ + static MqttClientConnectionConfigBuilder NewDefaultBuilder() noexcept; + + /** + * Sets endpoint to connect to. + * + * @param endpoint endpoint to connect to + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithEndpoint(const Crt::String &endpoint); + + /** + * Sets endpoint to connect to. + * + * @param endpoint endpoint to connect to + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithEndpoint(Crt::String &&endpoint); + + /** + * Overrides the default port. By default, if ALPN is supported, 443 will be used. Otherwise 8883 will be + * used. If you specify 443 and ALPN is not supported, we will still attempt to connect over 443 without + * ALPN. + * + * @param port port to connect to + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithPortOverride(uint32_t port) noexcept; + + /** + * Sets the certificate authority for the endpoint you're connecting to. This is a path to a file on disk + * and must be in PEM format. + * + * @param caPath path to the CA file in PEM format + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithCertificateAuthority(const char *caPath) noexcept; + + /** + * Sets the certificate authority for the endpoint you're connecting to. This is an in-memory buffer and + * must be in PEM format. + * + * @param cert buffer containing the CA certificate in a PEM format + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithCertificateAuthority(const Crt::ByteCursor &cert) noexcept; + + /** + * TCP option: Enables TCP keep alive. Defaults to off. + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithTcpKeepAlive() noexcept; + + /** + * TCP option: Sets the connect timeout. Defaults to 3 seconds. + * + * @param connectTimeoutMs socket connection timeout + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithTcpConnectTimeout(uint32_t connectTimeoutMs) noexcept; + + /** + * TCP option: Sets time before keep alive probes are sent. Defaults to kernel defaults + * + * @param keepAliveTimeoutSecs time interval of no activity, in seconds, before keep alive probes + * get sent + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithTcpKeepAliveTimeout(uint16_t keepAliveTimeoutSecs) noexcept; + + /** + * TCP option: Sets the frequency of sending keep alive probes in seconds once the keep alive timeout + * expires. Defaults to kernel defaults. + * + * @param keepAliveIntervalSecs the frequency of sending keep alive probes in seconds once the keep alive + * timeout expires + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithTcpKeepAliveInterval(uint16_t keepAliveIntervalSecs) noexcept; + + /** + * TCP option: Sets the amount of keep alive probes allowed to fail before the connection is terminated. + * Defaults to kernel defaults. + * + * @param maxProbes the amount of keep alive probes allowed to fail before the connection is terminated + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithTcpKeepAliveMaxProbes(uint16_t maxProbes) noexcept; + + /** + * Sets the minimum tls version that is acceptable for connection establishment + * + * @param minimumTlsVersion minimum tls version allowed in client connections + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithMinimumTlsVersion(aws_tls_versions minimumTlsVersion) noexcept; + + /** + * Sets http proxy options. + * + * @param proxyOptions proxy configuration options for connection establishment + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithHttpProxyOptions( + const Crt::Http::HttpClientConnectionProxyOptions &proxyOptions) noexcept; + + /** + * Whether to send the SDK name and version number in the MQTT CONNECT packet. + * Default is True. + * + * @param enabled true to send SDK version/name in the connect for metrics gathering purposes + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithMetricsCollection(bool enabled); + + /** + * Overrides the default SDK Name to send as a metric in the MQTT CONNECT packet. + * + * @param sdkName string to use as the SDK name parameter in the connection string + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithSdkName(const Crt::String &sdkName); + + /** + * Overrides the default SDK Version to send as a metric in the MQTT CONNECT packet. + * + * @param sdkVersion string to use as the SDK version parameter in the connection string + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithSdkVersion(const Crt::String &sdkVersion); + + /** + * Sets the custom authorizer settings. This function will modify the username, port, and TLS options. + * + * @param username The username to use with the custom authorizer. If an empty string is passed, it will + * check to see if a username has already been set (via WithUsername function). If no + * username is set then no username will be passed with the MQTT connection. + * @param authorizerName The name of the custom authorizer. If an empty string is passed, then + * 'x-amz-customauthorizer-name' will not be added with the MQTT connection. + * @param authorizerSignature The signature of the custom authorizer. + * NOTE: This will NOT work without the token key name and token value, which + * requires using the non-depreciated API. + * @param password The password to use with the custom authorizer. If null is passed, then no password will + * be set. + * + * @deprecated Please use the full WithCustomAuthorizer function that includes `tokenKeyName` and + * `tokenValue`. This version is left for backwards compatibility purposes. + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithCustomAuthorizer( + const Crt::String &username, + const Crt::String &authorizerName, + const Crt::String &authorizerSignature, + const Crt::String &password) noexcept; + + /** + * Sets the custom authorizer settings. This function will modify the username, port, and TLS options. + * + * @param username The username to use with the custom authorizer. If an empty string is passed, it will + * check to see if a username has already been set (via WithUsername function). If no + * username is set then no username will be passed with the MQTT connection. + * @param authorizerName The name of the custom authorizer. If an empty string is passed, then + * 'x-amz-customauthorizer-name' will not be added with the MQTT connection. + * @param authorizerSignature The signature of the custom authorizer. If an empty string is passed, then + * 'x-amz-customauthorizer-signature' will not be added with the MQTT connection. + * The signature must be based on the private key associated with the custom + * authorizer. The signature must be base64 encoded. + * @param password The password to use with the custom authorizer. If null is passed, then no password will + * be set. + * @param tokenKeyName Used to extract the custom authorizer token from MQTT username query-string + * properties. Required if the custom authorizer has signing enabled. It is strongly + * suggested to URL encode this value; the SDK will not do so for you. + * @param tokenValue An opaque token value. Required if the custom authorizer has signing enabled. This + * value must be signed by the private key associated with the custom authorizer and + * the result placed in the authorizerSignature argument. + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithCustomAuthorizer( + const Crt::String &username, + const Crt::String &authorizerName, + const Crt::String &authorizerSignature, + const Crt::String &password, + const Crt::String &tokenKeyName, + const Crt::String &tokenValue) noexcept; + + /** + * Sets username for the connection + * + * @param username the username that will be passed with the MQTT connection + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithUsername(const Crt::String &username) noexcept; + + /** + * Sets password for the connection + * + * @param password the password that will be passed with the MQTT connection + * + * @return this builder object + */ + MqttClientConnectionConfigBuilder &WithPassword(const Crt::String &password) noexcept; + + /** + * Builds a client configuration object from the set options. + * + * @return a new client connection config instance + */ + MqttClientConnectionConfig Build() noexcept; + + /** + * @return true if the instance is in a valid state, false otherwise. + */ + explicit operator bool() const noexcept { return m_lastError == 0; } + + /** + * @return the value of the last aws error encountered by operations on this instance. + */ + int LastError() const noexcept { return m_lastError ? m_lastError : AWS_ERROR_UNKNOWN; } + + private: + // Common setup shared by all valid constructors + MqttClientConnectionConfigBuilder(Crt::Allocator *allocator) noexcept; + + // Helper function to add parameters to the username in the WithCustomAuthorizer function + Crt::String AddToUsernameParameter( + Crt::String currentUsername, + Crt::String parameterValue, + Crt::String parameterPreText); + + Crt::Allocator *m_allocator; + Crt::String m_endpoint; + uint32_t m_portOverride; + Crt::Io::SocketOptions m_socketOptions; + Crt::Io::TlsContextOptions m_contextOptions; + Crt::Optional m_websocketConfig; + Crt::Optional m_proxyOptions; + bool m_enableMetricsCollection = true; + Crt::String m_sdkName = "CPPv2"; + Crt::String m_sdkVersion; + Crt::String m_username = ""; + Crt::String m_password = ""; + bool m_isUsingCustomAuthorizer = false; + + int m_lastError; + }; + + /** + * AWS IOT specific Mqtt Client. Sets defaults for using the AWS IOT service. You'll need an instance of + * MqttClientConnectionConfig to use. Once NewConnection returns, you use it's return value identically + * to how you would use Aws::Crt::Mqtt::MqttConnection + */ + class AWS_CRT_CPP_API MqttClient final + { + public: + MqttClient(Crt::Io::ClientBootstrap &bootstrap, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Constructs a new Mqtt Client object using the static default ClientBootstrap. + * + * For more information on the default ClientBootstrap see + * Aws::Crt::ApiHandle::GetOrCreateDefaultClientBootstrap + */ + MqttClient(Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Creates a new mqtt connection from a connection configuration object + * @param config mqtt connection configuration + * @return a new mqtt connection + */ + std::shared_ptr NewConnection(const MqttClientConnectionConfig &config) noexcept; + + /** + * @return the value of the last aws error encountered by operations on this instance. + */ + int LastError() const noexcept { return m_client.LastError(); } + + /** + * @return true if the instance is in a valid state, false otherwise. + */ + explicit operator bool() const noexcept { return m_client ? true : false; } + + private: + Crt::Mqtt::MqttClient m_client; + int m_lastError; + }; + } // namespace Iot +} // namespace Aws + +#endif // !BYO_CRYPTO diff --git a/include/aws/iot/MqttCommon.h b/include/aws/iot/MqttCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..c2211078a4c067066772dde9b5ef093bd122711a --- /dev/null +++ b/include/aws/iot/MqttCommon.h @@ -0,0 +1,113 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include + +#if !BYO_CRYPTO + +namespace Aws +{ + namespace Iot + { + + using CreateSigningConfig = std::function(void)>; + + /** + * Class encapsulating configuration for establishing an Aws IoT mqtt connection via websockets + */ + struct AWS_CRT_CPP_API WebsocketConfig + { + /** + * Create a websocket configuration for use with the default credentials provider chain. Signing region + * will be used for Sigv4 signature calculations. + * + * @param signingRegion Aws region that is being connected to. Required in order to properly sign the + * handshake upgrade request + * @param bootstrap client bootstrap to establish any connections needed by the default credentials + * provider chain which will get built for the user + * @param allocator memory allocator to use + */ + WebsocketConfig( + const Crt::String &signingRegion, + Crt::Io::ClientBootstrap *bootstrap, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Create a websocket configuration for use with the default credentials provider chain and default + * ClientBootstrap. Signing region will be used for Sigv4 signature calculations. + * + * For more information on the default ClientBootstrap see + * Aws::Crt::ApiHandle::GetOrCreateDefaultClientBootstrap + * + * @param signingRegion Aws region that is being connected to. Required in order to properly sign the + * handshake upgrade request + * @param allocator memory allocator to use + */ + WebsocketConfig(const Crt::String &signingRegion, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Create a websocket configuration for use with a custom credentials provider. Signing region will be used + * for Sigv4 signature calculations. + * + * @param signingRegion Aws region that is being connected to. Required in order to properly sign the + * handshake upgrade request + * @param credentialsProvider credentials provider to source AWS credentials from + * @param allocator memory allocator to use + */ + WebsocketConfig( + const Crt::String &signingRegion, + const std::shared_ptr &credentialsProvider, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * Create a websocket configuration for use with a custom credentials provider, and a custom signer. + * + * You'll need to provide a function for use with creating a signing Config and pass it to + * createSigningConfig. + * + * This is useful for cases use with: + * https://docs.aws.amazon.com/iot/latest/developerguide/custom-auth.html + * + * @param credentialsProvider credentials provider + * @param signer HTTP request signer + * @param createSigningConfig function that creates a signing config + */ + WebsocketConfig( + const std::shared_ptr &credentialsProvider, + const std::shared_ptr &signer, + CreateSigningConfig createSigningConfig) noexcept; + + std::shared_ptr CredentialsProvider; + std::shared_ptr Signer; + CreateSigningConfig CreateSigningConfigCb; + + /** + * @deprecated Specify ProxyOptions to use a proxy with your websocket connection. + * + * If MqttClientConnectionConfigBuilder::m_proxyOptions is valid, then that will be used over + * this value. + */ + Crt::Optional ProxyOptions; + Crt::String SigningRegion; + Crt::String ServiceName; + }; + + /** + * A simple struct to hold the options for creating a PKCS12 builder. Used to differentiate the + * PKCS12 builder from other options in the mTLS builders. + */ + struct Pkcs12Options + { + Crt::String pkcs12_file; + Crt::String pkcs12_password; + }; + + } // namespace Iot +} // namespace Aws + +#endif // !BYO_CRYPTO diff --git a/include/aws/iot/MqttRequestResponseClient.h b/include/aws/iot/MqttRequestResponseClient.h new file mode 100644 index 0000000000000000000000000000000000000000..67e72d8e78c300c676ef4af8c236fdaa9937b5d3 --- /dev/null +++ b/include/aws/iot/MqttRequestResponseClient.h @@ -0,0 +1,649 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace Aws +{ + + namespace Crt + { + namespace Mqtt + { + class MqttConnection; + } + + namespace Mqtt5 + { + class Mqtt5Client; + } + } // namespace Crt + + namespace Iot + { + namespace RequestResponse + { + /** + * The type of change to the state of a streaming operation subscription + */ + enum class SubscriptionStatusEventType + { + + /** + * The streaming operation is successfully subscribed to its topic (filter) + */ + SubscriptionEstablished = ARRSSET_SUBSCRIPTION_ESTABLISHED, + + /** + * The streaming operation has temporarily lost its subscription to its topic (filter) + */ + SubscriptionLost = ARRSSET_SUBSCRIPTION_LOST, + + /** + * The streaming operation has entered a terminal state where it has given up trying to subscribe + * to its topic (filter). This is always due to user error (bad topic filter or IoT Core permission + * policy). + */ + SubscriptionHalted = ARRSSET_SUBSCRIPTION_HALTED, + }; + + /** + * An event that describes a change in subscription status for a streaming operation. + */ + class AWS_CRT_CPP_API SubscriptionStatusEvent + { + public: + /** + * Sets the type of the event + * + * @param type kind of subscription status event this is + * @return reference to this + */ + SubscriptionStatusEvent &WithType(SubscriptionStatusEventType type) + { + m_type = type; + return *this; + } + + /** + * Sets an optional error code associated with the event + * + * @param errorCode CRT error code corresponding to the event + * @return reference to this + */ + SubscriptionStatusEvent &WithErrorCode(int errorCode) + { + m_errorCode = errorCode; + return *this; + } + + /** + * Gets the type of event + * @return the type of the event + */ + SubscriptionStatusEventType GetType() const { return m_type; } + + /** + * Get the error code associated with this event + * @return the error code associated with this event + */ + int GetErrorCode() const { return m_errorCode; } + + private: + SubscriptionStatusEventType m_type = SubscriptionStatusEventType::SubscriptionEstablished; + int m_errorCode = 0; + }; + + /** + * Function signature of a SubscriptionStatusEvent event handler + */ + using SubscriptionStatusEventHandler = std::function; + + /** + * Data model for MQTT5 user properties. + * + * A user property is a name-value pair of utf-8 strings that can be added to MQTT5 packets. + */ + struct AWS_CRT_CPP_API UserPropertyView + { + UserPropertyView(Aws::Crt::ByteCursor name, Aws::Crt::ByteCursor value) : m_name(name), m_value(value) + { + } + Aws::Crt::ByteCursor m_name; + Aws::Crt::ByteCursor m_value; + }; + + /** + * An event that describes an incoming publish message received on a streaming operation. + * + * @internal + */ + class AWS_CRT_CPP_API IncomingPublishEvent + { + public: + /** + * Default constructor + */ + IncomingPublishEvent() : m_topic(), m_payload() + { + AWS_ZERO_STRUCT(m_topic); + AWS_ZERO_STRUCT(m_payload); + } + + /** + * Sets the message response topic associated with this event. The event does not own this topic. + * + * @param topic the message response topic associated with this event + * @return reference to this + */ + IncomingPublishEvent &WithTopic(Aws::Crt::ByteCursor topic) + { + m_topic = topic; + return *this; + } + + /** + * Sets the message payload associated with this event. The event does not own this payload. + * + * @param payload the message payload associated with this event + * @return reference to this + */ + IncomingPublishEvent &WithPayload(Aws::Crt::ByteCursor payload) + { + m_payload = payload; + return *this; + } + + /** + * Sets the message content type associated with this event. The event does not own this content type. + * + * @param contentType the message content type associated with this event + * @return reference to this + */ + IncomingPublishEvent &WithContentType(Aws::Crt::ByteCursor contentType) + { + m_contentType = contentType; + return *this; + } + + /** + * Sets the message user properties associated with this event. + * + * @param userProperties the message user properties associated with this event + * @return reference to this + */ + IncomingPublishEvent &WithUserProperties(Aws::Crt::Vector userProperties) + { + m_userProperties = std::move(userProperties); + return *this; + } + + /** + * Sets the message expiry interval seconds associated with this event. + * + * @param messageExpiryIntervalSeconds the message expiry interval seconds associated with this event + * @return reference to this + */ + IncomingPublishEvent &WithMessageExpiryIntervalSeconds(uint32_t messageExpiryIntervalSeconds) + { + m_messageExpiryIntervalSeconds = messageExpiryIntervalSeconds; + return *this; + } + + /** + * Gets the message response topic associated with this event. + * + * @return the message response topic associated with this event + */ + Aws::Crt::ByteCursor GetTopic() const { return m_topic; } + + /** + * Gets the message payload associated with this event. + * + * @return the message payload associated with this event + */ + Aws::Crt::ByteCursor GetPayload() const { return m_payload; } + + /** + * Gets the message content type associated with this event. + * + * @return the message content type associated with this event + */ + const Aws::Crt::Optional &GetContentType() const { return m_contentType; } + + /** + * Gets the message user properties associated with this event. + * @return the message user properties associated with this event + */ + const Aws::Crt::Optional> &GetUserProperties() const + { + return m_userProperties; + } + + const Aws::Crt::Optional &GetMessageExpiryIntervalSeconds() const + { + return m_messageExpiryIntervalSeconds; + } + + private: + Aws::Crt::ByteCursor m_topic; + Aws::Crt::ByteCursor m_payload; + Aws::Crt::Optional m_contentType; + Aws::Crt::Optional> m_userProperties; + Aws::Crt::Optional m_messageExpiryIntervalSeconds; + }; + + /** + * Function signature of an IncomingPublishEvent event handler + * + * @internal + */ + using IncomingPublishEventHandler = std::function; + + /** + * Encapsulates a response to an AWS IoT Core MQTT-based service request + * + * @internal + */ + class AWS_CRT_CPP_API UnmodeledResponse + { + public: + /** + * Default constructor + */ + UnmodeledResponse() : m_topic(), m_payload() + { + AWS_ZERO_STRUCT(m_payload); + AWS_ZERO_STRUCT(m_topic); + } + + /** + * Sets the payload of the response that correlates to a submitted request. + * + * @param payload the payload of the response that correlates to a submitted request + * @return reference to this + */ + UnmodeledResponse &WithPayload(Aws::Crt::ByteCursor payload) + { + m_payload = payload; + return *this; + } + + /** + * Sets the MQTT Topic that the response was received on. + * + * @param topic the MQTT Topic that the response was received on + * @return reference to this + */ + UnmodeledResponse &WithTopic(Aws::Crt::ByteCursor topic) + { + m_topic = topic; + return *this; + } + + /** + * Gets the payload of the response that correlates to a submitted request. + * + * @return the payload of the response that correlates to a submitted request + */ + Aws::Crt::ByteCursor GetPayload() const { return m_payload; } + + /** + * Gets the MQTT Topic that the response was received on. + * + * @return the MQTT Topic that the response was received on + */ + Aws::Crt::ByteCursor GetTopic() const { return m_topic; } + + private: + /** + * MQTT Topic that the response was received on. Different topics map to different types within the + * service model, so we need this value in order to know what to deserialize the payload into. + */ + Aws::Crt::ByteCursor m_topic; + + /** + * Payload of the response that correlates to a submitted request. + */ + Aws::Crt::ByteCursor m_payload; + }; + + /** + * Either-or type that models the result of a carrying out a request - a response or an error. + * + * @tparam R type of a successful response + * @tparam E type of an error + */ + template class Result + { + public: + Result() = delete; + + explicit Result(const R &response) : m_rawResult(response) {} + explicit Result(R &&response) : m_rawResult(std::move(response)) {} + explicit Result(const E &error) : m_rawResult(error) {} + explicit Result(E &&error) : m_rawResult(std::move(error)) {} + + Result &operator=(const R &response) + { + this->m_rawResult = response; + + return *this; + } + + Result &operator=(R &&response) + { + this->m_rawResult = std::move(response); + + return *this; + } + + Result &operator=(const E &error) + { + this->m_rawResult = error; + return *this; + } + + Result &operator=(E &&error) + { + this->m_rawResult = std::move(error); + + return *this; + } + + bool IsSuccess() const { return m_rawResult.template holds_alternative(); } + + const R &GetResponse() const + { + AWS_FATAL_ASSERT(IsSuccess()); + + return m_rawResult.template get(); + } + + const E &GetError() const + { + AWS_FATAL_ASSERT(!IsSuccess()); + + return m_rawResult.template get(); + } + + private: + Aws::Crt::Variant m_rawResult; + }; + + /** + * Type definition for a request result where a response has not yet been deserialized into a specific + * response type. + */ + using UnmodeledResult = Result; + + /** + * Signature of a function object that handles unmodeled results. In general, these handlers will + * be built by service clients and are responsible for transforming an unmodeled response into a + * modeled response. + */ + using UnmodeledResultHandler = std::function; + + /** + * Generic configuration options for streaming operations + * + * @tparam T modeled message type emitted/handled by a particular stream + */ + template class StreamingOperationOptions + { + public: + /** + * Sets the handler function a streaming operation will use for subscription status events. + * + * @param handler the handler function a streaming operation will use for subscription status events + * @return reference to this + */ + StreamingOperationOptions &WithSubscriptionStatusEventHandler( + const SubscriptionStatusEventHandler &handler) + { + m_subscriptionStatusEventHandler = handler; + return *this; + } + + /** + * Sets the handler function a streaming operation will use for the modeled message type. + * + * @param handler the handler function a streaming operation will use for the modeled message type + * @return reference to this + */ + StreamingOperationOptions &WithStreamHandler(const std::function &handler) + { + m_streamHandler = handler; + return *this; + } + + /** + * Gets the handler function a streaming operation will use for subscription status events. + * + * @return the handler function a streaming operation will use for subscription status events + */ + const SubscriptionStatusEventHandler &GetSubscriptionStatusEventHandler() const + { + return m_subscriptionStatusEventHandler; + } + + /** + * Gets the handler function a streaming operation will use for the modeled message type. + * + * @return the handler function a streaming operation will use for the modeled message type + */ + const std::function &GetStreamHandler() const { return m_streamHandler; } + + private: + SubscriptionStatusEventHandler m_subscriptionStatusEventHandler; + + std::function m_streamHandler; + }; + + /** + * Streaming operation configuration options used internally by a service client's request response + * client. + * + * @internal + */ + struct AWS_CRT_CPP_API StreamingOperationOptionsInternal + { + public: + StreamingOperationOptionsInternal() + : subscriptionTopicFilter(), subscriptionStatusEventHandler(), incomingPublishEventHandler() + { + AWS_ZERO_STRUCT(subscriptionTopicFilter); + } + + Aws::Crt::ByteCursor subscriptionTopicFilter; + + SubscriptionStatusEventHandler subscriptionStatusEventHandler; + + IncomingPublishEventHandler incomingPublishEventHandler; + }; + + /** + * Base type for all streaming operations + */ + class AWS_CRT_CPP_API IStreamingOperation + { + public: + /** + * A streaming operation is automatically closed (and an MQTT unsubscribe triggered) when its + * destructor is invoked. + */ + virtual ~IStreamingOperation() = default; + + /** + * Opens a streaming operation by making the appropriate MQTT subscription with the broker. + */ + virtual void Open() = 0; + }; + + /** + * MQTT-based request-response client configuration options + */ + class AWS_CRT_CPP_API RequestResponseClientOptions + { + public: + /** + * Sets the maximum number of request-response subscriptions the client allows to be concurrently active + * at any one point in time. When the client hits this threshold, requests will be delayed until + * earlier requests complete and release their subscriptions. Each in-progress request will use either + * 1 or 2 MQTT subscriptions until completion. + * + * @param maxRequestResponseSubscriptions maximum number of concurrent subscriptions that the client + * will use for request-response operations + * @return reference to this + */ + RequestResponseClientOptions &WithMaxRequestResponseSubscriptions( + uint32_t maxRequestResponseSubscriptions) + { + m_maxRequestResponseSubscriptions = maxRequestResponseSubscriptions; + return *this; + } + + /** + * Sets the maximum number of concurrent streaming operation subscriptions that the client will allow. + * Each "unique" (different topic filter) streaming operation will use 1 MQTT subscription. When the + * client hits this threshold, attempts to open new streaming operations will fail. + * + * @param maxStreamingSubscriptions maximum number of current subscriptions that the client will + * use for streaming operations + * @return reference to this + */ + RequestResponseClientOptions &WithMaxStreamingSubscriptions(uint32_t maxStreamingSubscriptions) + { + m_maxStreamingSubscriptions = maxStreamingSubscriptions; + return *this; + } + + /** + * Sets the timeout value, in seconds, for a request-response operation. If a request is not complete + * by this time interval, the client will complete it as failed. This time interval starts the instant + * the request is submitted to the client. + * + * @param operationTimeoutInSeconds request timeout in seconds + * @return reference to this + */ + RequestResponseClientOptions &WithOperationTimeoutInSeconds(uint32_t operationTimeoutInSeconds) + { + m_operationTimeoutInSeconds = operationTimeoutInSeconds; + return *this; + } + + /** + * Gets the maximum number of request-response subscriptions the client allows to be concurrently + * active. + * + * @return the maximum number of request-response subscriptions the client allows to be concurrently + * active + */ + uint32_t GetMaxRequestResponseSubscriptions() const { return m_maxRequestResponseSubscriptions; } + + /** + * Gets the maximum number of concurrent streaming operation subscriptions that the client will allow. + * + * @return the maximum number of concurrent streaming operation subscriptions that the client will allow + */ + uint32_t GetMaxStreamingSubscriptions() const { return m_maxStreamingSubscriptions; } + + /** + * Gets the timeout value, in seconds, for a request-response operation. + * + * @return the timeout value, in seconds, for a request-response operation + */ + uint32_t GetOperationTimeoutInSeconds() const { return m_operationTimeoutInSeconds; } + + private: + /** + * Maximum number of subscriptions that the client will concurrently use for request-response operations + */ + uint32_t m_maxRequestResponseSubscriptions = 0; + + /** + * Maximum number of subscriptions that the client will concurrently use for streaming operations + */ + uint32_t m_maxStreamingSubscriptions = 0; + + /** + * Duration, in seconds, that a request-response operation will wait for completion before giving up + */ + uint32_t m_operationTimeoutInSeconds = 0; + }; + + /** + * Generic interface for the request-response client + */ + class AWS_CRT_CPP_API IMqttRequestResponseClient + { + public: + /** + * There is no close operation for the client. When the destructor is invoked, the underlying client + * will be closed. + */ + virtual ~IMqttRequestResponseClient() = default; + + /** + * Submits a generic request to the request-response client. + * + * @param requestOptions description of the request the client should perform + * @param resultHandler function object to invoke when the request is completed + * @return success (AWS_OP_SUCCESS) or failure (AWS_OP_ERR) + */ + virtual int SubmitRequest( + const aws_mqtt_request_operation_options &requestOptions, + UnmodeledResultHandler &&resultHandler) = 0; + + /** + * Creates a new streaming operation. Streaming operations "listen" to a specific kind of service + * event and invoke handlers every time one is received. + * + * @param options configuration options for the streaming operation to construct + * @return + */ + virtual std::shared_ptr CreateStream( + const StreamingOperationOptionsInternal &options) = 0; + }; + + /** + * Creates a new request-response client using an MQTT5 client for protocol transport + * + * @param protocolClient MQTT client to use for transport + * @param options request-response client configuration options + * @param allocator allocator to use to create the client + * @return a new request-response client if successful, otherwise nullptr + */ + AWS_CRT_CPP_API std::shared_ptr NewClientFrom5( + const Aws::Crt::Mqtt5::Mqtt5Client &protocolClient, + const RequestResponseClientOptions &options, + Aws::Crt::Allocator *allocator = Aws::Crt::ApiAllocator()); + + /** + * Creates a new request-response client using an MQTT311 client for protocol transport + * + * @param protocolClient MQTT client to use for transport + * @param options request-response client configuration options + * @param allocator allocator to use to create the client + * @return a new request-response client if successful, otherwise nullptr + */ + AWS_CRT_CPP_API std::shared_ptr NewClientFrom311( + const Aws::Crt::Mqtt::MqttConnection &protocolClient, + const RequestResponseClientOptions &options, + Aws::Crt::Allocator *allocator = Aws::Crt::ApiAllocator()); + + } // namespace RequestResponse + } // namespace Iot +} // namespace Aws diff --git a/include/aws/s3/model/AbortMultipartUploadResult.h b/include/aws/s3/model/AbortMultipartUploadResult.h new file mode 100644 index 0000000000000000000000000000000000000000..575e6b014ad9f789efcdadb6d1a3d758f6d01a34 --- /dev/null +++ b/include/aws/s3/model/AbortMultipartUploadResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class AbortMultipartUploadResult + { + public: + AWS_S3_API AbortMultipartUploadResult(); + AWS_S3_API AbortMultipartUploadResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API AbortMultipartUploadResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline AbortMultipartUploadResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline AbortMultipartUploadResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline AbortMultipartUploadResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline AbortMultipartUploadResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline AbortMultipartUploadResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/AccelerateConfiguration.h b/include/aws/s3/model/AccelerateConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..e69df61350f0f8c6721e01244ab4f2dfd8c8c636 --- /dev/null +++ b/include/aws/s3/model/AccelerateConfiguration.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Configures the transfer acceleration state for an Amazon S3 bucket. For more + * information, see Amazon + * S3 Transfer Acceleration in the Amazon S3 User Guide.

See + * Also:

AWS + * API Reference

+ */ + class AccelerateConfiguration + { + public: + AWS_S3_API AccelerateConfiguration(); + AWS_S3_API AccelerateConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API AccelerateConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the transfer acceleration status of the bucket.

+ */ + inline const BucketAccelerateStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const BucketAccelerateStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(BucketAccelerateStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline AccelerateConfiguration& WithStatus(const BucketAccelerateStatus& value) { SetStatus(value); return *this;} + inline AccelerateConfiguration& WithStatus(BucketAccelerateStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + BucketAccelerateStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/AnalyticsAndOperator.h b/include/aws/s3/model/AnalyticsAndOperator.h new file mode 100644 index 0000000000000000000000000000000000000000..387fab630a6f0a291feec31bb0e533417b2f5c84 --- /dev/null +++ b/include/aws/s3/model/AnalyticsAndOperator.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A conjunction (logical AND) of predicates, which is used in evaluating a + * metrics filter. The operator must have at least two predicates in any + * combination, and an object must match all of the predicates for the filter to + * apply.

See Also:

AWS + * API Reference

+ */ + class AnalyticsAndOperator + { + public: + AWS_S3_API AnalyticsAndOperator(); + AWS_S3_API AnalyticsAndOperator(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API AnalyticsAndOperator& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The prefix to use when evaluating an AND predicate: The prefix that an object + * must have to be included in the metrics results.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline AnalyticsAndOperator& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline AnalyticsAndOperator& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline AnalyticsAndOperator& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

The list of tags to use when evaluating an AND predicate.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline AnalyticsAndOperator& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline AnalyticsAndOperator& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline AnalyticsAndOperator& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline AnalyticsAndOperator& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/AnalyticsConfiguration.h b/include/aws/s3/model/AnalyticsConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..386390c13939d5ab09c14c0dfd2def892e76ab67 --- /dev/null +++ b/include/aws/s3/model/AnalyticsConfiguration.h @@ -0,0 +1,97 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the configuration and any analyses for the analytics filter of an + * Amazon S3 bucket.

See Also:

AWS + * API Reference

+ */ + class AnalyticsConfiguration + { + public: + AWS_S3_API AnalyticsConfiguration(); + AWS_S3_API AnalyticsConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API AnalyticsConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The ID that identifies the analytics configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline AnalyticsConfiguration& WithId(const Aws::String& value) { SetId(value); return *this;} + inline AnalyticsConfiguration& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline AnalyticsConfiguration& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The filter used to describe a set of objects for analyses. A filter must have + * exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). If no + * filter is provided, all objects will be considered in any analysis.

+ */ + inline const AnalyticsFilter& GetFilter() const{ return m_filter; } + inline bool FilterHasBeenSet() const { return m_filterHasBeenSet; } + inline void SetFilter(const AnalyticsFilter& value) { m_filterHasBeenSet = true; m_filter = value; } + inline void SetFilter(AnalyticsFilter&& value) { m_filterHasBeenSet = true; m_filter = std::move(value); } + inline AnalyticsConfiguration& WithFilter(const AnalyticsFilter& value) { SetFilter(value); return *this;} + inline AnalyticsConfiguration& WithFilter(AnalyticsFilter&& value) { SetFilter(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Contains data related to access patterns to be collected and made available + * to analyze the tradeoffs between different storage classes.

+ */ + inline const StorageClassAnalysis& GetStorageClassAnalysis() const{ return m_storageClassAnalysis; } + inline bool StorageClassAnalysisHasBeenSet() const { return m_storageClassAnalysisHasBeenSet; } + inline void SetStorageClassAnalysis(const StorageClassAnalysis& value) { m_storageClassAnalysisHasBeenSet = true; m_storageClassAnalysis = value; } + inline void SetStorageClassAnalysis(StorageClassAnalysis&& value) { m_storageClassAnalysisHasBeenSet = true; m_storageClassAnalysis = std::move(value); } + inline AnalyticsConfiguration& WithStorageClassAnalysis(const StorageClassAnalysis& value) { SetStorageClassAnalysis(value); return *this;} + inline AnalyticsConfiguration& WithStorageClassAnalysis(StorageClassAnalysis&& value) { SetStorageClassAnalysis(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + AnalyticsFilter m_filter; + bool m_filterHasBeenSet = false; + + StorageClassAnalysis m_storageClassAnalysis; + bool m_storageClassAnalysisHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/AnalyticsExportDestination.h b/include/aws/s3/model/AnalyticsExportDestination.h new file mode 100644 index 0000000000000000000000000000000000000000..c02a242c250a28f189969f52648bae2e44a71c3e --- /dev/null +++ b/include/aws/s3/model/AnalyticsExportDestination.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Where to publish the analytics results.

See Also:

AWS + * API Reference

+ */ + class AnalyticsExportDestination + { + public: + AWS_S3_API AnalyticsExportDestination(); + AWS_S3_API AnalyticsExportDestination(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API AnalyticsExportDestination& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

A destination signifying output to an S3 bucket.

+ */ + inline const AnalyticsS3BucketDestination& GetS3BucketDestination() const{ return m_s3BucketDestination; } + inline bool S3BucketDestinationHasBeenSet() const { return m_s3BucketDestinationHasBeenSet; } + inline void SetS3BucketDestination(const AnalyticsS3BucketDestination& value) { m_s3BucketDestinationHasBeenSet = true; m_s3BucketDestination = value; } + inline void SetS3BucketDestination(AnalyticsS3BucketDestination&& value) { m_s3BucketDestinationHasBeenSet = true; m_s3BucketDestination = std::move(value); } + inline AnalyticsExportDestination& WithS3BucketDestination(const AnalyticsS3BucketDestination& value) { SetS3BucketDestination(value); return *this;} + inline AnalyticsExportDestination& WithS3BucketDestination(AnalyticsS3BucketDestination&& value) { SetS3BucketDestination(std::move(value)); return *this;} + ///@} + private: + + AnalyticsS3BucketDestination m_s3BucketDestination; + bool m_s3BucketDestinationHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ArchiveStatus.h b/include/aws/s3/model/ArchiveStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..dc8b46d0d14fc9d1f9f7c2489673e783cf27a086 --- /dev/null +++ b/include/aws/s3/model/ArchiveStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ArchiveStatus + { + NOT_SET, + ARCHIVE_ACCESS, + DEEP_ARCHIVE_ACCESS + }; + +namespace ArchiveStatusMapper +{ +AWS_S3_API ArchiveStatus GetArchiveStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForArchiveStatus(ArchiveStatus value); +} // namespace ArchiveStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/BucketInfo.h b/include/aws/s3/model/BucketInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..3aef8c1719f4015530d95841aca37fc8522d8aa4 --- /dev/null +++ b/include/aws/s3/model/BucketInfo.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the information about the bucket that will be created. For more + * information about directory buckets, see Directory + * buckets in the Amazon S3 User Guide.

This functionality + * is only supported by directory buckets.

See Also:

AWS API + * Reference

+ */ + class BucketInfo + { + public: + AWS_S3_API BucketInfo(); + AWS_S3_API BucketInfo(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API BucketInfo& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The number of Zone (Availability Zone or Local Zone) that's used for + * redundancy for the bucket.

+ */ + inline const DataRedundancy& GetDataRedundancy() const{ return m_dataRedundancy; } + inline bool DataRedundancyHasBeenSet() const { return m_dataRedundancyHasBeenSet; } + inline void SetDataRedundancy(const DataRedundancy& value) { m_dataRedundancyHasBeenSet = true; m_dataRedundancy = value; } + inline void SetDataRedundancy(DataRedundancy&& value) { m_dataRedundancyHasBeenSet = true; m_dataRedundancy = std::move(value); } + inline BucketInfo& WithDataRedundancy(const DataRedundancy& value) { SetDataRedundancy(value); return *this;} + inline BucketInfo& WithDataRedundancy(DataRedundancy&& value) { SetDataRedundancy(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The type of bucket.

+ */ + inline const BucketType& GetType() const{ return m_type; } + inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } + inline void SetType(const BucketType& value) { m_typeHasBeenSet = true; m_type = value; } + inline void SetType(BucketType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } + inline BucketInfo& WithType(const BucketType& value) { SetType(value); return *this;} + inline BucketInfo& WithType(BucketType&& value) { SetType(std::move(value)); return *this;} + ///@} + private: + + DataRedundancy m_dataRedundancy; + bool m_dataRedundancyHasBeenSet = false; + + BucketType m_type; + bool m_typeHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/BucketLocationConstraint.h b/include/aws/s3/model/BucketLocationConstraint.h new file mode 100644 index 0000000000000000000000000000000000000000..fc8b78a3f0b0c6c00f73a52e2888530435f13566 --- /dev/null +++ b/include/aws/s3/model/BucketLocationConstraint.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class BucketLocationConstraint + { + NOT_SET, + af_south_1, + ap_east_1, + ap_northeast_1, + ap_northeast_2, + ap_northeast_3, + ap_south_1, + ap_south_2, + ap_southeast_1, + ap_southeast_2, + ap_southeast_3, + ap_southeast_4, + ap_southeast_5, + ca_central_1, + cn_north_1, + cn_northwest_1, + EU, + eu_central_1, + eu_central_2, + eu_north_1, + eu_south_1, + eu_south_2, + eu_west_1, + eu_west_2, + eu_west_3, + il_central_1, + me_central_1, + me_south_1, + sa_east_1, + us_east_2, + us_gov_east_1, + us_gov_west_1, + us_west_1, + us_west_2, + us_iso_west_1, + us_east_1 + }; + +namespace BucketLocationConstraintMapper +{ +AWS_S3_API BucketLocationConstraint GetBucketLocationConstraintForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForBucketLocationConstraint(BucketLocationConstraint value); +} // namespace BucketLocationConstraintMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/BucketVersioningStatus.h b/include/aws/s3/model/BucketVersioningStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..9b0b676f174d30ac8cd288a63fb3c41afc3b055a --- /dev/null +++ b/include/aws/s3/model/BucketVersioningStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class BucketVersioningStatus + { + NOT_SET, + Enabled, + Suspended + }; + +namespace BucketVersioningStatusMapper +{ +AWS_S3_API BucketVersioningStatus GetBucketVersioningStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForBucketVersioningStatus(BucketVersioningStatus value); +} // namespace BucketVersioningStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CORSConfiguration.h b/include/aws/s3/model/CORSConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..0d7ac81fe2bb7a49aeff5142845fba6c30c0985d --- /dev/null +++ b/include/aws/s3/model/CORSConfiguration.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Describes the cross-origin access configuration for objects in an Amazon S3 + * bucket. For more information, see Enabling + * Cross-Origin Resource Sharing in the Amazon S3 User + * Guide.

See Also:

AWS + * API Reference

+ */ + class CORSConfiguration + { + public: + AWS_S3_API CORSConfiguration(); + AWS_S3_API CORSConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API CORSConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

A set of origins and methods (cross-origin access that you want to allow). + * You can add up to 100 rules to the configuration.

+ */ + inline const Aws::Vector& GetCORSRules() const{ return m_cORSRules; } + inline bool CORSRulesHasBeenSet() const { return m_cORSRulesHasBeenSet; } + inline void SetCORSRules(const Aws::Vector& value) { m_cORSRulesHasBeenSet = true; m_cORSRules = value; } + inline void SetCORSRules(Aws::Vector&& value) { m_cORSRulesHasBeenSet = true; m_cORSRules = std::move(value); } + inline CORSConfiguration& WithCORSRules(const Aws::Vector& value) { SetCORSRules(value); return *this;} + inline CORSConfiguration& WithCORSRules(Aws::Vector&& value) { SetCORSRules(std::move(value)); return *this;} + inline CORSConfiguration& AddCORSRules(const CORSRule& value) { m_cORSRulesHasBeenSet = true; m_cORSRules.push_back(value); return *this; } + inline CORSConfiguration& AddCORSRules(CORSRule&& value) { m_cORSRulesHasBeenSet = true; m_cORSRules.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_cORSRules; + bool m_cORSRulesHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CORSRule.h b/include/aws/s3/model/CORSRule.h new file mode 100644 index 0000000000000000000000000000000000000000..8497abee88381b854374b6c690c5213de0855301 --- /dev/null +++ b/include/aws/s3/model/CORSRule.h @@ -0,0 +1,158 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies a cross-origin access rule for an Amazon S3 bucket.

See + * Also:

AWS API + * Reference

+ */ + class CORSRule + { + public: + AWS_S3_API CORSRule(); + AWS_S3_API CORSRule(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API CORSRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Unique identifier for the rule. The value cannot be longer than 255 + * characters.

+ */ + inline const Aws::String& GetID() const{ return m_iD; } + inline bool IDHasBeenSet() const { return m_iDHasBeenSet; } + inline void SetID(const Aws::String& value) { m_iDHasBeenSet = true; m_iD = value; } + inline void SetID(Aws::String&& value) { m_iDHasBeenSet = true; m_iD = std::move(value); } + inline void SetID(const char* value) { m_iDHasBeenSet = true; m_iD.assign(value); } + inline CORSRule& WithID(const Aws::String& value) { SetID(value); return *this;} + inline CORSRule& WithID(Aws::String&& value) { SetID(std::move(value)); return *this;} + inline CORSRule& WithID(const char* value) { SetID(value); return *this;} + ///@} + + ///@{ + /** + *

Headers that are specified in the Access-Control-Request-Headers + * header. These headers are allowed in a preflight OPTIONS request. In response to + * any preflight OPTIONS request, Amazon S3 returns any requested headers that are + * allowed.

+ */ + inline const Aws::Vector& GetAllowedHeaders() const{ return m_allowedHeaders; } + inline bool AllowedHeadersHasBeenSet() const { return m_allowedHeadersHasBeenSet; } + inline void SetAllowedHeaders(const Aws::Vector& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders = value; } + inline void SetAllowedHeaders(Aws::Vector&& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders = std::move(value); } + inline CORSRule& WithAllowedHeaders(const Aws::Vector& value) { SetAllowedHeaders(value); return *this;} + inline CORSRule& WithAllowedHeaders(Aws::Vector&& value) { SetAllowedHeaders(std::move(value)); return *this;} + inline CORSRule& AddAllowedHeaders(const Aws::String& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(value); return *this; } + inline CORSRule& AddAllowedHeaders(Aws::String&& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(std::move(value)); return *this; } + inline CORSRule& AddAllowedHeaders(const char* value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

An HTTP method that you allow the origin to execute. Valid values are + * GET, PUT, HEAD, POST, and + * DELETE.

+ */ + inline const Aws::Vector& GetAllowedMethods() const{ return m_allowedMethods; } + inline bool AllowedMethodsHasBeenSet() const { return m_allowedMethodsHasBeenSet; } + inline void SetAllowedMethods(const Aws::Vector& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods = value; } + inline void SetAllowedMethods(Aws::Vector&& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods = std::move(value); } + inline CORSRule& WithAllowedMethods(const Aws::Vector& value) { SetAllowedMethods(value); return *this;} + inline CORSRule& WithAllowedMethods(Aws::Vector&& value) { SetAllowedMethods(std::move(value)); return *this;} + inline CORSRule& AddAllowedMethods(const Aws::String& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(value); return *this; } + inline CORSRule& AddAllowedMethods(Aws::String&& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(std::move(value)); return *this; } + inline CORSRule& AddAllowedMethods(const char* value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

One or more origins you want customers to be able to access the bucket + * from.

+ */ + inline const Aws::Vector& GetAllowedOrigins() const{ return m_allowedOrigins; } + inline bool AllowedOriginsHasBeenSet() const { return m_allowedOriginsHasBeenSet; } + inline void SetAllowedOrigins(const Aws::Vector& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins = value; } + inline void SetAllowedOrigins(Aws::Vector&& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins = std::move(value); } + inline CORSRule& WithAllowedOrigins(const Aws::Vector& value) { SetAllowedOrigins(value); return *this;} + inline CORSRule& WithAllowedOrigins(Aws::Vector&& value) { SetAllowedOrigins(std::move(value)); return *this;} + inline CORSRule& AddAllowedOrigins(const Aws::String& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(value); return *this; } + inline CORSRule& AddAllowedOrigins(Aws::String&& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(std::move(value)); return *this; } + inline CORSRule& AddAllowedOrigins(const char* value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

One or more headers in the response that you want customers to be able to + * access from their applications (for example, from a JavaScript + * XMLHttpRequest object).

+ */ + inline const Aws::Vector& GetExposeHeaders() const{ return m_exposeHeaders; } + inline bool ExposeHeadersHasBeenSet() const { return m_exposeHeadersHasBeenSet; } + inline void SetExposeHeaders(const Aws::Vector& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders = value; } + inline void SetExposeHeaders(Aws::Vector&& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders = std::move(value); } + inline CORSRule& WithExposeHeaders(const Aws::Vector& value) { SetExposeHeaders(value); return *this;} + inline CORSRule& WithExposeHeaders(Aws::Vector&& value) { SetExposeHeaders(std::move(value)); return *this;} + inline CORSRule& AddExposeHeaders(const Aws::String& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(value); return *this; } + inline CORSRule& AddExposeHeaders(Aws::String&& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(std::move(value)); return *this; } + inline CORSRule& AddExposeHeaders(const char* value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The time in seconds that your browser is to cache the preflight response for + * the specified resource.

+ */ + inline int GetMaxAgeSeconds() const{ return m_maxAgeSeconds; } + inline bool MaxAgeSecondsHasBeenSet() const { return m_maxAgeSecondsHasBeenSet; } + inline void SetMaxAgeSeconds(int value) { m_maxAgeSecondsHasBeenSet = true; m_maxAgeSeconds = value; } + inline CORSRule& WithMaxAgeSeconds(int value) { SetMaxAgeSeconds(value); return *this;} + ///@} + private: + + Aws::String m_iD; + bool m_iDHasBeenSet = false; + + Aws::Vector m_allowedHeaders; + bool m_allowedHeadersHasBeenSet = false; + + Aws::Vector m_allowedMethods; + bool m_allowedMethodsHasBeenSet = false; + + Aws::Vector m_allowedOrigins; + bool m_allowedOriginsHasBeenSet = false; + + Aws::Vector m_exposeHeaders; + bool m_exposeHeadersHasBeenSet = false; + + int m_maxAgeSeconds; + bool m_maxAgeSecondsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Checksum.h b/include/aws/s3/model/Checksum.h new file mode 100644 index 0000000000000000000000000000000000000000..e40c2515a22d01983908c731fe2d38c23f11603d --- /dev/null +++ b/include/aws/s3/model/Checksum.h @@ -0,0 +1,183 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Contains all the possible checksum or digest values for an + * object.

See Also:

AWS API + * Reference

+ */ + class Checksum + { + public: + AWS_S3_API Checksum(); + AWS_S3_API Checksum(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Checksum& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32 checksum of the object. This + * checksum is only be present if the checksum was uploaded with the object. When + * you use an API operation on an object that was uploaded using multipart uploads, + * this value may not be a direct checksum value of the full object. Instead, it's + * a calculation based on the checksum values of each individual part. For more + * information about how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32() const{ return m_checksumCRC32; } + inline bool ChecksumCRC32HasBeenSet() const { return m_checksumCRC32HasBeenSet; } + inline void SetChecksumCRC32(const Aws::String& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = value; } + inline void SetChecksumCRC32(Aws::String&& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = std::move(value); } + inline void SetChecksumCRC32(const char* value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32.assign(value); } + inline Checksum& WithChecksumCRC32(const Aws::String& value) { SetChecksumCRC32(value); return *this;} + inline Checksum& WithChecksumCRC32(Aws::String&& value) { SetChecksumCRC32(std::move(value)); return *this;} + inline Checksum& WithChecksumCRC32(const char* value) { SetChecksumCRC32(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32C checksum of the object. This + * checksum is only present if the checksum was uploaded with the object. When you + * use an API operation on an object that was uploaded using multipart uploads, + * this value may not be a direct checksum value of the full object. Instead, it's + * a calculation based on the checksum values of each individual part. For more + * information about how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32C() const{ return m_checksumCRC32C; } + inline bool ChecksumCRC32CHasBeenSet() const { return m_checksumCRC32CHasBeenSet; } + inline void SetChecksumCRC32C(const Aws::String& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = value; } + inline void SetChecksumCRC32C(Aws::String&& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = std::move(value); } + inline void SetChecksumCRC32C(const char* value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C.assign(value); } + inline Checksum& WithChecksumCRC32C(const Aws::String& value) { SetChecksumCRC32C(value); return *this;} + inline Checksum& WithChecksumCRC32C(Aws::String&& value) { SetChecksumCRC32C(std::move(value)); return *this;} + inline Checksum& WithChecksumCRC32C(const char* value) { SetChecksumCRC32C(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 64-bit CRC64NVME checksum of the object. + * This checksum is present if the object was uploaded with the + * CRC64NVME checksum algorithm, or if the object was uploaded without + * a checksum (and Amazon S3 added the default checksum, CRC64NVME, to + * the uploaded object). For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC64NVME() const{ return m_checksumCRC64NVME; } + inline bool ChecksumCRC64NVMEHasBeenSet() const { return m_checksumCRC64NVMEHasBeenSet; } + inline void SetChecksumCRC64NVME(const Aws::String& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = value; } + inline void SetChecksumCRC64NVME(Aws::String&& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = std::move(value); } + inline void SetChecksumCRC64NVME(const char* value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME.assign(value); } + inline Checksum& WithChecksumCRC64NVME(const Aws::String& value) { SetChecksumCRC64NVME(value); return *this;} + inline Checksum& WithChecksumCRC64NVME(Aws::String&& value) { SetChecksumCRC64NVME(std::move(value)); return *this;} + inline Checksum& WithChecksumCRC64NVME(const char* value) { SetChecksumCRC64NVME(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 160-bit SHA1 digest of the object. This will + * only be present if the object was uploaded with the object. When you use the API + * operation on an object that was uploaded using multipart uploads, this value may + * not be a direct checksum value of the full object. Instead, it's a calculation + * based on the checksum values of each individual part. For more information about + * how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA1() const{ return m_checksumSHA1; } + inline bool ChecksumSHA1HasBeenSet() const { return m_checksumSHA1HasBeenSet; } + inline void SetChecksumSHA1(const Aws::String& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = value; } + inline void SetChecksumSHA1(Aws::String&& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = std::move(value); } + inline void SetChecksumSHA1(const char* value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1.assign(value); } + inline Checksum& WithChecksumSHA1(const Aws::String& value) { SetChecksumSHA1(value); return *this;} + inline Checksum& WithChecksumSHA1(Aws::String&& value) { SetChecksumSHA1(std::move(value)); return *this;} + inline Checksum& WithChecksumSHA1(const char* value) { SetChecksumSHA1(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 256-bit SHA256 digest of the object. This + * will only be present if the object was uploaded with the object. When you use an + * API operation on an object that was uploaded using multipart uploads, this value + * may not be a direct checksum value of the full object. Instead, it's a + * calculation based on the checksum values of each individual part. For more + * information about how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA256() const{ return m_checksumSHA256; } + inline bool ChecksumSHA256HasBeenSet() const { return m_checksumSHA256HasBeenSet; } + inline void SetChecksumSHA256(const Aws::String& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = value; } + inline void SetChecksumSHA256(Aws::String&& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = std::move(value); } + inline void SetChecksumSHA256(const char* value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256.assign(value); } + inline Checksum& WithChecksumSHA256(const Aws::String& value) { SetChecksumSHA256(value); return *this;} + inline Checksum& WithChecksumSHA256(Aws::String&& value) { SetChecksumSHA256(std::move(value)); return *this;} + inline Checksum& WithChecksumSHA256(const char* value) { SetChecksumSHA256(value); return *this;} + ///@} + + ///@{ + /** + *

The checksum type that is used to calculate the object’s checksum value. For + * more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline bool ChecksumTypeHasBeenSet() const { return m_checksumTypeHasBeenSet; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumTypeHasBeenSet = true; m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumTypeHasBeenSet = true; m_checksumType = std::move(value); } + inline Checksum& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline Checksum& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_checksumCRC32; + bool m_checksumCRC32HasBeenSet = false; + + Aws::String m_checksumCRC32C; + bool m_checksumCRC32CHasBeenSet = false; + + Aws::String m_checksumCRC64NVME; + bool m_checksumCRC64NVMEHasBeenSet = false; + + Aws::String m_checksumSHA1; + bool m_checksumSHA1HasBeenSet = false; + + Aws::String m_checksumSHA256; + bool m_checksumSHA256HasBeenSet = false; + + ChecksumType m_checksumType; + bool m_checksumTypeHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ChecksumAlgorithm.h b/include/aws/s3/model/ChecksumAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..f7c890e2b9d50909439d75ee0b29274dfe418103 --- /dev/null +++ b/include/aws/s3/model/ChecksumAlgorithm.h @@ -0,0 +1,34 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ChecksumAlgorithm + { + NOT_SET, + CRC32, + CRC32C, + SHA1, + SHA256, + CRC64NVME + }; + +namespace ChecksumAlgorithmMapper +{ +AWS_S3_API ChecksumAlgorithm GetChecksumAlgorithmForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForChecksumAlgorithm(ChecksumAlgorithm value); +} // namespace ChecksumAlgorithmMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ChecksumType.h b/include/aws/s3/model/ChecksumType.h new file mode 100644 index 0000000000000000000000000000000000000000..6d602e9ad8a4ed4fa65f92ee35a898483f62fafa --- /dev/null +++ b/include/aws/s3/model/ChecksumType.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ChecksumType + { + NOT_SET, + COMPOSITE, + FULL_OBJECT + }; + +namespace ChecksumTypeMapper +{ +AWS_S3_API ChecksumType GetChecksumTypeForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForChecksumType(ChecksumType value); +} // namespace ChecksumTypeMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CompleteMultipartUploadRequest.h b/include/aws/s3/model/CompleteMultipartUploadRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..25150446ef1aa5b2579fbf762ad37cb3414dc964 --- /dev/null +++ b/include/aws/s3/model/CompleteMultipartUploadRequest.h @@ -0,0 +1,472 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class CompleteMultipartUploadRequest : public S3Request + { + public: + AWS_S3_API CompleteMultipartUploadRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CompleteMultipartUpload"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

Name of the bucket to which the multipart upload was initiated.

+ * Directory buckets - When you use this operation with a directory bucket, + * you must use virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline CompleteMultipartUploadRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline CompleteMultipartUploadRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Object key for which the multipart upload was initiated.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline CompleteMultipartUploadRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline CompleteMultipartUploadRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The container for the multipart upload request information.

+ */ + inline const CompletedMultipartUpload& GetMultipartUpload() const{ return m_multipartUpload; } + inline bool MultipartUploadHasBeenSet() const { return m_multipartUploadHasBeenSet; } + inline void SetMultipartUpload(const CompletedMultipartUpload& value) { m_multipartUploadHasBeenSet = true; m_multipartUpload = value; } + inline void SetMultipartUpload(CompletedMultipartUpload&& value) { m_multipartUploadHasBeenSet = true; m_multipartUpload = std::move(value); } + inline CompleteMultipartUploadRequest& WithMultipartUpload(const CompletedMultipartUpload& value) { SetMultipartUpload(value); return *this;} + inline CompleteMultipartUploadRequest& WithMultipartUpload(CompletedMultipartUpload&& value) { SetMultipartUpload(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

ID for the initiated multipart upload.

+ */ + inline const Aws::String& GetUploadId() const{ return m_uploadId; } + inline bool UploadIdHasBeenSet() const { return m_uploadIdHasBeenSet; } + inline void SetUploadId(const Aws::String& value) { m_uploadIdHasBeenSet = true; m_uploadId = value; } + inline void SetUploadId(Aws::String&& value) { m_uploadIdHasBeenSet = true; m_uploadId = std::move(value); } + inline void SetUploadId(const char* value) { m_uploadIdHasBeenSet = true; m_uploadId.assign(value); } + inline CompleteMultipartUploadRequest& WithUploadId(const Aws::String& value) { SetUploadId(value); return *this;} + inline CompleteMultipartUploadRequest& WithUploadId(Aws::String&& value) { SetUploadId(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithUploadId(const char* value) { SetUploadId(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 32-bit CRC32 checksum of the object. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32() const{ return m_checksumCRC32; } + inline bool ChecksumCRC32HasBeenSet() const { return m_checksumCRC32HasBeenSet; } + inline void SetChecksumCRC32(const Aws::String& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = value; } + inline void SetChecksumCRC32(Aws::String&& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = std::move(value); } + inline void SetChecksumCRC32(const char* value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32.assign(value); } + inline CompleteMultipartUploadRequest& WithChecksumCRC32(const Aws::String& value) { SetChecksumCRC32(value); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumCRC32(Aws::String&& value) { SetChecksumCRC32(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumCRC32(const char* value) { SetChecksumCRC32(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 32-bit CRC32C checksum of the object. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32C() const{ return m_checksumCRC32C; } + inline bool ChecksumCRC32CHasBeenSet() const { return m_checksumCRC32CHasBeenSet; } + inline void SetChecksumCRC32C(const Aws::String& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = value; } + inline void SetChecksumCRC32C(Aws::String&& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = std::move(value); } + inline void SetChecksumCRC32C(const char* value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C.assign(value); } + inline CompleteMultipartUploadRequest& WithChecksumCRC32C(const Aws::String& value) { SetChecksumCRC32C(value); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumCRC32C(Aws::String&& value) { SetChecksumCRC32C(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumCRC32C(const char* value) { SetChecksumCRC32C(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 64-bit CRC64NVME checksum of the object. The + * CRC64NVME checksum is always a full object checksum. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC64NVME() const{ return m_checksumCRC64NVME; } + inline bool ChecksumCRC64NVMEHasBeenSet() const { return m_checksumCRC64NVMEHasBeenSet; } + inline void SetChecksumCRC64NVME(const Aws::String& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = value; } + inline void SetChecksumCRC64NVME(Aws::String&& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = std::move(value); } + inline void SetChecksumCRC64NVME(const char* value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME.assign(value); } + inline CompleteMultipartUploadRequest& WithChecksumCRC64NVME(const Aws::String& value) { SetChecksumCRC64NVME(value); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumCRC64NVME(Aws::String&& value) { SetChecksumCRC64NVME(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumCRC64NVME(const char* value) { SetChecksumCRC64NVME(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 160-bit SHA1 digest of the object. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA1() const{ return m_checksumSHA1; } + inline bool ChecksumSHA1HasBeenSet() const { return m_checksumSHA1HasBeenSet; } + inline void SetChecksumSHA1(const Aws::String& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = value; } + inline void SetChecksumSHA1(Aws::String&& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = std::move(value); } + inline void SetChecksumSHA1(const char* value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1.assign(value); } + inline CompleteMultipartUploadRequest& WithChecksumSHA1(const Aws::String& value) { SetChecksumSHA1(value); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumSHA1(Aws::String&& value) { SetChecksumSHA1(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumSHA1(const char* value) { SetChecksumSHA1(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 256-bit SHA256 digest of the object. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA256() const{ return m_checksumSHA256; } + inline bool ChecksumSHA256HasBeenSet() const { return m_checksumSHA256HasBeenSet; } + inline void SetChecksumSHA256(const Aws::String& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = value; } + inline void SetChecksumSHA256(Aws::String&& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = std::move(value); } + inline void SetChecksumSHA256(const char* value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256.assign(value); } + inline CompleteMultipartUploadRequest& WithChecksumSHA256(const Aws::String& value) { SetChecksumSHA256(value); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumSHA256(Aws::String&& value) { SetChecksumSHA256(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumSHA256(const char* value) { SetChecksumSHA256(value); return *this;} + ///@} + + ///@{ + /** + *

This header specifies the checksum type of the object, which determines how + * part-level checksums are combined to create an object-level checksum for + * multipart objects. You can use this header as a data integrity check to verify + * that the checksum type that is received is the same checksum that was specified. + * If the checksum type doesn’t match the checksum type that was specified for the + * object during the CreateMultipartUpload request, it’ll result in a + * BadDigest error. For more information, see Checking object + * integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline bool ChecksumTypeHasBeenSet() const { return m_checksumTypeHasBeenSet; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumTypeHasBeenSet = true; m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumTypeHasBeenSet = true; m_checksumType = std::move(value); } + inline CompleteMultipartUploadRequest& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline CompleteMultipartUploadRequest& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The expected total object size of the multipart upload request. If there’s a + * mismatch between the specified object size value and the actual object size + * value, it results in an HTTP 400 InvalidRequest error.

+ */ + inline long long GetMpuObjectSize() const{ return m_mpuObjectSize; } + inline bool MpuObjectSizeHasBeenSet() const { return m_mpuObjectSizeHasBeenSet; } + inline void SetMpuObjectSize(long long value) { m_mpuObjectSizeHasBeenSet = true; m_mpuObjectSize = value; } + inline CompleteMultipartUploadRequest& WithMpuObjectSize(long long value) { SetMpuObjectSize(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline CompleteMultipartUploadRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline CompleteMultipartUploadRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline CompleteMultipartUploadRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline CompleteMultipartUploadRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Uploads the object only if the ETag (entity tag) value provided during the + * WRITE operation matches the ETag of the object in S3. If the ETag values do not + * match, the operation returns a 412 Precondition Failed error.

+ *

If a conflicting operation occurs during the upload S3 returns a 409 + * ConditionalRequestConflict response. On a 409 failure you should fetch + * the object's ETag, re-initiate the multipart upload with + * CreateMultipartUpload, and re-upload each part.

Expects the + * ETag value as a string.

For more information about conditional requests, + * see RFC 7232, or Conditional + * requests in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetIfMatch() const{ return m_ifMatch; } + inline bool IfMatchHasBeenSet() const { return m_ifMatchHasBeenSet; } + inline void SetIfMatch(const Aws::String& value) { m_ifMatchHasBeenSet = true; m_ifMatch = value; } + inline void SetIfMatch(Aws::String&& value) { m_ifMatchHasBeenSet = true; m_ifMatch = std::move(value); } + inline void SetIfMatch(const char* value) { m_ifMatchHasBeenSet = true; m_ifMatch.assign(value); } + inline CompleteMultipartUploadRequest& WithIfMatch(const Aws::String& value) { SetIfMatch(value); return *this;} + inline CompleteMultipartUploadRequest& WithIfMatch(Aws::String&& value) { SetIfMatch(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithIfMatch(const char* value) { SetIfMatch(value); return *this;} + ///@} + + ///@{ + /** + *

Uploads the object only if the object key name does not already exist in the + * bucket specified. Otherwise, Amazon S3 returns a 412 Precondition + * Failed error.

If a conflicting operation occurs during the upload + * S3 returns a 409 ConditionalRequestConflict response. On a 409 + * failure you should re-initiate the multipart upload with + * CreateMultipartUpload and re-upload each part.

Expects the + * '*' (asterisk) character.

For more information about conditional + * requests, see RFC 7232, or Conditional + * requests in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetIfNoneMatch() const{ return m_ifNoneMatch; } + inline bool IfNoneMatchHasBeenSet() const { return m_ifNoneMatchHasBeenSet; } + inline void SetIfNoneMatch(const Aws::String& value) { m_ifNoneMatchHasBeenSet = true; m_ifNoneMatch = value; } + inline void SetIfNoneMatch(Aws::String&& value) { m_ifNoneMatchHasBeenSet = true; m_ifNoneMatch = std::move(value); } + inline void SetIfNoneMatch(const char* value) { m_ifNoneMatchHasBeenSet = true; m_ifNoneMatch.assign(value); } + inline CompleteMultipartUploadRequest& WithIfNoneMatch(const Aws::String& value) { SetIfNoneMatch(value); return *this;} + inline CompleteMultipartUploadRequest& WithIfNoneMatch(Aws::String&& value) { SetIfNoneMatch(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithIfNoneMatch(const char* value) { SetIfNoneMatch(value); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption (SSE) algorithm used to encrypt the object. This + * parameter is required only when the object was created using a checksum + * algorithm or if your bucket policy requires the use of SSE-C. For more + * information, see Protecting + * data using SSE-C keys in the Amazon S3 User Guide.

This + * functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline bool SSECustomerAlgorithmHasBeenSet() const { return m_sSECustomerAlgorithmHasBeenSet; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm.assign(value); } + inline CompleteMultipartUploadRequest& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline CompleteMultipartUploadRequest& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption (SSE) customer managed key. This parameter is + * needed only when the object was created using a checksum algorithm. For more + * information, see Protecting + * data using SSE-C keys in the Amazon S3 User Guide.

This + * functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKey() const{ return m_sSECustomerKey; } + inline bool SSECustomerKeyHasBeenSet() const { return m_sSECustomerKeyHasBeenSet; } + inline void SetSSECustomerKey(const Aws::String& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = value; } + inline void SetSSECustomerKey(Aws::String&& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = std::move(value); } + inline void SetSSECustomerKey(const char* value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey.assign(value); } + inline CompleteMultipartUploadRequest& WithSSECustomerKey(const Aws::String& value) { SetSSECustomerKey(value); return *this;} + inline CompleteMultipartUploadRequest& WithSSECustomerKey(Aws::String&& value) { SetSSECustomerKey(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithSSECustomerKey(const char* value) { SetSSECustomerKey(value); return *this;} + ///@} + + ///@{ + /** + *

The MD5 server-side encryption (SSE) customer managed key. This parameter is + * needed only when the object was created using a checksum algorithm. For more + * information, see Protecting + * data using SSE-C keys in the Amazon S3 User Guide.

This + * functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline bool SSECustomerKeyMD5HasBeenSet() const { return m_sSECustomerKeyMD5HasBeenSet; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5.assign(value); } + inline CompleteMultipartUploadRequest& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline CompleteMultipartUploadRequest& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline CompleteMultipartUploadRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline CompleteMultipartUploadRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline CompleteMultipartUploadRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline CompleteMultipartUploadRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline CompleteMultipartUploadRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline CompleteMultipartUploadRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline CompleteMultipartUploadRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline CompleteMultipartUploadRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline CompleteMultipartUploadRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + CompletedMultipartUpload m_multipartUpload; + bool m_multipartUploadHasBeenSet = false; + + Aws::String m_uploadId; + bool m_uploadIdHasBeenSet = false; + + Aws::String m_checksumCRC32; + bool m_checksumCRC32HasBeenSet = false; + + Aws::String m_checksumCRC32C; + bool m_checksumCRC32CHasBeenSet = false; + + Aws::String m_checksumCRC64NVME; + bool m_checksumCRC64NVMEHasBeenSet = false; + + Aws::String m_checksumSHA1; + bool m_checksumSHA1HasBeenSet = false; + + Aws::String m_checksumSHA256; + bool m_checksumSHA256HasBeenSet = false; + + ChecksumType m_checksumType; + bool m_checksumTypeHasBeenSet = false; + + long long m_mpuObjectSize; + bool m_mpuObjectSizeHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::String m_ifMatch; + bool m_ifMatchHasBeenSet = false; + + Aws::String m_ifNoneMatch; + bool m_ifNoneMatchHasBeenSet = false; + + Aws::String m_sSECustomerAlgorithm; + bool m_sSECustomerAlgorithmHasBeenSet = false; + + Aws::String m_sSECustomerKey; + bool m_sSECustomerKeyHasBeenSet = false; + + Aws::String m_sSECustomerKeyMD5; + bool m_sSECustomerKeyMD5HasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CompressionType.h b/include/aws/s3/model/CompressionType.h new file mode 100644 index 0000000000000000000000000000000000000000..726530f4a784e9c2a1f1b6bf0e0ff8d23a7756a4 --- /dev/null +++ b/include/aws/s3/model/CompressionType.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class CompressionType + { + NOT_SET, + NONE, + GZIP, + BZIP2 + }; + +namespace CompressionTypeMapper +{ +AWS_S3_API CompressionType GetCompressionTypeForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForCompressionType(CompressionType value); +} // namespace CompressionTypeMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CopyObjectResult.h b/include/aws/s3/model/CopyObjectResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0abaee7015b2deddda82b60dac6c91022c7514a3 --- /dev/null +++ b/include/aws/s3/model/CopyObjectResult.h @@ -0,0 +1,226 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class CopyObjectResult + { + public: + AWS_S3_API CopyObjectResult(); + AWS_S3_API CopyObjectResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API CopyObjectResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

If the object expiration is configured, the response includes this + * header.

Object expiration information is not returned in directory + * buckets and this header returns the value "NotImplemented" in all + * responses for directory buckets.

+ */ + inline const Aws::String& GetExpiration() const{ return m_expiration; } + inline void SetExpiration(const Aws::String& value) { m_expiration = value; } + inline void SetExpiration(Aws::String&& value) { m_expiration = std::move(value); } + inline void SetExpiration(const char* value) { m_expiration.assign(value); } + inline CopyObjectResult& WithExpiration(const Aws::String& value) { SetExpiration(value); return *this;} + inline CopyObjectResult& WithExpiration(Aws::String&& value) { SetExpiration(std::move(value)); return *this;} + inline CopyObjectResult& WithExpiration(const char* value) { SetExpiration(value); return *this;} + ///@} + + ///@{ + /** + *

Version ID of the source object that was copied.

This + * functionality is not supported when the source object is in a directory + * bucket.

+ */ + inline const Aws::String& GetCopySourceVersionId() const{ return m_copySourceVersionId; } + inline void SetCopySourceVersionId(const Aws::String& value) { m_copySourceVersionId = value; } + inline void SetCopySourceVersionId(Aws::String&& value) { m_copySourceVersionId = std::move(value); } + inline void SetCopySourceVersionId(const char* value) { m_copySourceVersionId.assign(value); } + inline CopyObjectResult& WithCopySourceVersionId(const Aws::String& value) { SetCopySourceVersionId(value); return *this;} + inline CopyObjectResult& WithCopySourceVersionId(Aws::String&& value) { SetCopySourceVersionId(std::move(value)); return *this;} + inline CopyObjectResult& WithCopySourceVersionId(const char* value) { SetCopySourceVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Version ID of the newly created copy.

This functionality is not + * supported for directory buckets.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline void SetVersionId(const Aws::String& value) { m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionId.assign(value); } + inline CopyObjectResult& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline CopyObjectResult& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline CopyObjectResult& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption algorithm used when you store this object in + * Amazon S3 (for example, AES256, aws:kms, + * aws:kms:dsse).

+ */ + inline const ServerSideEncryption& GetServerSideEncryption() const{ return m_serverSideEncryption; } + inline void SetServerSideEncryption(const ServerSideEncryption& value) { m_serverSideEncryption = value; } + inline void SetServerSideEncryption(ServerSideEncryption&& value) { m_serverSideEncryption = std::move(value); } + inline CopyObjectResult& WithServerSideEncryption(const ServerSideEncryption& value) { SetServerSideEncryption(value); return *this;} + inline CopyObjectResult& WithServerSideEncryption(ServerSideEncryption&& value) { SetServerSideEncryption(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to confirm the encryption + * algorithm that's used.

This functionality is not supported for + * directory buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithm.assign(value); } + inline CopyObjectResult& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline CopyObjectResult& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline CopyObjectResult& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to provide the round-trip + * message integrity verification of the customer-provided encryption key.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5.assign(value); } + inline CopyObjectResult& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline CopyObjectResult& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline CopyObjectResult& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + /** + *

If present, indicates the ID of the KMS key that was used for object + * encryption.

+ */ + inline const Aws::String& GetSSEKMSKeyId() const{ return m_sSEKMSKeyId; } + inline void SetSSEKMSKeyId(const Aws::String& value) { m_sSEKMSKeyId = value; } + inline void SetSSEKMSKeyId(Aws::String&& value) { m_sSEKMSKeyId = std::move(value); } + inline void SetSSEKMSKeyId(const char* value) { m_sSEKMSKeyId.assign(value); } + inline CopyObjectResult& WithSSEKMSKeyId(const Aws::String& value) { SetSSEKMSKeyId(value); return *this;} + inline CopyObjectResult& WithSSEKMSKeyId(Aws::String&& value) { SetSSEKMSKeyId(std::move(value)); return *this;} + inline CopyObjectResult& WithSSEKMSKeyId(const char* value) { SetSSEKMSKeyId(value); return *this;} + ///@} + + ///@{ + /** + *

If present, indicates the Amazon Web Services KMS Encryption Context to use + * for object encryption. The value of this header is a Base64 encoded UTF-8 string + * holding JSON with the encryption context key-value pairs.

+ */ + inline const Aws::String& GetSSEKMSEncryptionContext() const{ return m_sSEKMSEncryptionContext; } + inline void SetSSEKMSEncryptionContext(const Aws::String& value) { m_sSEKMSEncryptionContext = value; } + inline void SetSSEKMSEncryptionContext(Aws::String&& value) { m_sSEKMSEncryptionContext = std::move(value); } + inline void SetSSEKMSEncryptionContext(const char* value) { m_sSEKMSEncryptionContext.assign(value); } + inline CopyObjectResult& WithSSEKMSEncryptionContext(const Aws::String& value) { SetSSEKMSEncryptionContext(value); return *this;} + inline CopyObjectResult& WithSSEKMSEncryptionContext(Aws::String&& value) { SetSSEKMSEncryptionContext(std::move(value)); return *this;} + inline CopyObjectResult& WithSSEKMSEncryptionContext(const char* value) { SetSSEKMSEncryptionContext(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the copied object uses an S3 Bucket Key for server-side + * encryption with Key Management Service (KMS) keys (SSE-KMS).

+ */ + inline bool GetBucketKeyEnabled() const{ return m_bucketKeyEnabled; } + inline void SetBucketKeyEnabled(bool value) { m_bucketKeyEnabled = value; } + inline CopyObjectResult& WithBucketKeyEnabled(bool value) { SetBucketKeyEnabled(value); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline CopyObjectResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline CopyObjectResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container for all response elements.

+ */ + inline const CopyObjectResultDetails& GetCopyObjectResultDetails() const{ return m_copyObjectResultDetails; } + inline void SetCopyObjectResultDetails(const CopyObjectResultDetails& value) { m_copyObjectResultDetails = value; } + inline void SetCopyObjectResultDetails(CopyObjectResultDetails&& value) { m_copyObjectResultDetails = std::move(value); } + inline CopyObjectResult& WithCopyObjectResultDetails(const CopyObjectResultDetails& value) { SetCopyObjectResultDetails(value); return *this;} + inline CopyObjectResult& WithCopyObjectResultDetails(CopyObjectResultDetails&& value) { SetCopyObjectResultDetails(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline CopyObjectResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline CopyObjectResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline CopyObjectResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_expiration; + + Aws::String m_copySourceVersionId; + + Aws::String m_versionId; + + ServerSideEncryption m_serverSideEncryption; + + Aws::String m_sSECustomerAlgorithm; + + Aws::String m_sSECustomerKeyMD5; + + Aws::String m_sSEKMSKeyId; + + Aws::String m_sSEKMSEncryptionContext; + + bool m_bucketKeyEnabled; + + RequestCharged m_requestCharged; + + CopyObjectResultDetails m_copyObjectResultDetails; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CopyObjectResultDetails.h b/include/aws/s3/model/CopyObjectResultDetails.h new file mode 100644 index 0000000000000000000000000000000000000000..2f08741627ab117d96960492ecb10eb1046855c5 --- /dev/null +++ b/include/aws/s3/model/CopyObjectResultDetails.h @@ -0,0 +1,204 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for all response elements.

See Also:

AWS + * API Reference

+ */ + class CopyObjectResultDetails + { + public: + AWS_S3_API CopyObjectResultDetails(); + AWS_S3_API CopyObjectResultDetails(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API CopyObjectResultDetails& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Returns the ETag of the new object. The ETag reflects only changes to the + * contents of an object, not its metadata.

+ */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline bool ETagHasBeenSet() const { return m_eTagHasBeenSet; } + inline void SetETag(const Aws::String& value) { m_eTagHasBeenSet = true; m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTagHasBeenSet = true; m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTagHasBeenSet = true; m_eTag.assign(value); } + inline CopyObjectResultDetails& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline CopyObjectResultDetails& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline CopyObjectResultDetails& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

Creation date of the object.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline bool LastModifiedHasBeenSet() const { return m_lastModifiedHasBeenSet; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModifiedHasBeenSet = true; m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModifiedHasBeenSet = true; m_lastModified = std::move(value); } + inline CopyObjectResultDetails& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline CopyObjectResultDetails& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The checksum type that is used to calculate the object’s checksum value. For + * more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline bool ChecksumTypeHasBeenSet() const { return m_checksumTypeHasBeenSet; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumTypeHasBeenSet = true; m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumTypeHasBeenSet = true; m_checksumType = std::move(value); } + inline CopyObjectResultDetails& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline CopyObjectResultDetails& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32 checksum of the object. This + * checksum is only present if the object was uploaded with the object. For more + * information, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32() const{ return m_checksumCRC32; } + inline bool ChecksumCRC32HasBeenSet() const { return m_checksumCRC32HasBeenSet; } + inline void SetChecksumCRC32(const Aws::String& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = value; } + inline void SetChecksumCRC32(Aws::String&& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = std::move(value); } + inline void SetChecksumCRC32(const char* value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32.assign(value); } + inline CopyObjectResultDetails& WithChecksumCRC32(const Aws::String& value) { SetChecksumCRC32(value); return *this;} + inline CopyObjectResultDetails& WithChecksumCRC32(Aws::String&& value) { SetChecksumCRC32(std::move(value)); return *this;} + inline CopyObjectResultDetails& WithChecksumCRC32(const char* value) { SetChecksumCRC32(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32C checksum of the object. This + * will only be present if the object was uploaded with the object. For more + * information, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32C() const{ return m_checksumCRC32C; } + inline bool ChecksumCRC32CHasBeenSet() const { return m_checksumCRC32CHasBeenSet; } + inline void SetChecksumCRC32C(const Aws::String& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = value; } + inline void SetChecksumCRC32C(Aws::String&& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = std::move(value); } + inline void SetChecksumCRC32C(const char* value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C.assign(value); } + inline CopyObjectResultDetails& WithChecksumCRC32C(const Aws::String& value) { SetChecksumCRC32C(value); return *this;} + inline CopyObjectResultDetails& WithChecksumCRC32C(Aws::String&& value) { SetChecksumCRC32C(std::move(value)); return *this;} + inline CopyObjectResultDetails& WithChecksumCRC32C(const char* value) { SetChecksumCRC32C(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 64-bit CRC64NVME checksum of the object. + * This checksum is present if the object being copied was uploaded with the + * CRC64NVME checksum algorithm, or if the object was uploaded without + * a checksum (and Amazon S3 added the default checksum, CRC64NVME, to + * the uploaded object). For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC64NVME() const{ return m_checksumCRC64NVME; } + inline bool ChecksumCRC64NVMEHasBeenSet() const { return m_checksumCRC64NVMEHasBeenSet; } + inline void SetChecksumCRC64NVME(const Aws::String& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = value; } + inline void SetChecksumCRC64NVME(Aws::String&& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = std::move(value); } + inline void SetChecksumCRC64NVME(const char* value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME.assign(value); } + inline CopyObjectResultDetails& WithChecksumCRC64NVME(const Aws::String& value) { SetChecksumCRC64NVME(value); return *this;} + inline CopyObjectResultDetails& WithChecksumCRC64NVME(Aws::String&& value) { SetChecksumCRC64NVME(std::move(value)); return *this;} + inline CopyObjectResultDetails& WithChecksumCRC64NVME(const char* value) { SetChecksumCRC64NVME(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 160-bit SHA1 digest of the object. This will + * only be present if the object was uploaded with the object. For more + * information, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA1() const{ return m_checksumSHA1; } + inline bool ChecksumSHA1HasBeenSet() const { return m_checksumSHA1HasBeenSet; } + inline void SetChecksumSHA1(const Aws::String& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = value; } + inline void SetChecksumSHA1(Aws::String&& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = std::move(value); } + inline void SetChecksumSHA1(const char* value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1.assign(value); } + inline CopyObjectResultDetails& WithChecksumSHA1(const Aws::String& value) { SetChecksumSHA1(value); return *this;} + inline CopyObjectResultDetails& WithChecksumSHA1(Aws::String&& value) { SetChecksumSHA1(std::move(value)); return *this;} + inline CopyObjectResultDetails& WithChecksumSHA1(const char* value) { SetChecksumSHA1(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 256-bit SHA256 digest of the object. This + * will only be present if the object was uploaded with the object. For more + * information, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA256() const{ return m_checksumSHA256; } + inline bool ChecksumSHA256HasBeenSet() const { return m_checksumSHA256HasBeenSet; } + inline void SetChecksumSHA256(const Aws::String& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = value; } + inline void SetChecksumSHA256(Aws::String&& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = std::move(value); } + inline void SetChecksumSHA256(const char* value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256.assign(value); } + inline CopyObjectResultDetails& WithChecksumSHA256(const Aws::String& value) { SetChecksumSHA256(value); return *this;} + inline CopyObjectResultDetails& WithChecksumSHA256(Aws::String&& value) { SetChecksumSHA256(std::move(value)); return *this;} + inline CopyObjectResultDetails& WithChecksumSHA256(const char* value) { SetChecksumSHA256(value); return *this;} + ///@} + private: + + Aws::String m_eTag; + bool m_eTagHasBeenSet = false; + + Aws::Utils::DateTime m_lastModified; + bool m_lastModifiedHasBeenSet = false; + + ChecksumType m_checksumType; + bool m_checksumTypeHasBeenSet = false; + + Aws::String m_checksumCRC32; + bool m_checksumCRC32HasBeenSet = false; + + Aws::String m_checksumCRC32C; + bool m_checksumCRC32CHasBeenSet = false; + + Aws::String m_checksumCRC64NVME; + bool m_checksumCRC64NVMEHasBeenSet = false; + + Aws::String m_checksumSHA1; + bool m_checksumSHA1HasBeenSet = false; + + Aws::String m_checksumSHA256; + bool m_checksumSHA256HasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CopyPartResult.h b/include/aws/s3/model/CopyPartResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c728b5adddcd859662e78da4e7a7957bc7ffdbbd --- /dev/null +++ b/include/aws/s3/model/CopyPartResult.h @@ -0,0 +1,187 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for all response elements.

See Also:

AWS + * API Reference

+ */ + class CopyPartResult + { + public: + AWS_S3_API CopyPartResult(); + AWS_S3_API CopyPartResult(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API CopyPartResult& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Entity tag of the object.

+ */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline bool ETagHasBeenSet() const { return m_eTagHasBeenSet; } + inline void SetETag(const Aws::String& value) { m_eTagHasBeenSet = true; m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTagHasBeenSet = true; m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTagHasBeenSet = true; m_eTag.assign(value); } + inline CopyPartResult& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline CopyPartResult& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline CopyPartResult& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

Date and time at which the object was uploaded.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline bool LastModifiedHasBeenSet() const { return m_lastModifiedHasBeenSet; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModifiedHasBeenSet = true; m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModifiedHasBeenSet = true; m_lastModified = std::move(value); } + inline CopyPartResult& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline CopyPartResult& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 32-bit CRC32 checksum of the part. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32() const{ return m_checksumCRC32; } + inline bool ChecksumCRC32HasBeenSet() const { return m_checksumCRC32HasBeenSet; } + inline void SetChecksumCRC32(const Aws::String& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = value; } + inline void SetChecksumCRC32(Aws::String&& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = std::move(value); } + inline void SetChecksumCRC32(const char* value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32.assign(value); } + inline CopyPartResult& WithChecksumCRC32(const Aws::String& value) { SetChecksumCRC32(value); return *this;} + inline CopyPartResult& WithChecksumCRC32(Aws::String&& value) { SetChecksumCRC32(std::move(value)); return *this;} + inline CopyPartResult& WithChecksumCRC32(const char* value) { SetChecksumCRC32(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 32-bit CRC32C checksum of the part. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32C() const{ return m_checksumCRC32C; } + inline bool ChecksumCRC32CHasBeenSet() const { return m_checksumCRC32CHasBeenSet; } + inline void SetChecksumCRC32C(const Aws::String& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = value; } + inline void SetChecksumCRC32C(Aws::String&& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = std::move(value); } + inline void SetChecksumCRC32C(const char* value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C.assign(value); } + inline CopyPartResult& WithChecksumCRC32C(const Aws::String& value) { SetChecksumCRC32C(value); return *this;} + inline CopyPartResult& WithChecksumCRC32C(Aws::String&& value) { SetChecksumCRC32C(std::move(value)); return *this;} + inline CopyPartResult& WithChecksumCRC32C(const char* value) { SetChecksumCRC32C(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 64-bit CRC64NVME checksum of the part. This + * checksum is present if the multipart upload request was created with the + * CRC64NVME checksum algorithm to the uploaded object). For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC64NVME() const{ return m_checksumCRC64NVME; } + inline bool ChecksumCRC64NVMEHasBeenSet() const { return m_checksumCRC64NVMEHasBeenSet; } + inline void SetChecksumCRC64NVME(const Aws::String& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = value; } + inline void SetChecksumCRC64NVME(Aws::String&& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = std::move(value); } + inline void SetChecksumCRC64NVME(const char* value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME.assign(value); } + inline CopyPartResult& WithChecksumCRC64NVME(const Aws::String& value) { SetChecksumCRC64NVME(value); return *this;} + inline CopyPartResult& WithChecksumCRC64NVME(Aws::String&& value) { SetChecksumCRC64NVME(std::move(value)); return *this;} + inline CopyPartResult& WithChecksumCRC64NVME(const char* value) { SetChecksumCRC64NVME(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 160-bit SHA1 checksum of the part. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA1() const{ return m_checksumSHA1; } + inline bool ChecksumSHA1HasBeenSet() const { return m_checksumSHA1HasBeenSet; } + inline void SetChecksumSHA1(const Aws::String& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = value; } + inline void SetChecksumSHA1(Aws::String&& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = std::move(value); } + inline void SetChecksumSHA1(const char* value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1.assign(value); } + inline CopyPartResult& WithChecksumSHA1(const Aws::String& value) { SetChecksumSHA1(value); return *this;} + inline CopyPartResult& WithChecksumSHA1(Aws::String&& value) { SetChecksumSHA1(std::move(value)); return *this;} + inline CopyPartResult& WithChecksumSHA1(const char* value) { SetChecksumSHA1(value); return *this;} + ///@} + + ///@{ + /** + *

This header can be used as a data integrity check to verify that the data + * received is the same data that was originally sent. This header specifies the + * Base64 encoded, 256-bit SHA256 checksum of the part. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA256() const{ return m_checksumSHA256; } + inline bool ChecksumSHA256HasBeenSet() const { return m_checksumSHA256HasBeenSet; } + inline void SetChecksumSHA256(const Aws::String& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = value; } + inline void SetChecksumSHA256(Aws::String&& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = std::move(value); } + inline void SetChecksumSHA256(const char* value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256.assign(value); } + inline CopyPartResult& WithChecksumSHA256(const Aws::String& value) { SetChecksumSHA256(value); return *this;} + inline CopyPartResult& WithChecksumSHA256(Aws::String&& value) { SetChecksumSHA256(std::move(value)); return *this;} + inline CopyPartResult& WithChecksumSHA256(const char* value) { SetChecksumSHA256(value); return *this;} + ///@} + private: + + Aws::String m_eTag; + bool m_eTagHasBeenSet = false; + + Aws::Utils::DateTime m_lastModified; + bool m_lastModifiedHasBeenSet = false; + + Aws::String m_checksumCRC32; + bool m_checksumCRC32HasBeenSet = false; + + Aws::String m_checksumCRC32C; + bool m_checksumCRC32CHasBeenSet = false; + + Aws::String m_checksumCRC64NVME; + bool m_checksumCRC64NVMEHasBeenSet = false; + + Aws::String m_checksumSHA1; + bool m_checksumSHA1HasBeenSet = false; + + Aws::String m_checksumSHA256; + bool m_checksumSHA256HasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CreateBucketConfiguration.h b/include/aws/s3/model/CreateBucketConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..e330e33549b5929d9ce8d8ce9260875e5eed1041 --- /dev/null +++ b/include/aws/s3/model/CreateBucketConfiguration.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The configuration information for the bucket.

See Also:

AWS + * API Reference

+ */ + class CreateBucketConfiguration + { + public: + AWS_S3_API CreateBucketConfiguration(); + AWS_S3_API CreateBucketConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API CreateBucketConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the Region where the bucket will be created. You might choose a + * Region to optimize latency, minimize costs, or address regulatory requirements. + * For example, if you reside in Europe, you will probably find it advantageous to + * create buckets in the Europe (Ireland) Region.

If you don't specify a + * Region, the bucket is created in the US East (N. Virginia) Region (us-east-1) by + * default. Configurations using the value EU will create a bucket in + * eu-west-1.

For a list of the valid values for all of the + * Amazon Web Services Regions, see Regions + * and Endpoints.

This functionality is not supported for + * directory buckets.

+ */ + inline const BucketLocationConstraint& GetLocationConstraint() const{ return m_locationConstraint; } + inline bool LocationConstraintHasBeenSet() const { return m_locationConstraintHasBeenSet; } + inline void SetLocationConstraint(const BucketLocationConstraint& value) { m_locationConstraintHasBeenSet = true; m_locationConstraint = value; } + inline void SetLocationConstraint(BucketLocationConstraint&& value) { m_locationConstraintHasBeenSet = true; m_locationConstraint = std::move(value); } + inline CreateBucketConfiguration& WithLocationConstraint(const BucketLocationConstraint& value) { SetLocationConstraint(value); return *this;} + inline CreateBucketConfiguration& WithLocationConstraint(BucketLocationConstraint&& value) { SetLocationConstraint(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the location where the bucket will be created.

Directory + * buckets - The location type is Availability Zone or Local Zone. To use the + * Local Zone location type, your account must be enabled for Dedicated Local + * Zones. Otherwise, you get an HTTP 403 Forbidden error with the + * error code AccessDenied. To learn more, see Enable + * accounts for Dedicated Local Zones in the Amazon S3 User Guide.

+ *

This functionality is only supported by directory buckets.

+ */ + inline const LocationInfo& GetLocation() const{ return m_location; } + inline bool LocationHasBeenSet() const { return m_locationHasBeenSet; } + inline void SetLocation(const LocationInfo& value) { m_locationHasBeenSet = true; m_location = value; } + inline void SetLocation(LocationInfo&& value) { m_locationHasBeenSet = true; m_location = std::move(value); } + inline CreateBucketConfiguration& WithLocation(const LocationInfo& value) { SetLocation(value); return *this;} + inline CreateBucketConfiguration& WithLocation(LocationInfo&& value) { SetLocation(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the information about the bucket that will be created.

+ *

This functionality is only supported by directory buckets.

+ */ + inline const BucketInfo& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const BucketInfo& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(BucketInfo&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline CreateBucketConfiguration& WithBucket(const BucketInfo& value) { SetBucket(value); return *this;} + inline CreateBucketConfiguration& WithBucket(BucketInfo&& value) { SetBucket(std::move(value)); return *this;} + ///@} + private: + + BucketLocationConstraint m_locationConstraint; + bool m_locationConstraintHasBeenSet = false; + + LocationInfo m_location; + bool m_locationHasBeenSet = false; + + BucketInfo m_bucket; + bool m_bucketHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CreateBucketMetadataTableConfigurationRequest.h b/include/aws/s3/model/CreateBucketMetadataTableConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..081a07fae00b5f27a5c641a845f517726fdb6637 --- /dev/null +++ b/include/aws/s3/model/CreateBucketMetadataTableConfigurationRequest.h @@ -0,0 +1,161 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class CreateBucketMetadataTableConfigurationRequest : public S3Request + { + public: + AWS_S3_API CreateBucketMetadataTableConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CreateBucketMetadataTableConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The general purpose bucket that you want to create the metadata table + * configuration in.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline CreateBucketMetadataTableConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The Content-MD5 header for the metadata table configuration. + *

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline CreateBucketMetadataTableConfigurationRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

The checksum algorithm to use with your metadata table configuration.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline CreateBucketMetadataTableConfigurationRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The contents of your metadata table configuration.

+ */ + inline const MetadataTableConfiguration& GetMetadataTableConfiguration() const{ return m_metadataTableConfiguration; } + inline bool MetadataTableConfigurationHasBeenSet() const { return m_metadataTableConfigurationHasBeenSet; } + inline void SetMetadataTableConfiguration(const MetadataTableConfiguration& value) { m_metadataTableConfigurationHasBeenSet = true; m_metadataTableConfiguration = value; } + inline void SetMetadataTableConfiguration(MetadataTableConfiguration&& value) { m_metadataTableConfigurationHasBeenSet = true; m_metadataTableConfiguration = std::move(value); } + inline CreateBucketMetadataTableConfigurationRequest& WithMetadataTableConfiguration(const MetadataTableConfiguration& value) { SetMetadataTableConfiguration(value); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithMetadataTableConfiguration(MetadataTableConfiguration&& value) { SetMetadataTableConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The expected owner of the general purpose bucket that contains your metadata + * table configuration.

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline CreateBucketMetadataTableConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline CreateBucketMetadataTableConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline CreateBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline CreateBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline CreateBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline CreateBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline CreateBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline CreateBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline CreateBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + MetadataTableConfiguration m_metadataTableConfiguration; + bool m_metadataTableConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CreateMultipartUploadRequest.h b/include/aws/s3/model/CreateMultipartUploadRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..bbc688f6f12f38fd41031eaf7498cc7c90ec0dda --- /dev/null +++ b/include/aws/s3/model/CreateMultipartUploadRequest.h @@ -0,0 +1,877 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class CreateMultipartUploadRequest : public S3Request + { + public: + AWS_S3_API CreateMultipartUploadRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CreateMultipartUpload"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The canned ACL to apply to the object. Amazon S3 supports a set of predefined + * ACLs, known as canned ACLs. Each canned ACL has a predefined set of + * grantees and permissions. For more information, see Canned + * ACL in the Amazon S3 User Guide.

By default, all objects are + * private. Only the owner has full access control. When uploading an object, you + * can grant access permissions to individual Amazon Web Services accounts or to + * predefined groups defined by Amazon S3. These permissions are then added to the + * access control list (ACL) on the new object. For more information, see Using + * ACLs. One way to grant the permissions using the request headers is to + * specify a canned ACL with the x-amz-acl request header.

+ *
  • This functionality is not supported for directory buckets.

    + *
  • This functionality is not supported for Amazon S3 on Outposts.

    + *
+ */ + inline const ObjectCannedACL& GetACL() const{ return m_aCL; } + inline bool ACLHasBeenSet() const { return m_aCLHasBeenSet; } + inline void SetACL(const ObjectCannedACL& value) { m_aCLHasBeenSet = true; m_aCL = value; } + inline void SetACL(ObjectCannedACL&& value) { m_aCLHasBeenSet = true; m_aCL = std::move(value); } + inline CreateMultipartUploadRequest& WithACL(const ObjectCannedACL& value) { SetACL(value); return *this;} + inline CreateMultipartUploadRequest& WithACL(ObjectCannedACL&& value) { SetACL(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The name of the bucket where the multipart upload is initiated and where the + * object is uploaded.

Directory buckets - When you use this + * operation with a directory bucket, you must use virtual-hosted-style requests in + * the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline CreateMultipartUploadRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline CreateMultipartUploadRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies caching behavior along the request/reply chain.

+ */ + inline const Aws::String& GetCacheControl() const{ return m_cacheControl; } + inline bool CacheControlHasBeenSet() const { return m_cacheControlHasBeenSet; } + inline void SetCacheControl(const Aws::String& value) { m_cacheControlHasBeenSet = true; m_cacheControl = value; } + inline void SetCacheControl(Aws::String&& value) { m_cacheControlHasBeenSet = true; m_cacheControl = std::move(value); } + inline void SetCacheControl(const char* value) { m_cacheControlHasBeenSet = true; m_cacheControl.assign(value); } + inline CreateMultipartUploadRequest& WithCacheControl(const Aws::String& value) { SetCacheControl(value); return *this;} + inline CreateMultipartUploadRequest& WithCacheControl(Aws::String&& value) { SetCacheControl(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithCacheControl(const char* value) { SetCacheControl(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies presentational information for the object.

+ */ + inline const Aws::String& GetContentDisposition() const{ return m_contentDisposition; } + inline bool ContentDispositionHasBeenSet() const { return m_contentDispositionHasBeenSet; } + inline void SetContentDisposition(const Aws::String& value) { m_contentDispositionHasBeenSet = true; m_contentDisposition = value; } + inline void SetContentDisposition(Aws::String&& value) { m_contentDispositionHasBeenSet = true; m_contentDisposition = std::move(value); } + inline void SetContentDisposition(const char* value) { m_contentDispositionHasBeenSet = true; m_contentDisposition.assign(value); } + inline CreateMultipartUploadRequest& WithContentDisposition(const Aws::String& value) { SetContentDisposition(value); return *this;} + inline CreateMultipartUploadRequest& WithContentDisposition(Aws::String&& value) { SetContentDisposition(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithContentDisposition(const char* value) { SetContentDisposition(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies what content encodings have been applied to the object and thus + * what decoding mechanisms must be applied to obtain the media-type referenced by + * the Content-Type header field.

For directory buckets, only the + * aws-chunked value is supported in this header field.

+ */ + inline const Aws::String& GetContentEncoding() const{ return m_contentEncoding; } + inline bool ContentEncodingHasBeenSet() const { return m_contentEncodingHasBeenSet; } + inline void SetContentEncoding(const Aws::String& value) { m_contentEncodingHasBeenSet = true; m_contentEncoding = value; } + inline void SetContentEncoding(Aws::String&& value) { m_contentEncodingHasBeenSet = true; m_contentEncoding = std::move(value); } + inline void SetContentEncoding(const char* value) { m_contentEncodingHasBeenSet = true; m_contentEncoding.assign(value); } + inline CreateMultipartUploadRequest& WithContentEncoding(const Aws::String& value) { SetContentEncoding(value); return *this;} + inline CreateMultipartUploadRequest& WithContentEncoding(Aws::String&& value) { SetContentEncoding(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithContentEncoding(const char* value) { SetContentEncoding(value); return *this;} + ///@} + + ///@{ + /** + *

The language that the content is in.

+ */ + inline const Aws::String& GetContentLanguage() const{ return m_contentLanguage; } + inline bool ContentLanguageHasBeenSet() const { return m_contentLanguageHasBeenSet; } + inline void SetContentLanguage(const Aws::String& value) { m_contentLanguageHasBeenSet = true; m_contentLanguage = value; } + inline void SetContentLanguage(Aws::String&& value) { m_contentLanguageHasBeenSet = true; m_contentLanguage = std::move(value); } + inline void SetContentLanguage(const char* value) { m_contentLanguageHasBeenSet = true; m_contentLanguage.assign(value); } + inline CreateMultipartUploadRequest& WithContentLanguage(const Aws::String& value) { SetContentLanguage(value); return *this;} + inline CreateMultipartUploadRequest& WithContentLanguage(Aws::String&& value) { SetContentLanguage(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithContentLanguage(const char* value) { SetContentLanguage(value); return *this;} + ///@} + + ///@{ + /** + *

A standard MIME type describing the format of the object data.

+ */ + inline const Aws::String& GetContentType() const{ return m_contentType; } + inline bool ContentTypeHasBeenSet() const { return m_contentTypeHasBeenSet; } + inline void SetContentType(const Aws::String& value) { m_contentTypeHasBeenSet = true; m_contentType = value; } + inline void SetContentType(Aws::String&& value) { m_contentTypeHasBeenSet = true; m_contentType = std::move(value); } + inline void SetContentType(const char* value) { m_contentTypeHasBeenSet = true; m_contentType.assign(value); } + inline CreateMultipartUploadRequest& WithContentType(const Aws::String& value) { SetContentType(value); return *this;} + inline CreateMultipartUploadRequest& WithContentType(Aws::String&& value) { SetContentType(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithContentType(const char* value) { SetContentType(value); return *this;} + ///@} + + ///@{ + /** + *

The date and time at which the object is no longer cacheable.

+ */ + inline const Aws::Utils::DateTime& GetExpires() const{ return m_expires; } + inline bool ExpiresHasBeenSet() const { return m_expiresHasBeenSet; } + inline void SetExpires(const Aws::Utils::DateTime& value) { m_expiresHasBeenSet = true; m_expires = value; } + inline void SetExpires(Aws::Utils::DateTime&& value) { m_expiresHasBeenSet = true; m_expires = std::move(value); } + inline CreateMultipartUploadRequest& WithExpires(const Aws::Utils::DateTime& value) { SetExpires(value); return *this;} + inline CreateMultipartUploadRequest& WithExpires(Aws::Utils::DateTime&& value) { SetExpires(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specify access permissions explicitly to give the grantee READ, READ_ACP, and + * WRITE_ACP permissions on the object.

By default, all objects are private. + * Only the owner has full access control. When uploading an object, you can use + * this header to explicitly grant access permissions to specific Amazon Web + * Services accounts or groups. This header maps to specific permissions that + * Amazon S3 supports in an ACL. For more information, see Access + * Control List (ACL) Overview in the Amazon S3 User Guide.

You + * specify each grantee as a type=value pair, where the type is one of the + * following:

  • id – if the value specified is the + * canonical user ID of an Amazon Web Services account

  • + * uri – if you are granting permissions to a predefined group

    + *
  • emailAddress – if the value specified is the email + * address of an Amazon Web Services account

    Using email addresses to + * specify a grantee is only supported in the following Amazon Web Services + * Regions:

    • US East (N. Virginia)

    • US West (N. + * California)

    • US West (Oregon)

    • Asia Pacific + * (Singapore)

    • Asia Pacific (Sydney)

    • Asia + * Pacific (Tokyo)

    • Europe (Ireland)

    • South + * America (São Paulo)

    For a list of all the Amazon S3 supported + * Regions and endpoints, see Regions + * and Endpoints in the Amazon Web Services General Reference.

    + *

For example, the following x-amz-grant-read header + * grants the Amazon Web Services accounts identified by account IDs permissions to + * read object data and its metadata:

x-amz-grant-read: + * id="11112222333", id="444455556666"

  • This + * functionality is not supported for directory buckets.

  • This + * functionality is not supported for Amazon S3 on Outposts.

+ * + */ + inline const Aws::String& GetGrantFullControl() const{ return m_grantFullControl; } + inline bool GrantFullControlHasBeenSet() const { return m_grantFullControlHasBeenSet; } + inline void SetGrantFullControl(const Aws::String& value) { m_grantFullControlHasBeenSet = true; m_grantFullControl = value; } + inline void SetGrantFullControl(Aws::String&& value) { m_grantFullControlHasBeenSet = true; m_grantFullControl = std::move(value); } + inline void SetGrantFullControl(const char* value) { m_grantFullControlHasBeenSet = true; m_grantFullControl.assign(value); } + inline CreateMultipartUploadRequest& WithGrantFullControl(const Aws::String& value) { SetGrantFullControl(value); return *this;} + inline CreateMultipartUploadRequest& WithGrantFullControl(Aws::String&& value) { SetGrantFullControl(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithGrantFullControl(const char* value) { SetGrantFullControl(value); return *this;} + ///@} + + ///@{ + /** + *

Specify access permissions explicitly to allow grantee to read the object + * data and its metadata.

By default, all objects are private. Only the + * owner has full access control. When uploading an object, you can use this header + * to explicitly grant access permissions to specific Amazon Web Services accounts + * or groups. This header maps to specific permissions that Amazon S3 supports in + * an ACL. For more information, see Access + * Control List (ACL) Overview in the Amazon S3 User Guide.

You + * specify each grantee as a type=value pair, where the type is one of the + * following:

  • id – if the value specified is the + * canonical user ID of an Amazon Web Services account

  • + * uri – if you are granting permissions to a predefined group

    + *
  • emailAddress – if the value specified is the email + * address of an Amazon Web Services account

    Using email addresses to + * specify a grantee is only supported in the following Amazon Web Services + * Regions:

    • US East (N. Virginia)

    • US West (N. + * California)

    • US West (Oregon)

    • Asia Pacific + * (Singapore)

    • Asia Pacific (Sydney)

    • Asia + * Pacific (Tokyo)

    • Europe (Ireland)

    • South + * America (São Paulo)

    For a list of all the Amazon S3 supported + * Regions and endpoints, see Regions + * and Endpoints in the Amazon Web Services General Reference.

    + *

For example, the following x-amz-grant-read header + * grants the Amazon Web Services accounts identified by account IDs permissions to + * read object data and its metadata:

x-amz-grant-read: + * id="11112222333", id="444455556666"

  • This + * functionality is not supported for directory buckets.

  • This + * functionality is not supported for Amazon S3 on Outposts.

+ * + */ + inline const Aws::String& GetGrantRead() const{ return m_grantRead; } + inline bool GrantReadHasBeenSet() const { return m_grantReadHasBeenSet; } + inline void SetGrantRead(const Aws::String& value) { m_grantReadHasBeenSet = true; m_grantRead = value; } + inline void SetGrantRead(Aws::String&& value) { m_grantReadHasBeenSet = true; m_grantRead = std::move(value); } + inline void SetGrantRead(const char* value) { m_grantReadHasBeenSet = true; m_grantRead.assign(value); } + inline CreateMultipartUploadRequest& WithGrantRead(const Aws::String& value) { SetGrantRead(value); return *this;} + inline CreateMultipartUploadRequest& WithGrantRead(Aws::String&& value) { SetGrantRead(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithGrantRead(const char* value) { SetGrantRead(value); return *this;} + ///@} + + ///@{ + /** + *

Specify access permissions explicitly to allows grantee to read the object + * ACL.

By default, all objects are private. Only the owner has full access + * control. When uploading an object, you can use this header to explicitly grant + * access permissions to specific Amazon Web Services accounts or groups. This + * header maps to specific permissions that Amazon S3 supports in an ACL. For more + * information, see Access + * Control List (ACL) Overview in the Amazon S3 User Guide.

You + * specify each grantee as a type=value pair, where the type is one of the + * following:

  • id – if the value specified is the + * canonical user ID of an Amazon Web Services account

  • + * uri – if you are granting permissions to a predefined group

    + *
  • emailAddress – if the value specified is the email + * address of an Amazon Web Services account

    Using email addresses to + * specify a grantee is only supported in the following Amazon Web Services + * Regions:

    • US East (N. Virginia)

    • US West (N. + * California)

    • US West (Oregon)

    • Asia Pacific + * (Singapore)

    • Asia Pacific (Sydney)

    • Asia + * Pacific (Tokyo)

    • Europe (Ireland)

    • South + * America (São Paulo)

    For a list of all the Amazon S3 supported + * Regions and endpoints, see Regions + * and Endpoints in the Amazon Web Services General Reference.

    + *

For example, the following x-amz-grant-read header + * grants the Amazon Web Services accounts identified by account IDs permissions to + * read object data and its metadata:

x-amz-grant-read: + * id="11112222333", id="444455556666"

  • This + * functionality is not supported for directory buckets.

  • This + * functionality is not supported for Amazon S3 on Outposts.

+ * + */ + inline const Aws::String& GetGrantReadACP() const{ return m_grantReadACP; } + inline bool GrantReadACPHasBeenSet() const { return m_grantReadACPHasBeenSet; } + inline void SetGrantReadACP(const Aws::String& value) { m_grantReadACPHasBeenSet = true; m_grantReadACP = value; } + inline void SetGrantReadACP(Aws::String&& value) { m_grantReadACPHasBeenSet = true; m_grantReadACP = std::move(value); } + inline void SetGrantReadACP(const char* value) { m_grantReadACPHasBeenSet = true; m_grantReadACP.assign(value); } + inline CreateMultipartUploadRequest& WithGrantReadACP(const Aws::String& value) { SetGrantReadACP(value); return *this;} + inline CreateMultipartUploadRequest& WithGrantReadACP(Aws::String&& value) { SetGrantReadACP(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithGrantReadACP(const char* value) { SetGrantReadACP(value); return *this;} + ///@} + + ///@{ + /** + *

Specify access permissions explicitly to allows grantee to allow grantee to + * write the ACL for the applicable object.

By default, all objects are + * private. Only the owner has full access control. When uploading an object, you + * can use this header to explicitly grant access permissions to specific Amazon + * Web Services accounts or groups. This header maps to specific permissions that + * Amazon S3 supports in an ACL. For more information, see Access + * Control List (ACL) Overview in the Amazon S3 User Guide.

You + * specify each grantee as a type=value pair, where the type is one of the + * following:

  • id – if the value specified is the + * canonical user ID of an Amazon Web Services account

  • + * uri – if you are granting permissions to a predefined group

    + *
  • emailAddress – if the value specified is the email + * address of an Amazon Web Services account

    Using email addresses to + * specify a grantee is only supported in the following Amazon Web Services + * Regions:

    • US East (N. Virginia)

    • US West (N. + * California)

    • US West (Oregon)

    • Asia Pacific + * (Singapore)

    • Asia Pacific (Sydney)

    • Asia + * Pacific (Tokyo)

    • Europe (Ireland)

    • South + * America (São Paulo)

    For a list of all the Amazon S3 supported + * Regions and endpoints, see Regions + * and Endpoints in the Amazon Web Services General Reference.

    + *

For example, the following x-amz-grant-read header + * grants the Amazon Web Services accounts identified by account IDs permissions to + * read object data and its metadata:

x-amz-grant-read: + * id="11112222333", id="444455556666"

  • This + * functionality is not supported for directory buckets.

  • This + * functionality is not supported for Amazon S3 on Outposts.

+ * + */ + inline const Aws::String& GetGrantWriteACP() const{ return m_grantWriteACP; } + inline bool GrantWriteACPHasBeenSet() const { return m_grantWriteACPHasBeenSet; } + inline void SetGrantWriteACP(const Aws::String& value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP = value; } + inline void SetGrantWriteACP(Aws::String&& value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP = std::move(value); } + inline void SetGrantWriteACP(const char* value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP.assign(value); } + inline CreateMultipartUploadRequest& WithGrantWriteACP(const Aws::String& value) { SetGrantWriteACP(value); return *this;} + inline CreateMultipartUploadRequest& WithGrantWriteACP(Aws::String&& value) { SetGrantWriteACP(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithGrantWriteACP(const char* value) { SetGrantWriteACP(value); return *this;} + ///@} + + ///@{ + /** + *

Object key for which the multipart upload is to be initiated.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline CreateMultipartUploadRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline CreateMultipartUploadRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

A map of metadata to store with the object in S3.

+ */ + inline const Aws::Map& GetMetadata() const{ return m_metadata; } + inline bool MetadataHasBeenSet() const { return m_metadataHasBeenSet; } + inline void SetMetadata(const Aws::Map& value) { m_metadataHasBeenSet = true; m_metadata = value; } + inline void SetMetadata(Aws::Map&& value) { m_metadataHasBeenSet = true; m_metadata = std::move(value); } + inline CreateMultipartUploadRequest& WithMetadata(const Aws::Map& value) { SetMetadata(value); return *this;} + inline CreateMultipartUploadRequest& WithMetadata(Aws::Map&& value) { SetMetadata(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& AddMetadata(const Aws::String& key, const Aws::String& value) { m_metadataHasBeenSet = true; m_metadata.emplace(key, value); return *this; } + inline CreateMultipartUploadRequest& AddMetadata(Aws::String&& key, const Aws::String& value) { m_metadataHasBeenSet = true; m_metadata.emplace(std::move(key), value); return *this; } + inline CreateMultipartUploadRequest& AddMetadata(const Aws::String& key, Aws::String&& value) { m_metadataHasBeenSet = true; m_metadata.emplace(key, std::move(value)); return *this; } + inline CreateMultipartUploadRequest& AddMetadata(Aws::String&& key, Aws::String&& value) { m_metadataHasBeenSet = true; m_metadata.emplace(std::move(key), std::move(value)); return *this; } + inline CreateMultipartUploadRequest& AddMetadata(const char* key, Aws::String&& value) { m_metadataHasBeenSet = true; m_metadata.emplace(key, std::move(value)); return *this; } + inline CreateMultipartUploadRequest& AddMetadata(Aws::String&& key, const char* value) { m_metadataHasBeenSet = true; m_metadata.emplace(std::move(key), value); return *this; } + inline CreateMultipartUploadRequest& AddMetadata(const char* key, const char* value) { m_metadataHasBeenSet = true; m_metadata.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

The server-side encryption algorithm used when you store this object in + * Amazon S3 (for example, AES256, aws:kms).

    + *
  • Directory buckets - For directory buckets, there are only two + * supported options for server-side encryption: server-side encryption with Amazon + * S3 managed keys (SSE-S3) (AES256) and server-side encryption with + * KMS keys (SSE-KMS) (aws:kms). We recommend that the bucket's + * default encryption uses the desired encryption configuration and you don't + * override the bucket default encryption in your CreateSession + * requests or PUT object requests. Then, new objects are + * automatically encrypted with the desired encryption settings. For more + * information, see Protecting + * data with server-side encryption in the Amazon S3 User Guide. For + * more information about the encryption overriding behaviors in directory buckets, + * see Specifying + * server-side encryption with KMS for new object uploads.

    In the Zonal + * endpoint API calls (except CopyObject + * and UploadPartCopy) + * using the REST API, the encryption request headers must match the encryption + * settings that are specified in the CreateSession request. You can't + * override the values of the encryption settings + * (x-amz-server-side-encryption, + * x-amz-server-side-encryption-aws-kms-key-id, + * x-amz-server-side-encryption-context, and + * x-amz-server-side-encryption-bucket-key-enabled) that are specified + * in the CreateSession request. You don't need to explicitly specify + * these encryption settings values in Zonal endpoint API calls, and Amazon S3 will + * use the encryption settings values from the CreateSession request + * to protect new objects in the directory bucket.

    When you use the + * CLI or the Amazon Web Services SDKs, for CreateSession, the session + * token refreshes automatically to avoid service interruptions when a session + * expires. The CLI or the Amazon Web Services SDKs use the bucket's default + * encryption configuration for the CreateSession request. It's not + * supported to override the encryption settings values in the + * CreateSession request. So in the Zonal endpoint API calls (except + * CopyObject + * and UploadPartCopy), + * the encryption request headers must match the default encryption configuration + * of the directory bucket.

+ */ + inline const ServerSideEncryption& GetServerSideEncryption() const{ return m_serverSideEncryption; } + inline bool ServerSideEncryptionHasBeenSet() const { return m_serverSideEncryptionHasBeenSet; } + inline void SetServerSideEncryption(const ServerSideEncryption& value) { m_serverSideEncryptionHasBeenSet = true; m_serverSideEncryption = value; } + inline void SetServerSideEncryption(ServerSideEncryption&& value) { m_serverSideEncryptionHasBeenSet = true; m_serverSideEncryption = std::move(value); } + inline CreateMultipartUploadRequest& WithServerSideEncryption(const ServerSideEncryption& value) { SetServerSideEncryption(value); return *this;} + inline CreateMultipartUploadRequest& WithServerSideEncryption(ServerSideEncryption&& value) { SetServerSideEncryption(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

By default, Amazon S3 uses the STANDARD Storage Class to store newly created + * objects. The STANDARD storage class provides high durability and high + * availability. Depending on performance needs, you can specify a different + * Storage Class. For more information, see Storage + * Classes in the Amazon S3 User Guide.

  • For + * directory buckets, only the S3 Express One Zone storage class is supported to + * store newly created objects.

  • Amazon S3 on Outposts only uses + * the OUTPOSTS Storage Class.

+ */ + inline const StorageClass& GetStorageClass() const{ return m_storageClass; } + inline bool StorageClassHasBeenSet() const { return m_storageClassHasBeenSet; } + inline void SetStorageClass(const StorageClass& value) { m_storageClassHasBeenSet = true; m_storageClass = value; } + inline void SetStorageClass(StorageClass&& value) { m_storageClassHasBeenSet = true; m_storageClass = std::move(value); } + inline CreateMultipartUploadRequest& WithStorageClass(const StorageClass& value) { SetStorageClass(value); return *this;} + inline CreateMultipartUploadRequest& WithStorageClass(StorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If the bucket is configured as a website, redirects requests for this object + * to another object in the same bucket or to an external URL. Amazon S3 stores the + * value of this header in the object metadata.

This functionality is + * not supported for directory buckets.

+ */ + inline const Aws::String& GetWebsiteRedirectLocation() const{ return m_websiteRedirectLocation; } + inline bool WebsiteRedirectLocationHasBeenSet() const { return m_websiteRedirectLocationHasBeenSet; } + inline void SetWebsiteRedirectLocation(const Aws::String& value) { m_websiteRedirectLocationHasBeenSet = true; m_websiteRedirectLocation = value; } + inline void SetWebsiteRedirectLocation(Aws::String&& value) { m_websiteRedirectLocationHasBeenSet = true; m_websiteRedirectLocation = std::move(value); } + inline void SetWebsiteRedirectLocation(const char* value) { m_websiteRedirectLocationHasBeenSet = true; m_websiteRedirectLocation.assign(value); } + inline CreateMultipartUploadRequest& WithWebsiteRedirectLocation(const Aws::String& value) { SetWebsiteRedirectLocation(value); return *this;} + inline CreateMultipartUploadRequest& WithWebsiteRedirectLocation(Aws::String&& value) { SetWebsiteRedirectLocation(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithWebsiteRedirectLocation(const char* value) { SetWebsiteRedirectLocation(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the algorithm to use when encrypting the object (for example, + * AES256).

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline bool SSECustomerAlgorithmHasBeenSet() const { return m_sSECustomerAlgorithmHasBeenSet; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm.assign(value); } + inline CreateMultipartUploadRequest& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline CreateMultipartUploadRequest& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the customer-provided encryption key for Amazon S3 to use in + * encrypting data. This value is used to store the object and then it is + * discarded; Amazon S3 does not store the encryption key. The key must be + * appropriate for use with the algorithm specified in the + * x-amz-server-side-encryption-customer-algorithm header.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKey() const{ return m_sSECustomerKey; } + inline bool SSECustomerKeyHasBeenSet() const { return m_sSECustomerKeyHasBeenSet; } + inline void SetSSECustomerKey(const Aws::String& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = value; } + inline void SetSSECustomerKey(Aws::String&& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = std::move(value); } + inline void SetSSECustomerKey(const char* value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey.assign(value); } + inline CreateMultipartUploadRequest& WithSSECustomerKey(const Aws::String& value) { SetSSECustomerKey(value); return *this;} + inline CreateMultipartUploadRequest& WithSSECustomerKey(Aws::String&& value) { SetSSECustomerKey(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithSSECustomerKey(const char* value) { SetSSECustomerKey(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the 128-bit MD5 digest of the customer-provided encryption key + * according to RFC 1321. Amazon S3 uses this header for a message integrity check + * to ensure that the encryption key was transmitted without error.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline bool SSECustomerKeyMD5HasBeenSet() const { return m_sSECustomerKeyMD5HasBeenSet; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5.assign(value); } + inline CreateMultipartUploadRequest& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline CreateMultipartUploadRequest& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the KMS key ID (Key ID, Key ARN, or Key Alias) to use for object + * encryption. If the KMS key doesn't exist in the same account that's issuing the + * command, you must use the full Key ARN not the Key ID.

General + * purpose buckets - If you specify x-amz-server-side-encryption + * with aws:kms or aws:kms:dsse, this header specifies + * the ID (Key ID, Key ARN, or Key Alias) of the KMS key to use. If you specify + * x-amz-server-side-encryption:aws:kms or + * x-amz-server-side-encryption:aws:kms:dsse, but do not provide + * x-amz-server-side-encryption-aws-kms-key-id, Amazon S3 uses the + * Amazon Web Services managed key (aws/s3) to protect the data.

+ *

Directory buckets - To encrypt data using SSE-KMS, it's recommended + * to specify the x-amz-server-side-encryption header to + * aws:kms. Then, the + * x-amz-server-side-encryption-aws-kms-key-id header implicitly uses + * the bucket's default KMS customer managed key ID. If you want to explicitly set + * the x-amz-server-side-encryption-aws-kms-key-id header, it must + * match the bucket's default customer managed key (using key ID or ARN, not + * alias). Your SSE-KMS configuration can only support 1 customer + * managed key per directory bucket's lifetime. The Amazon + * Web Services managed key (aws/s3) isn't supported. Incorrect + * key specification results in an HTTP 400 Bad Request error.

+ */ + inline const Aws::String& GetSSEKMSKeyId() const{ return m_sSEKMSKeyId; } + inline bool SSEKMSKeyIdHasBeenSet() const { return m_sSEKMSKeyIdHasBeenSet; } + inline void SetSSEKMSKeyId(const Aws::String& value) { m_sSEKMSKeyIdHasBeenSet = true; m_sSEKMSKeyId = value; } + inline void SetSSEKMSKeyId(Aws::String&& value) { m_sSEKMSKeyIdHasBeenSet = true; m_sSEKMSKeyId = std::move(value); } + inline void SetSSEKMSKeyId(const char* value) { m_sSEKMSKeyIdHasBeenSet = true; m_sSEKMSKeyId.assign(value); } + inline CreateMultipartUploadRequest& WithSSEKMSKeyId(const Aws::String& value) { SetSSEKMSKeyId(value); return *this;} + inline CreateMultipartUploadRequest& WithSSEKMSKeyId(Aws::String&& value) { SetSSEKMSKeyId(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithSSEKMSKeyId(const char* value) { SetSSEKMSKeyId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the Amazon Web Services KMS Encryption Context to use for object + * encryption. The value of this header is a Base64 encoded string of a UTF-8 + * encoded JSON, which contains the encryption context as key-value pairs.

+ * Directory buckets - You can optionally provide an explicit encryption + * context value. The value must match the default encryption context - the bucket + * Amazon Resource Name (ARN). An additional encryption context value is not + * supported.

+ */ + inline const Aws::String& GetSSEKMSEncryptionContext() const{ return m_sSEKMSEncryptionContext; } + inline bool SSEKMSEncryptionContextHasBeenSet() const { return m_sSEKMSEncryptionContextHasBeenSet; } + inline void SetSSEKMSEncryptionContext(const Aws::String& value) { m_sSEKMSEncryptionContextHasBeenSet = true; m_sSEKMSEncryptionContext = value; } + inline void SetSSEKMSEncryptionContext(Aws::String&& value) { m_sSEKMSEncryptionContextHasBeenSet = true; m_sSEKMSEncryptionContext = std::move(value); } + inline void SetSSEKMSEncryptionContext(const char* value) { m_sSEKMSEncryptionContextHasBeenSet = true; m_sSEKMSEncryptionContext.assign(value); } + inline CreateMultipartUploadRequest& WithSSEKMSEncryptionContext(const Aws::String& value) { SetSSEKMSEncryptionContext(value); return *this;} + inline CreateMultipartUploadRequest& WithSSEKMSEncryptionContext(Aws::String&& value) { SetSSEKMSEncryptionContext(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithSSEKMSEncryptionContext(const char* value) { SetSSEKMSEncryptionContext(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption + * with server-side encryption using Key Management Service (KMS) keys + * (SSE-KMS).

General purpose buckets - Setting this header to + * true causes Amazon S3 to use an S3 Bucket Key for object encryption + * with SSE-KMS. Also, specifying this header with a PUT action doesn't affect + * bucket-level settings for S3 Bucket Key.

Directory buckets - S3 + * Bucket Keys are always enabled for GET and PUT + * operations in a directory bucket and can’t be disabled. S3 Bucket Keys aren't + * supported, when you copy SSE-KMS encrypted objects from general purpose buckets + * to directory buckets, from directory buckets to general purpose buckets, or + * between directory buckets, through CopyObject, + * UploadPartCopy, + * the + * Copy operation in Batch Operations, or the + * import jobs. In this case, Amazon S3 makes a call to KMS every time a copy + * request is made for a KMS-encrypted object.

+ */ + inline bool GetBucketKeyEnabled() const{ return m_bucketKeyEnabled; } + inline bool BucketKeyEnabledHasBeenSet() const { return m_bucketKeyEnabledHasBeenSet; } + inline void SetBucketKeyEnabled(bool value) { m_bucketKeyEnabledHasBeenSet = true; m_bucketKeyEnabled = value; } + inline CreateMultipartUploadRequest& WithBucketKeyEnabled(bool value) { SetBucketKeyEnabled(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline CreateMultipartUploadRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline CreateMultipartUploadRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The tag-set for the object. The tag-set must be encoded as URL Query + * parameters.

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::String& GetTagging() const{ return m_tagging; } + inline bool TaggingHasBeenSet() const { return m_taggingHasBeenSet; } + inline void SetTagging(const Aws::String& value) { m_taggingHasBeenSet = true; m_tagging = value; } + inline void SetTagging(Aws::String&& value) { m_taggingHasBeenSet = true; m_tagging = std::move(value); } + inline void SetTagging(const char* value) { m_taggingHasBeenSet = true; m_tagging.assign(value); } + inline CreateMultipartUploadRequest& WithTagging(const Aws::String& value) { SetTagging(value); return *this;} + inline CreateMultipartUploadRequest& WithTagging(Aws::String&& value) { SetTagging(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithTagging(const char* value) { SetTagging(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the Object Lock mode that you want to apply to the uploaded + * object.

This functionality is not supported for directory + * buckets.

+ */ + inline const ObjectLockMode& GetObjectLockMode() const{ return m_objectLockMode; } + inline bool ObjectLockModeHasBeenSet() const { return m_objectLockModeHasBeenSet; } + inline void SetObjectLockMode(const ObjectLockMode& value) { m_objectLockModeHasBeenSet = true; m_objectLockMode = value; } + inline void SetObjectLockMode(ObjectLockMode&& value) { m_objectLockModeHasBeenSet = true; m_objectLockMode = std::move(value); } + inline CreateMultipartUploadRequest& WithObjectLockMode(const ObjectLockMode& value) { SetObjectLockMode(value); return *this;} + inline CreateMultipartUploadRequest& WithObjectLockMode(ObjectLockMode&& value) { SetObjectLockMode(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the date and time when you want the Object Lock to expire.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::Utils::DateTime& GetObjectLockRetainUntilDate() const{ return m_objectLockRetainUntilDate; } + inline bool ObjectLockRetainUntilDateHasBeenSet() const { return m_objectLockRetainUntilDateHasBeenSet; } + inline void SetObjectLockRetainUntilDate(const Aws::Utils::DateTime& value) { m_objectLockRetainUntilDateHasBeenSet = true; m_objectLockRetainUntilDate = value; } + inline void SetObjectLockRetainUntilDate(Aws::Utils::DateTime&& value) { m_objectLockRetainUntilDateHasBeenSet = true; m_objectLockRetainUntilDate = std::move(value); } + inline CreateMultipartUploadRequest& WithObjectLockRetainUntilDate(const Aws::Utils::DateTime& value) { SetObjectLockRetainUntilDate(value); return *this;} + inline CreateMultipartUploadRequest& WithObjectLockRetainUntilDate(Aws::Utils::DateTime&& value) { SetObjectLockRetainUntilDate(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether you want to apply a legal hold to the uploaded object.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const ObjectLockLegalHoldStatus& GetObjectLockLegalHoldStatus() const{ return m_objectLockLegalHoldStatus; } + inline bool ObjectLockLegalHoldStatusHasBeenSet() const { return m_objectLockLegalHoldStatusHasBeenSet; } + inline void SetObjectLockLegalHoldStatus(const ObjectLockLegalHoldStatus& value) { m_objectLockLegalHoldStatusHasBeenSet = true; m_objectLockLegalHoldStatus = value; } + inline void SetObjectLockLegalHoldStatus(ObjectLockLegalHoldStatus&& value) { m_objectLockLegalHoldStatusHasBeenSet = true; m_objectLockLegalHoldStatus = std::move(value); } + inline CreateMultipartUploadRequest& WithObjectLockLegalHoldStatus(const ObjectLockLegalHoldStatus& value) { SetObjectLockLegalHoldStatus(value); return *this;} + inline CreateMultipartUploadRequest& WithObjectLockLegalHoldStatus(ObjectLockLegalHoldStatus&& value) { SetObjectLockLegalHoldStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline CreateMultipartUploadRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline CreateMultipartUploadRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm that you want Amazon S3 to use to create the checksum + * for the object. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline CreateMultipartUploadRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline CreateMultipartUploadRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Indicates the checksum type that you want Amazon S3 to use to calculate the + * object’s checksum value. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline bool ChecksumTypeHasBeenSet() const { return m_checksumTypeHasBeenSet; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumTypeHasBeenSet = true; m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumTypeHasBeenSet = true; m_checksumType = std::move(value); } + inline CreateMultipartUploadRequest& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline CreateMultipartUploadRequest& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline CreateMultipartUploadRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline CreateMultipartUploadRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline CreateMultipartUploadRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline CreateMultipartUploadRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline CreateMultipartUploadRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline CreateMultipartUploadRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline CreateMultipartUploadRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline CreateMultipartUploadRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline CreateMultipartUploadRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + ObjectCannedACL m_aCL; + bool m_aCLHasBeenSet = false; + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_cacheControl; + bool m_cacheControlHasBeenSet = false; + + Aws::String m_contentDisposition; + bool m_contentDispositionHasBeenSet = false; + + Aws::String m_contentEncoding; + bool m_contentEncodingHasBeenSet = false; + + Aws::String m_contentLanguage; + bool m_contentLanguageHasBeenSet = false; + + Aws::String m_contentType; + bool m_contentTypeHasBeenSet = false; + + Aws::Utils::DateTime m_expires; + bool m_expiresHasBeenSet = false; + + Aws::String m_grantFullControl; + bool m_grantFullControlHasBeenSet = false; + + Aws::String m_grantRead; + bool m_grantReadHasBeenSet = false; + + Aws::String m_grantReadACP; + bool m_grantReadACPHasBeenSet = false; + + Aws::String m_grantWriteACP; + bool m_grantWriteACPHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::Map m_metadata; + bool m_metadataHasBeenSet = false; + + ServerSideEncryption m_serverSideEncryption; + bool m_serverSideEncryptionHasBeenSet = false; + + StorageClass m_storageClass; + bool m_storageClassHasBeenSet = false; + + Aws::String m_websiteRedirectLocation; + bool m_websiteRedirectLocationHasBeenSet = false; + + Aws::String m_sSECustomerAlgorithm; + bool m_sSECustomerAlgorithmHasBeenSet = false; + + Aws::String m_sSECustomerKey; + bool m_sSECustomerKeyHasBeenSet = false; + + Aws::String m_sSECustomerKeyMD5; + bool m_sSECustomerKeyMD5HasBeenSet = false; + + Aws::String m_sSEKMSKeyId; + bool m_sSEKMSKeyIdHasBeenSet = false; + + Aws::String m_sSEKMSEncryptionContext; + bool m_sSEKMSEncryptionContextHasBeenSet = false; + + bool m_bucketKeyEnabled; + bool m_bucketKeyEnabledHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_tagging; + bool m_taggingHasBeenSet = false; + + ObjectLockMode m_objectLockMode; + bool m_objectLockModeHasBeenSet = false; + + Aws::Utils::DateTime m_objectLockRetainUntilDate; + bool m_objectLockRetainUntilDateHasBeenSet = false; + + ObjectLockLegalHoldStatus m_objectLockLegalHoldStatus; + bool m_objectLockLegalHoldStatusHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + ChecksumType m_checksumType; + bool m_checksumTypeHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CreateMultipartUploadResult.h b/include/aws/s3/model/CreateMultipartUploadResult.h new file mode 100644 index 0000000000000000000000000000000000000000..de3d1df7ef43ecf2e3590f50acdfa5ae396ca32c --- /dev/null +++ b/include/aws/s3/model/CreateMultipartUploadResult.h @@ -0,0 +1,281 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class CreateMultipartUploadResult + { + public: + AWS_S3_API CreateMultipartUploadResult(); + AWS_S3_API CreateMultipartUploadResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API CreateMultipartUploadResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

If the bucket has a lifecycle rule configured with an action to abort + * incomplete multipart uploads and the prefix in the lifecycle rule matches the + * object name in the request, the response includes this header. The header + * indicates when the initiated multipart upload becomes eligible for an abort + * operation. For more information, see + * Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle Configuration + * in the Amazon S3 User Guide.

The response also includes the + * x-amz-abort-rule-id header that provides the ID of the lifecycle + * configuration rule that defines the abort action.

This + * functionality is not supported for directory buckets.

+ */ + inline const Aws::Utils::DateTime& GetAbortDate() const{ return m_abortDate; } + inline void SetAbortDate(const Aws::Utils::DateTime& value) { m_abortDate = value; } + inline void SetAbortDate(Aws::Utils::DateTime&& value) { m_abortDate = std::move(value); } + inline CreateMultipartUploadResult& WithAbortDate(const Aws::Utils::DateTime& value) { SetAbortDate(value); return *this;} + inline CreateMultipartUploadResult& WithAbortDate(Aws::Utils::DateTime&& value) { SetAbortDate(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

This header is returned along with the x-amz-abort-date header. + * It identifies the applicable lifecycle configuration rule that defines the + * action to abort incomplete multipart uploads.

This functionality + * is not supported for directory buckets.

+ */ + inline const Aws::String& GetAbortRuleId() const{ return m_abortRuleId; } + inline void SetAbortRuleId(const Aws::String& value) { m_abortRuleId = value; } + inline void SetAbortRuleId(Aws::String&& value) { m_abortRuleId = std::move(value); } + inline void SetAbortRuleId(const char* value) { m_abortRuleId.assign(value); } + inline CreateMultipartUploadResult& WithAbortRuleId(const Aws::String& value) { SetAbortRuleId(value); return *this;} + inline CreateMultipartUploadResult& WithAbortRuleId(Aws::String&& value) { SetAbortRuleId(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithAbortRuleId(const char* value) { SetAbortRuleId(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the bucket to which the multipart upload was initiated. Does not + * return the access point ARN or access point alias if used.

Access + * points are not supported by directory buckets.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline void SetBucket(const Aws::String& value) { m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucket.assign(value); } + inline CreateMultipartUploadResult& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline CreateMultipartUploadResult& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Object key for which the multipart upload was initiated.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline void SetKey(const Aws::String& value) { m_key = value; } + inline void SetKey(Aws::String&& value) { m_key = std::move(value); } + inline void SetKey(const char* value) { m_key.assign(value); } + inline CreateMultipartUploadResult& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline CreateMultipartUploadResult& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

ID for the initiated multipart upload.

+ */ + inline const Aws::String& GetUploadId() const{ return m_uploadId; } + inline void SetUploadId(const Aws::String& value) { m_uploadId = value; } + inline void SetUploadId(Aws::String&& value) { m_uploadId = std::move(value); } + inline void SetUploadId(const char* value) { m_uploadId.assign(value); } + inline CreateMultipartUploadResult& WithUploadId(const Aws::String& value) { SetUploadId(value); return *this;} + inline CreateMultipartUploadResult& WithUploadId(Aws::String&& value) { SetUploadId(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithUploadId(const char* value) { SetUploadId(value); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption algorithm used when you store this object in + * Amazon S3 (for example, AES256, aws:kms).

+ */ + inline const ServerSideEncryption& GetServerSideEncryption() const{ return m_serverSideEncryption; } + inline void SetServerSideEncryption(const ServerSideEncryption& value) { m_serverSideEncryption = value; } + inline void SetServerSideEncryption(ServerSideEncryption&& value) { m_serverSideEncryption = std::move(value); } + inline CreateMultipartUploadResult& WithServerSideEncryption(const ServerSideEncryption& value) { SetServerSideEncryption(value); return *this;} + inline CreateMultipartUploadResult& WithServerSideEncryption(ServerSideEncryption&& value) { SetServerSideEncryption(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to confirm the encryption + * algorithm that's used.

This functionality is not supported for + * directory buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithm.assign(value); } + inline CreateMultipartUploadResult& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline CreateMultipartUploadResult& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to provide the round-trip + * message integrity verification of the customer-provided encryption key.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5.assign(value); } + inline CreateMultipartUploadResult& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline CreateMultipartUploadResult& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + /** + *

If present, indicates the ID of the KMS key that was used for object + * encryption.

+ */ + inline const Aws::String& GetSSEKMSKeyId() const{ return m_sSEKMSKeyId; } + inline void SetSSEKMSKeyId(const Aws::String& value) { m_sSEKMSKeyId = value; } + inline void SetSSEKMSKeyId(Aws::String&& value) { m_sSEKMSKeyId = std::move(value); } + inline void SetSSEKMSKeyId(const char* value) { m_sSEKMSKeyId.assign(value); } + inline CreateMultipartUploadResult& WithSSEKMSKeyId(const Aws::String& value) { SetSSEKMSKeyId(value); return *this;} + inline CreateMultipartUploadResult& WithSSEKMSKeyId(Aws::String&& value) { SetSSEKMSKeyId(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithSSEKMSKeyId(const char* value) { SetSSEKMSKeyId(value); return *this;} + ///@} + + ///@{ + /** + *

If present, indicates the Amazon Web Services KMS Encryption Context to use + * for object encryption. The value of this header is a Base64 encoded string of a + * UTF-8 encoded JSON, which contains the encryption context as key-value + * pairs.

+ */ + inline const Aws::String& GetSSEKMSEncryptionContext() const{ return m_sSEKMSEncryptionContext; } + inline void SetSSEKMSEncryptionContext(const Aws::String& value) { m_sSEKMSEncryptionContext = value; } + inline void SetSSEKMSEncryptionContext(Aws::String&& value) { m_sSEKMSEncryptionContext = std::move(value); } + inline void SetSSEKMSEncryptionContext(const char* value) { m_sSEKMSEncryptionContext.assign(value); } + inline CreateMultipartUploadResult& WithSSEKMSEncryptionContext(const Aws::String& value) { SetSSEKMSEncryptionContext(value); return *this;} + inline CreateMultipartUploadResult& WithSSEKMSEncryptionContext(Aws::String&& value) { SetSSEKMSEncryptionContext(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithSSEKMSEncryptionContext(const char* value) { SetSSEKMSEncryptionContext(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the multipart upload uses an S3 Bucket Key for server-side + * encryption with Key Management Service (KMS) keys (SSE-KMS).

+ */ + inline bool GetBucketKeyEnabled() const{ return m_bucketKeyEnabled; } + inline void SetBucketKeyEnabled(bool value) { m_bucketKeyEnabled = value; } + inline CreateMultipartUploadResult& WithBucketKeyEnabled(bool value) { SetBucketKeyEnabled(value); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline CreateMultipartUploadResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline CreateMultipartUploadResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The algorithm that was used to create a checksum of the object.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithm = std::move(value); } + inline CreateMultipartUploadResult& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline CreateMultipartUploadResult& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Indicates the checksum type that you want Amazon S3 to use to calculate the + * object’s checksum value. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumType = std::move(value); } + inline CreateMultipartUploadResult& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline CreateMultipartUploadResult& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline CreateMultipartUploadResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline CreateMultipartUploadResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline CreateMultipartUploadResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Utils::DateTime m_abortDate; + + Aws::String m_abortRuleId; + + Aws::String m_bucket; + + Aws::String m_key; + + Aws::String m_uploadId; + + ServerSideEncryption m_serverSideEncryption; + + Aws::String m_sSECustomerAlgorithm; + + Aws::String m_sSECustomerKeyMD5; + + Aws::String m_sSEKMSKeyId; + + Aws::String m_sSEKMSEncryptionContext; + + bool m_bucketKeyEnabled; + + RequestCharged m_requestCharged; + + ChecksumAlgorithm m_checksumAlgorithm; + + ChecksumType m_checksumType; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/CreateSessionResult.h b/include/aws/s3/model/CreateSessionResult.h new file mode 100644 index 0000000000000000000000000000000000000000..ecd3b3a14095ed3884b31c6ce04f337f3543178e --- /dev/null +++ b/include/aws/s3/model/CreateSessionResult.h @@ -0,0 +1,130 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class CreateSessionResult + { + public: + AWS_S3_API CreateSessionResult(); + AWS_S3_API CreateSessionResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API CreateSessionResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The server-side encryption algorithm used when you store objects in the + * directory bucket.

+ */ + inline const ServerSideEncryption& GetServerSideEncryption() const{ return m_serverSideEncryption; } + inline void SetServerSideEncryption(const ServerSideEncryption& value) { m_serverSideEncryption = value; } + inline void SetServerSideEncryption(ServerSideEncryption&& value) { m_serverSideEncryption = std::move(value); } + inline CreateSessionResult& WithServerSideEncryption(const ServerSideEncryption& value) { SetServerSideEncryption(value); return *this;} + inline CreateSessionResult& WithServerSideEncryption(ServerSideEncryption&& value) { SetServerSideEncryption(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If you specify x-amz-server-side-encryption with + * aws:kms, this header indicates the ID of the KMS symmetric + * encryption customer managed key that was used for object encryption.

+ */ + inline const Aws::String& GetSSEKMSKeyId() const{ return m_sSEKMSKeyId; } + inline void SetSSEKMSKeyId(const Aws::String& value) { m_sSEKMSKeyId = value; } + inline void SetSSEKMSKeyId(Aws::String&& value) { m_sSEKMSKeyId = std::move(value); } + inline void SetSSEKMSKeyId(const char* value) { m_sSEKMSKeyId.assign(value); } + inline CreateSessionResult& WithSSEKMSKeyId(const Aws::String& value) { SetSSEKMSKeyId(value); return *this;} + inline CreateSessionResult& WithSSEKMSKeyId(Aws::String&& value) { SetSSEKMSKeyId(std::move(value)); return *this;} + inline CreateSessionResult& WithSSEKMSKeyId(const char* value) { SetSSEKMSKeyId(value); return *this;} + ///@} + + ///@{ + /** + *

If present, indicates the Amazon Web Services KMS Encryption Context to use + * for object encryption. The value of this header is a Base64 encoded string of a + * UTF-8 encoded JSON, which contains the encryption context as key-value pairs. + * This value is stored as object metadata and automatically gets passed on to + * Amazon Web Services KMS for future GetObject operations on this + * object.

+ */ + inline const Aws::String& GetSSEKMSEncryptionContext() const{ return m_sSEKMSEncryptionContext; } + inline void SetSSEKMSEncryptionContext(const Aws::String& value) { m_sSEKMSEncryptionContext = value; } + inline void SetSSEKMSEncryptionContext(Aws::String&& value) { m_sSEKMSEncryptionContext = std::move(value); } + inline void SetSSEKMSEncryptionContext(const char* value) { m_sSEKMSEncryptionContext.assign(value); } + inline CreateSessionResult& WithSSEKMSEncryptionContext(const Aws::String& value) { SetSSEKMSEncryptionContext(value); return *this;} + inline CreateSessionResult& WithSSEKMSEncryptionContext(Aws::String&& value) { SetSSEKMSEncryptionContext(std::move(value)); return *this;} + inline CreateSessionResult& WithSSEKMSEncryptionContext(const char* value) { SetSSEKMSEncryptionContext(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether to use an S3 Bucket Key for server-side encryption with KMS + * keys (SSE-KMS).

+ */ + inline bool GetBucketKeyEnabled() const{ return m_bucketKeyEnabled; } + inline void SetBucketKeyEnabled(bool value) { m_bucketKeyEnabled = value; } + inline CreateSessionResult& WithBucketKeyEnabled(bool value) { SetBucketKeyEnabled(value); return *this;} + ///@} + + ///@{ + /** + *

The established temporary security credentials for the created session.

+ */ + inline const SessionCredentials& GetCredentials() const{ return m_credentials; } + inline void SetCredentials(const SessionCredentials& value) { m_credentials = value; } + inline void SetCredentials(SessionCredentials&& value) { m_credentials = std::move(value); } + inline CreateSessionResult& WithCredentials(const SessionCredentials& value) { SetCredentials(value); return *this;} + inline CreateSessionResult& WithCredentials(SessionCredentials&& value) { SetCredentials(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline CreateSessionResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline CreateSessionResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline CreateSessionResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ServerSideEncryption m_serverSideEncryption; + + Aws::String m_sSEKMSKeyId; + + Aws::String m_sSEKMSEncryptionContext; + + bool m_bucketKeyEnabled; + + SessionCredentials m_credentials; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DataRedundancy.h b/include/aws/s3/model/DataRedundancy.h new file mode 100644 index 0000000000000000000000000000000000000000..78aa05d48ae3fe23499a47ec8503a93a66ef4723 --- /dev/null +++ b/include/aws/s3/model/DataRedundancy.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class DataRedundancy + { + NOT_SET, + SingleAvailabilityZone, + SingleLocalZone + }; + +namespace DataRedundancyMapper +{ +AWS_S3_API DataRedundancy GetDataRedundancyForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForDataRedundancy(DataRedundancy value); +} // namespace DataRedundancyMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketAnalyticsConfigurationRequest.h b/include/aws/s3/model/DeleteBucketAnalyticsConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..381098dc4ca247f8eddbc13397272269fd704f6a --- /dev/null +++ b/include/aws/s3/model/DeleteBucketAnalyticsConfigurationRequest.h @@ -0,0 +1,125 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketAnalyticsConfigurationRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketAnalyticsConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketAnalyticsConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket from which an analytics configuration is deleted.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketAnalyticsConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The ID that identifies the analytics configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline DeleteBucketAnalyticsConfigurationRequest& WithId(const Aws::String& value) { SetId(value); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketAnalyticsConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketAnalyticsConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketCorsRequest.h b/include/aws/s3/model/DeleteBucketCorsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c7be01edc8fd20ae946fe3bdca9dd89258a473b9 --- /dev/null +++ b/include/aws/s3/model/DeleteBucketCorsRequest.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketCorsRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketCorsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketCors"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

Specifies the bucket whose cors configuration is being + * deleted.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketCorsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketCorsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketCorsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketCorsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketCorsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketCorsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketCorsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketCorsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketCorsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketCorsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketCorsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketCorsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketCorsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketCorsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketCorsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketInventoryConfigurationRequest.h b/include/aws/s3/model/DeleteBucketInventoryConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..cb0f0f8fdae5060f520cc9e26b958f1edd0ce33c --- /dev/null +++ b/include/aws/s3/model/DeleteBucketInventoryConfigurationRequest.h @@ -0,0 +1,126 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketInventoryConfigurationRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketInventoryConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketInventoryConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket containing the inventory configuration to delete.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketInventoryConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketInventoryConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketInventoryConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The ID used to identify the inventory configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline DeleteBucketInventoryConfigurationRequest& WithId(const Aws::String& value) { SetId(value); return *this;} + inline DeleteBucketInventoryConfigurationRequest& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline DeleteBucketInventoryConfigurationRequest& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketInventoryConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketInventoryConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketInventoryConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketInventoryConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketInventoryConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketLifecycleRequest.h b/include/aws/s3/model/DeleteBucketLifecycleRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..305163827924cf33c663ae2e392c79eb8557c589 --- /dev/null +++ b/include/aws/s3/model/DeleteBucketLifecycleRequest.h @@ -0,0 +1,111 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketLifecycleRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketLifecycleRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketLifecycle"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name of the lifecycle to delete.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketLifecycleRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketLifecycleRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketLifecycleRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ *

This parameter applies to general purpose buckets only. It is not supported + * for directory bucket lifecycle configurations.

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketLifecycleRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketLifecycleRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketLifecycleRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketLifecycleRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketLifecycleRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketLifecycleRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketLifecycleRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketLifecycleRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketLifecycleRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketLifecycleRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketLifecycleRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketLifecycleRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketOwnershipControlsRequest.h b/include/aws/s3/model/DeleteBucketOwnershipControlsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..010c11e660e68d62c150e8c4cc9e14c237a64f4b --- /dev/null +++ b/include/aws/s3/model/DeleteBucketOwnershipControlsRequest.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketOwnershipControlsRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketOwnershipControlsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketOwnershipControls"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The Amazon S3 bucket whose OwnershipControls you want to delete. + *

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketOwnershipControlsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketOwnershipControlsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketOwnershipControlsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketOwnershipControlsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketOwnershipControlsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketOwnershipControlsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketOwnershipControlsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketOwnershipControlsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketReplicationRequest.h b/include/aws/s3/model/DeleteBucketReplicationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..9013fbd3f92b1fe6b351361bdcdc0cd5cc43a3c9 --- /dev/null +++ b/include/aws/s3/model/DeleteBucketReplicationRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketReplicationRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketReplicationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketReplication"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketReplicationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketReplicationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketReplicationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketReplicationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketReplicationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketReplicationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketReplicationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketReplicationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketReplicationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketReplicationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketReplicationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketReplicationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketReplicationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketReplicationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketReplicationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketRequest.h b/include/aws/s3/model/DeleteBucketRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..dd8449f47d6b440279e8b09fa7fd41476a27380e --- /dev/null +++ b/include/aws/s3/model/DeleteBucketRequest.h @@ -0,0 +1,123 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucket"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

Specifies the bucket being deleted.

Directory buckets - When + * you use this operation with a directory bucket, you must use path-style requests + * in the format + * https://s3express-control.region-code.amazonaws.com/bucket-name + * . Virtual-hosted-style requests aren't supported. Directory bucket names + * must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket + * names must also follow the format + * bucket-base-name--zone-id--x-s3 (for example, + * DOC-EXAMPLE-BUCKET--usw2-az1--x-s3). For information about + * bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ *

For directory buckets, this header is not supported in this API operation. If + * you specify this header, the request fails with the HTTP status code 501 + * Not Implemented.

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketTaggingRequest.h b/include/aws/s3/model/DeleteBucketTaggingRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d4ac48f366fc2f0ea6404e208247146a63d54b32 --- /dev/null +++ b/include/aws/s3/model/DeleteBucketTaggingRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketTaggingRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketTaggingRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketTagging"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket that has the tag set to be removed.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketTaggingRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketTaggingRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketTaggingRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketTaggingRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketTaggingRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketTaggingRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketTaggingRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketTaggingRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteBucketWebsiteRequest.h b/include/aws/s3/model/DeleteBucketWebsiteRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e7adc4e8eba9aecf1838a403c78bff21d0dfd03b --- /dev/null +++ b/include/aws/s3/model/DeleteBucketWebsiteRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteBucketWebsiteRequest : public S3Request + { + public: + AWS_S3_API DeleteBucketWebsiteRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketWebsite"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name for which you want to remove the website configuration.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteBucketWebsiteRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteBucketWebsiteRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteBucketWebsiteRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteBucketWebsiteRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteBucketWebsiteRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteBucketWebsiteRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteBucketWebsiteRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteBucketWebsiteRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteBucketWebsiteRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketWebsiteRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteBucketWebsiteRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteBucketWebsiteRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteMarkerEntry.h b/include/aws/s3/model/DeleteMarkerEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..282f3e5d90975020c468ca9dc6c6483e9593eff0 --- /dev/null +++ b/include/aws/s3/model/DeleteMarkerEntry.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Information about the delete marker.

See Also:

AWS + * API Reference

+ */ + class DeleteMarkerEntry + { + public: + AWS_S3_API DeleteMarkerEntry(); + AWS_S3_API DeleteMarkerEntry(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API DeleteMarkerEntry& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The account that created the delete marker.

+ */ + inline const Owner& GetOwner() const{ return m_owner; } + inline bool OwnerHasBeenSet() const { return m_ownerHasBeenSet; } + inline void SetOwner(const Owner& value) { m_ownerHasBeenSet = true; m_owner = value; } + inline void SetOwner(Owner&& value) { m_ownerHasBeenSet = true; m_owner = std::move(value); } + inline DeleteMarkerEntry& WithOwner(const Owner& value) { SetOwner(value); return *this;} + inline DeleteMarkerEntry& WithOwner(Owner&& value) { SetOwner(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The object key.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline DeleteMarkerEntry& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline DeleteMarkerEntry& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline DeleteMarkerEntry& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

Version ID of an object.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline DeleteMarkerEntry& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline DeleteMarkerEntry& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline DeleteMarkerEntry& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether the object is (true) or is not (false) the latest version + * of an object.

+ */ + inline bool GetIsLatest() const{ return m_isLatest; } + inline bool IsLatestHasBeenSet() const { return m_isLatestHasBeenSet; } + inline void SetIsLatest(bool value) { m_isLatestHasBeenSet = true; m_isLatest = value; } + inline DeleteMarkerEntry& WithIsLatest(bool value) { SetIsLatest(value); return *this;} + ///@} + + ///@{ + /** + *

Date and time when the object was last modified.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline bool LastModifiedHasBeenSet() const { return m_lastModifiedHasBeenSet; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModifiedHasBeenSet = true; m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModifiedHasBeenSet = true; m_lastModified = std::move(value); } + inline DeleteMarkerEntry& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline DeleteMarkerEntry& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + private: + + Owner m_owner; + bool m_ownerHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + bool m_isLatest; + bool m_isLatestHasBeenSet = false; + + Aws::Utils::DateTime m_lastModified; + bool m_lastModifiedHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteMarkerReplication.h b/include/aws/s3/model/DeleteMarkerReplication.h new file mode 100644 index 0000000000000000000000000000000000000000..9f02041ddc57ff88ad5f64d34df79021f0c6233a --- /dev/null +++ b/include/aws/s3/model/DeleteMarkerReplication.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies whether Amazon S3 replicates delete markers. If you specify a + * Filter in your replication configuration, you must also include a + * DeleteMarkerReplication element. If your Filter + * includes a Tag element, the DeleteMarkerReplication + * Status must be set to Disabled, because Amazon S3 does not support + * replicating delete markers for tag-based rules. For an example configuration, + * see Basic + * Rule Configuration.

For more information about delete marker + * replication, see Basic + * Rule Configuration.

If you are using an earlier version of + * the replication configuration, Amazon S3 handles replication of delete markers + * differently. For more information, see Backward + * Compatibility.

See Also:

AWS + * API Reference

+ */ + class DeleteMarkerReplication + { + public: + AWS_S3_API DeleteMarkerReplication(); + AWS_S3_API DeleteMarkerReplication(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API DeleteMarkerReplication& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Indicates whether to replicate delete markers.

Indicates + * whether to replicate delete markers.

+ */ + inline const DeleteMarkerReplicationStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const DeleteMarkerReplicationStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(DeleteMarkerReplicationStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline DeleteMarkerReplication& WithStatus(const DeleteMarkerReplicationStatus& value) { SetStatus(value); return *this;} + inline DeleteMarkerReplication& WithStatus(DeleteMarkerReplicationStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + DeleteMarkerReplicationStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteObjectRequest.h b/include/aws/s3/model/DeleteObjectRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2f411df710b2cf94f17a80b74fcbb1d334338e2e --- /dev/null +++ b/include/aws/s3/model/DeleteObjectRequest.h @@ -0,0 +1,291 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteObjectRequest : public S3Request + { + public: + AWS_S3_API DeleteObjectRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteObject"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name of the bucket containing the object.

Directory + * buckets - When you use this operation with a directory bucket, you must use + * virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteObjectRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteObjectRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteObjectRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Key name of the object to delete.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline DeleteObjectRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline DeleteObjectRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline DeleteObjectRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The concatenation of the authentication device's serial number, a space, and + * the value that is displayed on your authentication device. Required to + * permanently delete a versioned object if versioning is configured with MFA + * delete enabled.

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::String& GetMFA() const{ return m_mFA; } + inline bool MFAHasBeenSet() const { return m_mFAHasBeenSet; } + inline void SetMFA(const Aws::String& value) { m_mFAHasBeenSet = true; m_mFA = value; } + inline void SetMFA(Aws::String&& value) { m_mFAHasBeenSet = true; m_mFA = std::move(value); } + inline void SetMFA(const char* value) { m_mFAHasBeenSet = true; m_mFA.assign(value); } + inline DeleteObjectRequest& WithMFA(const Aws::String& value) { SetMFA(value); return *this;} + inline DeleteObjectRequest& WithMFA(Aws::String&& value) { SetMFA(std::move(value)); return *this;} + inline DeleteObjectRequest& WithMFA(const char* value) { SetMFA(value); return *this;} + ///@} + + ///@{ + /** + *

Version ID used to reference a specific version of the object.

+ *

For directory buckets in this API operation, only the null value + * of the version ID is supported.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline DeleteObjectRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline DeleteObjectRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline DeleteObjectRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline DeleteObjectRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline DeleteObjectRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether S3 Object Lock should bypass Governance-mode restrictions + * to process this operation. To use this header, you must have the + * s3:BypassGovernanceRetention permission.

This + * functionality is not supported for directory buckets.

+ */ + inline bool GetBypassGovernanceRetention() const{ return m_bypassGovernanceRetention; } + inline bool BypassGovernanceRetentionHasBeenSet() const { return m_bypassGovernanceRetentionHasBeenSet; } + inline void SetBypassGovernanceRetention(bool value) { m_bypassGovernanceRetentionHasBeenSet = true; m_bypassGovernanceRetention = value; } + inline DeleteObjectRequest& WithBypassGovernanceRetention(bool value) { SetBypassGovernanceRetention(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteObjectRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteObjectRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteObjectRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

The If-Match header field makes the request method conditional + * on ETags. If the ETag value does not match, the operation returns a 412 + * Precondition Failed error. If the ETag matches or if the object doesn't + * exist, the operation will return a 204 Success (No Content) + * response.

For more information about conditional requests, see RFC 7232.

This + * functionality is only supported for directory buckets.

+ */ + inline const Aws::String& GetIfMatch() const{ return m_ifMatch; } + inline bool IfMatchHasBeenSet() const { return m_ifMatchHasBeenSet; } + inline void SetIfMatch(const Aws::String& value) { m_ifMatchHasBeenSet = true; m_ifMatch = value; } + inline void SetIfMatch(Aws::String&& value) { m_ifMatchHasBeenSet = true; m_ifMatch = std::move(value); } + inline void SetIfMatch(const char* value) { m_ifMatchHasBeenSet = true; m_ifMatch.assign(value); } + inline DeleteObjectRequest& WithIfMatch(const Aws::String& value) { SetIfMatch(value); return *this;} + inline DeleteObjectRequest& WithIfMatch(Aws::String&& value) { SetIfMatch(std::move(value)); return *this;} + inline DeleteObjectRequest& WithIfMatch(const char* value) { SetIfMatch(value); return *this;} + ///@} + + ///@{ + /** + *

If present, the object is deleted only if its modification times matches the + * provided Timestamp. If the Timestamp values do not + * match, the operation returns a 412 Precondition Failed error. If + * the Timestamp matches or if the object doesn’t exist, the operation + * returns a 204 Success (No Content) response.

This + * functionality is only supported for directory buckets.

+ */ + inline const Aws::Utils::DateTime& GetIfMatchLastModifiedTime() const{ return m_ifMatchLastModifiedTime; } + inline bool IfMatchLastModifiedTimeHasBeenSet() const { return m_ifMatchLastModifiedTimeHasBeenSet; } + inline void SetIfMatchLastModifiedTime(const Aws::Utils::DateTime& value) { m_ifMatchLastModifiedTimeHasBeenSet = true; m_ifMatchLastModifiedTime = value; } + inline void SetIfMatchLastModifiedTime(Aws::Utils::DateTime&& value) { m_ifMatchLastModifiedTimeHasBeenSet = true; m_ifMatchLastModifiedTime = std::move(value); } + inline DeleteObjectRequest& WithIfMatchLastModifiedTime(const Aws::Utils::DateTime& value) { SetIfMatchLastModifiedTime(value); return *this;} + inline DeleteObjectRequest& WithIfMatchLastModifiedTime(Aws::Utils::DateTime&& value) { SetIfMatchLastModifiedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If present, the object is deleted only if its size matches the provided size + * in bytes. If the Size value does not match, the operation returns a + * 412 Precondition Failed error. If the Size matches or + * if the object doesn’t exist, the operation returns a 204 Success (No + * Content) response.

This functionality is only supported for + * directory buckets.

You can use the + * If-Match, x-amz-if-match-last-modified-time and + * x-amz-if-match-size conditional headers in conjunction with + * each-other or individually.

+ */ + inline long long GetIfMatchSize() const{ return m_ifMatchSize; } + inline bool IfMatchSizeHasBeenSet() const { return m_ifMatchSizeHasBeenSet; } + inline void SetIfMatchSize(long long value) { m_ifMatchSizeHasBeenSet = true; m_ifMatchSize = value; } + inline DeleteObjectRequest& WithIfMatchSize(long long value) { SetIfMatchSize(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteObjectRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteObjectRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteObjectRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteObjectRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteObjectRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteObjectRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_mFA; + bool m_mFAHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + bool m_bypassGovernanceRetention; + bool m_bypassGovernanceRetentionHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::String m_ifMatch; + bool m_ifMatchHasBeenSet = false; + + Aws::Utils::DateTime m_ifMatchLastModifiedTime; + bool m_ifMatchLastModifiedTimeHasBeenSet = false; + + long long m_ifMatchSize; + bool m_ifMatchSizeHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteObjectResult.h b/include/aws/s3/model/DeleteObjectResult.h new file mode 100644 index 0000000000000000000000000000000000000000..71a34ea3c640ae937627b6ff7cd2eafa8e579b51 --- /dev/null +++ b/include/aws/s3/model/DeleteObjectResult.h @@ -0,0 +1,98 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class DeleteObjectResult + { + public: + AWS_S3_API DeleteObjectResult(); + AWS_S3_API DeleteObjectResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API DeleteObjectResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether the specified object version that was permanently deleted + * was (true) or was not (false) a delete marker before deletion. In a simple + * DELETE, this header indicates whether (true) or not (false) the current version + * of the object is a delete marker. To learn more about delete markers, see Working + * with delete markers.

This functionality is not supported for + * directory buckets.

+ */ + inline bool GetDeleteMarker() const{ return m_deleteMarker; } + inline void SetDeleteMarker(bool value) { m_deleteMarker = value; } + inline DeleteObjectResult& WithDeleteMarker(bool value) { SetDeleteMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Returns the version ID of the delete marker created as a result of the DELETE + * operation.

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline void SetVersionId(const Aws::String& value) { m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionId.assign(value); } + inline DeleteObjectResult& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline DeleteObjectResult& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline DeleteObjectResult& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline DeleteObjectResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline DeleteObjectResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteObjectResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteObjectResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteObjectResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + bool m_deleteMarker; + + Aws::String m_versionId; + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteObjectTaggingRequest.h b/include/aws/s3/model/DeleteObjectTaggingRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5a782cafff8de4a8b6fa14ed7bbaa007d7a1477f --- /dev/null +++ b/include/aws/s3/model/DeleteObjectTaggingRequest.h @@ -0,0 +1,163 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteObjectTaggingRequest : public S3Request + { + public: + AWS_S3_API DeleteObjectTaggingRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteObjectTagging"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name containing the objects from which to remove the tags.

+ *

Access points - When you use this action with an access point, you + * must provide the alias of the access point in place of the bucket name or + * specify the access point ARN. When using the access point ARN, you must direct + * requests to the access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

S3 on + * Outposts - When you use this action with S3 on Outposts, you must direct + * requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the + * form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteObjectTaggingRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteObjectTaggingRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteObjectTaggingRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The key that identifies the object in the bucket from which to remove all + * tags.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline DeleteObjectTaggingRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline DeleteObjectTaggingRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline DeleteObjectTaggingRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The versionId of the object that the tag-set will be removed from.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline DeleteObjectTaggingRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline DeleteObjectTaggingRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline DeleteObjectTaggingRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteObjectTaggingRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteObjectTaggingRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteObjectTaggingRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteObjectTaggingRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteObjectTaggingRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteObjectTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteObjectTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteObjectTaggingRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteObjectTaggingRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteObjectTaggingResult.h b/include/aws/s3/model/DeleteObjectTaggingResult.h new file mode 100644 index 0000000000000000000000000000000000000000..56b84b5822cd5284d118f19e1919934e6629f9e5 --- /dev/null +++ b/include/aws/s3/model/DeleteObjectTaggingResult.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class DeleteObjectTaggingResult + { + public: + AWS_S3_API DeleteObjectTaggingResult(); + AWS_S3_API DeleteObjectTaggingResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API DeleteObjectTaggingResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The versionId of the object the tag-set was removed from.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline void SetVersionId(const Aws::String& value) { m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionId.assign(value); } + inline DeleteObjectTaggingResult& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline DeleteObjectTaggingResult& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline DeleteObjectTaggingResult& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteObjectTaggingResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteObjectTaggingResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteObjectTaggingResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_versionId; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeleteObjectsRequest.h b/include/aws/s3/model/DeleteObjectsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..58a450274f4d75b67b58cdbcfaf92faaf91e9374 --- /dev/null +++ b/include/aws/s3/model/DeleteObjectsRequest.h @@ -0,0 +1,252 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeleteObjectsRequest : public S3Request + { + public: + AWS_S3_API DeleteObjectsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteObjects"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name containing the objects to delete.

Directory + * buckets - When you use this operation with a directory bucket, you must use + * virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeleteObjectsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeleteObjectsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeleteObjectsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Container for the request.

+ */ + inline const Delete& GetDelete() const{ return m_delete; } + inline bool DeleteHasBeenSet() const { return m_deleteHasBeenSet; } + inline void SetDelete(const Delete& value) { m_deleteHasBeenSet = true; m_delete = value; } + inline void SetDelete(Delete&& value) { m_deleteHasBeenSet = true; m_delete = std::move(value); } + inline DeleteObjectsRequest& WithDelete(const Delete& value) { SetDelete(value); return *this;} + inline DeleteObjectsRequest& WithDelete(Delete&& value) { SetDelete(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The concatenation of the authentication device's serial number, a space, and + * the value that is displayed on your authentication device. Required to + * permanently delete a versioned object if versioning is configured with MFA + * delete enabled.

When performing the DeleteObjects operation + * on an MFA delete enabled bucket, which attempts to delete the specified + * versioned objects, you must include an MFA token. If you don't provide an MFA + * token, the entire request will fail, even if there are non-versioned objects + * that you are trying to delete. If you provide an invalid token, whether there + * are versioned object keys in the request or not, the entire Multi-Object Delete + * request will fail. For information about MFA Delete, see + * MFA Delete in the Amazon S3 User Guide.

This + * functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetMFA() const{ return m_mFA; } + inline bool MFAHasBeenSet() const { return m_mFAHasBeenSet; } + inline void SetMFA(const Aws::String& value) { m_mFAHasBeenSet = true; m_mFA = value; } + inline void SetMFA(Aws::String&& value) { m_mFAHasBeenSet = true; m_mFA = std::move(value); } + inline void SetMFA(const char* value) { m_mFAHasBeenSet = true; m_mFA.assign(value); } + inline DeleteObjectsRequest& WithMFA(const Aws::String& value) { SetMFA(value); return *this;} + inline DeleteObjectsRequest& WithMFA(Aws::String&& value) { SetMFA(std::move(value)); return *this;} + inline DeleteObjectsRequest& WithMFA(const char* value) { SetMFA(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline DeleteObjectsRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline DeleteObjectsRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether you want to delete this object even if it has a + * Governance-type Object Lock in place. To use this header, you must have the + * s3:BypassGovernanceRetention permission.

This + * functionality is not supported for directory buckets.

+ */ + inline bool GetBypassGovernanceRetention() const{ return m_bypassGovernanceRetention; } + inline bool BypassGovernanceRetentionHasBeenSet() const { return m_bypassGovernanceRetentionHasBeenSet; } + inline void SetBypassGovernanceRetention(bool value) { m_bypassGovernanceRetentionHasBeenSet = true; m_bypassGovernanceRetention = value; } + inline DeleteObjectsRequest& WithBypassGovernanceRetention(bool value) { SetBypassGovernanceRetention(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeleteObjectsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeleteObjectsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeleteObjectsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum-algorithm or x-amz-trailer + * header sent. Otherwise, Amazon S3 fails the request with the HTTP status code + * 400 Bad Request.

For the + * x-amz-checksum-algorithm header, replace + * algorithm with the supported algorithm from the following list: + *

  • CRC32

  • CRC32C + *

  • CRC64NVME

  • SHA1 + *

  • SHA256

For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

If the + * individual checksum value you provide through + * x-amz-checksum-algorithm doesn't match the checksum + * algorithm you set through x-amz-sdk-checksum-algorithm, Amazon S3 + * fails the request with a BadDigest error.

If you provide an + * individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline DeleteObjectsRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline DeleteObjectsRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeleteObjectsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeleteObjectsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeleteObjectsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeleteObjectsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteObjectsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteObjectsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeleteObjectsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeleteObjectsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeleteObjectsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Delete m_delete; + bool m_deleteHasBeenSet = false; + + Aws::String m_mFA; + bool m_mFAHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + bool m_bypassGovernanceRetention; + bool m_bypassGovernanceRetentionHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeletePublicAccessBlockRequest.h b/include/aws/s3/model/DeletePublicAccessBlockRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a39f5bb25a03818434f4b0efd51a167e48f0938e --- /dev/null +++ b/include/aws/s3/model/DeletePublicAccessBlockRequest.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class DeletePublicAccessBlockRequest : public S3Request + { + public: + AWS_S3_API DeletePublicAccessBlockRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeletePublicAccessBlock"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The Amazon S3 bucket whose PublicAccessBlock configuration you + * want to delete.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline DeletePublicAccessBlockRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline DeletePublicAccessBlockRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline DeletePublicAccessBlockRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline DeletePublicAccessBlockRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline DeletePublicAccessBlockRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline DeletePublicAccessBlockRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline DeletePublicAccessBlockRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline DeletePublicAccessBlockRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline DeletePublicAccessBlockRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline DeletePublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeletePublicAccessBlockRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeletePublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline DeletePublicAccessBlockRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline DeletePublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline DeletePublicAccessBlockRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/DeletedObject.h b/include/aws/s3/model/DeletedObject.h new file mode 100644 index 0000000000000000000000000000000000000000..24e90245d498fa80d86a6711e14ae8f5cd3c59e3 --- /dev/null +++ b/include/aws/s3/model/DeletedObject.h @@ -0,0 +1,118 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Information about the deleted object.

See Also:

AWS + * API Reference

+ */ + class DeletedObject + { + public: + AWS_S3_API DeletedObject(); + AWS_S3_API DeletedObject(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API DeletedObject& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The name of the deleted object.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline DeletedObject& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline DeletedObject& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline DeletedObject& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The version ID of the deleted object.

This functionality is not + * supported for directory buckets.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline DeletedObject& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline DeletedObject& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline DeletedObject& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the specified object version that was permanently deleted + * was (true) or was not (false) a delete marker before deletion. In a simple + * DELETE, this header indicates whether (true) or not (false) the current version + * of the object is a delete marker. To learn more about delete markers, see Working + * with delete markers.

This functionality is not supported for + * directory buckets.

+ */ + inline bool GetDeleteMarker() const{ return m_deleteMarker; } + inline bool DeleteMarkerHasBeenSet() const { return m_deleteMarkerHasBeenSet; } + inline void SetDeleteMarker(bool value) { m_deleteMarkerHasBeenSet = true; m_deleteMarker = value; } + inline DeletedObject& WithDeleteMarker(bool value) { SetDeleteMarker(value); return *this;} + ///@} + + ///@{ + /** + *

The version ID of the delete marker created as a result of the DELETE + * operation. If you delete a specific object version, the value returned by this + * header is the version ID of the object version deleted.

This + * functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetDeleteMarkerVersionId() const{ return m_deleteMarkerVersionId; } + inline bool DeleteMarkerVersionIdHasBeenSet() const { return m_deleteMarkerVersionIdHasBeenSet; } + inline void SetDeleteMarkerVersionId(const Aws::String& value) { m_deleteMarkerVersionIdHasBeenSet = true; m_deleteMarkerVersionId = value; } + inline void SetDeleteMarkerVersionId(Aws::String&& value) { m_deleteMarkerVersionIdHasBeenSet = true; m_deleteMarkerVersionId = std::move(value); } + inline void SetDeleteMarkerVersionId(const char* value) { m_deleteMarkerVersionIdHasBeenSet = true; m_deleteMarkerVersionId.assign(value); } + inline DeletedObject& WithDeleteMarkerVersionId(const Aws::String& value) { SetDeleteMarkerVersionId(value); return *this;} + inline DeletedObject& WithDeleteMarkerVersionId(Aws::String&& value) { SetDeleteMarkerVersionId(std::move(value)); return *this;} + inline DeletedObject& WithDeleteMarkerVersionId(const char* value) { SetDeleteMarkerVersionId(value); return *this;} + ///@} + private: + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + bool m_deleteMarker; + bool m_deleteMarkerHasBeenSet = false; + + Aws::String m_deleteMarkerVersionId; + bool m_deleteMarkerVersionIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Destination.h b/include/aws/s3/model/Destination.h new file mode 100644 index 0000000000000000000000000000000000000000..c024e792d00f1388da78fcf0f4b3efe36ce3d132 --- /dev/null +++ b/include/aws/s3/model/Destination.h @@ -0,0 +1,183 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies information about where to publish analysis or configuration + * results for an Amazon S3 bucket and S3 Replication Time Control (S3 + * RTC).

See Also:

AWS API + * Reference

+ */ + class Destination + { + public: + AWS_S3_API Destination(); + AWS_S3_API Destination(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Destination& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to + * store the results.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline Destination& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline Destination& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline Destination& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Destination bucket owner account ID. In a cross-account scenario, if you + * direct Amazon S3 to change replica ownership to the Amazon Web Services account + * that owns the destination bucket by specifying the + * AccessControlTranslation property, this is the account ID of the + * destination bucket owner. For more information, see Replication + * Additional Configuration: Changing the Replica Owner in the Amazon S3 + * User Guide.

+ */ + inline const Aws::String& GetAccount() const{ return m_account; } + inline bool AccountHasBeenSet() const { return m_accountHasBeenSet; } + inline void SetAccount(const Aws::String& value) { m_accountHasBeenSet = true; m_account = value; } + inline void SetAccount(Aws::String&& value) { m_accountHasBeenSet = true; m_account = std::move(value); } + inline void SetAccount(const char* value) { m_accountHasBeenSet = true; m_account.assign(value); } + inline Destination& WithAccount(const Aws::String& value) { SetAccount(value); return *this;} + inline Destination& WithAccount(Aws::String&& value) { SetAccount(std::move(value)); return *this;} + inline Destination& WithAccount(const char* value) { SetAccount(value); return *this;} + ///@} + + ///@{ + /** + *

The storage class to use when replicating objects, such as S3 Standard or + * reduced redundancy. By default, Amazon S3 uses the storage class of the source + * object to create the object replica.

For valid values, see the + * StorageClass element of the PUT + * Bucket replication action in the Amazon S3 API Reference.

+ */ + inline const StorageClass& GetStorageClass() const{ return m_storageClass; } + inline bool StorageClassHasBeenSet() const { return m_storageClassHasBeenSet; } + inline void SetStorageClass(const StorageClass& value) { m_storageClassHasBeenSet = true; m_storageClass = value; } + inline void SetStorageClass(StorageClass&& value) { m_storageClassHasBeenSet = true; m_storageClass = std::move(value); } + inline Destination& WithStorageClass(const StorageClass& value) { SetStorageClass(value); return *this;} + inline Destination& WithStorageClass(StorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specify this only in a cross-account scenario (where source and destination + * bucket owners are not the same), and you want to change replica ownership to the + * Amazon Web Services account that owns the destination bucket. If this is not + * specified in the replication configuration, the replicas are owned by same + * Amazon Web Services account that owns the source object.

+ */ + inline const AccessControlTranslation& GetAccessControlTranslation() const{ return m_accessControlTranslation; } + inline bool AccessControlTranslationHasBeenSet() const { return m_accessControlTranslationHasBeenSet; } + inline void SetAccessControlTranslation(const AccessControlTranslation& value) { m_accessControlTranslationHasBeenSet = true; m_accessControlTranslation = value; } + inline void SetAccessControlTranslation(AccessControlTranslation&& value) { m_accessControlTranslationHasBeenSet = true; m_accessControlTranslation = std::move(value); } + inline Destination& WithAccessControlTranslation(const AccessControlTranslation& value) { SetAccessControlTranslation(value); return *this;} + inline Destination& WithAccessControlTranslation(AccessControlTranslation&& value) { SetAccessControlTranslation(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A container that provides information about encryption. If + * SourceSelectionCriteria is specified, you must specify this + * element.

+ */ + inline const EncryptionConfiguration& GetEncryptionConfiguration() const{ return m_encryptionConfiguration; } + inline bool EncryptionConfigurationHasBeenSet() const { return m_encryptionConfigurationHasBeenSet; } + inline void SetEncryptionConfiguration(const EncryptionConfiguration& value) { m_encryptionConfigurationHasBeenSet = true; m_encryptionConfiguration = value; } + inline void SetEncryptionConfiguration(EncryptionConfiguration&& value) { m_encryptionConfigurationHasBeenSet = true; m_encryptionConfiguration = std::move(value); } + inline Destination& WithEncryptionConfiguration(const EncryptionConfiguration& value) { SetEncryptionConfiguration(value); return *this;} + inline Destination& WithEncryptionConfiguration(EncryptionConfiguration&& value) { SetEncryptionConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A container specifying S3 Replication Time Control (S3 RTC), including + * whether S3 RTC is enabled and the time when all objects and operations on + * objects must be replicated. Must be specified together with a + * Metrics block.

+ */ + inline const ReplicationTime& GetReplicationTime() const{ return m_replicationTime; } + inline bool ReplicationTimeHasBeenSet() const { return m_replicationTimeHasBeenSet; } + inline void SetReplicationTime(const ReplicationTime& value) { m_replicationTimeHasBeenSet = true; m_replicationTime = value; } + inline void SetReplicationTime(ReplicationTime&& value) { m_replicationTimeHasBeenSet = true; m_replicationTime = std::move(value); } + inline Destination& WithReplicationTime(const ReplicationTime& value) { SetReplicationTime(value); return *this;} + inline Destination& WithReplicationTime(ReplicationTime&& value) { SetReplicationTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A container specifying replication metrics-related settings enabling + * replication metrics and events.

+ */ + inline const Metrics& GetMetrics() const{ return m_metrics; } + inline bool MetricsHasBeenSet() const { return m_metricsHasBeenSet; } + inline void SetMetrics(const Metrics& value) { m_metricsHasBeenSet = true; m_metrics = value; } + inline void SetMetrics(Metrics&& value) { m_metricsHasBeenSet = true; m_metrics = std::move(value); } + inline Destination& WithMetrics(const Metrics& value) { SetMetrics(value); return *this;} + inline Destination& WithMetrics(Metrics&& value) { SetMetrics(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_account; + bool m_accountHasBeenSet = false; + + StorageClass m_storageClass; + bool m_storageClassHasBeenSet = false; + + AccessControlTranslation m_accessControlTranslation; + bool m_accessControlTranslationHasBeenSet = false; + + EncryptionConfiguration m_encryptionConfiguration; + bool m_encryptionConfigurationHasBeenSet = false; + + ReplicationTime m_replicationTime; + bool m_replicationTimeHasBeenSet = false; + + Metrics m_metrics; + bool m_metricsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/EventBridgeConfiguration.h b/include/aws/s3/model/EventBridgeConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..193108dcec95aa653683a8b2f5d414eb355326a8 --- /dev/null +++ b/include/aws/s3/model/EventBridgeConfiguration.h @@ -0,0 +1,42 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container for specifying the configuration for Amazon + * EventBridge.

See Also:

AWS + * API Reference

+ */ + class EventBridgeConfiguration + { + public: + AWS_S3_API EventBridgeConfiguration(); + AWS_S3_API EventBridgeConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API EventBridgeConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ExistingObjectReplication.h b/include/aws/s3/model/ExistingObjectReplication.h new file mode 100644 index 0000000000000000000000000000000000000000..3aa4e6fda79896b827181723f69b68d1d25537c0 --- /dev/null +++ b/include/aws/s3/model/ExistingObjectReplication.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Optional configuration to replicate existing source bucket objects.

+ *

This parameter is no longer supported. To replicate existing objects, + * see Replicating + * existing objects with S3 Batch Replication in the Amazon S3 User + * Guide.

See Also:

AWS + * API Reference

+ */ + class ExistingObjectReplication + { + public: + AWS_S3_API ExistingObjectReplication(); + AWS_S3_API ExistingObjectReplication(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ExistingObjectReplication& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies whether Amazon S3 replicates existing source bucket objects.

+ */ + inline const ExistingObjectReplicationStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const ExistingObjectReplicationStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(ExistingObjectReplicationStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline ExistingObjectReplication& WithStatus(const ExistingObjectReplicationStatus& value) { SetStatus(value); return *this;} + inline ExistingObjectReplication& WithStatus(ExistingObjectReplicationStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + ExistingObjectReplicationStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ExistingObjectReplicationStatus.h b/include/aws/s3/model/ExistingObjectReplicationStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..6aeab10028f24acd2c01fd8f6a469b90e3579000 --- /dev/null +++ b/include/aws/s3/model/ExistingObjectReplicationStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ExistingObjectReplicationStatus + { + NOT_SET, + Enabled, + Disabled + }; + +namespace ExistingObjectReplicationStatusMapper +{ +AWS_S3_API ExistingObjectReplicationStatus GetExistingObjectReplicationStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForExistingObjectReplicationStatus(ExistingObjectReplicationStatus value); +} // namespace ExistingObjectReplicationStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ExpirationStatus.h b/include/aws/s3/model/ExpirationStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..e9cbfe898b56d84af6e172711c5eba3c5b5aa6a3 --- /dev/null +++ b/include/aws/s3/model/ExpirationStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ExpirationStatus + { + NOT_SET, + Enabled, + Disabled + }; + +namespace ExpirationStatusMapper +{ +AWS_S3_API ExpirationStatus GetExpirationStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForExpirationStatus(ExpirationStatus value); +} // namespace ExpirationStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/FileHeaderInfo.h b/include/aws/s3/model/FileHeaderInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..33b267c9fc1ef1dad3ebcd84483c8793faf96bee --- /dev/null +++ b/include/aws/s3/model/FileHeaderInfo.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class FileHeaderInfo + { + NOT_SET, + USE, + IGNORE, + NONE + }; + +namespace FileHeaderInfoMapper +{ +AWS_S3_API FileHeaderInfo GetFileHeaderInfoForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForFileHeaderInfo(FileHeaderInfo value); +} // namespace FileHeaderInfoMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/FilterRule.h b/include/aws/s3/model/FilterRule.h new file mode 100644 index 0000000000000000000000000000000000000000..83803ac49780cf87b650647c6c6ca4f379d3cb74 --- /dev/null +++ b/include/aws/s3/model/FilterRule.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the Amazon S3 object key name to filter on. An object key name is + * the name assigned to an object in your Amazon S3 bucket. You specify whether to + * filter on the suffix or prefix of the object key name. A prefix is a specific + * string of characters at the beginning of an object key name, which you can use + * to organize objects. For example, you can start the key names of related objects + * with a prefix, such as 2023- or engineering/. Then, + * you can use FilterRule to find objects in a bucket with key names + * that have the same prefix. A suffix is similar to a prefix, but it is at the end + * of the object key name instead of at the beginning.

See Also:

+ * AWS + * API Reference

+ */ + class FilterRule + { + public: + AWS_S3_API FilterRule(); + AWS_S3_API FilterRule(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API FilterRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The object key name prefix or suffix identifying one or more objects to which + * the filtering rule applies. The maximum length is 1,024 characters. Overlapping + * prefixes and suffixes are not supported. For more information, see Configuring + * Event Notifications in the Amazon S3 User Guide.

+ */ + inline const FilterRuleName& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const FilterRuleName& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(FilterRuleName&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline FilterRule& WithName(const FilterRuleName& value) { SetName(value); return *this;} + inline FilterRule& WithName(FilterRuleName&& value) { SetName(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The value that the filter searches for in object key names.

+ */ + inline const Aws::String& GetValue() const{ return m_value; } + inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; } + inline void SetValue(const Aws::String& value) { m_valueHasBeenSet = true; m_value = value; } + inline void SetValue(Aws::String&& value) { m_valueHasBeenSet = true; m_value = std::move(value); } + inline void SetValue(const char* value) { m_valueHasBeenSet = true; m_value.assign(value); } + inline FilterRule& WithValue(const Aws::String& value) { SetValue(value); return *this;} + inline FilterRule& WithValue(Aws::String&& value) { SetValue(std::move(value)); return *this;} + inline FilterRule& WithValue(const char* value) { SetValue(value); return *this;} + ///@} + private: + + FilterRuleName m_name; + bool m_nameHasBeenSet = false; + + Aws::String m_value; + bool m_valueHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/FilterRuleName.h b/include/aws/s3/model/FilterRuleName.h new file mode 100644 index 0000000000000000000000000000000000000000..b3bf232e800afc99d2a2f2671a712492f133c89d --- /dev/null +++ b/include/aws/s3/model/FilterRuleName.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class FilterRuleName + { + NOT_SET, + prefix, + suffix + }; + +namespace FilterRuleNameMapper +{ +AWS_S3_API FilterRuleName GetFilterRuleNameForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForFilterRuleName(FilterRuleName value); +} // namespace FilterRuleNameMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketAccelerateConfigurationRequest.h b/include/aws/s3/model/GetBucketAccelerateConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a2c4be26708ab61b7042a6292fbe19cab36858d3 --- /dev/null +++ b/include/aws/s3/model/GetBucketAccelerateConfigurationRequest.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketAccelerateConfigurationRequest : public S3Request + { + public: + AWS_S3_API GetBucketAccelerateConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketAccelerateConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket for which the accelerate configuration is + * retrieved.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketAccelerateConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketAccelerateConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketAccelerateConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketAccelerateConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketAccelerateConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketAccelerateConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline GetBucketAccelerateConfigurationRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline GetBucketAccelerateConfigurationRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketAccelerateConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketAccelerateConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketAccelerateConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketAccelerateConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketAccelerateConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketAccelerateConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketAccelerateConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketAccelerateConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketAccelerateConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketAclResult.h b/include/aws/s3/model/GetBucketAclResult.h new file mode 100644 index 0000000000000000000000000000000000000000..1fe6db83c70835f03b153ed5e7836f98182549e5 --- /dev/null +++ b/include/aws/s3/model/GetBucketAclResult.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketAclResult + { + public: + AWS_S3_API GetBucketAclResult(); + AWS_S3_API GetBucketAclResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketAclResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Container for the bucket owner's display name and ID.

+ */ + inline const Owner& GetOwner() const{ return m_owner; } + inline void SetOwner(const Owner& value) { m_owner = value; } + inline void SetOwner(Owner&& value) { m_owner = std::move(value); } + inline GetBucketAclResult& WithOwner(const Owner& value) { SetOwner(value); return *this;} + inline GetBucketAclResult& WithOwner(Owner&& value) { SetOwner(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A list of grants.

+ */ + inline const Aws::Vector& GetGrants() const{ return m_grants; } + inline void SetGrants(const Aws::Vector& value) { m_grants = value; } + inline void SetGrants(Aws::Vector&& value) { m_grants = std::move(value); } + inline GetBucketAclResult& WithGrants(const Aws::Vector& value) { SetGrants(value); return *this;} + inline GetBucketAclResult& WithGrants(Aws::Vector&& value) { SetGrants(std::move(value)); return *this;} + inline GetBucketAclResult& AddGrants(const Grant& value) { m_grants.push_back(value); return *this; } + inline GetBucketAclResult& AddGrants(Grant&& value) { m_grants.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketAclResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketAclResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketAclResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Owner m_owner; + + Aws::Vector m_grants; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketAnalyticsConfigurationRequest.h b/include/aws/s3/model/GetBucketAnalyticsConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..81471bd9a3b0031bd8a8a2191fcd1c386697d8c3 --- /dev/null +++ b/include/aws/s3/model/GetBucketAnalyticsConfigurationRequest.h @@ -0,0 +1,127 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketAnalyticsConfigurationRequest : public S3Request + { + public: + AWS_S3_API GetBucketAnalyticsConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketAnalyticsConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket from which an analytics configuration is + * retrieved.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketAnalyticsConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketAnalyticsConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketAnalyticsConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The ID that identifies the analytics configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline GetBucketAnalyticsConfigurationRequest& WithId(const Aws::String& value) { SetId(value); return *this;} + inline GetBucketAnalyticsConfigurationRequest& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline GetBucketAnalyticsConfigurationRequest& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketAnalyticsConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketAnalyticsConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketAnalyticsConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketAnalyticsConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketAnalyticsConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketAnalyticsConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketCorsResult.h b/include/aws/s3/model/GetBucketCorsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..54d3dc9cbb1791e9cd8636566b5ff2dc94bba168 --- /dev/null +++ b/include/aws/s3/model/GetBucketCorsResult.h @@ -0,0 +1,70 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketCorsResult + { + public: + AWS_S3_API GetBucketCorsResult(); + AWS_S3_API GetBucketCorsResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketCorsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A set of origins and methods (cross-origin access that you want to allow). + * You can add up to 100 rules to the configuration.

+ */ + inline const Aws::Vector& GetCORSRules() const{ return m_cORSRules; } + inline void SetCORSRules(const Aws::Vector& value) { m_cORSRules = value; } + inline void SetCORSRules(Aws::Vector&& value) { m_cORSRules = std::move(value); } + inline GetBucketCorsResult& WithCORSRules(const Aws::Vector& value) { SetCORSRules(value); return *this;} + inline GetBucketCorsResult& WithCORSRules(Aws::Vector&& value) { SetCORSRules(std::move(value)); return *this;} + inline GetBucketCorsResult& AddCORSRules(const CORSRule& value) { m_cORSRules.push_back(value); return *this; } + inline GetBucketCorsResult& AddCORSRules(CORSRule&& value) { m_cORSRules.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketCorsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketCorsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketCorsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_cORSRules; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketEncryptionRequest.h b/include/aws/s3/model/GetBucketEncryptionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..053047468235dde076e796681959c26b047e39f3 --- /dev/null +++ b/include/aws/s3/model/GetBucketEncryptionRequest.h @@ -0,0 +1,123 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketEncryptionRequest : public S3Request + { + public: + AWS_S3_API GetBucketEncryptionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketEncryption"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket from which the server-side encryption configuration is + * retrieved.

Directory buckets - When you use this operation with + * a directory bucket, you must use path-style requests in the format + * https://s3express-control.region-code.amazonaws.com/bucket-name + * . Virtual-hosted-style requests aren't supported. Directory bucket names + * must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket + * names must also follow the format + * bucket-base-name--zone-id--x-s3 (for example, + * DOC-EXAMPLE-BUCKET--usw2-az1--x-s3). For information about + * bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketEncryptionRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketEncryptionRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketEncryptionRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ *

For directory buckets, this header is not supported in this API operation. If + * you specify this header, the request fails with the HTTP status code 501 + * Not Implemented.

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketEncryptionRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketEncryptionRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketEncryptionRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketEncryptionRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketEncryptionRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketEncryptionRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketEncryptionRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketEncryptionRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketEncryptionRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketEncryptionRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketEncryptionRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketEncryptionRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketEncryptionResult.h b/include/aws/s3/model/GetBucketEncryptionResult.h new file mode 100644 index 0000000000000000000000000000000000000000..11309d9275a2ccbc65b5448c153251043243f729 --- /dev/null +++ b/include/aws/s3/model/GetBucketEncryptionResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketEncryptionResult + { + public: + AWS_S3_API GetBucketEncryptionResult(); + AWS_S3_API GetBucketEncryptionResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketEncryptionResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ServerSideEncryptionConfiguration& GetServerSideEncryptionConfiguration() const{ return m_serverSideEncryptionConfiguration; } + inline void SetServerSideEncryptionConfiguration(const ServerSideEncryptionConfiguration& value) { m_serverSideEncryptionConfiguration = value; } + inline void SetServerSideEncryptionConfiguration(ServerSideEncryptionConfiguration&& value) { m_serverSideEncryptionConfiguration = std::move(value); } + inline GetBucketEncryptionResult& WithServerSideEncryptionConfiguration(const ServerSideEncryptionConfiguration& value) { SetServerSideEncryptionConfiguration(value); return *this;} + inline GetBucketEncryptionResult& WithServerSideEncryptionConfiguration(ServerSideEncryptionConfiguration&& value) { SetServerSideEncryptionConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketEncryptionResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketEncryptionResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketEncryptionResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ServerSideEncryptionConfiguration m_serverSideEncryptionConfiguration; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketIntelligentTieringConfigurationResult.h b/include/aws/s3/model/GetBucketIntelligentTieringConfigurationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c4f0b5c17619631c7392549b6570a7bbe51b561c --- /dev/null +++ b/include/aws/s3/model/GetBucketIntelligentTieringConfigurationResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketIntelligentTieringConfigurationResult + { + public: + AWS_S3_API GetBucketIntelligentTieringConfigurationResult(); + AWS_S3_API GetBucketIntelligentTieringConfigurationResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketIntelligentTieringConfigurationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Container for S3 Intelligent-Tiering configuration.

+ */ + inline const IntelligentTieringConfiguration& GetIntelligentTieringConfiguration() const{ return m_intelligentTieringConfiguration; } + inline void SetIntelligentTieringConfiguration(const IntelligentTieringConfiguration& value) { m_intelligentTieringConfiguration = value; } + inline void SetIntelligentTieringConfiguration(IntelligentTieringConfiguration&& value) { m_intelligentTieringConfiguration = std::move(value); } + inline GetBucketIntelligentTieringConfigurationResult& WithIntelligentTieringConfiguration(const IntelligentTieringConfiguration& value) { SetIntelligentTieringConfiguration(value); return *this;} + inline GetBucketIntelligentTieringConfigurationResult& WithIntelligentTieringConfiguration(IntelligentTieringConfiguration&& value) { SetIntelligentTieringConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketIntelligentTieringConfigurationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketIntelligentTieringConfigurationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketIntelligentTieringConfigurationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + IntelligentTieringConfiguration m_intelligentTieringConfiguration; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketInventoryConfigurationRequest.h b/include/aws/s3/model/GetBucketInventoryConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f2bec6f0bce4237be2ce0fee0b5d1093d90a989e --- /dev/null +++ b/include/aws/s3/model/GetBucketInventoryConfigurationRequest.h @@ -0,0 +1,127 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketInventoryConfigurationRequest : public S3Request + { + public: + AWS_S3_API GetBucketInventoryConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketInventoryConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket containing the inventory configuration to + * retrieve.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketInventoryConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketInventoryConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketInventoryConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The ID used to identify the inventory configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline GetBucketInventoryConfigurationRequest& WithId(const Aws::String& value) { SetId(value); return *this;} + inline GetBucketInventoryConfigurationRequest& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline GetBucketInventoryConfigurationRequest& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketInventoryConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketInventoryConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketInventoryConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketInventoryConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketInventoryConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketMetadataTableConfigurationRequest.h b/include/aws/s3/model/GetBucketMetadataTableConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..648de524966484dff06152d1415ba144ed3f8be9 --- /dev/null +++ b/include/aws/s3/model/GetBucketMetadataTableConfigurationRequest.h @@ -0,0 +1,108 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketMetadataTableConfigurationRequest : public S3Request + { + public: + AWS_S3_API GetBucketMetadataTableConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketMetadataTableConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The general purpose bucket that contains the metadata table configuration + * that you want to retrieve.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketMetadataTableConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketMetadataTableConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketMetadataTableConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The expected owner of the general purpose bucket that you want to retrieve + * the metadata table configuration from.

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketMetadataTableConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketMetadataTableConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketMetadataTableConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketMetadataTableConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketMetadataTableConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketMetadataTableConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketMetadataTableConfigurationSdkResult.h b/include/aws/s3/model/GetBucketMetadataTableConfigurationSdkResult.h new file mode 100644 index 0000000000000000000000000000000000000000..64d7df6b6194ac5e67e1f1118fc7d24cd0328060 --- /dev/null +++ b/include/aws/s3/model/GetBucketMetadataTableConfigurationSdkResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketMetadataTableConfigurationSdkResult + { + public: + AWS_S3_API GetBucketMetadataTableConfigurationSdkResult(); + AWS_S3_API GetBucketMetadataTableConfigurationSdkResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketMetadataTableConfigurationSdkResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The metadata table configuration for the general purpose bucket.

+ */ + inline const GetBucketMetadataTableConfigurationResult& GetGetBucketMetadataTableConfigurationResult() const{ return m_getBucketMetadataTableConfigurationResult; } + inline void SetGetBucketMetadataTableConfigurationResult(const GetBucketMetadataTableConfigurationResult& value) { m_getBucketMetadataTableConfigurationResult = value; } + inline void SetGetBucketMetadataTableConfigurationResult(GetBucketMetadataTableConfigurationResult&& value) { m_getBucketMetadataTableConfigurationResult = std::move(value); } + inline GetBucketMetadataTableConfigurationSdkResult& WithGetBucketMetadataTableConfigurationResult(const GetBucketMetadataTableConfigurationResult& value) { SetGetBucketMetadataTableConfigurationResult(value); return *this;} + inline GetBucketMetadataTableConfigurationSdkResult& WithGetBucketMetadataTableConfigurationResult(GetBucketMetadataTableConfigurationResult&& value) { SetGetBucketMetadataTableConfigurationResult(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketMetadataTableConfigurationSdkResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketMetadataTableConfigurationSdkResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketMetadataTableConfigurationSdkResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + GetBucketMetadataTableConfigurationResult m_getBucketMetadataTableConfigurationResult; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketMetricsConfigurationResult.h b/include/aws/s3/model/GetBucketMetricsConfigurationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..40199695f17f19373bfc6c60b3d4aa72d5f1d110 --- /dev/null +++ b/include/aws/s3/model/GetBucketMetricsConfigurationResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketMetricsConfigurationResult + { + public: + AWS_S3_API GetBucketMetricsConfigurationResult(); + AWS_S3_API GetBucketMetricsConfigurationResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketMetricsConfigurationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Specifies the metrics configuration.

+ */ + inline const MetricsConfiguration& GetMetricsConfiguration() const{ return m_metricsConfiguration; } + inline void SetMetricsConfiguration(const MetricsConfiguration& value) { m_metricsConfiguration = value; } + inline void SetMetricsConfiguration(MetricsConfiguration&& value) { m_metricsConfiguration = std::move(value); } + inline GetBucketMetricsConfigurationResult& WithMetricsConfiguration(const MetricsConfiguration& value) { SetMetricsConfiguration(value); return *this;} + inline GetBucketMetricsConfigurationResult& WithMetricsConfiguration(MetricsConfiguration&& value) { SetMetricsConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketMetricsConfigurationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketMetricsConfigurationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketMetricsConfigurationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + MetricsConfiguration m_metricsConfiguration; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketNotificationConfigurationRequest.h b/include/aws/s3/model/GetBucketNotificationConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1e02701fa4f97a9354dc4aefe36604870209b07c --- /dev/null +++ b/include/aws/s3/model/GetBucketNotificationConfigurationRequest.h @@ -0,0 +1,118 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketNotificationConfigurationRequest : public S3Request + { + public: + AWS_S3_API GetBucketNotificationConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketNotificationConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket for which to get the notification configuration.

+ *

When you use this API operation with an access point, provide the alias of + * the access point in place of the bucket name.

When you use this API + * operation with an Object Lambda access point, provide the alias of the Object + * Lambda access point in place of the bucket name. If the Object Lambda access + * point alias in a request is not valid, the error code + * InvalidAccessPointAliasError is returned. For more information + * about InvalidAccessPointAliasError, see List + * of Error Codes.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketNotificationConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketNotificationConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketNotificationConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketNotificationConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketNotificationConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketNotificationConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketNotificationConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketNotificationConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketOwnershipControlsRequest.h b/include/aws/s3/model/GetBucketOwnershipControlsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a78b35452ffb87b6a5b7bfd9a473e01aed133866 --- /dev/null +++ b/include/aws/s3/model/GetBucketOwnershipControlsRequest.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketOwnershipControlsRequest : public S3Request + { + public: + AWS_S3_API GetBucketOwnershipControlsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketOwnershipControls"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the Amazon S3 bucket whose OwnershipControls you + * want to retrieve.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketOwnershipControlsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketOwnershipControlsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketOwnershipControlsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketOwnershipControlsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketOwnershipControlsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketOwnershipControlsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketOwnershipControlsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketOwnershipControlsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketOwnershipControlsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketRequestPaymentRequest.h b/include/aws/s3/model/GetBucketRequestPaymentRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..41b88dd18fe9e7768118828e948e52e7f6f089b5 --- /dev/null +++ b/include/aws/s3/model/GetBucketRequestPaymentRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketRequestPaymentRequest : public S3Request + { + public: + AWS_S3_API GetBucketRequestPaymentRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketRequestPayment"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket for which to get the payment request configuration

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketRequestPaymentRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketRequestPaymentRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketRequestPaymentRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketRequestPaymentRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketRequestPaymentRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketRequestPaymentRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketRequestPaymentRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketRequestPaymentRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketRequestPaymentRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketRequestPaymentRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketRequestPaymentRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketRequestPaymentResult.h b/include/aws/s3/model/GetBucketRequestPaymentResult.h new file mode 100644 index 0000000000000000000000000000000000000000..31cc59676947efa3bd8469dbba5eb33ac661d8ba --- /dev/null +++ b/include/aws/s3/model/GetBucketRequestPaymentResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketRequestPaymentResult + { + public: + AWS_S3_API GetBucketRequestPaymentResult(); + AWS_S3_API GetBucketRequestPaymentResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketRequestPaymentResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Specifies who pays for the download and request fees.

+ */ + inline const Payer& GetPayer() const{ return m_payer; } + inline void SetPayer(const Payer& value) { m_payer = value; } + inline void SetPayer(Payer&& value) { m_payer = std::move(value); } + inline GetBucketRequestPaymentResult& WithPayer(const Payer& value) { SetPayer(value); return *this;} + inline GetBucketRequestPaymentResult& WithPayer(Payer&& value) { SetPayer(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketRequestPaymentResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketRequestPaymentResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketRequestPaymentResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Payer m_payer; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketTaggingRequest.h b/include/aws/s3/model/GetBucketTaggingRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c3fea18617226fe35fa52090a6b401ba1a1a9a85 --- /dev/null +++ b/include/aws/s3/model/GetBucketTaggingRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketTaggingRequest : public S3Request + { + public: + AWS_S3_API GetBucketTaggingRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketTagging"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket for which to get the tagging information.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketTaggingRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketTaggingRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketTaggingRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketTaggingRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketTaggingRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketTaggingRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketTaggingRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketTaggingRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketTaggingResult.h b/include/aws/s3/model/GetBucketTaggingResult.h new file mode 100644 index 0000000000000000000000000000000000000000..590025785b762c92378bc6f363f65147d8432121 --- /dev/null +++ b/include/aws/s3/model/GetBucketTaggingResult.h @@ -0,0 +1,69 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketTaggingResult + { + public: + AWS_S3_API GetBucketTaggingResult(); + AWS_S3_API GetBucketTaggingResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketTaggingResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Contains the tag set.

+ */ + inline const Aws::Vector& GetTagSet() const{ return m_tagSet; } + inline void SetTagSet(const Aws::Vector& value) { m_tagSet = value; } + inline void SetTagSet(Aws::Vector&& value) { m_tagSet = std::move(value); } + inline GetBucketTaggingResult& WithTagSet(const Aws::Vector& value) { SetTagSet(value); return *this;} + inline GetBucketTaggingResult& WithTagSet(Aws::Vector&& value) { SetTagSet(std::move(value)); return *this;} + inline GetBucketTaggingResult& AddTagSet(const Tag& value) { m_tagSet.push_back(value); return *this; } + inline GetBucketTaggingResult& AddTagSet(Tag&& value) { m_tagSet.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketTaggingResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketTaggingResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketTaggingResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_tagSet; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketVersioningRequest.h b/include/aws/s3/model/GetBucketVersioningRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..22ab6e23e3c565c0ce6fcd626d712f4d8322749b --- /dev/null +++ b/include/aws/s3/model/GetBucketVersioningRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketVersioningRequest : public S3Request + { + public: + AWS_S3_API GetBucketVersioningRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketVersioning"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket for which to get the versioning information.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketVersioningRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketVersioningRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketVersioningRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketVersioningRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketVersioningRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketVersioningRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketVersioningRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketVersioningRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketVersioningRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketVersioningRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketVersioningRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketVersioningRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketVersioningRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketVersioningRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketVersioningRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketVersioningResult.h b/include/aws/s3/model/GetBucketVersioningResult.h new file mode 100644 index 0000000000000000000000000000000000000000..b9ae32e49b65eca3617acc9e010daa654a945b51 --- /dev/null +++ b/include/aws/s3/model/GetBucketVersioningResult.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketVersioningResult + { + public: + AWS_S3_API GetBucketVersioningResult(); + AWS_S3_API GetBucketVersioningResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketVersioningResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The versioning state of the bucket.

+ */ + inline const BucketVersioningStatus& GetStatus() const{ return m_status; } + inline void SetStatus(const BucketVersioningStatus& value) { m_status = value; } + inline void SetStatus(BucketVersioningStatus&& value) { m_status = std::move(value); } + inline GetBucketVersioningResult& WithStatus(const BucketVersioningStatus& value) { SetStatus(value); return *this;} + inline GetBucketVersioningResult& WithStatus(BucketVersioningStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether MFA delete is enabled in the bucket versioning + * configuration. This element is only returned if the bucket has been configured + * with MFA delete. If the bucket has never been so configured, this element is not + * returned.

+ */ + inline const MFADeleteStatus& GetMFADelete() const{ return m_mFADelete; } + inline void SetMFADelete(const MFADeleteStatus& value) { m_mFADelete = value; } + inline void SetMFADelete(MFADeleteStatus&& value) { m_mFADelete = std::move(value); } + inline GetBucketVersioningResult& WithMFADelete(const MFADeleteStatus& value) { SetMFADelete(value); return *this;} + inline GetBucketVersioningResult& WithMFADelete(MFADeleteStatus&& value) { SetMFADelete(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketVersioningResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketVersioningResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketVersioningResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + BucketVersioningStatus m_status; + + MFADeleteStatus m_mFADelete; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketWebsiteRequest.h b/include/aws/s3/model/GetBucketWebsiteRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..8a8cf027edb0d14e291cfd21f6287396a69f2854 --- /dev/null +++ b/include/aws/s3/model/GetBucketWebsiteRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetBucketWebsiteRequest : public S3Request + { + public: + AWS_S3_API GetBucketWebsiteRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetBucketWebsite"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name for which to get the website configuration.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetBucketWebsiteRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetBucketWebsiteRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetBucketWebsiteRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetBucketWebsiteRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetBucketWebsiteRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetBucketWebsiteRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetBucketWebsiteRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetBucketWebsiteRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetBucketWebsiteRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketWebsiteRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetBucketWebsiteRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetBucketWebsiteRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetBucketWebsiteResult.h b/include/aws/s3/model/GetBucketWebsiteResult.h new file mode 100644 index 0000000000000000000000000000000000000000..ff83eab55d2e8d191086508f1a010f39ca1ba7fc --- /dev/null +++ b/include/aws/s3/model/GetBucketWebsiteResult.h @@ -0,0 +1,114 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetBucketWebsiteResult + { + public: + AWS_S3_API GetBucketWebsiteResult(); + AWS_S3_API GetBucketWebsiteResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetBucketWebsiteResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Specifies the redirect behavior of all requests to a website endpoint of an + * Amazon S3 bucket.

+ */ + inline const RedirectAllRequestsTo& GetRedirectAllRequestsTo() const{ return m_redirectAllRequestsTo; } + inline void SetRedirectAllRequestsTo(const RedirectAllRequestsTo& value) { m_redirectAllRequestsTo = value; } + inline void SetRedirectAllRequestsTo(RedirectAllRequestsTo&& value) { m_redirectAllRequestsTo = std::move(value); } + inline GetBucketWebsiteResult& WithRedirectAllRequestsTo(const RedirectAllRequestsTo& value) { SetRedirectAllRequestsTo(value); return *this;} + inline GetBucketWebsiteResult& WithRedirectAllRequestsTo(RedirectAllRequestsTo&& value) { SetRedirectAllRequestsTo(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The name of the index document for the website (for example + * index.html).

+ */ + inline const IndexDocument& GetIndexDocument() const{ return m_indexDocument; } + inline void SetIndexDocument(const IndexDocument& value) { m_indexDocument = value; } + inline void SetIndexDocument(IndexDocument&& value) { m_indexDocument = std::move(value); } + inline GetBucketWebsiteResult& WithIndexDocument(const IndexDocument& value) { SetIndexDocument(value); return *this;} + inline GetBucketWebsiteResult& WithIndexDocument(IndexDocument&& value) { SetIndexDocument(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The object key name of the website error document to use for 4XX class + * errors.

+ */ + inline const ErrorDocument& GetErrorDocument() const{ return m_errorDocument; } + inline void SetErrorDocument(const ErrorDocument& value) { m_errorDocument = value; } + inline void SetErrorDocument(ErrorDocument&& value) { m_errorDocument = std::move(value); } + inline GetBucketWebsiteResult& WithErrorDocument(const ErrorDocument& value) { SetErrorDocument(value); return *this;} + inline GetBucketWebsiteResult& WithErrorDocument(ErrorDocument&& value) { SetErrorDocument(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Rules that define when a redirect is applied and the redirect behavior.

+ */ + inline const Aws::Vector& GetRoutingRules() const{ return m_routingRules; } + inline void SetRoutingRules(const Aws::Vector& value) { m_routingRules = value; } + inline void SetRoutingRules(Aws::Vector&& value) { m_routingRules = std::move(value); } + inline GetBucketWebsiteResult& WithRoutingRules(const Aws::Vector& value) { SetRoutingRules(value); return *this;} + inline GetBucketWebsiteResult& WithRoutingRules(Aws::Vector&& value) { SetRoutingRules(std::move(value)); return *this;} + inline GetBucketWebsiteResult& AddRoutingRules(const RoutingRule& value) { m_routingRules.push_back(value); return *this; } + inline GetBucketWebsiteResult& AddRoutingRules(RoutingRule&& value) { m_routingRules.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetBucketWebsiteResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetBucketWebsiteResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetBucketWebsiteResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RedirectAllRequestsTo m_redirectAllRequestsTo; + + IndexDocument m_indexDocument; + + ErrorDocument m_errorDocument; + + Aws::Vector m_routingRules; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectAttributesRequest.h b/include/aws/s3/model/GetObjectAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..554bc24106b60e42c7e57c3d1a960fdfb3f783da --- /dev/null +++ b/include/aws/s3/model/GetObjectAttributesRequest.h @@ -0,0 +1,299 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetObjectAttributesRequest : public S3Request + { + public: + AWS_S3_API GetObjectAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetObjectAttributes"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket that contains the object.

Directory + * buckets - When you use this operation with a directory bucket, you must use + * virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetObjectAttributesRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetObjectAttributesRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetObjectAttributesRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The object key.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline GetObjectAttributesRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline GetObjectAttributesRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline GetObjectAttributesRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The version ID used to reference a specific version of the object.

+ *

S3 Versioning isn't enabled and supported for directory buckets. For this API + * operation, only the null value of the version ID is supported by + * directory buckets. You can only specify null to the + * versionId query parameter in the request.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline GetObjectAttributesRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline GetObjectAttributesRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline GetObjectAttributesRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the maximum number of parts to return.

+ */ + inline int GetMaxParts() const{ return m_maxParts; } + inline bool MaxPartsHasBeenSet() const { return m_maxPartsHasBeenSet; } + inline void SetMaxParts(int value) { m_maxPartsHasBeenSet = true; m_maxParts = value; } + inline GetObjectAttributesRequest& WithMaxParts(int value) { SetMaxParts(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the part after which listing should begin. Only parts with higher + * part numbers will be listed.

+ */ + inline int GetPartNumberMarker() const{ return m_partNumberMarker; } + inline bool PartNumberMarkerHasBeenSet() const { return m_partNumberMarkerHasBeenSet; } + inline void SetPartNumberMarker(int value) { m_partNumberMarkerHasBeenSet = true; m_partNumberMarker = value; } + inline GetObjectAttributesRequest& WithPartNumberMarker(int value) { SetPartNumberMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the algorithm to use when encrypting the object (for example, + * AES256).

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline bool SSECustomerAlgorithmHasBeenSet() const { return m_sSECustomerAlgorithmHasBeenSet; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm.assign(value); } + inline GetObjectAttributesRequest& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline GetObjectAttributesRequest& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline GetObjectAttributesRequest& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the customer-provided encryption key for Amazon S3 to use in + * encrypting data. This value is used to store the object and then it is + * discarded; Amazon S3 does not store the encryption key. The key must be + * appropriate for use with the algorithm specified in the + * x-amz-server-side-encryption-customer-algorithm header.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKey() const{ return m_sSECustomerKey; } + inline bool SSECustomerKeyHasBeenSet() const { return m_sSECustomerKeyHasBeenSet; } + inline void SetSSECustomerKey(const Aws::String& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = value; } + inline void SetSSECustomerKey(Aws::String&& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = std::move(value); } + inline void SetSSECustomerKey(const char* value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey.assign(value); } + inline GetObjectAttributesRequest& WithSSECustomerKey(const Aws::String& value) { SetSSECustomerKey(value); return *this;} + inline GetObjectAttributesRequest& WithSSECustomerKey(Aws::String&& value) { SetSSECustomerKey(std::move(value)); return *this;} + inline GetObjectAttributesRequest& WithSSECustomerKey(const char* value) { SetSSECustomerKey(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + * Amazon S3 uses this header for a message integrity check to ensure that the + * encryption key was transmitted without error.

This functionality + * is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline bool SSECustomerKeyMD5HasBeenSet() const { return m_sSECustomerKeyMD5HasBeenSet; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5.assign(value); } + inline GetObjectAttributesRequest& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline GetObjectAttributesRequest& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline GetObjectAttributesRequest& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline GetObjectAttributesRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline GetObjectAttributesRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetObjectAttributesRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetObjectAttributesRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetObjectAttributesRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the fields at the root level that you want returned in the + * response. Fields that you do not specify are not returned.

+ */ + inline const Aws::Vector& GetObjectAttributes() const{ return m_objectAttributes; } + inline bool ObjectAttributesHasBeenSet() const { return m_objectAttributesHasBeenSet; } + inline void SetObjectAttributes(const Aws::Vector& value) { m_objectAttributesHasBeenSet = true; m_objectAttributes = value; } + inline void SetObjectAttributes(Aws::Vector&& value) { m_objectAttributesHasBeenSet = true; m_objectAttributes = std::move(value); } + inline GetObjectAttributesRequest& WithObjectAttributes(const Aws::Vector& value) { SetObjectAttributes(value); return *this;} + inline GetObjectAttributesRequest& WithObjectAttributes(Aws::Vector&& value) { SetObjectAttributes(std::move(value)); return *this;} + inline GetObjectAttributesRequest& AddObjectAttributes(const ObjectAttributes& value) { m_objectAttributesHasBeenSet = true; m_objectAttributes.push_back(value); return *this; } + inline GetObjectAttributesRequest& AddObjectAttributes(ObjectAttributes&& value) { m_objectAttributesHasBeenSet = true; m_objectAttributes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetObjectAttributesRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetObjectAttributesRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetObjectAttributesRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetObjectAttributesRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetObjectAttributesRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetObjectAttributesRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetObjectAttributesRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetObjectAttributesRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetObjectAttributesRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + int m_maxParts; + bool m_maxPartsHasBeenSet = false; + + int m_partNumberMarker; + bool m_partNumberMarkerHasBeenSet = false; + + Aws::String m_sSECustomerAlgorithm; + bool m_sSECustomerAlgorithmHasBeenSet = false; + + Aws::String m_sSECustomerKey; + bool m_sSECustomerKeyHasBeenSet = false; + + Aws::String m_sSECustomerKeyMD5; + bool m_sSECustomerKeyMD5HasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Vector m_objectAttributes; + bool m_objectAttributesHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectAttributesResult.h b/include/aws/s3/model/GetObjectAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..5b758e18db7f9457fcab24a646ec180a43a58eca --- /dev/null +++ b/include/aws/s3/model/GetObjectAttributesResult.h @@ -0,0 +1,186 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetObjectAttributesResult + { + public: + AWS_S3_API GetObjectAttributesResult(); + AWS_S3_API GetObjectAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetObjectAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Specifies whether the object retrieved was (true) or was not + * (false) a delete marker. If false, this response + * header does not appear in the response. To learn more about delete markers, see + * Working + * with delete markers.

This functionality is not supported for + * directory buckets.

+ */ + inline bool GetDeleteMarker() const{ return m_deleteMarker; } + inline void SetDeleteMarker(bool value) { m_deleteMarker = value; } + inline GetObjectAttributesResult& WithDeleteMarker(bool value) { SetDeleteMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Date and time when the object was last modified.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModified = std::move(value); } + inline GetObjectAttributesResult& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline GetObjectAttributesResult& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The version ID of the object.

This functionality is not + * supported for directory buckets.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline void SetVersionId(const Aws::String& value) { m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionId.assign(value); } + inline GetObjectAttributesResult& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline GetObjectAttributesResult& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline GetObjectAttributesResult& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline GetObjectAttributesResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline GetObjectAttributesResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An ETag is an opaque identifier assigned by a web server to a specific + * version of a resource found at a URL.

+ */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline void SetETag(const Aws::String& value) { m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTag.assign(value); } + inline GetObjectAttributesResult& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline GetObjectAttributesResult& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline GetObjectAttributesResult& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

The checksum or digest of the object.

+ */ + inline const Checksum& GetChecksum() const{ return m_checksum; } + inline void SetChecksum(const Checksum& value) { m_checksum = value; } + inline void SetChecksum(Checksum&& value) { m_checksum = std::move(value); } + inline GetObjectAttributesResult& WithChecksum(const Checksum& value) { SetChecksum(value); return *this;} + inline GetObjectAttributesResult& WithChecksum(Checksum&& value) { SetChecksum(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A collection of parts associated with a multipart upload.

+ */ + inline const GetObjectAttributesParts& GetObjectParts() const{ return m_objectParts; } + inline void SetObjectParts(const GetObjectAttributesParts& value) { m_objectParts = value; } + inline void SetObjectParts(GetObjectAttributesParts&& value) { m_objectParts = std::move(value); } + inline GetObjectAttributesResult& WithObjectParts(const GetObjectAttributesParts& value) { SetObjectParts(value); return *this;} + inline GetObjectAttributesResult& WithObjectParts(GetObjectAttributesParts&& value) { SetObjectParts(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Provides the storage class information of the object. Amazon S3 returns this + * header for all objects except for S3 Standard storage class objects.

For + * more information, see Storage + * Classes.

Directory buckets - Only the S3 Express One + * Zone storage class is supported by directory buckets to store objects.

+ * + */ + inline const StorageClass& GetStorageClass() const{ return m_storageClass; } + inline void SetStorageClass(const StorageClass& value) { m_storageClass = value; } + inline void SetStorageClass(StorageClass&& value) { m_storageClass = std::move(value); } + inline GetObjectAttributesResult& WithStorageClass(const StorageClass& value) { SetStorageClass(value); return *this;} + inline GetObjectAttributesResult& WithStorageClass(StorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The size of the object in bytes.

+ */ + inline long long GetObjectSize() const{ return m_objectSize; } + inline void SetObjectSize(long long value) { m_objectSize = value; } + inline GetObjectAttributesResult& WithObjectSize(long long value) { SetObjectSize(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetObjectAttributesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetObjectAttributesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetObjectAttributesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + bool m_deleteMarker; + + Aws::Utils::DateTime m_lastModified; + + Aws::String m_versionId; + + RequestCharged m_requestCharged; + + Aws::String m_eTag; + + Checksum m_checksum; + + GetObjectAttributesParts m_objectParts; + + StorageClass m_storageClass; + + long long m_objectSize; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectLockConfigurationRequest.h b/include/aws/s3/model/GetObjectLockConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2ccb73cbc538e4ee9131963f45e95cc6b2df3a48 --- /dev/null +++ b/include/aws/s3/model/GetObjectLockConfigurationRequest.h @@ -0,0 +1,119 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetObjectLockConfigurationRequest : public S3Request + { + public: + AWS_S3_API GetObjectLockConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetObjectLockConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket whose Object Lock configuration you want to retrieve.

+ * Access points - When you use this action with an access point, you must + * provide the alias of the access point in place of the bucket name or specify the + * access point ARN. When using the access point ARN, you must direct requests to + * the access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetObjectLockConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetObjectLockConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetObjectLockConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetObjectLockConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetObjectLockConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetObjectLockConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetObjectLockConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetObjectLockConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetObjectLockConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetObjectLockConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetObjectLockConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectLockConfigurationResult.h b/include/aws/s3/model/GetObjectLockConfigurationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..6458e98887e409ec89bc88352dbb61233c433d11 --- /dev/null +++ b/include/aws/s3/model/GetObjectLockConfigurationResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetObjectLockConfigurationResult + { + public: + AWS_S3_API GetObjectLockConfigurationResult(); + AWS_S3_API GetObjectLockConfigurationResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetObjectLockConfigurationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The specified bucket's Object Lock configuration.

+ */ + inline const ObjectLockConfiguration& GetObjectLockConfiguration() const{ return m_objectLockConfiguration; } + inline void SetObjectLockConfiguration(const ObjectLockConfiguration& value) { m_objectLockConfiguration = value; } + inline void SetObjectLockConfiguration(ObjectLockConfiguration&& value) { m_objectLockConfiguration = std::move(value); } + inline GetObjectLockConfigurationResult& WithObjectLockConfiguration(const ObjectLockConfiguration& value) { SetObjectLockConfiguration(value); return *this;} + inline GetObjectLockConfigurationResult& WithObjectLockConfiguration(ObjectLockConfiguration&& value) { SetObjectLockConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetObjectLockConfigurationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetObjectLockConfigurationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetObjectLockConfigurationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ObjectLockConfiguration m_objectLockConfiguration; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectRetentionResult.h b/include/aws/s3/model/GetObjectRetentionResult.h new file mode 100644 index 0000000000000000000000000000000000000000..b2c16928d72d5e3d3f9a3206074b2d31c89b6d6d --- /dev/null +++ b/include/aws/s3/model/GetObjectRetentionResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetObjectRetentionResult + { + public: + AWS_S3_API GetObjectRetentionResult(); + AWS_S3_API GetObjectRetentionResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetObjectRetentionResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The container element for an object's retention settings.

+ */ + inline const ObjectLockRetention& GetRetention() const{ return m_retention; } + inline void SetRetention(const ObjectLockRetention& value) { m_retention = value; } + inline void SetRetention(ObjectLockRetention&& value) { m_retention = std::move(value); } + inline GetObjectRetentionResult& WithRetention(const ObjectLockRetention& value) { SetRetention(value); return *this;} + inline GetObjectRetentionResult& WithRetention(ObjectLockRetention&& value) { SetRetention(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetObjectRetentionResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetObjectRetentionResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetObjectRetentionResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + ObjectLockRetention m_retention; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectTaggingRequest.h b/include/aws/s3/model/GetObjectTaggingRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e6810ae47ec493d86f6e47153ffa9d6d836878f8 --- /dev/null +++ b/include/aws/s3/model/GetObjectTaggingRequest.h @@ -0,0 +1,177 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetObjectTaggingRequest : public S3Request + { + public: + AWS_S3_API GetObjectTaggingRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetObjectTagging"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name containing the object for which to get the tagging + * information.

Access points - When you use this action with an + * access point, you must provide the alias of the access point in place of the + * bucket name or specify the access point ARN. When using the access point ARN, + * you must direct requests to the access point hostname. The access point hostname + * takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

S3 on + * Outposts - When you use this action with S3 on Outposts, you must direct + * requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the + * form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetObjectTaggingRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetObjectTaggingRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetObjectTaggingRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Object key for which to get the tagging information.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline GetObjectTaggingRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline GetObjectTaggingRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline GetObjectTaggingRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The versionId of the object for which to get the tagging information.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline GetObjectTaggingRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline GetObjectTaggingRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline GetObjectTaggingRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetObjectTaggingRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetObjectTaggingRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetObjectTaggingRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline GetObjectTaggingRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline GetObjectTaggingRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetObjectTaggingRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetObjectTaggingRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetObjectTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetObjectTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetObjectTaggingRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetObjectTaggingRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectTaggingResult.h b/include/aws/s3/model/GetObjectTaggingResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a1f9ade97f191e9ff570683dda5148b881f1a7f4 --- /dev/null +++ b/include/aws/s3/model/GetObjectTaggingResult.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class GetObjectTaggingResult + { + public: + AWS_S3_API GetObjectTaggingResult(); + AWS_S3_API GetObjectTaggingResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API GetObjectTaggingResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The versionId of the object for which you got the tagging information.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline void SetVersionId(const Aws::String& value) { m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionId.assign(value); } + inline GetObjectTaggingResult& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline GetObjectTaggingResult& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline GetObjectTaggingResult& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Contains the tag set.

+ */ + inline const Aws::Vector& GetTagSet() const{ return m_tagSet; } + inline void SetTagSet(const Aws::Vector& value) { m_tagSet = value; } + inline void SetTagSet(Aws::Vector&& value) { m_tagSet = std::move(value); } + inline GetObjectTaggingResult& WithTagSet(const Aws::Vector& value) { SetTagSet(value); return *this;} + inline GetObjectTaggingResult& WithTagSet(Aws::Vector&& value) { SetTagSet(std::move(value)); return *this;} + inline GetObjectTaggingResult& AddTagSet(const Tag& value) { m_tagSet.push_back(value); return *this; } + inline GetObjectTaggingResult& AddTagSet(Tag&& value) { m_tagSet.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetObjectTaggingResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetObjectTaggingResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetObjectTaggingResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_versionId; + + Aws::Vector m_tagSet; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetObjectTorrentResult.h b/include/aws/s3/model/GetObjectTorrentResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0cc4b6c545dbb9828177bfd83dd4293e91d221e3 --- /dev/null +++ b/include/aws/s3/model/GetObjectTorrentResult.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace S3 +{ +namespace Model +{ + class GetObjectTorrentResult + { + public: + AWS_S3_API GetObjectTorrentResult(); + //We have to define these because Microsoft doesn't auto generate them + AWS_S3_API GetObjectTorrentResult(GetObjectTorrentResult&&); + AWS_S3_API GetObjectTorrentResult& operator=(GetObjectTorrentResult&&); + //we delete these because Microsoft doesn't handle move generation correctly + //and we therefore don't trust them to get it right here either. + GetObjectTorrentResult(const GetObjectTorrentResult&) = delete; + GetObjectTorrentResult& operator=(const GetObjectTorrentResult&) = delete; + + + AWS_S3_API GetObjectTorrentResult(Aws::AmazonWebServiceResult&& result); + AWS_S3_API GetObjectTorrentResult& operator=(Aws::AmazonWebServiceResult&& result); + + + + ///@{ + /** + *

A Bencoded dictionary as defined by the BitTorrent specification

+ */ + inline Aws::IOStream& GetBody() const { return m_body.GetUnderlyingStream(); } + inline void ReplaceBody(Aws::IOStream* body) { m_body = Aws::Utils::Stream::ResponseStream(body); } + + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline GetObjectTorrentResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline GetObjectTorrentResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetObjectTorrentResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetObjectTorrentResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetObjectTorrentResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Utils::Stream::ResponseStream m_body; + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GetPublicAccessBlockRequest.h b/include/aws/s3/model/GetPublicAccessBlockRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..fd4c6b9c41f2994f29b9bdd5e1e31967f3faf840 --- /dev/null +++ b/include/aws/s3/model/GetPublicAccessBlockRequest.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class GetPublicAccessBlockRequest : public S3Request + { + public: + AWS_S3_API GetPublicAccessBlockRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetPublicAccessBlock"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the Amazon S3 bucket whose PublicAccessBlock + * configuration you want to retrieve.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline GetPublicAccessBlockRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline GetPublicAccessBlockRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline GetPublicAccessBlockRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline GetPublicAccessBlockRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline GetPublicAccessBlockRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline GetPublicAccessBlockRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline GetPublicAccessBlockRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline GetPublicAccessBlockRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline GetPublicAccessBlockRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline GetPublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetPublicAccessBlockRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetPublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline GetPublicAccessBlockRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline GetPublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline GetPublicAccessBlockRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/GlacierJobParameters.h b/include/aws/s3/model/GlacierJobParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..8b3e0d71caa521515f3b783f67e79f066b235ded --- /dev/null +++ b/include/aws/s3/model/GlacierJobParameters.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for S3 Glacier job parameters.

See Also:

AWS + * API Reference

+ */ + class GlacierJobParameters + { + public: + AWS_S3_API GlacierJobParameters(); + AWS_S3_API GlacierJobParameters(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API GlacierJobParameters& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Retrieval tier at which the restore will be processed.

+ */ + inline const Tier& GetTier() const{ return m_tier; } + inline bool TierHasBeenSet() const { return m_tierHasBeenSet; } + inline void SetTier(const Tier& value) { m_tierHasBeenSet = true; m_tier = value; } + inline void SetTier(Tier&& value) { m_tierHasBeenSet = true; m_tier = std::move(value); } + inline GlacierJobParameters& WithTier(const Tier& value) { SetTier(value); return *this;} + inline GlacierJobParameters& WithTier(Tier&& value) { SetTier(std::move(value)); return *this;} + ///@} + private: + + Tier m_tier; + bool m_tierHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Grant.h b/include/aws/s3/model/Grant.h new file mode 100644 index 0000000000000000000000000000000000000000..936f08d8fde9812d919459713b586da5851c2cae --- /dev/null +++ b/include/aws/s3/model/Grant.h @@ -0,0 +1,75 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for grant information.

See Also:

AWS API + * Reference

+ */ + class Grant + { + public: + AWS_S3_API Grant(); + AWS_S3_API Grant(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Grant& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The person being granted permissions.

+ */ + inline const Grantee& GetGrantee() const{ return m_grantee; } + inline bool GranteeHasBeenSet() const { return m_granteeHasBeenSet; } + inline void SetGrantee(const Grantee& value) { m_granteeHasBeenSet = true; m_grantee = value; } + inline void SetGrantee(Grantee&& value) { m_granteeHasBeenSet = true; m_grantee = std::move(value); } + inline Grant& WithGrantee(const Grantee& value) { SetGrantee(value); return *this;} + inline Grant& WithGrantee(Grantee&& value) { SetGrantee(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the permission given to the grantee.

+ */ + inline const Permission& GetPermission() const{ return m_permission; } + inline bool PermissionHasBeenSet() const { return m_permissionHasBeenSet; } + inline void SetPermission(const Permission& value) { m_permissionHasBeenSet = true; m_permission = value; } + inline void SetPermission(Permission&& value) { m_permissionHasBeenSet = true; m_permission = std::move(value); } + inline Grant& WithPermission(const Permission& value) { SetPermission(value); return *this;} + inline Grant& WithPermission(Permission&& value) { SetPermission(std::move(value)); return *this;} + ///@} + private: + + Grantee m_grantee; + bool m_granteeHasBeenSet = false; + + Permission m_permission; + bool m_permissionHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/HeadBucketRequest.h b/include/aws/s3/model/HeadBucketRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..caabe83ff4eaa4e555f1a57e32ca18cbe8432688 --- /dev/null +++ b/include/aws/s3/model/HeadBucketRequest.h @@ -0,0 +1,145 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class HeadBucketRequest : public S3Request + { + public: + AWS_S3_API HeadBucketRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "HeadBucket"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name.

Directory buckets - When you use this + * operation with a directory bucket, you must use virtual-hosted-style requests in + * the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Object Lambda + * access points - When you use this API operation with an Object Lambda access + * point, provide the alias of the Object Lambda access point in place of the + * bucket name. If the Object Lambda access point alias in a request is not valid, + * the error code InvalidAccessPointAliasError is returned. For more + * information about InvalidAccessPointAliasError, see List + * of Error Codes.

Access points and Object Lambda access points + * are not supported by directory buckets.

S3 on Outposts - + * When you use this action with S3 on Outposts, you must direct requests to the S3 + * on Outposts hostname. The S3 on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline HeadBucketRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline HeadBucketRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline HeadBucketRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline HeadBucketRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline HeadBucketRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline HeadBucketRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline HeadBucketRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline HeadBucketRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline HeadBucketRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline HeadBucketRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline HeadBucketRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline HeadBucketRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline HeadBucketRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline HeadBucketRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline HeadBucketRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/HeadBucketResult.h b/include/aws/s3/model/HeadBucketResult.h new file mode 100644 index 0000000000000000000000000000000000000000..87679397b0911586acfbe9056a51a6afe0f8e817 --- /dev/null +++ b/include/aws/s3/model/HeadBucketResult.h @@ -0,0 +1,114 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class HeadBucketResult + { + public: + AWS_S3_API HeadBucketResult(); + AWS_S3_API HeadBucketResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API HeadBucketResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The type of location where the bucket is created.

This + * functionality is only supported by directory buckets.

+ */ + inline const LocationType& GetBucketLocationType() const{ return m_bucketLocationType; } + inline void SetBucketLocationType(const LocationType& value) { m_bucketLocationType = value; } + inline void SetBucketLocationType(LocationType&& value) { m_bucketLocationType = std::move(value); } + inline HeadBucketResult& WithBucketLocationType(const LocationType& value) { SetBucketLocationType(value); return *this;} + inline HeadBucketResult& WithBucketLocationType(LocationType&& value) { SetBucketLocationType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The name of the location where the bucket will be created.

For + * directory buckets, the Zone ID of the Availability Zone or the Local Zone where + * the bucket is created. An example Zone ID value for an Availability Zone is + * usw2-az1.

This functionality is only supported by + * directory buckets.

+ */ + inline const Aws::String& GetBucketLocationName() const{ return m_bucketLocationName; } + inline void SetBucketLocationName(const Aws::String& value) { m_bucketLocationName = value; } + inline void SetBucketLocationName(Aws::String&& value) { m_bucketLocationName = std::move(value); } + inline void SetBucketLocationName(const char* value) { m_bucketLocationName.assign(value); } + inline HeadBucketResult& WithBucketLocationName(const Aws::String& value) { SetBucketLocationName(value); return *this;} + inline HeadBucketResult& WithBucketLocationName(Aws::String&& value) { SetBucketLocationName(std::move(value)); return *this;} + inline HeadBucketResult& WithBucketLocationName(const char* value) { SetBucketLocationName(value); return *this;} + ///@} + + ///@{ + /** + *

The Region that the bucket is located.

+ */ + inline const Aws::String& GetBucketRegion() const{ return m_bucketRegion; } + inline void SetBucketRegion(const Aws::String& value) { m_bucketRegion = value; } + inline void SetBucketRegion(Aws::String&& value) { m_bucketRegion = std::move(value); } + inline void SetBucketRegion(const char* value) { m_bucketRegion.assign(value); } + inline HeadBucketResult& WithBucketRegion(const Aws::String& value) { SetBucketRegion(value); return *this;} + inline HeadBucketResult& WithBucketRegion(Aws::String&& value) { SetBucketRegion(std::move(value)); return *this;} + inline HeadBucketResult& WithBucketRegion(const char* value) { SetBucketRegion(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the bucket name used in the request is an access point + * alias.

For directory buckets, the value of this field is + * false.

+ */ + inline bool GetAccessPointAlias() const{ return m_accessPointAlias; } + inline void SetAccessPointAlias(bool value) { m_accessPointAlias = value; } + inline HeadBucketResult& WithAccessPointAlias(bool value) { SetAccessPointAlias(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline HeadBucketResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline HeadBucketResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline HeadBucketResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + LocationType m_bucketLocationType; + + Aws::String m_bucketLocationName; + + Aws::String m_bucketRegion; + + bool m_accessPointAlias; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/HeadObjectRequest.h b/include/aws/s3/model/HeadObjectRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2bc8adc581daee117a777099c48148c3cd916a13 --- /dev/null +++ b/include/aws/s3/model/HeadObjectRequest.h @@ -0,0 +1,509 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class HeadObjectRequest : public S3Request + { + public: + AWS_S3_API HeadObjectRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "HeadObject"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket that contains the object.

Directory + * buckets - When you use this operation with a directory bucket, you must use + * virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline HeadObjectRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline HeadObjectRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline HeadObjectRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Return the object only if its entity tag (ETag) is the same as the one + * specified; otherwise, return a 412 (precondition failed) error.

If both + * of the If-Match and If-Unmodified-Since headers are + * present in the request as follows:

  • If-Match + * condition evaluates to true, and;

  • + * If-Unmodified-Since condition evaluates to false;

    + *

Then Amazon S3 returns 200 OK and the data + * requested.

For more information about conditional requests, see RFC 7232.

+ */ + inline const Aws::String& GetIfMatch() const{ return m_ifMatch; } + inline bool IfMatchHasBeenSet() const { return m_ifMatchHasBeenSet; } + inline void SetIfMatch(const Aws::String& value) { m_ifMatchHasBeenSet = true; m_ifMatch = value; } + inline void SetIfMatch(Aws::String&& value) { m_ifMatchHasBeenSet = true; m_ifMatch = std::move(value); } + inline void SetIfMatch(const char* value) { m_ifMatchHasBeenSet = true; m_ifMatch.assign(value); } + inline HeadObjectRequest& WithIfMatch(const Aws::String& value) { SetIfMatch(value); return *this;} + inline HeadObjectRequest& WithIfMatch(Aws::String&& value) { SetIfMatch(std::move(value)); return *this;} + inline HeadObjectRequest& WithIfMatch(const char* value) { SetIfMatch(value); return *this;} + ///@} + + ///@{ + /** + *

Return the object only if it has been modified since the specified time; + * otherwise, return a 304 (not modified) error.

If both of the + * If-None-Match and If-Modified-Since headers are + * present in the request as follows:

  • If-None-Match + * condition evaluates to false, and;

  • + * If-Modified-Since condition evaluates to true;

    + *

Then Amazon S3 returns the 304 Not Modified response + * code.

For more information about conditional requests, see RFC 7232.

+ */ + inline const Aws::Utils::DateTime& GetIfModifiedSince() const{ return m_ifModifiedSince; } + inline bool IfModifiedSinceHasBeenSet() const { return m_ifModifiedSinceHasBeenSet; } + inline void SetIfModifiedSince(const Aws::Utils::DateTime& value) { m_ifModifiedSinceHasBeenSet = true; m_ifModifiedSince = value; } + inline void SetIfModifiedSince(Aws::Utils::DateTime&& value) { m_ifModifiedSinceHasBeenSet = true; m_ifModifiedSince = std::move(value); } + inline HeadObjectRequest& WithIfModifiedSince(const Aws::Utils::DateTime& value) { SetIfModifiedSince(value); return *this;} + inline HeadObjectRequest& WithIfModifiedSince(Aws::Utils::DateTime&& value) { SetIfModifiedSince(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Return the object only if its entity tag (ETag) is different from the one + * specified; otherwise, return a 304 (not modified) error.

If both of the + * If-None-Match and If-Modified-Since headers are + * present in the request as follows:

  • If-None-Match + * condition evaluates to false, and;

  • + * If-Modified-Since condition evaluates to true;

    + *

Then Amazon S3 returns the 304 Not Modified response + * code.

For more information about conditional requests, see RFC 7232.

+ */ + inline const Aws::String& GetIfNoneMatch() const{ return m_ifNoneMatch; } + inline bool IfNoneMatchHasBeenSet() const { return m_ifNoneMatchHasBeenSet; } + inline void SetIfNoneMatch(const Aws::String& value) { m_ifNoneMatchHasBeenSet = true; m_ifNoneMatch = value; } + inline void SetIfNoneMatch(Aws::String&& value) { m_ifNoneMatchHasBeenSet = true; m_ifNoneMatch = std::move(value); } + inline void SetIfNoneMatch(const char* value) { m_ifNoneMatchHasBeenSet = true; m_ifNoneMatch.assign(value); } + inline HeadObjectRequest& WithIfNoneMatch(const Aws::String& value) { SetIfNoneMatch(value); return *this;} + inline HeadObjectRequest& WithIfNoneMatch(Aws::String&& value) { SetIfNoneMatch(std::move(value)); return *this;} + inline HeadObjectRequest& WithIfNoneMatch(const char* value) { SetIfNoneMatch(value); return *this;} + ///@} + + ///@{ + /** + *

Return the object only if it has not been modified since the specified time; + * otherwise, return a 412 (precondition failed) error.

If both of the + * If-Match and If-Unmodified-Since headers are present + * in the request as follows:

  • If-Match condition + * evaluates to true, and;

  • + * If-Unmodified-Since condition evaluates to false;

    + *

Then Amazon S3 returns 200 OK and the data + * requested.

For more information about conditional requests, see RFC 7232.

+ */ + inline const Aws::Utils::DateTime& GetIfUnmodifiedSince() const{ return m_ifUnmodifiedSince; } + inline bool IfUnmodifiedSinceHasBeenSet() const { return m_ifUnmodifiedSinceHasBeenSet; } + inline void SetIfUnmodifiedSince(const Aws::Utils::DateTime& value) { m_ifUnmodifiedSinceHasBeenSet = true; m_ifUnmodifiedSince = value; } + inline void SetIfUnmodifiedSince(Aws::Utils::DateTime&& value) { m_ifUnmodifiedSinceHasBeenSet = true; m_ifUnmodifiedSince = std::move(value); } + inline HeadObjectRequest& WithIfUnmodifiedSince(const Aws::Utils::DateTime& value) { SetIfUnmodifiedSince(value); return *this;} + inline HeadObjectRequest& WithIfUnmodifiedSince(Aws::Utils::DateTime&& value) { SetIfUnmodifiedSince(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The object key.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline HeadObjectRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline HeadObjectRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline HeadObjectRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

HeadObject returns only the metadata for an object. If the Range is + * satisfiable, only the ContentLength is affected in the response. If + * the Range is not satisfiable, S3 returns a 416 - Requested Range Not + * Satisfiable error.

+ */ + inline const Aws::String& GetRange() const{ return m_range; } + inline bool RangeHasBeenSet() const { return m_rangeHasBeenSet; } + inline void SetRange(const Aws::String& value) { m_rangeHasBeenSet = true; m_range = value; } + inline void SetRange(Aws::String&& value) { m_rangeHasBeenSet = true; m_range = std::move(value); } + inline void SetRange(const char* value) { m_rangeHasBeenSet = true; m_range.assign(value); } + inline HeadObjectRequest& WithRange(const Aws::String& value) { SetRange(value); return *this;} + inline HeadObjectRequest& WithRange(Aws::String&& value) { SetRange(std::move(value)); return *this;} + inline HeadObjectRequest& WithRange(const char* value) { SetRange(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the Cache-Control header of the response.

+ */ + inline const Aws::String& GetResponseCacheControl() const{ return m_responseCacheControl; } + inline bool ResponseCacheControlHasBeenSet() const { return m_responseCacheControlHasBeenSet; } + inline void SetResponseCacheControl(const Aws::String& value) { m_responseCacheControlHasBeenSet = true; m_responseCacheControl = value; } + inline void SetResponseCacheControl(Aws::String&& value) { m_responseCacheControlHasBeenSet = true; m_responseCacheControl = std::move(value); } + inline void SetResponseCacheControl(const char* value) { m_responseCacheControlHasBeenSet = true; m_responseCacheControl.assign(value); } + inline HeadObjectRequest& WithResponseCacheControl(const Aws::String& value) { SetResponseCacheControl(value); return *this;} + inline HeadObjectRequest& WithResponseCacheControl(Aws::String&& value) { SetResponseCacheControl(std::move(value)); return *this;} + inline HeadObjectRequest& WithResponseCacheControl(const char* value) { SetResponseCacheControl(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the Content-Disposition header of the response.

+ */ + inline const Aws::String& GetResponseContentDisposition() const{ return m_responseContentDisposition; } + inline bool ResponseContentDispositionHasBeenSet() const { return m_responseContentDispositionHasBeenSet; } + inline void SetResponseContentDisposition(const Aws::String& value) { m_responseContentDispositionHasBeenSet = true; m_responseContentDisposition = value; } + inline void SetResponseContentDisposition(Aws::String&& value) { m_responseContentDispositionHasBeenSet = true; m_responseContentDisposition = std::move(value); } + inline void SetResponseContentDisposition(const char* value) { m_responseContentDispositionHasBeenSet = true; m_responseContentDisposition.assign(value); } + inline HeadObjectRequest& WithResponseContentDisposition(const Aws::String& value) { SetResponseContentDisposition(value); return *this;} + inline HeadObjectRequest& WithResponseContentDisposition(Aws::String&& value) { SetResponseContentDisposition(std::move(value)); return *this;} + inline HeadObjectRequest& WithResponseContentDisposition(const char* value) { SetResponseContentDisposition(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the Content-Encoding header of the response.

+ */ + inline const Aws::String& GetResponseContentEncoding() const{ return m_responseContentEncoding; } + inline bool ResponseContentEncodingHasBeenSet() const { return m_responseContentEncodingHasBeenSet; } + inline void SetResponseContentEncoding(const Aws::String& value) { m_responseContentEncodingHasBeenSet = true; m_responseContentEncoding = value; } + inline void SetResponseContentEncoding(Aws::String&& value) { m_responseContentEncodingHasBeenSet = true; m_responseContentEncoding = std::move(value); } + inline void SetResponseContentEncoding(const char* value) { m_responseContentEncodingHasBeenSet = true; m_responseContentEncoding.assign(value); } + inline HeadObjectRequest& WithResponseContentEncoding(const Aws::String& value) { SetResponseContentEncoding(value); return *this;} + inline HeadObjectRequest& WithResponseContentEncoding(Aws::String&& value) { SetResponseContentEncoding(std::move(value)); return *this;} + inline HeadObjectRequest& WithResponseContentEncoding(const char* value) { SetResponseContentEncoding(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the Content-Language header of the response.

+ */ + inline const Aws::String& GetResponseContentLanguage() const{ return m_responseContentLanguage; } + inline bool ResponseContentLanguageHasBeenSet() const { return m_responseContentLanguageHasBeenSet; } + inline void SetResponseContentLanguage(const Aws::String& value) { m_responseContentLanguageHasBeenSet = true; m_responseContentLanguage = value; } + inline void SetResponseContentLanguage(Aws::String&& value) { m_responseContentLanguageHasBeenSet = true; m_responseContentLanguage = std::move(value); } + inline void SetResponseContentLanguage(const char* value) { m_responseContentLanguageHasBeenSet = true; m_responseContentLanguage.assign(value); } + inline HeadObjectRequest& WithResponseContentLanguage(const Aws::String& value) { SetResponseContentLanguage(value); return *this;} + inline HeadObjectRequest& WithResponseContentLanguage(Aws::String&& value) { SetResponseContentLanguage(std::move(value)); return *this;} + inline HeadObjectRequest& WithResponseContentLanguage(const char* value) { SetResponseContentLanguage(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the Content-Type header of the response.

+ */ + inline const Aws::String& GetResponseContentType() const{ return m_responseContentType; } + inline bool ResponseContentTypeHasBeenSet() const { return m_responseContentTypeHasBeenSet; } + inline void SetResponseContentType(const Aws::String& value) { m_responseContentTypeHasBeenSet = true; m_responseContentType = value; } + inline void SetResponseContentType(Aws::String&& value) { m_responseContentTypeHasBeenSet = true; m_responseContentType = std::move(value); } + inline void SetResponseContentType(const char* value) { m_responseContentTypeHasBeenSet = true; m_responseContentType.assign(value); } + inline HeadObjectRequest& WithResponseContentType(const Aws::String& value) { SetResponseContentType(value); return *this;} + inline HeadObjectRequest& WithResponseContentType(Aws::String&& value) { SetResponseContentType(std::move(value)); return *this;} + inline HeadObjectRequest& WithResponseContentType(const char* value) { SetResponseContentType(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the Expires header of the response.

+ */ + inline const Aws::Utils::DateTime& GetResponseExpires() const{ return m_responseExpires; } + inline bool ResponseExpiresHasBeenSet() const { return m_responseExpiresHasBeenSet; } + inline void SetResponseExpires(const Aws::Utils::DateTime& value) { m_responseExpiresHasBeenSet = true; m_responseExpires = value; } + inline void SetResponseExpires(Aws::Utils::DateTime&& value) { m_responseExpiresHasBeenSet = true; m_responseExpires = std::move(value); } + inline HeadObjectRequest& WithResponseExpires(const Aws::Utils::DateTime& value) { SetResponseExpires(value); return *this;} + inline HeadObjectRequest& WithResponseExpires(Aws::Utils::DateTime&& value) { SetResponseExpires(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Version ID used to reference a specific version of the object.

+ *

For directory buckets in this API operation, only the null value + * of the version ID is supported.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline HeadObjectRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline HeadObjectRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline HeadObjectRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the algorithm to use when encrypting the object (for example, + * AES256).

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline bool SSECustomerAlgorithmHasBeenSet() const { return m_sSECustomerAlgorithmHasBeenSet; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm.assign(value); } + inline HeadObjectRequest& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline HeadObjectRequest& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline HeadObjectRequest& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the customer-provided encryption key for Amazon S3 to use in + * encrypting data. This value is used to store the object and then it is + * discarded; Amazon S3 does not store the encryption key. The key must be + * appropriate for use with the algorithm specified in the + * x-amz-server-side-encryption-customer-algorithm header.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKey() const{ return m_sSECustomerKey; } + inline bool SSECustomerKeyHasBeenSet() const { return m_sSECustomerKeyHasBeenSet; } + inline void SetSSECustomerKey(const Aws::String& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = value; } + inline void SetSSECustomerKey(Aws::String&& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = std::move(value); } + inline void SetSSECustomerKey(const char* value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey.assign(value); } + inline HeadObjectRequest& WithSSECustomerKey(const Aws::String& value) { SetSSECustomerKey(value); return *this;} + inline HeadObjectRequest& WithSSECustomerKey(Aws::String&& value) { SetSSECustomerKey(std::move(value)); return *this;} + inline HeadObjectRequest& WithSSECustomerKey(const char* value) { SetSSECustomerKey(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + * Amazon S3 uses this header for a message integrity check to ensure that the + * encryption key was transmitted without error.

This functionality + * is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline bool SSECustomerKeyMD5HasBeenSet() const { return m_sSECustomerKeyMD5HasBeenSet; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5.assign(value); } + inline HeadObjectRequest& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline HeadObjectRequest& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline HeadObjectRequest& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline HeadObjectRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline HeadObjectRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Part number of the object being read. This is a positive integer between 1 + * and 10,000. Effectively performs a 'ranged' HEAD request for the part specified. + * Useful querying about the size of the part and the number of parts in this + * object.

+ */ + inline int GetPartNumber() const{ return m_partNumber; } + inline bool PartNumberHasBeenSet() const { return m_partNumberHasBeenSet; } + inline void SetPartNumber(int value) { m_partNumberHasBeenSet = true; m_partNumber = value; } + inline HeadObjectRequest& WithPartNumber(int value) { SetPartNumber(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline HeadObjectRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline HeadObjectRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline HeadObjectRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

To retrieve the checksum, this parameter must be enabled.

General + * purpose buckets - If you enable checksum mode and the object is uploaded + * with a checksum + * and encrypted with an Key Management Service (KMS) key, you must have permission + * to use the kms:Decrypt action to retrieve the checksum.

+ * Directory buckets - If you enable ChecksumMode and the + * object is encrypted with Amazon Web Services Key Management Service (Amazon Web + * Services KMS), you must also have the kms:GenerateDataKey and + * kms:Decrypt permissions in IAM identity-based policies and KMS key + * policies for the KMS key to retrieve the checksum of the object.

+ */ + inline const ChecksumMode& GetChecksumMode() const{ return m_checksumMode; } + inline bool ChecksumModeHasBeenSet() const { return m_checksumModeHasBeenSet; } + inline void SetChecksumMode(const ChecksumMode& value) { m_checksumModeHasBeenSet = true; m_checksumMode = value; } + inline void SetChecksumMode(ChecksumMode&& value) { m_checksumModeHasBeenSet = true; m_checksumMode = std::move(value); } + inline HeadObjectRequest& WithChecksumMode(const ChecksumMode& value) { SetChecksumMode(value); return *this;} + inline HeadObjectRequest& WithChecksumMode(ChecksumMode&& value) { SetChecksumMode(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline HeadObjectRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline HeadObjectRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline HeadObjectRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline HeadObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline HeadObjectRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline HeadObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline HeadObjectRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline HeadObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline HeadObjectRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_ifMatch; + bool m_ifMatchHasBeenSet = false; + + Aws::Utils::DateTime m_ifModifiedSince; + bool m_ifModifiedSinceHasBeenSet = false; + + Aws::String m_ifNoneMatch; + bool m_ifNoneMatchHasBeenSet = false; + + Aws::Utils::DateTime m_ifUnmodifiedSince; + bool m_ifUnmodifiedSinceHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_range; + bool m_rangeHasBeenSet = false; + + Aws::String m_responseCacheControl; + bool m_responseCacheControlHasBeenSet = false; + + Aws::String m_responseContentDisposition; + bool m_responseContentDispositionHasBeenSet = false; + + Aws::String m_responseContentEncoding; + bool m_responseContentEncodingHasBeenSet = false; + + Aws::String m_responseContentLanguage; + bool m_responseContentLanguageHasBeenSet = false; + + Aws::String m_responseContentType; + bool m_responseContentTypeHasBeenSet = false; + + Aws::Utils::DateTime m_responseExpires; + bool m_responseExpiresHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + Aws::String m_sSECustomerAlgorithm; + bool m_sSECustomerAlgorithmHasBeenSet = false; + + Aws::String m_sSECustomerKey; + bool m_sSECustomerKeyHasBeenSet = false; + + Aws::String m_sSECustomerKeyMD5; + bool m_sSECustomerKeyMD5HasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + int m_partNumber; + bool m_partNumberHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + ChecksumMode m_checksumMode; + bool m_checksumModeHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/HeadObjectResult.h b/include/aws/s3/model/HeadObjectResult.h new file mode 100644 index 0000000000000000000000000000000000000000..1473c99b9025637c91a8e242f6b0c950ef5a5aa3 --- /dev/null +++ b/include/aws/s3/model/HeadObjectResult.h @@ -0,0 +1,730 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class HeadObjectResult + { + public: + AWS_S3_API HeadObjectResult(); + AWS_S3_API HeadObjectResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API HeadObjectResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Specifies whether the object retrieved was (true) or was not (false) a Delete + * Marker. If false, this response header does not appear in the response.

+ *

This functionality is not supported for directory buckets.

+ */ + inline bool GetDeleteMarker() const{ return m_deleteMarker; } + inline void SetDeleteMarker(bool value) { m_deleteMarker = value; } + inline HeadObjectResult& WithDeleteMarker(bool value) { SetDeleteMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates that a range of bytes was specified.

+ */ + inline const Aws::String& GetAcceptRanges() const{ return m_acceptRanges; } + inline void SetAcceptRanges(const Aws::String& value) { m_acceptRanges = value; } + inline void SetAcceptRanges(Aws::String&& value) { m_acceptRanges = std::move(value); } + inline void SetAcceptRanges(const char* value) { m_acceptRanges.assign(value); } + inline HeadObjectResult& WithAcceptRanges(const Aws::String& value) { SetAcceptRanges(value); return *this;} + inline HeadObjectResult& WithAcceptRanges(Aws::String&& value) { SetAcceptRanges(std::move(value)); return *this;} + inline HeadObjectResult& WithAcceptRanges(const char* value) { SetAcceptRanges(value); return *this;} + ///@} + + ///@{ + /** + *

If the object expiration is configured (see + * PutBucketLifecycleConfiguration ), the response includes this + * header. It includes the expiry-date and rule-id + * key-value pairs providing object expiration information. The value of the + * rule-id is URL-encoded.

Object expiration information + * is not returned in directory buckets and this header returns the value + * "NotImplemented" in all responses for directory buckets.

+ * + */ + inline const Aws::String& GetExpiration() const{ return m_expiration; } + inline void SetExpiration(const Aws::String& value) { m_expiration = value; } + inline void SetExpiration(Aws::String&& value) { m_expiration = std::move(value); } + inline void SetExpiration(const char* value) { m_expiration.assign(value); } + inline HeadObjectResult& WithExpiration(const Aws::String& value) { SetExpiration(value); return *this;} + inline HeadObjectResult& WithExpiration(Aws::String&& value) { SetExpiration(std::move(value)); return *this;} + inline HeadObjectResult& WithExpiration(const char* value) { SetExpiration(value); return *this;} + ///@} + + ///@{ + /** + *

If the object is an archived object (an object whose storage class is + * GLACIER), the response includes this header if either the archive restoration is + * in progress (see RestoreObject + * or an archive copy is already restored.

If an archive copy is already + * restored, the header value indicates when Amazon S3 is scheduled to delete the + * object copy. For example:

x-amz-restore: ongoing-request="false", + * expiry-date="Fri, 21 Dec 2012 00:00:00 GMT"

If the object + * restoration is in progress, the header returns the value + * ongoing-request="true".

For more information about archiving + * objects, see Transitioning + * Objects: General Considerations.

This functionality is not + * supported for directory buckets. Only the S3 Express One Zone storage class is + * supported by directory buckets to store objects.

+ */ + inline const Aws::String& GetRestore() const{ return m_restore; } + inline void SetRestore(const Aws::String& value) { m_restore = value; } + inline void SetRestore(Aws::String&& value) { m_restore = std::move(value); } + inline void SetRestore(const char* value) { m_restore.assign(value); } + inline HeadObjectResult& WithRestore(const Aws::String& value) { SetRestore(value); return *this;} + inline HeadObjectResult& WithRestore(Aws::String&& value) { SetRestore(std::move(value)); return *this;} + inline HeadObjectResult& WithRestore(const char* value) { SetRestore(value); return *this;} + ///@} + + ///@{ + /** + *

The archive state of the head object.

This functionality is not + * supported for directory buckets.

+ */ + inline const ArchiveStatus& GetArchiveStatus() const{ return m_archiveStatus; } + inline void SetArchiveStatus(const ArchiveStatus& value) { m_archiveStatus = value; } + inline void SetArchiveStatus(ArchiveStatus&& value) { m_archiveStatus = std::move(value); } + inline HeadObjectResult& WithArchiveStatus(const ArchiveStatus& value) { SetArchiveStatus(value); return *this;} + inline HeadObjectResult& WithArchiveStatus(ArchiveStatus&& value) { SetArchiveStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Date and time when the object was last modified.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModified = std::move(value); } + inline HeadObjectResult& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline HeadObjectResult& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Size of the body in bytes.

+ */ + inline long long GetContentLength() const{ return m_contentLength; } + inline void SetContentLength(long long value) { m_contentLength = value; } + inline HeadObjectResult& WithContentLength(long long value) { SetContentLength(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32 checksum of the object. This + * checksum is only be present if the checksum was uploaded with the object. When + * you use an API operation on an object that was uploaded using multipart uploads, + * this value may not be a direct checksum value of the full object. Instead, it's + * a calculation based on the checksum values of each individual part. For more + * information about how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32() const{ return m_checksumCRC32; } + inline void SetChecksumCRC32(const Aws::String& value) { m_checksumCRC32 = value; } + inline void SetChecksumCRC32(Aws::String&& value) { m_checksumCRC32 = std::move(value); } + inline void SetChecksumCRC32(const char* value) { m_checksumCRC32.assign(value); } + inline HeadObjectResult& WithChecksumCRC32(const Aws::String& value) { SetChecksumCRC32(value); return *this;} + inline HeadObjectResult& WithChecksumCRC32(Aws::String&& value) { SetChecksumCRC32(std::move(value)); return *this;} + inline HeadObjectResult& WithChecksumCRC32(const char* value) { SetChecksumCRC32(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32C checksum of the object. This + * checksum is only present if the checksum was uploaded with the object. When you + * use an API operation on an object that was uploaded using multipart uploads, + * this value may not be a direct checksum value of the full object. Instead, it's + * a calculation based on the checksum values of each individual part. For more + * information about how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32C() const{ return m_checksumCRC32C; } + inline void SetChecksumCRC32C(const Aws::String& value) { m_checksumCRC32C = value; } + inline void SetChecksumCRC32C(Aws::String&& value) { m_checksumCRC32C = std::move(value); } + inline void SetChecksumCRC32C(const char* value) { m_checksumCRC32C.assign(value); } + inline HeadObjectResult& WithChecksumCRC32C(const Aws::String& value) { SetChecksumCRC32C(value); return *this;} + inline HeadObjectResult& WithChecksumCRC32C(Aws::String&& value) { SetChecksumCRC32C(std::move(value)); return *this;} + inline HeadObjectResult& WithChecksumCRC32C(const char* value) { SetChecksumCRC32C(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 64-bit CRC64NVME checksum of the object. For + * more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC64NVME() const{ return m_checksumCRC64NVME; } + inline void SetChecksumCRC64NVME(const Aws::String& value) { m_checksumCRC64NVME = value; } + inline void SetChecksumCRC64NVME(Aws::String&& value) { m_checksumCRC64NVME = std::move(value); } + inline void SetChecksumCRC64NVME(const char* value) { m_checksumCRC64NVME.assign(value); } + inline HeadObjectResult& WithChecksumCRC64NVME(const Aws::String& value) { SetChecksumCRC64NVME(value); return *this;} + inline HeadObjectResult& WithChecksumCRC64NVME(Aws::String&& value) { SetChecksumCRC64NVME(std::move(value)); return *this;} + inline HeadObjectResult& WithChecksumCRC64NVME(const char* value) { SetChecksumCRC64NVME(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 160-bit SHA1 digest of the object. This will + * only be present if the object was uploaded with the object. When you use the API + * operation on an object that was uploaded using multipart uploads, this value may + * not be a direct checksum value of the full object. Instead, it's a calculation + * based on the checksum values of each individual part. For more information about + * how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA1() const{ return m_checksumSHA1; } + inline void SetChecksumSHA1(const Aws::String& value) { m_checksumSHA1 = value; } + inline void SetChecksumSHA1(Aws::String&& value) { m_checksumSHA1 = std::move(value); } + inline void SetChecksumSHA1(const char* value) { m_checksumSHA1.assign(value); } + inline HeadObjectResult& WithChecksumSHA1(const Aws::String& value) { SetChecksumSHA1(value); return *this;} + inline HeadObjectResult& WithChecksumSHA1(Aws::String&& value) { SetChecksumSHA1(std::move(value)); return *this;} + inline HeadObjectResult& WithChecksumSHA1(const char* value) { SetChecksumSHA1(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 256-bit SHA256 digest of the object. This + * will only be present if the object was uploaded with the object. When you use an + * API operation on an object that was uploaded using multipart uploads, this value + * may not be a direct checksum value of the full object. Instead, it's a + * calculation based on the checksum values of each individual part. For more + * information about how checksums are calculated with multipart uploads, see + * Checking object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA256() const{ return m_checksumSHA256; } + inline void SetChecksumSHA256(const Aws::String& value) { m_checksumSHA256 = value; } + inline void SetChecksumSHA256(Aws::String&& value) { m_checksumSHA256 = std::move(value); } + inline void SetChecksumSHA256(const char* value) { m_checksumSHA256.assign(value); } + inline HeadObjectResult& WithChecksumSHA256(const Aws::String& value) { SetChecksumSHA256(value); return *this;} + inline HeadObjectResult& WithChecksumSHA256(Aws::String&& value) { SetChecksumSHA256(std::move(value)); return *this;} + inline HeadObjectResult& WithChecksumSHA256(const char* value) { SetChecksumSHA256(value); return *this;} + ///@} + + ///@{ + /** + *

The checksum type, which determines how part-level checksums are combined to + * create an object-level checksum for multipart objects. You can use this header + * response to verify that the checksum type that is received is the same checksum + * type that was specified in CreateMultipartUpload request. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumType = std::move(value); } + inline HeadObjectResult& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline HeadObjectResult& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

An entity tag (ETag) is an opaque identifier assigned by a web server to a + * specific version of a resource found at a URL.

+ */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline void SetETag(const Aws::String& value) { m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTag.assign(value); } + inline HeadObjectResult& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline HeadObjectResult& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline HeadObjectResult& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

This is set to the number of metadata entries not returned in + * x-amz-meta headers. This can happen if you create metadata using an + * API like SOAP that supports more flexible metadata than the REST API. For + * example, using SOAP, you can create metadata whose values are not legal HTTP + * headers.

This functionality is not supported for directory + * buckets.

+ */ + inline int GetMissingMeta() const{ return m_missingMeta; } + inline void SetMissingMeta(int value) { m_missingMeta = value; } + inline HeadObjectResult& WithMissingMeta(int value) { SetMissingMeta(value); return *this;} + ///@} + + ///@{ + /** + *

Version ID of the object.

This functionality is not supported + * for directory buckets.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline void SetVersionId(const Aws::String& value) { m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionId.assign(value); } + inline HeadObjectResult& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline HeadObjectResult& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline HeadObjectResult& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies caching behavior along the request/reply chain.

+ */ + inline const Aws::String& GetCacheControl() const{ return m_cacheControl; } + inline void SetCacheControl(const Aws::String& value) { m_cacheControl = value; } + inline void SetCacheControl(Aws::String&& value) { m_cacheControl = std::move(value); } + inline void SetCacheControl(const char* value) { m_cacheControl.assign(value); } + inline HeadObjectResult& WithCacheControl(const Aws::String& value) { SetCacheControl(value); return *this;} + inline HeadObjectResult& WithCacheControl(Aws::String&& value) { SetCacheControl(std::move(value)); return *this;} + inline HeadObjectResult& WithCacheControl(const char* value) { SetCacheControl(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies presentational information for the object.

+ */ + inline const Aws::String& GetContentDisposition() const{ return m_contentDisposition; } + inline void SetContentDisposition(const Aws::String& value) { m_contentDisposition = value; } + inline void SetContentDisposition(Aws::String&& value) { m_contentDisposition = std::move(value); } + inline void SetContentDisposition(const char* value) { m_contentDisposition.assign(value); } + inline HeadObjectResult& WithContentDisposition(const Aws::String& value) { SetContentDisposition(value); return *this;} + inline HeadObjectResult& WithContentDisposition(Aws::String&& value) { SetContentDisposition(std::move(value)); return *this;} + inline HeadObjectResult& WithContentDisposition(const char* value) { SetContentDisposition(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates what content encodings have been applied to the object and thus + * what decoding mechanisms must be applied to obtain the media-type referenced by + * the Content-Type header field.

+ */ + inline const Aws::String& GetContentEncoding() const{ return m_contentEncoding; } + inline void SetContentEncoding(const Aws::String& value) { m_contentEncoding = value; } + inline void SetContentEncoding(Aws::String&& value) { m_contentEncoding = std::move(value); } + inline void SetContentEncoding(const char* value) { m_contentEncoding.assign(value); } + inline HeadObjectResult& WithContentEncoding(const Aws::String& value) { SetContentEncoding(value); return *this;} + inline HeadObjectResult& WithContentEncoding(Aws::String&& value) { SetContentEncoding(std::move(value)); return *this;} + inline HeadObjectResult& WithContentEncoding(const char* value) { SetContentEncoding(value); return *this;} + ///@} + + ///@{ + /** + *

The language the content is in.

+ */ + inline const Aws::String& GetContentLanguage() const{ return m_contentLanguage; } + inline void SetContentLanguage(const Aws::String& value) { m_contentLanguage = value; } + inline void SetContentLanguage(Aws::String&& value) { m_contentLanguage = std::move(value); } + inline void SetContentLanguage(const char* value) { m_contentLanguage.assign(value); } + inline HeadObjectResult& WithContentLanguage(const Aws::String& value) { SetContentLanguage(value); return *this;} + inline HeadObjectResult& WithContentLanguage(Aws::String&& value) { SetContentLanguage(std::move(value)); return *this;} + inline HeadObjectResult& WithContentLanguage(const char* value) { SetContentLanguage(value); return *this;} + ///@} + + ///@{ + /** + *

A standard MIME type describing the format of the object data.

+ */ + inline const Aws::String& GetContentType() const{ return m_contentType; } + inline void SetContentType(const Aws::String& value) { m_contentType = value; } + inline void SetContentType(Aws::String&& value) { m_contentType = std::move(value); } + inline void SetContentType(const char* value) { m_contentType.assign(value); } + inline HeadObjectResult& WithContentType(const Aws::String& value) { SetContentType(value); return *this;} + inline HeadObjectResult& WithContentType(Aws::String&& value) { SetContentType(std::move(value)); return *this;} + inline HeadObjectResult& WithContentType(const char* value) { SetContentType(value); return *this;} + ///@} + + ///@{ + /** + *

The portion of the object returned in the response for a GET + * request.

+ */ + inline const Aws::String& GetContentRange() const{ return m_contentRange; } + inline void SetContentRange(const Aws::String& value) { m_contentRange = value; } + inline void SetContentRange(Aws::String&& value) { m_contentRange = std::move(value); } + inline void SetContentRange(const char* value) { m_contentRange.assign(value); } + inline HeadObjectResult& WithContentRange(const Aws::String& value) { SetContentRange(value); return *this;} + inline HeadObjectResult& WithContentRange(Aws::String&& value) { SetContentRange(std::move(value)); return *this;} + inline HeadObjectResult& WithContentRange(const char* value) { SetContentRange(value); return *this;} + ///@} + + ///@{ + /** + *

The date and time at which the object is no longer cacheable.

+ */ + inline const Aws::Utils::DateTime& GetExpires() const{ return m_expires; } + inline void SetExpires(const Aws::Utils::DateTime& value) { m_expires = value; } + inline void SetExpires(Aws::Utils::DateTime&& value) { m_expires = std::move(value); } + inline HeadObjectResult& WithExpires(const Aws::Utils::DateTime& value) { SetExpires(value); return *this;} + inline HeadObjectResult& WithExpires(Aws::Utils::DateTime&& value) { SetExpires(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If the bucket is configured as a website, redirects requests for this object + * to another object in the same bucket or to an external URL. Amazon S3 stores the + * value of this header in the object metadata.

This functionality is + * not supported for directory buckets.

+ */ + inline const Aws::String& GetWebsiteRedirectLocation() const{ return m_websiteRedirectLocation; } + inline void SetWebsiteRedirectLocation(const Aws::String& value) { m_websiteRedirectLocation = value; } + inline void SetWebsiteRedirectLocation(Aws::String&& value) { m_websiteRedirectLocation = std::move(value); } + inline void SetWebsiteRedirectLocation(const char* value) { m_websiteRedirectLocation.assign(value); } + inline HeadObjectResult& WithWebsiteRedirectLocation(const Aws::String& value) { SetWebsiteRedirectLocation(value); return *this;} + inline HeadObjectResult& WithWebsiteRedirectLocation(Aws::String&& value) { SetWebsiteRedirectLocation(std::move(value)); return *this;} + inline HeadObjectResult& WithWebsiteRedirectLocation(const char* value) { SetWebsiteRedirectLocation(value); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption algorithm used when you store this object in + * Amazon S3 (for example, AES256, aws:kms, + * aws:kms:dsse).

+ */ + inline const ServerSideEncryption& GetServerSideEncryption() const{ return m_serverSideEncryption; } + inline void SetServerSideEncryption(const ServerSideEncryption& value) { m_serverSideEncryption = value; } + inline void SetServerSideEncryption(ServerSideEncryption&& value) { m_serverSideEncryption = std::move(value); } + inline HeadObjectResult& WithServerSideEncryption(const ServerSideEncryption& value) { SetServerSideEncryption(value); return *this;} + inline HeadObjectResult& WithServerSideEncryption(ServerSideEncryption&& value) { SetServerSideEncryption(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A map of metadata to store with the object in S3.

+ */ + inline const Aws::Map& GetMetadata() const{ return m_metadata; } + inline void SetMetadata(const Aws::Map& value) { m_metadata = value; } + inline void SetMetadata(Aws::Map&& value) { m_metadata = std::move(value); } + inline HeadObjectResult& WithMetadata(const Aws::Map& value) { SetMetadata(value); return *this;} + inline HeadObjectResult& WithMetadata(Aws::Map&& value) { SetMetadata(std::move(value)); return *this;} + inline HeadObjectResult& AddMetadata(const Aws::String& key, const Aws::String& value) { m_metadata.emplace(key, value); return *this; } + inline HeadObjectResult& AddMetadata(Aws::String&& key, const Aws::String& value) { m_metadata.emplace(std::move(key), value); return *this; } + inline HeadObjectResult& AddMetadata(const Aws::String& key, Aws::String&& value) { m_metadata.emplace(key, std::move(value)); return *this; } + inline HeadObjectResult& AddMetadata(Aws::String&& key, Aws::String&& value) { m_metadata.emplace(std::move(key), std::move(value)); return *this; } + inline HeadObjectResult& AddMetadata(const char* key, Aws::String&& value) { m_metadata.emplace(key, std::move(value)); return *this; } + inline HeadObjectResult& AddMetadata(Aws::String&& key, const char* value) { m_metadata.emplace(std::move(key), value); return *this; } + inline HeadObjectResult& AddMetadata(const char* key, const char* value) { m_metadata.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to confirm the encryption + * algorithm that's used.

This functionality is not supported for + * directory buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithm.assign(value); } + inline HeadObjectResult& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline HeadObjectResult& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline HeadObjectResult& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to provide the round-trip + * message integrity verification of the customer-provided encryption key.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5.assign(value); } + inline HeadObjectResult& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline HeadObjectResult& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline HeadObjectResult& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + /** + *

If present, indicates the ID of the KMS key that was used for object + * encryption.

+ */ + inline const Aws::String& GetSSEKMSKeyId() const{ return m_sSEKMSKeyId; } + inline void SetSSEKMSKeyId(const Aws::String& value) { m_sSEKMSKeyId = value; } + inline void SetSSEKMSKeyId(Aws::String&& value) { m_sSEKMSKeyId = std::move(value); } + inline void SetSSEKMSKeyId(const char* value) { m_sSEKMSKeyId.assign(value); } + inline HeadObjectResult& WithSSEKMSKeyId(const Aws::String& value) { SetSSEKMSKeyId(value); return *this;} + inline HeadObjectResult& WithSSEKMSKeyId(Aws::String&& value) { SetSSEKMSKeyId(std::move(value)); return *this;} + inline HeadObjectResult& WithSSEKMSKeyId(const char* value) { SetSSEKMSKeyId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the object uses an S3 Bucket Key for server-side encryption + * with Key Management Service (KMS) keys (SSE-KMS).

+ */ + inline bool GetBucketKeyEnabled() const{ return m_bucketKeyEnabled; } + inline void SetBucketKeyEnabled(bool value) { m_bucketKeyEnabled = value; } + inline HeadObjectResult& WithBucketKeyEnabled(bool value) { SetBucketKeyEnabled(value); return *this;} + ///@} + + ///@{ + /** + *

Provides storage class information of the object. Amazon S3 returns this + * header for all objects except for S3 Standard storage class objects.

For + * more information, see Storage + * Classes.

Directory buckets - Only the S3 Express One + * Zone storage class is supported by directory buckets to store objects.

+ * + */ + inline const StorageClass& GetStorageClass() const{ return m_storageClass; } + inline void SetStorageClass(const StorageClass& value) { m_storageClass = value; } + inline void SetStorageClass(StorageClass&& value) { m_storageClass = std::move(value); } + inline HeadObjectResult& WithStorageClass(const StorageClass& value) { SetStorageClass(value); return *this;} + inline HeadObjectResult& WithStorageClass(StorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline HeadObjectResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline HeadObjectResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Amazon S3 can return this header if your request involves a bucket that is + * either a source or a destination in a replication rule.

In replication, + * you have a source bucket on which you configure replication and destination + * bucket or buckets where Amazon S3 stores object replicas. When you request an + * object (GetObject) or object metadata (HeadObject) + * from these buckets, Amazon S3 will return the + * x-amz-replication-status header in the response as follows:

+ *
  • If requesting an object from the source bucket, Amazon S3 + * will return the x-amz-replication-status header if the object in + * your request is eligible for replication.

    For example, suppose that in + * your replication configuration, you specify object prefix TaxDocs + * requesting Amazon S3 to replicate objects with key prefix TaxDocs. + * Any objects you upload with this key name prefix, for example + * TaxDocs/document1.pdf, are eligible for replication. For any object + * request with this key name prefix, Amazon S3 will return the + * x-amz-replication-status header with value PENDING, COMPLETED or + * FAILED indicating object replication status.

  • If requesting + * an object from a destination bucket, Amazon S3 will return the + * x-amz-replication-status header with value REPLICA if the object in + * your request is a replica that Amazon S3 created and there is no replica + * modification replication in progress.

  • When replicating + * objects to multiple destination buckets, the + * x-amz-replication-status header acts differently. The header of the + * source object will only return a value of COMPLETED when replication is + * successful to all destinations. The header will remain at value PENDING until + * replication has completed for all destinations. If one or more destinations + * fails replication the header will return FAILED.

For more + * information, see Replication.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const ReplicationStatus& GetReplicationStatus() const{ return m_replicationStatus; } + inline void SetReplicationStatus(const ReplicationStatus& value) { m_replicationStatus = value; } + inline void SetReplicationStatus(ReplicationStatus&& value) { m_replicationStatus = std::move(value); } + inline HeadObjectResult& WithReplicationStatus(const ReplicationStatus& value) { SetReplicationStatus(value); return *this;} + inline HeadObjectResult& WithReplicationStatus(ReplicationStatus&& value) { SetReplicationStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The count of parts this object has. This value is only returned if you + * specify partNumber in your request and the object was uploaded as a + * multipart upload.

+ */ + inline int GetPartsCount() const{ return m_partsCount; } + inline void SetPartsCount(int value) { m_partsCount = value; } + inline HeadObjectResult& WithPartsCount(int value) { SetPartsCount(value); return *this;} + ///@} + + ///@{ + /** + *

The Object Lock mode, if any, that's in effect for this object. This header + * is only returned if the requester has the s3:GetObjectRetention + * permission. For more information about S3 Object Lock, see Object + * Lock.

This functionality is not supported for directory + * buckets.

+ */ + inline const ObjectLockMode& GetObjectLockMode() const{ return m_objectLockMode; } + inline void SetObjectLockMode(const ObjectLockMode& value) { m_objectLockMode = value; } + inline void SetObjectLockMode(ObjectLockMode&& value) { m_objectLockMode = std::move(value); } + inline HeadObjectResult& WithObjectLockMode(const ObjectLockMode& value) { SetObjectLockMode(value); return *this;} + inline HeadObjectResult& WithObjectLockMode(ObjectLockMode&& value) { SetObjectLockMode(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The date and time when the Object Lock retention period expires. This header + * is only returned if the requester has the s3:GetObjectRetention + * permission.

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::Utils::DateTime& GetObjectLockRetainUntilDate() const{ return m_objectLockRetainUntilDate; } + inline void SetObjectLockRetainUntilDate(const Aws::Utils::DateTime& value) { m_objectLockRetainUntilDate = value; } + inline void SetObjectLockRetainUntilDate(Aws::Utils::DateTime&& value) { m_objectLockRetainUntilDate = std::move(value); } + inline HeadObjectResult& WithObjectLockRetainUntilDate(const Aws::Utils::DateTime& value) { SetObjectLockRetainUntilDate(value); return *this;} + inline HeadObjectResult& WithObjectLockRetainUntilDate(Aws::Utils::DateTime&& value) { SetObjectLockRetainUntilDate(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether a legal hold is in effect for this object. This header is + * only returned if the requester has the s3:GetObjectLegalHold + * permission. This header is not returned if the specified version of this object + * has never had a legal hold applied. For more information about S3 Object Lock, + * see Object + * Lock.

This functionality is not supported for directory + * buckets.

+ */ + inline const ObjectLockLegalHoldStatus& GetObjectLockLegalHoldStatus() const{ return m_objectLockLegalHoldStatus; } + inline void SetObjectLockLegalHoldStatus(const ObjectLockLegalHoldStatus& value) { m_objectLockLegalHoldStatus = value; } + inline void SetObjectLockLegalHoldStatus(ObjectLockLegalHoldStatus&& value) { m_objectLockLegalHoldStatus = std::move(value); } + inline HeadObjectResult& WithObjectLockLegalHoldStatus(const ObjectLockLegalHoldStatus& value) { SetObjectLockLegalHoldStatus(value); return *this;} + inline HeadObjectResult& WithObjectLockLegalHoldStatus(ObjectLockLegalHoldStatus&& value) { SetObjectLockLegalHoldStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The date and time at which the object is no longer cacheable.

+ */ + inline const Aws::String& GetExpiresString() const{ return m_expiresString; } + inline void SetExpiresString(const Aws::String& value) { m_expiresString = value; } + inline void SetExpiresString(Aws::String&& value) { m_expiresString = std::move(value); } + inline void SetExpiresString(const char* value) { m_expiresString.assign(value); } + inline HeadObjectResult& WithExpiresString(const Aws::String& value) { SetExpiresString(value); return *this;} + inline HeadObjectResult& WithExpiresString(Aws::String&& value) { SetExpiresString(std::move(value)); return *this;} + inline HeadObjectResult& WithExpiresString(const char* value) { SetExpiresString(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline HeadObjectResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline HeadObjectResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline HeadObjectResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + bool m_deleteMarker; + + Aws::String m_acceptRanges; + + Aws::String m_expiration; + + Aws::String m_restore; + + ArchiveStatus m_archiveStatus; + + Aws::Utils::DateTime m_lastModified; + + long long m_contentLength; + + Aws::String m_checksumCRC32; + + Aws::String m_checksumCRC32C; + + Aws::String m_checksumCRC64NVME; + + Aws::String m_checksumSHA1; + + Aws::String m_checksumSHA256; + + ChecksumType m_checksumType; + + Aws::String m_eTag; + + int m_missingMeta; + + Aws::String m_versionId; + + Aws::String m_cacheControl; + + Aws::String m_contentDisposition; + + Aws::String m_contentEncoding; + + Aws::String m_contentLanguage; + + Aws::String m_contentType; + + Aws::String m_contentRange; + + Aws::Utils::DateTime m_expires; + + Aws::String m_websiteRedirectLocation; + + ServerSideEncryption m_serverSideEncryption; + + Aws::Map m_metadata; + + Aws::String m_sSECustomerAlgorithm; + + Aws::String m_sSECustomerKeyMD5; + + Aws::String m_sSEKMSKeyId; + + bool m_bucketKeyEnabled; + + StorageClass m_storageClass; + + RequestCharged m_requestCharged; + + ReplicationStatus m_replicationStatus; + + int m_partsCount; + + ObjectLockMode m_objectLockMode; + + Aws::Utils::DateTime m_objectLockRetainUntilDate; + + ObjectLockLegalHoldStatus m_objectLockLegalHoldStatus; + + Aws::String m_expiresString; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/IntelligentTieringAndOperator.h b/include/aws/s3/model/IntelligentTieringAndOperator.h new file mode 100644 index 0000000000000000000000000000000000000000..447997f9d86ddaabcf36301d539c60f5d4db0b6a --- /dev/null +++ b/include/aws/s3/model/IntelligentTieringAndOperator.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container for specifying S3 Intelligent-Tiering filters. The filters + * determine the subset of objects to which the rule applies.

See + * Also:

AWS + * API Reference

+ */ + class IntelligentTieringAndOperator + { + public: + AWS_S3_API IntelligentTieringAndOperator(); + AWS_S3_API IntelligentTieringAndOperator(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API IntelligentTieringAndOperator& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

An object key name prefix that identifies the subset of objects to which the + * configuration applies.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline IntelligentTieringAndOperator& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline IntelligentTieringAndOperator& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline IntelligentTieringAndOperator& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

All of these tags must exist in the object's tag set in order for the + * configuration to apply.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline IntelligentTieringAndOperator& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline IntelligentTieringAndOperator& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline IntelligentTieringAndOperator& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline IntelligentTieringAndOperator& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/IntelligentTieringFilter.h b/include/aws/s3/model/IntelligentTieringFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..34aec4ebb3c58e066cb385bf24facab869b26e9d --- /dev/null +++ b/include/aws/s3/model/IntelligentTieringFilter.h @@ -0,0 +1,99 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The Filter is used to identify objects that the S3 + * Intelligent-Tiering configuration applies to.

See Also:

AWS + * API Reference

+ */ + class IntelligentTieringFilter + { + public: + AWS_S3_API IntelligentTieringFilter(); + AWS_S3_API IntelligentTieringFilter(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API IntelligentTieringFilter& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

An object key name prefix that identifies the subset of objects to which the + * rule applies.

Replacement must be made for object keys + * containing special characters (such as carriage returns) when using XML + * requests. For more information, see + * XML related object key constraints.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline IntelligentTieringFilter& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline IntelligentTieringFilter& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline IntelligentTieringFilter& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + + inline const Tag& GetTag() const{ return m_tag; } + inline bool TagHasBeenSet() const { return m_tagHasBeenSet; } + inline void SetTag(const Tag& value) { m_tagHasBeenSet = true; m_tag = value; } + inline void SetTag(Tag&& value) { m_tagHasBeenSet = true; m_tag = std::move(value); } + inline IntelligentTieringFilter& WithTag(const Tag& value) { SetTag(value); return *this;} + inline IntelligentTieringFilter& WithTag(Tag&& value) { SetTag(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A conjunction (logical AND) of predicates, which is used in evaluating a + * metrics filter. The operator must have at least two predicates, and an object + * must match all of the predicates in order for the filter to apply.

+ */ + inline const IntelligentTieringAndOperator& GetAnd() const{ return m_and; } + inline bool AndHasBeenSet() const { return m_andHasBeenSet; } + inline void SetAnd(const IntelligentTieringAndOperator& value) { m_andHasBeenSet = true; m_and = value; } + inline void SetAnd(IntelligentTieringAndOperator&& value) { m_andHasBeenSet = true; m_and = std::move(value); } + inline IntelligentTieringFilter& WithAnd(const IntelligentTieringAndOperator& value) { SetAnd(value); return *this;} + inline IntelligentTieringFilter& WithAnd(IntelligentTieringAndOperator&& value) { SetAnd(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Tag m_tag; + bool m_tagHasBeenSet = false; + + IntelligentTieringAndOperator m_and; + bool m_andHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/InventoryConfiguration.h b/include/aws/s3/model/InventoryConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..c5b5ff1a1e7c24d1d73c09076e14fc17bbb42470 --- /dev/null +++ b/include/aws/s3/model/InventoryConfiguration.h @@ -0,0 +1,168 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the inventory configuration for an Amazon S3 bucket. For more + * information, see GET + * Bucket inventory in the Amazon S3 API Reference.

See + * Also:

AWS + * API Reference

+ */ + class InventoryConfiguration + { + public: + AWS_S3_API InventoryConfiguration(); + AWS_S3_API InventoryConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API InventoryConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Contains information about where to publish the inventory results.

+ */ + inline const InventoryDestination& GetDestination() const{ return m_destination; } + inline bool DestinationHasBeenSet() const { return m_destinationHasBeenSet; } + inline void SetDestination(const InventoryDestination& value) { m_destinationHasBeenSet = true; m_destination = value; } + inline void SetDestination(InventoryDestination&& value) { m_destinationHasBeenSet = true; m_destination = std::move(value); } + inline InventoryConfiguration& WithDestination(const InventoryDestination& value) { SetDestination(value); return *this;} + inline InventoryConfiguration& WithDestination(InventoryDestination&& value) { SetDestination(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether the inventory is enabled or disabled. If set to + * True, an inventory list is generated. If set to False, + * no inventory list is generated.

+ */ + inline bool GetIsEnabled() const{ return m_isEnabled; } + inline bool IsEnabledHasBeenSet() const { return m_isEnabledHasBeenSet; } + inline void SetIsEnabled(bool value) { m_isEnabledHasBeenSet = true; m_isEnabled = value; } + inline InventoryConfiguration& WithIsEnabled(bool value) { SetIsEnabled(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies an inventory filter. The inventory only includes objects that meet + * the filter's criteria.

+ */ + inline const InventoryFilter& GetFilter() const{ return m_filter; } + inline bool FilterHasBeenSet() const { return m_filterHasBeenSet; } + inline void SetFilter(const InventoryFilter& value) { m_filterHasBeenSet = true; m_filter = value; } + inline void SetFilter(InventoryFilter&& value) { m_filterHasBeenSet = true; m_filter = std::move(value); } + inline InventoryConfiguration& WithFilter(const InventoryFilter& value) { SetFilter(value); return *this;} + inline InventoryConfiguration& WithFilter(InventoryFilter&& value) { SetFilter(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The ID used to identify the inventory configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline InventoryConfiguration& WithId(const Aws::String& value) { SetId(value); return *this;} + inline InventoryConfiguration& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline InventoryConfiguration& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

Object versions to include in the inventory list. If set to All, + * the list includes all the object versions, which adds the version-related fields + * VersionId, IsLatest, and DeleteMarker to + * the list. If set to Current, the list does not contain these + * version-related fields.

+ */ + inline const InventoryIncludedObjectVersions& GetIncludedObjectVersions() const{ return m_includedObjectVersions; } + inline bool IncludedObjectVersionsHasBeenSet() const { return m_includedObjectVersionsHasBeenSet; } + inline void SetIncludedObjectVersions(const InventoryIncludedObjectVersions& value) { m_includedObjectVersionsHasBeenSet = true; m_includedObjectVersions = value; } + inline void SetIncludedObjectVersions(InventoryIncludedObjectVersions&& value) { m_includedObjectVersionsHasBeenSet = true; m_includedObjectVersions = std::move(value); } + inline InventoryConfiguration& WithIncludedObjectVersions(const InventoryIncludedObjectVersions& value) { SetIncludedObjectVersions(value); return *this;} + inline InventoryConfiguration& WithIncludedObjectVersions(InventoryIncludedObjectVersions&& value) { SetIncludedObjectVersions(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Contains the optional fields that are included in the inventory results.

+ */ + inline const Aws::Vector& GetOptionalFields() const{ return m_optionalFields; } + inline bool OptionalFieldsHasBeenSet() const { return m_optionalFieldsHasBeenSet; } + inline void SetOptionalFields(const Aws::Vector& value) { m_optionalFieldsHasBeenSet = true; m_optionalFields = value; } + inline void SetOptionalFields(Aws::Vector&& value) { m_optionalFieldsHasBeenSet = true; m_optionalFields = std::move(value); } + inline InventoryConfiguration& WithOptionalFields(const Aws::Vector& value) { SetOptionalFields(value); return *this;} + inline InventoryConfiguration& WithOptionalFields(Aws::Vector&& value) { SetOptionalFields(std::move(value)); return *this;} + inline InventoryConfiguration& AddOptionalFields(const InventoryOptionalField& value) { m_optionalFieldsHasBeenSet = true; m_optionalFields.push_back(value); return *this; } + inline InventoryConfiguration& AddOptionalFields(InventoryOptionalField&& value) { m_optionalFieldsHasBeenSet = true; m_optionalFields.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Specifies the schedule for generating inventory results.

+ */ + inline const InventorySchedule& GetSchedule() const{ return m_schedule; } + inline bool ScheduleHasBeenSet() const { return m_scheduleHasBeenSet; } + inline void SetSchedule(const InventorySchedule& value) { m_scheduleHasBeenSet = true; m_schedule = value; } + inline void SetSchedule(InventorySchedule&& value) { m_scheduleHasBeenSet = true; m_schedule = std::move(value); } + inline InventoryConfiguration& WithSchedule(const InventorySchedule& value) { SetSchedule(value); return *this;} + inline InventoryConfiguration& WithSchedule(InventorySchedule&& value) { SetSchedule(std::move(value)); return *this;} + ///@} + private: + + InventoryDestination m_destination; + bool m_destinationHasBeenSet = false; + + bool m_isEnabled; + bool m_isEnabledHasBeenSet = false; + + InventoryFilter m_filter; + bool m_filterHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + InventoryIncludedObjectVersions m_includedObjectVersions; + bool m_includedObjectVersionsHasBeenSet = false; + + Aws::Vector m_optionalFields; + bool m_optionalFieldsHasBeenSet = false; + + InventorySchedule m_schedule; + bool m_scheduleHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/InventoryDestination.h b/include/aws/s3/model/InventoryDestination.h new file mode 100644 index 0000000000000000000000000000000000000000..01590607cb58cefbd3db68080771ccc024bec945 --- /dev/null +++ b/include/aws/s3/model/InventoryDestination.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the inventory configuration for an Amazon S3 bucket.

See + * Also:

AWS + * API Reference

+ */ + class InventoryDestination + { + public: + AWS_S3_API InventoryDestination(); + AWS_S3_API InventoryDestination(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API InventoryDestination& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Contains the bucket name, file format, bucket owner (optional), and prefix + * (optional) where inventory results are published.

+ */ + inline const InventoryS3BucketDestination& GetS3BucketDestination() const{ return m_s3BucketDestination; } + inline bool S3BucketDestinationHasBeenSet() const { return m_s3BucketDestinationHasBeenSet; } + inline void SetS3BucketDestination(const InventoryS3BucketDestination& value) { m_s3BucketDestinationHasBeenSet = true; m_s3BucketDestination = value; } + inline void SetS3BucketDestination(InventoryS3BucketDestination&& value) { m_s3BucketDestinationHasBeenSet = true; m_s3BucketDestination = std::move(value); } + inline InventoryDestination& WithS3BucketDestination(const InventoryS3BucketDestination& value) { SetS3BucketDestination(value); return *this;} + inline InventoryDestination& WithS3BucketDestination(InventoryS3BucketDestination&& value) { SetS3BucketDestination(std::move(value)); return *this;} + ///@} + private: + + InventoryS3BucketDestination m_s3BucketDestination; + bool m_s3BucketDestinationHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/InventoryFormat.h b/include/aws/s3/model/InventoryFormat.h new file mode 100644 index 0000000000000000000000000000000000000000..e3f3a4923311e5d94ac431666bf20f4ccd526317 --- /dev/null +++ b/include/aws/s3/model/InventoryFormat.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class InventoryFormat + { + NOT_SET, + CSV, + ORC, + Parquet + }; + +namespace InventoryFormatMapper +{ +AWS_S3_API InventoryFormat GetInventoryFormatForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForInventoryFormat(InventoryFormat value); +} // namespace InventoryFormatMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/InventoryOptionalField.h b/include/aws/s3/model/InventoryOptionalField.h new file mode 100644 index 0000000000000000000000000000000000000000..ba17652988daea56da401edd6dc2811eb2a80328 --- /dev/null +++ b/include/aws/s3/model/InventoryOptionalField.h @@ -0,0 +1,44 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class InventoryOptionalField + { + NOT_SET, + Size, + LastModifiedDate, + StorageClass, + ETag, + IsMultipartUploaded, + ReplicationStatus, + EncryptionStatus, + ObjectLockRetainUntilDate, + ObjectLockMode, + ObjectLockLegalHoldStatus, + IntelligentTieringAccessTier, + BucketKeyStatus, + ChecksumAlgorithm, + ObjectAccessControlList, + ObjectOwner + }; + +namespace InventoryOptionalFieldMapper +{ +AWS_S3_API InventoryOptionalField GetInventoryOptionalFieldForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForInventoryOptionalField(InventoryOptionalField value); +} // namespace InventoryOptionalFieldMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/InventoryS3BucketDestination.h b/include/aws/s3/model/InventoryS3BucketDestination.h new file mode 100644 index 0000000000000000000000000000000000000000..d87e4636e589f05f787162807bed7ab5c5128838 --- /dev/null +++ b/include/aws/s3/model/InventoryS3BucketDestination.h @@ -0,0 +1,133 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Contains the bucket name, file format, bucket owner (optional), and prefix + * (optional) where inventory results are published.

See Also:

AWS + * API Reference

+ */ + class InventoryS3BucketDestination + { + public: + AWS_S3_API InventoryS3BucketDestination(); + AWS_S3_API InventoryS3BucketDestination(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API InventoryS3BucketDestination& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The account ID that owns the destination S3 bucket. If no account ID is + * provided, the owner is not validated before exporting data.

+ * Although this value is optional, we strongly recommend that you set it to help + * prevent problems if the destination bucket ownership changes.

+ */ + inline const Aws::String& GetAccountId() const{ return m_accountId; } + inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } + inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } + inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } + inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } + inline InventoryS3BucketDestination& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} + inline InventoryS3BucketDestination& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} + inline InventoryS3BucketDestination& WithAccountId(const char* value) { SetAccountId(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the bucket where inventory results will be + * published.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline InventoryS3BucketDestination& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline InventoryS3BucketDestination& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline InventoryS3BucketDestination& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the output format of the inventory results.

+ */ + inline const InventoryFormat& GetFormat() const{ return m_format; } + inline bool FormatHasBeenSet() const { return m_formatHasBeenSet; } + inline void SetFormat(const InventoryFormat& value) { m_formatHasBeenSet = true; m_format = value; } + inline void SetFormat(InventoryFormat&& value) { m_formatHasBeenSet = true; m_format = std::move(value); } + inline InventoryS3BucketDestination& WithFormat(const InventoryFormat& value) { SetFormat(value); return *this;} + inline InventoryS3BucketDestination& WithFormat(InventoryFormat&& value) { SetFormat(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The prefix that is prepended to all inventory results.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline InventoryS3BucketDestination& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline InventoryS3BucketDestination& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline InventoryS3BucketDestination& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

Contains the type of server-side encryption used to encrypt the inventory + * results.

+ */ + inline const InventoryEncryption& GetEncryption() const{ return m_encryption; } + inline bool EncryptionHasBeenSet() const { return m_encryptionHasBeenSet; } + inline void SetEncryption(const InventoryEncryption& value) { m_encryptionHasBeenSet = true; m_encryption = value; } + inline void SetEncryption(InventoryEncryption&& value) { m_encryptionHasBeenSet = true; m_encryption = std::move(value); } + inline InventoryS3BucketDestination& WithEncryption(const InventoryEncryption& value) { SetEncryption(value); return *this;} + inline InventoryS3BucketDestination& WithEncryption(InventoryEncryption&& value) { SetEncryption(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_accountId; + bool m_accountIdHasBeenSet = false; + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + InventoryFormat m_format; + bool m_formatHasBeenSet = false; + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + InventoryEncryption m_encryption; + bool m_encryptionHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/InventorySchedule.h b/include/aws/s3/model/InventorySchedule.h new file mode 100644 index 0000000000000000000000000000000000000000..8e3cf61c8fa1827e04ba43932bc7d3249471f944 --- /dev/null +++ b/include/aws/s3/model/InventorySchedule.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the schedule for generating inventory results.

See + * Also:

AWS + * API Reference

+ */ + class InventorySchedule + { + public: + AWS_S3_API InventorySchedule(); + AWS_S3_API InventorySchedule(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API InventorySchedule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies how frequently inventory results are produced.

+ */ + inline const InventoryFrequency& GetFrequency() const{ return m_frequency; } + inline bool FrequencyHasBeenSet() const { return m_frequencyHasBeenSet; } + inline void SetFrequency(const InventoryFrequency& value) { m_frequencyHasBeenSet = true; m_frequency = value; } + inline void SetFrequency(InventoryFrequency&& value) { m_frequencyHasBeenSet = true; m_frequency = std::move(value); } + inline InventorySchedule& WithFrequency(const InventoryFrequency& value) { SetFrequency(value); return *this;} + inline InventorySchedule& WithFrequency(InventoryFrequency&& value) { SetFrequency(std::move(value)); return *this;} + ///@} + private: + + InventoryFrequency m_frequency; + bool m_frequencyHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/LifecycleConfiguration.h b/include/aws/s3/model/LifecycleConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..6413aeb88a1adbea898026afacf6ac5c6a8b9929 --- /dev/null +++ b/include/aws/s3/model/LifecycleConfiguration.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for lifecycle rules. You can add as many as 1000 rules.

For + * more information see, Managing + * your storage lifecycle in the Amazon S3 User Guide.

See + * Also:

AWS + * API Reference

+ */ + class LifecycleConfiguration + { + public: + AWS_S3_API LifecycleConfiguration(); + AWS_S3_API LifecycleConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API LifecycleConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies lifecycle configuration rules for an Amazon S3 bucket.

+ */ + inline const Aws::Vector& GetRules() const{ return m_rules; } + inline bool RulesHasBeenSet() const { return m_rulesHasBeenSet; } + inline void SetRules(const Aws::Vector& value) { m_rulesHasBeenSet = true; m_rules = value; } + inline void SetRules(Aws::Vector&& value) { m_rulesHasBeenSet = true; m_rules = std::move(value); } + inline LifecycleConfiguration& WithRules(const Aws::Vector& value) { SetRules(value); return *this;} + inline LifecycleConfiguration& WithRules(Aws::Vector&& value) { SetRules(std::move(value)); return *this;} + inline LifecycleConfiguration& AddRules(const Rule& value) { m_rulesHasBeenSet = true; m_rules.push_back(value); return *this; } + inline LifecycleConfiguration& AddRules(Rule&& value) { m_rulesHasBeenSet = true; m_rules.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_rules; + bool m_rulesHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/LifecycleRuleAndOperator.h b/include/aws/s3/model/LifecycleRuleAndOperator.h new file mode 100644 index 0000000000000000000000000000000000000000..ecbd7c69ccb576dba61723b2dce3fcfb23b84000 --- /dev/null +++ b/include/aws/s3/model/LifecycleRuleAndOperator.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

This is used in a Lifecycle Rule Filter to apply a logical AND to two or more + * predicates. The Lifecycle Rule will apply to any object matching all of the + * predicates configured inside the And operator.

See Also:

AWS + * API Reference

+ */ + class LifecycleRuleAndOperator + { + public: + AWS_S3_API LifecycleRuleAndOperator(); + AWS_S3_API LifecycleRuleAndOperator(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API LifecycleRuleAndOperator& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Prefix identifying one or more objects to which the rule applies.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline LifecycleRuleAndOperator& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline LifecycleRuleAndOperator& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline LifecycleRuleAndOperator& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

All of these tags must exist in the object's tag set in order for the rule to + * apply.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline LifecycleRuleAndOperator& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline LifecycleRuleAndOperator& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline LifecycleRuleAndOperator& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline LifecycleRuleAndOperator& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Minimum object size to which the rule applies.

+ */ + inline long long GetObjectSizeGreaterThan() const{ return m_objectSizeGreaterThan; } + inline bool ObjectSizeGreaterThanHasBeenSet() const { return m_objectSizeGreaterThanHasBeenSet; } + inline void SetObjectSizeGreaterThan(long long value) { m_objectSizeGreaterThanHasBeenSet = true; m_objectSizeGreaterThan = value; } + inline LifecycleRuleAndOperator& WithObjectSizeGreaterThan(long long value) { SetObjectSizeGreaterThan(value); return *this;} + ///@} + + ///@{ + /** + *

Maximum object size to which the rule applies.

+ */ + inline long long GetObjectSizeLessThan() const{ return m_objectSizeLessThan; } + inline bool ObjectSizeLessThanHasBeenSet() const { return m_objectSizeLessThanHasBeenSet; } + inline void SetObjectSizeLessThan(long long value) { m_objectSizeLessThanHasBeenSet = true; m_objectSizeLessThan = value; } + inline LifecycleRuleAndOperator& WithObjectSizeLessThan(long long value) { SetObjectSizeLessThan(value); return *this;} + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + + long long m_objectSizeGreaterThan; + bool m_objectSizeGreaterThanHasBeenSet = false; + + long long m_objectSizeLessThan; + bool m_objectSizeLessThanHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/LifecycleRuleFilter.h b/include/aws/s3/model/LifecycleRuleFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..9a053f19812c27f40548497428ac50708c06f949 --- /dev/null +++ b/include/aws/s3/model/LifecycleRuleFilter.h @@ -0,0 +1,129 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The Filter is used to identify objects that a Lifecycle Rule + * applies to. A Filter can have exactly one of Prefix, + * Tag, ObjectSizeGreaterThan, + * ObjectSizeLessThan, or And specified. If the + * Filter element is left empty, the Lifecycle Rule applies to all + * objects in the bucket.

See Also:

AWS + * API Reference

+ */ + class LifecycleRuleFilter + { + public: + AWS_S3_API LifecycleRuleFilter(); + AWS_S3_API LifecycleRuleFilter(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API LifecycleRuleFilter& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Prefix identifying one or more objects to which the rule applies.

+ *

Replacement must be made for object keys containing special + * characters (such as carriage returns) when using XML requests. For more + * information, see + * XML related object key constraints.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline LifecycleRuleFilter& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline LifecycleRuleFilter& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline LifecycleRuleFilter& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

This tag must exist in the object's tag set in order for the rule to + * apply.

This parameter applies to general purpose buckets only. It + * is not supported for directory bucket lifecycle configurations.

+ */ + inline const Tag& GetTag() const{ return m_tag; } + inline bool TagHasBeenSet() const { return m_tagHasBeenSet; } + inline void SetTag(const Tag& value) { m_tagHasBeenSet = true; m_tag = value; } + inline void SetTag(Tag&& value) { m_tagHasBeenSet = true; m_tag = std::move(value); } + inline LifecycleRuleFilter& WithTag(const Tag& value) { SetTag(value); return *this;} + inline LifecycleRuleFilter& WithTag(Tag&& value) { SetTag(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Minimum object size to which the rule applies.

+ */ + inline long long GetObjectSizeGreaterThan() const{ return m_objectSizeGreaterThan; } + inline bool ObjectSizeGreaterThanHasBeenSet() const { return m_objectSizeGreaterThanHasBeenSet; } + inline void SetObjectSizeGreaterThan(long long value) { m_objectSizeGreaterThanHasBeenSet = true; m_objectSizeGreaterThan = value; } + inline LifecycleRuleFilter& WithObjectSizeGreaterThan(long long value) { SetObjectSizeGreaterThan(value); return *this;} + ///@} + + ///@{ + /** + *

Maximum object size to which the rule applies.

+ */ + inline long long GetObjectSizeLessThan() const{ return m_objectSizeLessThan; } + inline bool ObjectSizeLessThanHasBeenSet() const { return m_objectSizeLessThanHasBeenSet; } + inline void SetObjectSizeLessThan(long long value) { m_objectSizeLessThanHasBeenSet = true; m_objectSizeLessThan = value; } + inline LifecycleRuleFilter& WithObjectSizeLessThan(long long value) { SetObjectSizeLessThan(value); return *this;} + ///@} + + ///@{ + + inline const LifecycleRuleAndOperator& GetAnd() const{ return m_and; } + inline bool AndHasBeenSet() const { return m_andHasBeenSet; } + inline void SetAnd(const LifecycleRuleAndOperator& value) { m_andHasBeenSet = true; m_and = value; } + inline void SetAnd(LifecycleRuleAndOperator&& value) { m_andHasBeenSet = true; m_and = std::move(value); } + inline LifecycleRuleFilter& WithAnd(const LifecycleRuleAndOperator& value) { SetAnd(value); return *this;} + inline LifecycleRuleFilter& WithAnd(LifecycleRuleAndOperator&& value) { SetAnd(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Tag m_tag; + bool m_tagHasBeenSet = false; + + long long m_objectSizeGreaterThan; + bool m_objectSizeGreaterThanHasBeenSet = false; + + long long m_objectSizeLessThan; + bool m_objectSizeLessThanHasBeenSet = false; + + LifecycleRuleAndOperator m_and; + bool m_andHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListBucketAnalyticsConfigurationsResult.h b/include/aws/s3/model/ListBucketAnalyticsConfigurationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a8b3505d7a44f837519e31dfb200664bc8a3ec61 --- /dev/null +++ b/include/aws/s3/model/ListBucketAnalyticsConfigurationsResult.h @@ -0,0 +1,116 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class ListBucketAnalyticsConfigurationsResult + { + public: + AWS_S3_API ListBucketAnalyticsConfigurationsResult(); + AWS_S3_API ListBucketAnalyticsConfigurationsResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API ListBucketAnalyticsConfigurationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether the returned list of analytics configurations is complete. + * A value of true indicates that the list is not complete and the + * NextContinuationToken will be provided for a subsequent request.

+ */ + inline bool GetIsTruncated() const{ return m_isTruncated; } + inline void SetIsTruncated(bool value) { m_isTruncated = value; } + inline ListBucketAnalyticsConfigurationsResult& WithIsTruncated(bool value) { SetIsTruncated(value); return *this;} + ///@} + + ///@{ + /** + *

The marker that is used as a starting point for this analytics configuration + * list response. This value is present if it was sent in the request.

+ */ + inline const Aws::String& GetContinuationToken() const{ return m_continuationToken; } + inline void SetContinuationToken(const Aws::String& value) { m_continuationToken = value; } + inline void SetContinuationToken(Aws::String&& value) { m_continuationToken = std::move(value); } + inline void SetContinuationToken(const char* value) { m_continuationToken.assign(value); } + inline ListBucketAnalyticsConfigurationsResult& WithContinuationToken(const Aws::String& value) { SetContinuationToken(value); return *this;} + inline ListBucketAnalyticsConfigurationsResult& WithContinuationToken(Aws::String&& value) { SetContinuationToken(std::move(value)); return *this;} + inline ListBucketAnalyticsConfigurationsResult& WithContinuationToken(const char* value) { SetContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

NextContinuationToken is sent when isTruncated is + * true, which indicates that there are more analytics configurations to list. The + * next request must include this NextContinuationToken. The token is + * obfuscated and is not a usable value.

+ */ + inline const Aws::String& GetNextContinuationToken() const{ return m_nextContinuationToken; } + inline void SetNextContinuationToken(const Aws::String& value) { m_nextContinuationToken = value; } + inline void SetNextContinuationToken(Aws::String&& value) { m_nextContinuationToken = std::move(value); } + inline void SetNextContinuationToken(const char* value) { m_nextContinuationToken.assign(value); } + inline ListBucketAnalyticsConfigurationsResult& WithNextContinuationToken(const Aws::String& value) { SetNextContinuationToken(value); return *this;} + inline ListBucketAnalyticsConfigurationsResult& WithNextContinuationToken(Aws::String&& value) { SetNextContinuationToken(std::move(value)); return *this;} + inline ListBucketAnalyticsConfigurationsResult& WithNextContinuationToken(const char* value) { SetNextContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

The list of analytics configurations for a bucket.

+ */ + inline const Aws::Vector& GetAnalyticsConfigurationList() const{ return m_analyticsConfigurationList; } + inline void SetAnalyticsConfigurationList(const Aws::Vector& value) { m_analyticsConfigurationList = value; } + inline void SetAnalyticsConfigurationList(Aws::Vector&& value) { m_analyticsConfigurationList = std::move(value); } + inline ListBucketAnalyticsConfigurationsResult& WithAnalyticsConfigurationList(const Aws::Vector& value) { SetAnalyticsConfigurationList(value); return *this;} + inline ListBucketAnalyticsConfigurationsResult& WithAnalyticsConfigurationList(Aws::Vector&& value) { SetAnalyticsConfigurationList(std::move(value)); return *this;} + inline ListBucketAnalyticsConfigurationsResult& AddAnalyticsConfigurationList(const AnalyticsConfiguration& value) { m_analyticsConfigurationList.push_back(value); return *this; } + inline ListBucketAnalyticsConfigurationsResult& AddAnalyticsConfigurationList(AnalyticsConfiguration&& value) { m_analyticsConfigurationList.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListBucketAnalyticsConfigurationsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListBucketAnalyticsConfigurationsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListBucketAnalyticsConfigurationsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + bool m_isTruncated; + + Aws::String m_continuationToken; + + Aws::String m_nextContinuationToken; + + Aws::Vector m_analyticsConfigurationList; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListBucketInventoryConfigurationsRequest.h b/include/aws/s3/model/ListBucketInventoryConfigurationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..761d6f13ab32e0fc4c19666c2535806948d4e140 --- /dev/null +++ b/include/aws/s3/model/ListBucketInventoryConfigurationsRequest.h @@ -0,0 +1,130 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class ListBucketInventoryConfigurationsRequest : public S3Request + { + public: + AWS_S3_API ListBucketInventoryConfigurationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListBucketInventoryConfigurations"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket containing the inventory configurations to + * retrieve.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline ListBucketInventoryConfigurationsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline ListBucketInventoryConfigurationsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline ListBucketInventoryConfigurationsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The marker used to continue an inventory configuration listing that has been + * truncated. Use the NextContinuationToken from a previously + * truncated list response to continue the listing. The continuation token is an + * opaque value that Amazon S3 understands.

+ */ + inline const Aws::String& GetContinuationToken() const{ return m_continuationToken; } + inline bool ContinuationTokenHasBeenSet() const { return m_continuationTokenHasBeenSet; } + inline void SetContinuationToken(const Aws::String& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = value; } + inline void SetContinuationToken(Aws::String&& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = std::move(value); } + inline void SetContinuationToken(const char* value) { m_continuationTokenHasBeenSet = true; m_continuationToken.assign(value); } + inline ListBucketInventoryConfigurationsRequest& WithContinuationToken(const Aws::String& value) { SetContinuationToken(value); return *this;} + inline ListBucketInventoryConfigurationsRequest& WithContinuationToken(Aws::String&& value) { SetContinuationToken(std::move(value)); return *this;} + inline ListBucketInventoryConfigurationsRequest& WithContinuationToken(const char* value) { SetContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline ListBucketInventoryConfigurationsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline ListBucketInventoryConfigurationsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline ListBucketInventoryConfigurationsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline ListBucketInventoryConfigurationsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline ListBucketInventoryConfigurationsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline ListBucketInventoryConfigurationsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline ListBucketInventoryConfigurationsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListBucketInventoryConfigurationsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListBucketInventoryConfigurationsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline ListBucketInventoryConfigurationsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListBucketInventoryConfigurationsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListBucketInventoryConfigurationsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_continuationToken; + bool m_continuationTokenHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListBucketsRequest.h b/include/aws/s3/model/ListBucketsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c8716cece77761dc8739f5765128f46f748971d0 --- /dev/null +++ b/include/aws/s3/model/ListBucketsRequest.h @@ -0,0 +1,153 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class ListBucketsRequest : public S3Request + { + public: + AWS_S3_API ListBucketsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListBuckets"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + + ///@{ + /** + *

Maximum number of buckets to be returned in response. When the number is more + * than the count of buckets that are owned by an Amazon Web Services account, + * return all the buckets in response.

+ */ + inline int GetMaxBuckets() const{ return m_maxBuckets; } + inline bool MaxBucketsHasBeenSet() const { return m_maxBucketsHasBeenSet; } + inline void SetMaxBuckets(int value) { m_maxBucketsHasBeenSet = true; m_maxBuckets = value; } + inline ListBucketsRequest& WithMaxBuckets(int value) { SetMaxBuckets(value); return *this;} + ///@} + + ///@{ + /** + *

ContinuationToken indicates to Amazon S3 that the list is being + * continued on this bucket with a token. ContinuationToken is + * obfuscated and is not a real key. You can use this + * ContinuationToken for pagination of the list results.

+ *

Length Constraints: Minimum length of 0. Maximum length of 1024.

+ *

Required: No.

If you specify the bucket-region, + * prefix, or continuation-token query parameters without + * using max-buckets to set the maximum number of buckets returned in + * the response, Amazon S3 applies a default page size of 10,000 and provides a + * continuation token if there are more buckets.

+ */ + inline const Aws::String& GetContinuationToken() const{ return m_continuationToken; } + inline bool ContinuationTokenHasBeenSet() const { return m_continuationTokenHasBeenSet; } + inline void SetContinuationToken(const Aws::String& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = value; } + inline void SetContinuationToken(Aws::String&& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = std::move(value); } + inline void SetContinuationToken(const char* value) { m_continuationTokenHasBeenSet = true; m_continuationToken.assign(value); } + inline ListBucketsRequest& WithContinuationToken(const Aws::String& value) { SetContinuationToken(value); return *this;} + inline ListBucketsRequest& WithContinuationToken(Aws::String&& value) { SetContinuationToken(std::move(value)); return *this;} + inline ListBucketsRequest& WithContinuationToken(const char* value) { SetContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

Limits the response to bucket names that begin with the specified bucket name + * prefix.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline ListBucketsRequest& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ListBucketsRequest& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ListBucketsRequest& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

Limits the response to buckets that are located in the specified Amazon Web + * Services Region. The Amazon Web Services Region must be expressed according to + * the Amazon Web Services Region code, such as us-west-2 for the US + * West (Oregon) Region. For a list of the valid values for all of the Amazon Web + * Services Regions, see Regions + * and Endpoints.

Requests made to a Regional endpoint that is + * different from the bucket-region parameter are not supported. For + * example, if you want to limit the response to your buckets in Region + * us-west-2, the request must be made to an endpoint in Region + * us-west-2.

+ */ + inline const Aws::String& GetBucketRegion() const{ return m_bucketRegion; } + inline bool BucketRegionHasBeenSet() const { return m_bucketRegionHasBeenSet; } + inline void SetBucketRegion(const Aws::String& value) { m_bucketRegionHasBeenSet = true; m_bucketRegion = value; } + inline void SetBucketRegion(Aws::String&& value) { m_bucketRegionHasBeenSet = true; m_bucketRegion = std::move(value); } + inline void SetBucketRegion(const char* value) { m_bucketRegionHasBeenSet = true; m_bucketRegion.assign(value); } + inline ListBucketsRequest& WithBucketRegion(const Aws::String& value) { SetBucketRegion(value); return *this;} + inline ListBucketsRequest& WithBucketRegion(Aws::String&& value) { SetBucketRegion(std::move(value)); return *this;} + inline ListBucketsRequest& WithBucketRegion(const char* value) { SetBucketRegion(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline ListBucketsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline ListBucketsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline ListBucketsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline ListBucketsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListBucketsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListBucketsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline ListBucketsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListBucketsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListBucketsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + int m_maxBuckets; + bool m_maxBucketsHasBeenSet = false; + + Aws::String m_continuationToken; + bool m_continuationTokenHasBeenSet = false; + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::String m_bucketRegion; + bool m_bucketRegionHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListDirectoryBucketsRequest.h b/include/aws/s3/model/ListDirectoryBucketsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e938456bc7e2f1146cae8394c993884af024b91d --- /dev/null +++ b/include/aws/s3/model/ListDirectoryBucketsRequest.h @@ -0,0 +1,107 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class ListDirectoryBucketsRequest : public S3Request + { + public: + AWS_S3_API ListDirectoryBucketsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListDirectoryBuckets"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

ContinuationToken indicates to Amazon S3 that the list is being + * continued on buckets in this account with a token. + * ContinuationToken is obfuscated and is not a real bucket name. You + * can use this ContinuationToken for the pagination of the list + * results.

+ */ + inline const Aws::String& GetContinuationToken() const{ return m_continuationToken; } + inline bool ContinuationTokenHasBeenSet() const { return m_continuationTokenHasBeenSet; } + inline void SetContinuationToken(const Aws::String& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = value; } + inline void SetContinuationToken(Aws::String&& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = std::move(value); } + inline void SetContinuationToken(const char* value) { m_continuationTokenHasBeenSet = true; m_continuationToken.assign(value); } + inline ListDirectoryBucketsRequest& WithContinuationToken(const Aws::String& value) { SetContinuationToken(value); return *this;} + inline ListDirectoryBucketsRequest& WithContinuationToken(Aws::String&& value) { SetContinuationToken(std::move(value)); return *this;} + inline ListDirectoryBucketsRequest& WithContinuationToken(const char* value) { SetContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

Maximum number of buckets to be returned in response. When the number is more + * than the count of buckets that are owned by an Amazon Web Services account, + * return all the buckets in response.

+ */ + inline int GetMaxDirectoryBuckets() const{ return m_maxDirectoryBuckets; } + inline bool MaxDirectoryBucketsHasBeenSet() const { return m_maxDirectoryBucketsHasBeenSet; } + inline void SetMaxDirectoryBuckets(int value) { m_maxDirectoryBucketsHasBeenSet = true; m_maxDirectoryBuckets = value; } + inline ListDirectoryBucketsRequest& WithMaxDirectoryBuckets(int value) { SetMaxDirectoryBuckets(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline ListDirectoryBucketsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline ListDirectoryBucketsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline ListDirectoryBucketsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline ListDirectoryBucketsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListDirectoryBucketsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListDirectoryBucketsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline ListDirectoryBucketsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListDirectoryBucketsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListDirectoryBucketsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_continuationToken; + bool m_continuationTokenHasBeenSet = false; + + int m_maxDirectoryBuckets; + bool m_maxDirectoryBucketsHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListDirectoryBucketsResult.h b/include/aws/s3/model/ListDirectoryBucketsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..39c19a7e5d96f0b5283659ba0f853f991020f0f9 --- /dev/null +++ b/include/aws/s3/model/ListDirectoryBucketsResult.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class ListDirectoryBucketsResult + { + public: + AWS_S3_API ListDirectoryBucketsResult(); + AWS_S3_API ListDirectoryBucketsResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API ListDirectoryBucketsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The list of buckets owned by the requester.

+ */ + inline const Aws::Vector& GetBuckets() const{ return m_buckets; } + inline void SetBuckets(const Aws::Vector& value) { m_buckets = value; } + inline void SetBuckets(Aws::Vector&& value) { m_buckets = std::move(value); } + inline ListDirectoryBucketsResult& WithBuckets(const Aws::Vector& value) { SetBuckets(value); return *this;} + inline ListDirectoryBucketsResult& WithBuckets(Aws::Vector&& value) { SetBuckets(std::move(value)); return *this;} + inline ListDirectoryBucketsResult& AddBuckets(const Bucket& value) { m_buckets.push_back(value); return *this; } + inline ListDirectoryBucketsResult& AddBuckets(Bucket&& value) { m_buckets.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

If ContinuationToken was sent with the request, it is included + * in the response. You can use the returned ContinuationToken for + * pagination of the list response.

+ */ + inline const Aws::String& GetContinuationToken() const{ return m_continuationToken; } + inline void SetContinuationToken(const Aws::String& value) { m_continuationToken = value; } + inline void SetContinuationToken(Aws::String&& value) { m_continuationToken = std::move(value); } + inline void SetContinuationToken(const char* value) { m_continuationToken.assign(value); } + inline ListDirectoryBucketsResult& WithContinuationToken(const Aws::String& value) { SetContinuationToken(value); return *this;} + inline ListDirectoryBucketsResult& WithContinuationToken(Aws::String&& value) { SetContinuationToken(std::move(value)); return *this;} + inline ListDirectoryBucketsResult& WithContinuationToken(const char* value) { SetContinuationToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListDirectoryBucketsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListDirectoryBucketsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListDirectoryBucketsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_buckets; + + Aws::String m_continuationToken; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListMultipartUploadsRequest.h b/include/aws/s3/model/ListMultipartUploadsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e16003794d4ad6527374e4d952dd048b4b2e7db1 --- /dev/null +++ b/include/aws/s3/model/ListMultipartUploadsRequest.h @@ -0,0 +1,284 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class ListMultipartUploadsRequest : public S3Request + { + public: + AWS_S3_API ListMultipartUploadsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListMultipartUploads"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket to which the multipart upload was initiated.

+ * Directory buckets - When you use this operation with a directory bucket, + * you must use virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline ListMultipartUploadsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline ListMultipartUploadsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline ListMultipartUploadsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Character you use to group keys.

All keys that contain the same string + * between the prefix, if specified, and the first occurrence of the delimiter + * after the prefix are grouped under a single result element, + * CommonPrefixes. If you don't specify the prefix parameter, then the + * substring starts at the beginning of the key. The keys that are grouped under + * CommonPrefixes result element are not returned elsewhere in the + * response.

Directory buckets - For directory buckets, + * / is the only supported delimiter.

+ */ + inline const Aws::String& GetDelimiter() const{ return m_delimiter; } + inline bool DelimiterHasBeenSet() const { return m_delimiterHasBeenSet; } + inline void SetDelimiter(const Aws::String& value) { m_delimiterHasBeenSet = true; m_delimiter = value; } + inline void SetDelimiter(Aws::String&& value) { m_delimiterHasBeenSet = true; m_delimiter = std::move(value); } + inline void SetDelimiter(const char* value) { m_delimiterHasBeenSet = true; m_delimiter.assign(value); } + inline ListMultipartUploadsRequest& WithDelimiter(const Aws::String& value) { SetDelimiter(value); return *this;} + inline ListMultipartUploadsRequest& WithDelimiter(Aws::String&& value) { SetDelimiter(std::move(value)); return *this;} + inline ListMultipartUploadsRequest& WithDelimiter(const char* value) { SetDelimiter(value); return *this;} + ///@} + + ///@{ + + inline const EncodingType& GetEncodingType() const{ return m_encodingType; } + inline bool EncodingTypeHasBeenSet() const { return m_encodingTypeHasBeenSet; } + inline void SetEncodingType(const EncodingType& value) { m_encodingTypeHasBeenSet = true; m_encodingType = value; } + inline void SetEncodingType(EncodingType&& value) { m_encodingTypeHasBeenSet = true; m_encodingType = std::move(value); } + inline ListMultipartUploadsRequest& WithEncodingType(const EncodingType& value) { SetEncodingType(value); return *this;} + inline ListMultipartUploadsRequest& WithEncodingType(EncodingType&& value) { SetEncodingType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the multipart upload after which listing should begin.

+ *
  • General purpose buckets - For general purpose buckets, + * key-marker is an object key. Together with + * upload-id-marker, this parameter specifies the multipart upload + * after which listing should begin.

    If upload-id-marker is not + * specified, only the keys lexicographically greater than the specified + * key-marker will be included in the list.

    If + * upload-id-marker is specified, any multipart uploads for a key + * equal to the key-marker might also be included, provided those + * multipart uploads have upload IDs lexicographically greater than the specified + * upload-id-marker.

  • Directory buckets - For + * directory buckets, key-marker is obfuscated and isn't a real object + * key. The upload-id-marker parameter isn't supported by directory + * buckets. To list the additional multipart uploads, you only need to set the + * value of key-marker to the NextKeyMarker value from + * the previous response.

    In the ListMultipartUploads + * response, the multipart uploads aren't sorted lexicographically based on the + * object keys.

+ */ + inline const Aws::String& GetKeyMarker() const{ return m_keyMarker; } + inline bool KeyMarkerHasBeenSet() const { return m_keyMarkerHasBeenSet; } + inline void SetKeyMarker(const Aws::String& value) { m_keyMarkerHasBeenSet = true; m_keyMarker = value; } + inline void SetKeyMarker(Aws::String&& value) { m_keyMarkerHasBeenSet = true; m_keyMarker = std::move(value); } + inline void SetKeyMarker(const char* value) { m_keyMarkerHasBeenSet = true; m_keyMarker.assign(value); } + inline ListMultipartUploadsRequest& WithKeyMarker(const Aws::String& value) { SetKeyMarker(value); return *this;} + inline ListMultipartUploadsRequest& WithKeyMarker(Aws::String&& value) { SetKeyMarker(std::move(value)); return *this;} + inline ListMultipartUploadsRequest& WithKeyMarker(const char* value) { SetKeyMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the maximum number of multipart uploads, from 1 to 1,000, to return in + * the response body. 1,000 is the maximum number of uploads that can be returned + * in a response.

+ */ + inline int GetMaxUploads() const{ return m_maxUploads; } + inline bool MaxUploadsHasBeenSet() const { return m_maxUploadsHasBeenSet; } + inline void SetMaxUploads(int value) { m_maxUploadsHasBeenSet = true; m_maxUploads = value; } + inline ListMultipartUploadsRequest& WithMaxUploads(int value) { SetMaxUploads(value); return *this;} + ///@} + + ///@{ + /** + *

Lists in-progress uploads only for those keys that begin with the specified + * prefix. You can use prefixes to separate a bucket into different grouping of + * keys. (You can think of using prefix to make groups in the same way + * that you'd use a folder in a file system.)

Directory + * buckets - For directory buckets, only prefixes that end in a delimiter + * (/) are supported.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline ListMultipartUploadsRequest& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ListMultipartUploadsRequest& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ListMultipartUploadsRequest& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

Together with key-marker, specifies the multipart upload after which listing + * should begin. If key-marker is not specified, the upload-id-marker parameter is + * ignored. Otherwise, any multipart uploads for a key equal to the key-marker + * might be included in the list only if they have an upload ID lexicographically + * greater than the specified upload-id-marker.

This + * functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetUploadIdMarker() const{ return m_uploadIdMarker; } + inline bool UploadIdMarkerHasBeenSet() const { return m_uploadIdMarkerHasBeenSet; } + inline void SetUploadIdMarker(const Aws::String& value) { m_uploadIdMarkerHasBeenSet = true; m_uploadIdMarker = value; } + inline void SetUploadIdMarker(Aws::String&& value) { m_uploadIdMarkerHasBeenSet = true; m_uploadIdMarker = std::move(value); } + inline void SetUploadIdMarker(const char* value) { m_uploadIdMarkerHasBeenSet = true; m_uploadIdMarker.assign(value); } + inline ListMultipartUploadsRequest& WithUploadIdMarker(const Aws::String& value) { SetUploadIdMarker(value); return *this;} + inline ListMultipartUploadsRequest& WithUploadIdMarker(Aws::String&& value) { SetUploadIdMarker(std::move(value)); return *this;} + inline ListMultipartUploadsRequest& WithUploadIdMarker(const char* value) { SetUploadIdMarker(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline ListMultipartUploadsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline ListMultipartUploadsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline ListMultipartUploadsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline ListMultipartUploadsRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline ListMultipartUploadsRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline ListMultipartUploadsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline ListMultipartUploadsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline ListMultipartUploadsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline ListMultipartUploadsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListMultipartUploadsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListMultipartUploadsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline ListMultipartUploadsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListMultipartUploadsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListMultipartUploadsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_delimiter; + bool m_delimiterHasBeenSet = false; + + EncodingType m_encodingType; + bool m_encodingTypeHasBeenSet = false; + + Aws::String m_keyMarker; + bool m_keyMarkerHasBeenSet = false; + + int m_maxUploads; + bool m_maxUploadsHasBeenSet = false; + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::String m_uploadIdMarker; + bool m_uploadIdMarkerHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListObjectVersionsResult.h b/include/aws/s3/model/ListObjectVersionsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..6c08e8b488db4c0c9601b3ab99b335fe90417228 --- /dev/null +++ b/include/aws/s3/model/ListObjectVersionsResult.h @@ -0,0 +1,277 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class ListObjectVersionsResult + { + public: + AWS_S3_API ListObjectVersionsResult(); + AWS_S3_API ListObjectVersionsResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API ListObjectVersionsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A flag that indicates whether Amazon S3 returned all of the results that + * satisfied the search criteria. If your results were truncated, you can make a + * follow-up paginated request by using the NextKeyMarker and + * NextVersionIdMarker response parameters as a starting place in + * another request to return the rest of the results.

+ */ + inline bool GetIsTruncated() const{ return m_isTruncated; } + inline void SetIsTruncated(bool value) { m_isTruncated = value; } + inline ListObjectVersionsResult& WithIsTruncated(bool value) { SetIsTruncated(value); return *this;} + ///@} + + ///@{ + /** + *

Marks the last key returned in a truncated response.

+ */ + inline const Aws::String& GetKeyMarker() const{ return m_keyMarker; } + inline void SetKeyMarker(const Aws::String& value) { m_keyMarker = value; } + inline void SetKeyMarker(Aws::String&& value) { m_keyMarker = std::move(value); } + inline void SetKeyMarker(const char* value) { m_keyMarker.assign(value); } + inline ListObjectVersionsResult& WithKeyMarker(const Aws::String& value) { SetKeyMarker(value); return *this;} + inline ListObjectVersionsResult& WithKeyMarker(Aws::String&& value) { SetKeyMarker(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithKeyMarker(const char* value) { SetKeyMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Marks the last version of the key returned in a truncated response.

+ */ + inline const Aws::String& GetVersionIdMarker() const{ return m_versionIdMarker; } + inline void SetVersionIdMarker(const Aws::String& value) { m_versionIdMarker = value; } + inline void SetVersionIdMarker(Aws::String&& value) { m_versionIdMarker = std::move(value); } + inline void SetVersionIdMarker(const char* value) { m_versionIdMarker.assign(value); } + inline ListObjectVersionsResult& WithVersionIdMarker(const Aws::String& value) { SetVersionIdMarker(value); return *this;} + inline ListObjectVersionsResult& WithVersionIdMarker(Aws::String&& value) { SetVersionIdMarker(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithVersionIdMarker(const char* value) { SetVersionIdMarker(value); return *this;} + ///@} + + ///@{ + /** + *

When the number of responses exceeds the value of MaxKeys, + * NextKeyMarker specifies the first key not returned that satisfies + * the search criteria. Use this value for the key-marker request parameter in a + * subsequent request.

+ */ + inline const Aws::String& GetNextKeyMarker() const{ return m_nextKeyMarker; } + inline void SetNextKeyMarker(const Aws::String& value) { m_nextKeyMarker = value; } + inline void SetNextKeyMarker(Aws::String&& value) { m_nextKeyMarker = std::move(value); } + inline void SetNextKeyMarker(const char* value) { m_nextKeyMarker.assign(value); } + inline ListObjectVersionsResult& WithNextKeyMarker(const Aws::String& value) { SetNextKeyMarker(value); return *this;} + inline ListObjectVersionsResult& WithNextKeyMarker(Aws::String&& value) { SetNextKeyMarker(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithNextKeyMarker(const char* value) { SetNextKeyMarker(value); return *this;} + ///@} + + ///@{ + /** + *

When the number of responses exceeds the value of MaxKeys, + * NextVersionIdMarker specifies the first object version not returned + * that satisfies the search criteria. Use this value for the + * version-id-marker request parameter in a subsequent request.

+ */ + inline const Aws::String& GetNextVersionIdMarker() const{ return m_nextVersionIdMarker; } + inline void SetNextVersionIdMarker(const Aws::String& value) { m_nextVersionIdMarker = value; } + inline void SetNextVersionIdMarker(Aws::String&& value) { m_nextVersionIdMarker = std::move(value); } + inline void SetNextVersionIdMarker(const char* value) { m_nextVersionIdMarker.assign(value); } + inline ListObjectVersionsResult& WithNextVersionIdMarker(const Aws::String& value) { SetNextVersionIdMarker(value); return *this;} + inline ListObjectVersionsResult& WithNextVersionIdMarker(Aws::String&& value) { SetNextVersionIdMarker(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithNextVersionIdMarker(const char* value) { SetNextVersionIdMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Container for version information.

+ */ + inline const Aws::Vector& GetVersions() const{ return m_versions; } + inline void SetVersions(const Aws::Vector& value) { m_versions = value; } + inline void SetVersions(Aws::Vector&& value) { m_versions = std::move(value); } + inline ListObjectVersionsResult& WithVersions(const Aws::Vector& value) { SetVersions(value); return *this;} + inline ListObjectVersionsResult& WithVersions(Aws::Vector&& value) { SetVersions(std::move(value)); return *this;} + inline ListObjectVersionsResult& AddVersions(const ObjectVersion& value) { m_versions.push_back(value); return *this; } + inline ListObjectVersionsResult& AddVersions(ObjectVersion&& value) { m_versions.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Container for an object that is a delete marker. To learn more about delete + * markers, see Working + * with delete markers.

+ */ + inline const Aws::Vector& GetDeleteMarkers() const{ return m_deleteMarkers; } + inline void SetDeleteMarkers(const Aws::Vector& value) { m_deleteMarkers = value; } + inline void SetDeleteMarkers(Aws::Vector&& value) { m_deleteMarkers = std::move(value); } + inline ListObjectVersionsResult& WithDeleteMarkers(const Aws::Vector& value) { SetDeleteMarkers(value); return *this;} + inline ListObjectVersionsResult& WithDeleteMarkers(Aws::Vector&& value) { SetDeleteMarkers(std::move(value)); return *this;} + inline ListObjectVersionsResult& AddDeleteMarkers(const DeleteMarkerEntry& value) { m_deleteMarkers.push_back(value); return *this; } + inline ListObjectVersionsResult& AddDeleteMarkers(DeleteMarkerEntry&& value) { m_deleteMarkers.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The bucket name.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline void SetName(const Aws::String& value) { m_name = value; } + inline void SetName(Aws::String&& value) { m_name = std::move(value); } + inline void SetName(const char* value) { m_name.assign(value); } + inline ListObjectVersionsResult& WithName(const Aws::String& value) { SetName(value); return *this;} + inline ListObjectVersionsResult& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

Selects objects that start with the value supplied by this parameter.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline void SetPrefix(const Aws::String& value) { m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefix.assign(value); } + inline ListObjectVersionsResult& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ListObjectVersionsResult& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

The delimiter grouping the included keys. A delimiter is a character that you + * specify to group keys. All keys that contain the same string between the prefix + * and the first occurrence of the delimiter are grouped under a single result + * element in CommonPrefixes. These groups are counted as one result + * against the max-keys limitation. These keys are not returned + * elsewhere in the response.

+ */ + inline const Aws::String& GetDelimiter() const{ return m_delimiter; } + inline void SetDelimiter(const Aws::String& value) { m_delimiter = value; } + inline void SetDelimiter(Aws::String&& value) { m_delimiter = std::move(value); } + inline void SetDelimiter(const char* value) { m_delimiter.assign(value); } + inline ListObjectVersionsResult& WithDelimiter(const Aws::String& value) { SetDelimiter(value); return *this;} + inline ListObjectVersionsResult& WithDelimiter(Aws::String&& value) { SetDelimiter(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithDelimiter(const char* value) { SetDelimiter(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the maximum number of objects to return.

+ */ + inline int GetMaxKeys() const{ return m_maxKeys; } + inline void SetMaxKeys(int value) { m_maxKeys = value; } + inline ListObjectVersionsResult& WithMaxKeys(int value) { SetMaxKeys(value); return *this;} + ///@} + + ///@{ + /** + *

All of the keys rolled up into a common prefix count as a single return when + * calculating the number of returns.

+ */ + inline const Aws::Vector& GetCommonPrefixes() const{ return m_commonPrefixes; } + inline void SetCommonPrefixes(const Aws::Vector& value) { m_commonPrefixes = value; } + inline void SetCommonPrefixes(Aws::Vector&& value) { m_commonPrefixes = std::move(value); } + inline ListObjectVersionsResult& WithCommonPrefixes(const Aws::Vector& value) { SetCommonPrefixes(value); return *this;} + inline ListObjectVersionsResult& WithCommonPrefixes(Aws::Vector&& value) { SetCommonPrefixes(std::move(value)); return *this;} + inline ListObjectVersionsResult& AddCommonPrefixes(const CommonPrefix& value) { m_commonPrefixes.push_back(value); return *this; } + inline ListObjectVersionsResult& AddCommonPrefixes(CommonPrefix&& value) { m_commonPrefixes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Encoding type used by Amazon S3 to encode object key names in the XML + * response.

If you specify the encoding-type request + * parameter, Amazon S3 includes this element in the response, and returns encoded + * key name values in the following response elements:

KeyMarker, + * NextKeyMarker, Prefix, Key, and Delimiter.

+ */ + inline const EncodingType& GetEncodingType() const{ return m_encodingType; } + inline void SetEncodingType(const EncodingType& value) { m_encodingType = value; } + inline void SetEncodingType(EncodingType&& value) { m_encodingType = std::move(value); } + inline ListObjectVersionsResult& WithEncodingType(const EncodingType& value) { SetEncodingType(value); return *this;} + inline ListObjectVersionsResult& WithEncodingType(EncodingType&& value) { SetEncodingType(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline ListObjectVersionsResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline ListObjectVersionsResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListObjectVersionsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListObjectVersionsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListObjectVersionsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + bool m_isTruncated; + + Aws::String m_keyMarker; + + Aws::String m_versionIdMarker; + + Aws::String m_nextKeyMarker; + + Aws::String m_nextVersionIdMarker; + + Aws::Vector m_versions; + + Aws::Vector m_deleteMarkers; + + Aws::String m_name; + + Aws::String m_prefix; + + Aws::String m_delimiter; + + int m_maxKeys; + + Aws::Vector m_commonPrefixes; + + EncodingType m_encodingType; + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListObjectsRequest.h b/include/aws/s3/model/ListObjectsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f15ae201e4fdc1b2eec1fe0f6a212681c86f67ad --- /dev/null +++ b/include/aws/s3/model/ListObjectsRequest.h @@ -0,0 +1,258 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class ListObjectsRequest : public S3Request + { + public: + AWS_S3_API ListObjectsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListObjects"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket containing the objects.

Directory + * buckets - When you use this operation with a directory bucket, you must use + * virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline ListObjectsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline ListObjectsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline ListObjectsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

A delimiter is a character that you use to group keys.

+ */ + inline const Aws::String& GetDelimiter() const{ return m_delimiter; } + inline bool DelimiterHasBeenSet() const { return m_delimiterHasBeenSet; } + inline void SetDelimiter(const Aws::String& value) { m_delimiterHasBeenSet = true; m_delimiter = value; } + inline void SetDelimiter(Aws::String&& value) { m_delimiterHasBeenSet = true; m_delimiter = std::move(value); } + inline void SetDelimiter(const char* value) { m_delimiterHasBeenSet = true; m_delimiter.assign(value); } + inline ListObjectsRequest& WithDelimiter(const Aws::String& value) { SetDelimiter(value); return *this;} + inline ListObjectsRequest& WithDelimiter(Aws::String&& value) { SetDelimiter(std::move(value)); return *this;} + inline ListObjectsRequest& WithDelimiter(const char* value) { SetDelimiter(value); return *this;} + ///@} + + ///@{ + + inline const EncodingType& GetEncodingType() const{ return m_encodingType; } + inline bool EncodingTypeHasBeenSet() const { return m_encodingTypeHasBeenSet; } + inline void SetEncodingType(const EncodingType& value) { m_encodingTypeHasBeenSet = true; m_encodingType = value; } + inline void SetEncodingType(EncodingType&& value) { m_encodingTypeHasBeenSet = true; m_encodingType = std::move(value); } + inline ListObjectsRequest& WithEncodingType(const EncodingType& value) { SetEncodingType(value); return *this;} + inline ListObjectsRequest& WithEncodingType(EncodingType&& value) { SetEncodingType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Marker is where you want Amazon S3 to start listing from. Amazon S3 starts + * listing after this specified key. Marker can be any key in the bucket.

+ */ + inline const Aws::String& GetMarker() const{ return m_marker; } + inline bool MarkerHasBeenSet() const { return m_markerHasBeenSet; } + inline void SetMarker(const Aws::String& value) { m_markerHasBeenSet = true; m_marker = value; } + inline void SetMarker(Aws::String&& value) { m_markerHasBeenSet = true; m_marker = std::move(value); } + inline void SetMarker(const char* value) { m_markerHasBeenSet = true; m_marker.assign(value); } + inline ListObjectsRequest& WithMarker(const Aws::String& value) { SetMarker(value); return *this;} + inline ListObjectsRequest& WithMarker(Aws::String&& value) { SetMarker(std::move(value)); return *this;} + inline ListObjectsRequest& WithMarker(const char* value) { SetMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the maximum number of keys returned in the response. By default, the + * action returns up to 1,000 key names. The response might contain fewer keys but + * will never contain more.

+ */ + inline int GetMaxKeys() const{ return m_maxKeys; } + inline bool MaxKeysHasBeenSet() const { return m_maxKeysHasBeenSet; } + inline void SetMaxKeys(int value) { m_maxKeysHasBeenSet = true; m_maxKeys = value; } + inline ListObjectsRequest& WithMaxKeys(int value) { SetMaxKeys(value); return *this;} + ///@} + + ///@{ + /** + *

Limits the response to keys that begin with the specified prefix.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline ListObjectsRequest& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ListObjectsRequest& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ListObjectsRequest& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

Confirms that the requester knows that she or he will be charged for the list + * objects request. Bucket owners need not specify this parameter in their + * requests.

+ */ + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline ListObjectsRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline ListObjectsRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline ListObjectsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline ListObjectsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline ListObjectsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the optional fields that you want returned in the response. Fields + * that you do not specify are not returned.

+ */ + inline const Aws::Vector& GetOptionalObjectAttributes() const{ return m_optionalObjectAttributes; } + inline bool OptionalObjectAttributesHasBeenSet() const { return m_optionalObjectAttributesHasBeenSet; } + inline void SetOptionalObjectAttributes(const Aws::Vector& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes = value; } + inline void SetOptionalObjectAttributes(Aws::Vector&& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes = std::move(value); } + inline ListObjectsRequest& WithOptionalObjectAttributes(const Aws::Vector& value) { SetOptionalObjectAttributes(value); return *this;} + inline ListObjectsRequest& WithOptionalObjectAttributes(Aws::Vector&& value) { SetOptionalObjectAttributes(std::move(value)); return *this;} + inline ListObjectsRequest& AddOptionalObjectAttributes(const OptionalObjectAttributes& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes.push_back(value); return *this; } + inline ListObjectsRequest& AddOptionalObjectAttributes(OptionalObjectAttributes&& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline ListObjectsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline ListObjectsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline ListObjectsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline ListObjectsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListObjectsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListObjectsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline ListObjectsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListObjectsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListObjectsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_delimiter; + bool m_delimiterHasBeenSet = false; + + EncodingType m_encodingType; + bool m_encodingTypeHasBeenSet = false; + + Aws::String m_marker; + bool m_markerHasBeenSet = false; + + int m_maxKeys; + bool m_maxKeysHasBeenSet = false; + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Vector m_optionalObjectAttributes; + bool m_optionalObjectAttributesHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListObjectsV2Request.h b/include/aws/s3/model/ListObjectsV2Request.h new file mode 100644 index 0000000000000000000000000000000000000000..06369341512fa9b3a92960566793135ed772fbfb --- /dev/null +++ b/include/aws/s3/model/ListObjectsV2Request.h @@ -0,0 +1,323 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class ListObjectsV2Request : public S3Request + { + public: + AWS_S3_API ListObjectsV2Request(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListObjectsV2"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

Directory buckets - When you use this operation with a directory + * bucket, you must use virtual-hosted-style requests in the format + * Bucket-name.s3express-zone-id.region-code.amazonaws.com. + * Path-style requests are not supported. Directory bucket names must be unique in + * the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the + * format bucket-base-name--zone-id--x-s3 (for example, + * amzn-s3-demo-bucket--usw2-az1--x-s3). For + * information about bucket naming restrictions, see Directory + * bucket naming rules in the Amazon S3 User Guide.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

Access + * points and Object Lambda access points are not supported by directory + * buckets.

S3 on Outposts - When you use this action with + * S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 + * on Outposts hostname takes the form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline ListObjectsV2Request& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline ListObjectsV2Request& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline ListObjectsV2Request& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

A delimiter is a character that you use to group keys.

  • + *

    Directory buckets - For directory buckets, / is the only + * supported delimiter.

  • Directory buckets - When you + * query ListObjectsV2 with a delimiter during in-progress multipart + * uploads, the CommonPrefixes response parameter contains the + * prefixes that are associated with the in-progress multipart uploads. For more + * information about multipart uploads, see Multipart + * Upload Overview in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetDelimiter() const{ return m_delimiter; } + inline bool DelimiterHasBeenSet() const { return m_delimiterHasBeenSet; } + inline void SetDelimiter(const Aws::String& value) { m_delimiterHasBeenSet = true; m_delimiter = value; } + inline void SetDelimiter(Aws::String&& value) { m_delimiterHasBeenSet = true; m_delimiter = std::move(value); } + inline void SetDelimiter(const char* value) { m_delimiterHasBeenSet = true; m_delimiter.assign(value); } + inline ListObjectsV2Request& WithDelimiter(const Aws::String& value) { SetDelimiter(value); return *this;} + inline ListObjectsV2Request& WithDelimiter(Aws::String&& value) { SetDelimiter(std::move(value)); return *this;} + inline ListObjectsV2Request& WithDelimiter(const char* value) { SetDelimiter(value); return *this;} + ///@} + + ///@{ + /** + *

Encoding type used by Amazon S3 to encode the object + * keys in the response. Responses are encoded only in UTF-8. An object key can + * contain any Unicode character. However, the XML 1.0 parser can't parse certain + * characters, such as characters with an ASCII value from 0 to 10. For characters + * that aren't supported in XML 1.0, you can add this parameter to request that + * Amazon S3 encode the keys in the response. For more information about characters + * to avoid in object key names, see Object + * key naming guidelines.

When using the URL encoding type, + * non-ASCII characters that are used in an object's key name will be + * percent-encoded according to UTF-8 code values. For example, the object + * test_file(3).png will appear as + * test_file%283%29.png.

+ */ + inline const EncodingType& GetEncodingType() const{ return m_encodingType; } + inline bool EncodingTypeHasBeenSet() const { return m_encodingTypeHasBeenSet; } + inline void SetEncodingType(const EncodingType& value) { m_encodingTypeHasBeenSet = true; m_encodingType = value; } + inline void SetEncodingType(EncodingType&& value) { m_encodingTypeHasBeenSet = true; m_encodingType = std::move(value); } + inline ListObjectsV2Request& WithEncodingType(const EncodingType& value) { SetEncodingType(value); return *this;} + inline ListObjectsV2Request& WithEncodingType(EncodingType&& value) { SetEncodingType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Sets the maximum number of keys returned in the response. By default, the + * action returns up to 1,000 key names. The response might contain fewer keys but + * will never contain more.

+ */ + inline int GetMaxKeys() const{ return m_maxKeys; } + inline bool MaxKeysHasBeenSet() const { return m_maxKeysHasBeenSet; } + inline void SetMaxKeys(int value) { m_maxKeysHasBeenSet = true; m_maxKeys = value; } + inline ListObjectsV2Request& WithMaxKeys(int value) { SetMaxKeys(value); return *this;} + ///@} + + ///@{ + /** + *

Limits the response to keys that begin with the specified prefix.

+ *

Directory buckets - For directory buckets, only prefixes that end in + * a delimiter (/) are supported.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline ListObjectsV2Request& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ListObjectsV2Request& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ListObjectsV2Request& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

ContinuationToken indicates to Amazon S3 that the list is being + * continued on this bucket with a token. ContinuationToken is + * obfuscated and is not a real key. You can use this + * ContinuationToken for pagination of the list results.

+ */ + inline const Aws::String& GetContinuationToken() const{ return m_continuationToken; } + inline bool ContinuationTokenHasBeenSet() const { return m_continuationTokenHasBeenSet; } + inline void SetContinuationToken(const Aws::String& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = value; } + inline void SetContinuationToken(Aws::String&& value) { m_continuationTokenHasBeenSet = true; m_continuationToken = std::move(value); } + inline void SetContinuationToken(const char* value) { m_continuationTokenHasBeenSet = true; m_continuationToken.assign(value); } + inline ListObjectsV2Request& WithContinuationToken(const Aws::String& value) { SetContinuationToken(value); return *this;} + inline ListObjectsV2Request& WithContinuationToken(Aws::String&& value) { SetContinuationToken(std::move(value)); return *this;} + inline ListObjectsV2Request& WithContinuationToken(const char* value) { SetContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

The owner field is not present in ListObjectsV2 by default. If + * you want to return the owner field with each key in the result, then set the + * FetchOwner field to true.

Directory + * buckets - For directory buckets, the bucket owner is returned as the object + * owner for all objects.

+ */ + inline bool GetFetchOwner() const{ return m_fetchOwner; } + inline bool FetchOwnerHasBeenSet() const { return m_fetchOwnerHasBeenSet; } + inline void SetFetchOwner(bool value) { m_fetchOwnerHasBeenSet = true; m_fetchOwner = value; } + inline ListObjectsV2Request& WithFetchOwner(bool value) { SetFetchOwner(value); return *this;} + ///@} + + ///@{ + /** + *

StartAfter is where you want Amazon S3 to start listing from. Amazon S3 + * starts listing after this specified key. StartAfter can be any key in the + * bucket.

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::String& GetStartAfter() const{ return m_startAfter; } + inline bool StartAfterHasBeenSet() const { return m_startAfterHasBeenSet; } + inline void SetStartAfter(const Aws::String& value) { m_startAfterHasBeenSet = true; m_startAfter = value; } + inline void SetStartAfter(Aws::String&& value) { m_startAfterHasBeenSet = true; m_startAfter = std::move(value); } + inline void SetStartAfter(const char* value) { m_startAfterHasBeenSet = true; m_startAfter.assign(value); } + inline ListObjectsV2Request& WithStartAfter(const Aws::String& value) { SetStartAfter(value); return *this;} + inline ListObjectsV2Request& WithStartAfter(Aws::String&& value) { SetStartAfter(std::move(value)); return *this;} + inline ListObjectsV2Request& WithStartAfter(const char* value) { SetStartAfter(value); return *this;} + ///@} + + ///@{ + /** + *

Confirms that the requester knows that she or he will be charged for the list + * objects request in V2 style. Bucket owners need not specify this parameter in + * their requests.

This functionality is not supported for directory + * buckets.

+ */ + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline ListObjectsV2Request& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline ListObjectsV2Request& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline ListObjectsV2Request& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline ListObjectsV2Request& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline ListObjectsV2Request& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the optional fields that you want returned in the response. Fields + * that you do not specify are not returned.

This functionality is + * not supported for directory buckets.

+ */ + inline const Aws::Vector& GetOptionalObjectAttributes() const{ return m_optionalObjectAttributes; } + inline bool OptionalObjectAttributesHasBeenSet() const { return m_optionalObjectAttributesHasBeenSet; } + inline void SetOptionalObjectAttributes(const Aws::Vector& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes = value; } + inline void SetOptionalObjectAttributes(Aws::Vector&& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes = std::move(value); } + inline ListObjectsV2Request& WithOptionalObjectAttributes(const Aws::Vector& value) { SetOptionalObjectAttributes(value); return *this;} + inline ListObjectsV2Request& WithOptionalObjectAttributes(Aws::Vector&& value) { SetOptionalObjectAttributes(std::move(value)); return *this;} + inline ListObjectsV2Request& AddOptionalObjectAttributes(const OptionalObjectAttributes& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes.push_back(value); return *this; } + inline ListObjectsV2Request& AddOptionalObjectAttributes(OptionalObjectAttributes&& value) { m_optionalObjectAttributesHasBeenSet = true; m_optionalObjectAttributes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline ListObjectsV2Request& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline ListObjectsV2Request& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline ListObjectsV2Request& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline ListObjectsV2Request& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListObjectsV2Request& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListObjectsV2Request& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline ListObjectsV2Request& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline ListObjectsV2Request& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline ListObjectsV2Request& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_delimiter; + bool m_delimiterHasBeenSet = false; + + EncodingType m_encodingType; + bool m_encodingTypeHasBeenSet = false; + + int m_maxKeys; + bool m_maxKeysHasBeenSet = false; + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::String m_continuationToken; + bool m_continuationTokenHasBeenSet = false; + + bool m_fetchOwner; + bool m_fetchOwnerHasBeenSet = false; + + Aws::String m_startAfter; + bool m_startAfterHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Vector m_optionalObjectAttributes; + bool m_optionalObjectAttributesHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListObjectsV2Result.h b/include/aws/s3/model/ListObjectsV2Result.h new file mode 100644 index 0000000000000000000000000000000000000000..4f704ed785c44f20209d9f64a7f965150f6689ed --- /dev/null +++ b/include/aws/s3/model/ListObjectsV2Result.h @@ -0,0 +1,282 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class ListObjectsV2Result + { + public: + AWS_S3_API ListObjectsV2Result(); + AWS_S3_API ListObjectsV2Result(const Aws::AmazonWebServiceResult& result); + AWS_S3_API ListObjectsV2Result& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Set to false if all of the results were returned. Set to + * true if more keys are available to return. If the number of results + * exceeds that specified by MaxKeys, all of the results might not be + * returned.

+ */ + inline bool GetIsTruncated() const{ return m_isTruncated; } + inline void SetIsTruncated(bool value) { m_isTruncated = value; } + inline ListObjectsV2Result& WithIsTruncated(bool value) { SetIsTruncated(value); return *this;} + ///@} + + ///@{ + /** + *

Metadata about each object returned.

+ */ + inline const Aws::Vector& GetContents() const{ return m_contents; } + inline void SetContents(const Aws::Vector& value) { m_contents = value; } + inline void SetContents(Aws::Vector&& value) { m_contents = std::move(value); } + inline ListObjectsV2Result& WithContents(const Aws::Vector& value) { SetContents(value); return *this;} + inline ListObjectsV2Result& WithContents(Aws::Vector&& value) { SetContents(std::move(value)); return *this;} + inline ListObjectsV2Result& AddContents(const Object& value) { m_contents.push_back(value); return *this; } + inline ListObjectsV2Result& AddContents(Object&& value) { m_contents.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The bucket name.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline void SetName(const Aws::String& value) { m_name = value; } + inline void SetName(Aws::String&& value) { m_name = std::move(value); } + inline void SetName(const char* value) { m_name.assign(value); } + inline ListObjectsV2Result& WithName(const Aws::String& value) { SetName(value); return *this;} + inline ListObjectsV2Result& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline ListObjectsV2Result& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

Keys that begin with the indicated prefix.

Directory + * buckets - For directory buckets, only prefixes that end in a delimiter + * (/) are supported.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline void SetPrefix(const Aws::String& value) { m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefix.assign(value); } + inline ListObjectsV2Result& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ListObjectsV2Result& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ListObjectsV2Result& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

Causes keys that contain the same string between the prefix and + * the first occurrence of the delimiter to be rolled up into a single result + * element in the CommonPrefixes collection. These rolled-up keys are + * not returned elsewhere in the response. Each rolled-up result counts as only one + * return against the MaxKeys value.

Directory + * buckets - For directory buckets, / is the only supported + * delimiter.

+ */ + inline const Aws::String& GetDelimiter() const{ return m_delimiter; } + inline void SetDelimiter(const Aws::String& value) { m_delimiter = value; } + inline void SetDelimiter(Aws::String&& value) { m_delimiter = std::move(value); } + inline void SetDelimiter(const char* value) { m_delimiter.assign(value); } + inline ListObjectsV2Result& WithDelimiter(const Aws::String& value) { SetDelimiter(value); return *this;} + inline ListObjectsV2Result& WithDelimiter(Aws::String&& value) { SetDelimiter(std::move(value)); return *this;} + inline ListObjectsV2Result& WithDelimiter(const char* value) { SetDelimiter(value); return *this;} + ///@} + + ///@{ + /** + *

Sets the maximum number of keys returned in the response. By default, the + * action returns up to 1,000 key names. The response might contain fewer keys but + * will never contain more.

+ */ + inline int GetMaxKeys() const{ return m_maxKeys; } + inline void SetMaxKeys(int value) { m_maxKeys = value; } + inline ListObjectsV2Result& WithMaxKeys(int value) { SetMaxKeys(value); return *this;} + ///@} + + ///@{ + /** + *

All of the keys (up to 1,000) that share the same prefix are grouped + * together. When counting the total numbers of returns by this API operation, this + * group of keys is considered as one item.

A response can contain + * CommonPrefixes only if you specify a delimiter.

+ * CommonPrefixes contains all (if there are any) keys between + * Prefix and the next occurrence of the string specified by a + * delimiter.

CommonPrefixes lists keys that act like + * subdirectories in the directory specified by Prefix.

For + * example, if the prefix is notes/ and the delimiter is a slash + * (/) as in notes/summer/july, the common prefix is + * notes/summer/. All of the keys that roll up into a common prefix + * count as a single return when calculating the number of returns.

+ *
  • Directory buckets - For directory buckets, only prefixes + * that end in a delimiter (/) are supported.

  • + * Directory buckets - When you query ListObjectsV2 with a + * delimiter during in-progress multipart uploads, the CommonPrefixes + * response parameter contains the prefixes that are associated with the + * in-progress multipart uploads. For more information about multipart uploads, see + * Multipart + * Upload Overview in the Amazon S3 User Guide.

+ */ + inline const Aws::Vector& GetCommonPrefixes() const{ return m_commonPrefixes; } + inline void SetCommonPrefixes(const Aws::Vector& value) { m_commonPrefixes = value; } + inline void SetCommonPrefixes(Aws::Vector&& value) { m_commonPrefixes = std::move(value); } + inline ListObjectsV2Result& WithCommonPrefixes(const Aws::Vector& value) { SetCommonPrefixes(value); return *this;} + inline ListObjectsV2Result& WithCommonPrefixes(Aws::Vector&& value) { SetCommonPrefixes(std::move(value)); return *this;} + inline ListObjectsV2Result& AddCommonPrefixes(const CommonPrefix& value) { m_commonPrefixes.push_back(value); return *this; } + inline ListObjectsV2Result& AddCommonPrefixes(CommonPrefix&& value) { m_commonPrefixes.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Encoding type used by Amazon S3 to encode object key names in the XML + * response.

If you specify the encoding-type request + * parameter, Amazon S3 includes this element in the response, and returns encoded + * key name values in the following response elements:

Delimiter, + * Prefix, Key, and StartAfter.

+ */ + inline const EncodingType& GetEncodingType() const{ return m_encodingType; } + inline void SetEncodingType(const EncodingType& value) { m_encodingType = value; } + inline void SetEncodingType(EncodingType&& value) { m_encodingType = std::move(value); } + inline ListObjectsV2Result& WithEncodingType(const EncodingType& value) { SetEncodingType(value); return *this;} + inline ListObjectsV2Result& WithEncodingType(EncodingType&& value) { SetEncodingType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

KeyCount is the number of keys returned with this request. + * KeyCount will always be less than or equal to the + * MaxKeys field. For example, if you ask for 50 keys, your result + * will include 50 keys or fewer.

+ */ + inline int GetKeyCount() const{ return m_keyCount; } + inline void SetKeyCount(int value) { m_keyCount = value; } + inline ListObjectsV2Result& WithKeyCount(int value) { SetKeyCount(value); return *this;} + ///@} + + ///@{ + /** + *

If ContinuationToken was sent with the request, it is included + * in the response. You can use the returned ContinuationToken for + * pagination of the list response. You can use this ContinuationToken + * for pagination of the list results.

+ */ + inline const Aws::String& GetContinuationToken() const{ return m_continuationToken; } + inline void SetContinuationToken(const Aws::String& value) { m_continuationToken = value; } + inline void SetContinuationToken(Aws::String&& value) { m_continuationToken = std::move(value); } + inline void SetContinuationToken(const char* value) { m_continuationToken.assign(value); } + inline ListObjectsV2Result& WithContinuationToken(const Aws::String& value) { SetContinuationToken(value); return *this;} + inline ListObjectsV2Result& WithContinuationToken(Aws::String&& value) { SetContinuationToken(std::move(value)); return *this;} + inline ListObjectsV2Result& WithContinuationToken(const char* value) { SetContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

NextContinuationToken is sent when isTruncated is + * true, which means there are more keys in the bucket that can be listed. The next + * list requests to Amazon S3 can be continued with this + * NextContinuationToken. NextContinuationToken is + * obfuscated and is not a real key

+ */ + inline const Aws::String& GetNextContinuationToken() const{ return m_nextContinuationToken; } + inline void SetNextContinuationToken(const Aws::String& value) { m_nextContinuationToken = value; } + inline void SetNextContinuationToken(Aws::String&& value) { m_nextContinuationToken = std::move(value); } + inline void SetNextContinuationToken(const char* value) { m_nextContinuationToken.assign(value); } + inline ListObjectsV2Result& WithNextContinuationToken(const Aws::String& value) { SetNextContinuationToken(value); return *this;} + inline ListObjectsV2Result& WithNextContinuationToken(Aws::String&& value) { SetNextContinuationToken(std::move(value)); return *this;} + inline ListObjectsV2Result& WithNextContinuationToken(const char* value) { SetNextContinuationToken(value); return *this;} + ///@} + + ///@{ + /** + *

If StartAfter was sent with the request, it is included in the response.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetStartAfter() const{ return m_startAfter; } + inline void SetStartAfter(const Aws::String& value) { m_startAfter = value; } + inline void SetStartAfter(Aws::String&& value) { m_startAfter = std::move(value); } + inline void SetStartAfter(const char* value) { m_startAfter.assign(value); } + inline ListObjectsV2Result& WithStartAfter(const Aws::String& value) { SetStartAfter(value); return *this;} + inline ListObjectsV2Result& WithStartAfter(Aws::String&& value) { SetStartAfter(std::move(value)); return *this;} + inline ListObjectsV2Result& WithStartAfter(const char* value) { SetStartAfter(value); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline ListObjectsV2Result& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline ListObjectsV2Result& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListObjectsV2Result& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListObjectsV2Result& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListObjectsV2Result& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + bool m_isTruncated; + + Aws::Vector m_contents; + + Aws::String m_name; + + Aws::String m_prefix; + + Aws::String m_delimiter; + + int m_maxKeys; + + Aws::Vector m_commonPrefixes; + + EncodingType m_encodingType; + + int m_keyCount; + + Aws::String m_continuationToken; + + Aws::String m_nextContinuationToken; + + Aws::String m_startAfter; + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ListPartsResult.h b/include/aws/s3/model/ListPartsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..8662a8bc9550951df22f9fe30910f0ae08d0c1d8 --- /dev/null +++ b/include/aws/s3/model/ListPartsResult.h @@ -0,0 +1,304 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class ListPartsResult + { + public: + AWS_S3_API ListPartsResult(); + AWS_S3_API ListPartsResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API ListPartsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

If the bucket has a lifecycle rule configured with an action to abort + * incomplete multipart uploads and the prefix in the lifecycle rule matches the + * object name in the request, then the response includes this header indicating + * when the initiated multipart upload will become eligible for abort operation. + * For more information, see Aborting + * Incomplete Multipart Uploads Using a Bucket Lifecycle Configuration.

+ *

The response will also include the x-amz-abort-rule-id header + * that will provide the ID of the lifecycle configuration rule that defines this + * action.

This functionality is not supported for directory + * buckets.

+ */ + inline const Aws::Utils::DateTime& GetAbortDate() const{ return m_abortDate; } + inline void SetAbortDate(const Aws::Utils::DateTime& value) { m_abortDate = value; } + inline void SetAbortDate(Aws::Utils::DateTime&& value) { m_abortDate = std::move(value); } + inline ListPartsResult& WithAbortDate(const Aws::Utils::DateTime& value) { SetAbortDate(value); return *this;} + inline ListPartsResult& WithAbortDate(Aws::Utils::DateTime&& value) { SetAbortDate(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

This header is returned along with the x-amz-abort-date header. + * It identifies applicable lifecycle configuration rule that defines the action to + * abort incomplete multipart uploads.

This functionality is not + * supported for directory buckets.

+ */ + inline const Aws::String& GetAbortRuleId() const{ return m_abortRuleId; } + inline void SetAbortRuleId(const Aws::String& value) { m_abortRuleId = value; } + inline void SetAbortRuleId(Aws::String&& value) { m_abortRuleId = std::move(value); } + inline void SetAbortRuleId(const char* value) { m_abortRuleId.assign(value); } + inline ListPartsResult& WithAbortRuleId(const Aws::String& value) { SetAbortRuleId(value); return *this;} + inline ListPartsResult& WithAbortRuleId(Aws::String&& value) { SetAbortRuleId(std::move(value)); return *this;} + inline ListPartsResult& WithAbortRuleId(const char* value) { SetAbortRuleId(value); return *this;} + ///@} + + ///@{ + /** + *

The name of the bucket to which the multipart upload was initiated. Does not + * return the access point ARN or access point alias if used.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline void SetBucket(const Aws::String& value) { m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucket.assign(value); } + inline ListPartsResult& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline ListPartsResult& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline ListPartsResult& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Object key for which the multipart upload was initiated.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline void SetKey(const Aws::String& value) { m_key = value; } + inline void SetKey(Aws::String&& value) { m_key = std::move(value); } + inline void SetKey(const char* value) { m_key.assign(value); } + inline ListPartsResult& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline ListPartsResult& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline ListPartsResult& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

Upload ID identifying the multipart upload whose parts are being listed.

+ */ + inline const Aws::String& GetUploadId() const{ return m_uploadId; } + inline void SetUploadId(const Aws::String& value) { m_uploadId = value; } + inline void SetUploadId(Aws::String&& value) { m_uploadId = std::move(value); } + inline void SetUploadId(const char* value) { m_uploadId.assign(value); } + inline ListPartsResult& WithUploadId(const Aws::String& value) { SetUploadId(value); return *this;} + inline ListPartsResult& WithUploadId(Aws::String&& value) { SetUploadId(std::move(value)); return *this;} + inline ListPartsResult& WithUploadId(const char* value) { SetUploadId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the part after which listing should begin. Only parts with higher + * part numbers will be listed.

+ */ + inline int GetPartNumberMarker() const{ return m_partNumberMarker; } + inline void SetPartNumberMarker(int value) { m_partNumberMarker = value; } + inline ListPartsResult& WithPartNumberMarker(int value) { SetPartNumberMarker(value); return *this;} + ///@} + + ///@{ + /** + *

When a list is truncated, this element specifies the last part in the list, + * as well as the value to use for the part-number-marker request + * parameter in a subsequent request.

+ */ + inline int GetNextPartNumberMarker() const{ return m_nextPartNumberMarker; } + inline void SetNextPartNumberMarker(int value) { m_nextPartNumberMarker = value; } + inline ListPartsResult& WithNextPartNumberMarker(int value) { SetNextPartNumberMarker(value); return *this;} + ///@} + + ///@{ + /** + *

Maximum number of parts that were allowed in the response.

+ */ + inline int GetMaxParts() const{ return m_maxParts; } + inline void SetMaxParts(int value) { m_maxParts = value; } + inline ListPartsResult& WithMaxParts(int value) { SetMaxParts(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the returned list of parts is truncated. A true value + * indicates that the list was truncated. A list can be truncated if the number of + * parts exceeds the limit returned in the MaxParts element.

+ */ + inline bool GetIsTruncated() const{ return m_isTruncated; } + inline void SetIsTruncated(bool value) { m_isTruncated = value; } + inline ListPartsResult& WithIsTruncated(bool value) { SetIsTruncated(value); return *this;} + ///@} + + ///@{ + /** + *

Container for elements related to a particular part. A response can contain + * zero or more Part elements.

+ */ + inline const Aws::Vector& GetParts() const{ return m_parts; } + inline void SetParts(const Aws::Vector& value) { m_parts = value; } + inline void SetParts(Aws::Vector&& value) { m_parts = std::move(value); } + inline ListPartsResult& WithParts(const Aws::Vector& value) { SetParts(value); return *this;} + inline ListPartsResult& WithParts(Aws::Vector&& value) { SetParts(std::move(value)); return *this;} + inline ListPartsResult& AddParts(const Part& value) { m_parts.push_back(value); return *this; } + inline ListPartsResult& AddParts(Part&& value) { m_parts.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Container element that identifies who initiated the multipart upload. If the + * initiator is an Amazon Web Services account, this element provides the same + * information as the Owner element. If the initiator is an IAM User, + * this element provides the user ARN and display name.

+ */ + inline const Initiator& GetInitiator() const{ return m_initiator; } + inline void SetInitiator(const Initiator& value) { m_initiator = value; } + inline void SetInitiator(Initiator&& value) { m_initiator = std::move(value); } + inline ListPartsResult& WithInitiator(const Initiator& value) { SetInitiator(value); return *this;} + inline ListPartsResult& WithInitiator(Initiator&& value) { SetInitiator(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container element that identifies the object owner, after the object is + * created. If multipart upload is initiated by an IAM user, this element provides + * the parent account ID and display name.

Directory buckets + * - The bucket owner is returned as the object owner for all the parts.

+ * + */ + inline const Owner& GetOwner() const{ return m_owner; } + inline void SetOwner(const Owner& value) { m_owner = value; } + inline void SetOwner(Owner&& value) { m_owner = std::move(value); } + inline ListPartsResult& WithOwner(const Owner& value) { SetOwner(value); return *this;} + inline ListPartsResult& WithOwner(Owner&& value) { SetOwner(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The class of storage used to store the uploaded object.

+ * Directory buckets - Only the S3 Express One Zone storage class is + * supported by directory buckets to store objects.

+ */ + inline const StorageClass& GetStorageClass() const{ return m_storageClass; } + inline void SetStorageClass(const StorageClass& value) { m_storageClass = value; } + inline void SetStorageClass(StorageClass&& value) { m_storageClass = std::move(value); } + inline ListPartsResult& WithStorageClass(const StorageClass& value) { SetStorageClass(value); return *this;} + inline ListPartsResult& WithStorageClass(StorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline ListPartsResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline ListPartsResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The algorithm that was used to create a checksum of the object.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithm = std::move(value); } + inline ListPartsResult& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline ListPartsResult& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The checksum type, which determines how part-level checksums are combined to + * create an object-level checksum for multipart objects. You can use this header + * response to verify that the checksum type that is received is the same checksum + * type that was specified in CreateMultipartUpload request. For more + * information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumType = std::move(value); } + inline ListPartsResult& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline ListPartsResult& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListPartsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListPartsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListPartsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Utils::DateTime m_abortDate; + + Aws::String m_abortRuleId; + + Aws::String m_bucket; + + Aws::String m_key; + + Aws::String m_uploadId; + + int m_partNumberMarker; + + int m_nextPartNumberMarker; + + int m_maxParts; + + bool m_isTruncated; + + Aws::Vector m_parts; + + Initiator m_initiator; + + Owner m_owner; + + StorageClass m_storageClass; + + RequestCharged m_requestCharged; + + ChecksumAlgorithm m_checksumAlgorithm; + + ChecksumType m_checksumType; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/LocationInfo.h b/include/aws/s3/model/LocationInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..c6d509b472915fbb481441a9c8083a04e8f299a8 --- /dev/null +++ b/include/aws/s3/model/LocationInfo.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the location where the bucket will be created.

For directory + * buckets, the location type is Availability Zone or Local Zone. For more + * information about directory buckets, see Working + * with directory buckets in the Amazon S3 User Guide.

+ *

This functionality is only supported by directory buckets.

+ *

See Also:

AWS API + * Reference

+ */ + class LocationInfo + { + public: + AWS_S3_API LocationInfo(); + AWS_S3_API LocationInfo(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API LocationInfo& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The type of location where the bucket will be created.

+ */ + inline const LocationType& GetType() const{ return m_type; } + inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } + inline void SetType(const LocationType& value) { m_typeHasBeenSet = true; m_type = value; } + inline void SetType(LocationType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } + inline LocationInfo& WithType(const LocationType& value) { SetType(value); return *this;} + inline LocationInfo& WithType(LocationType&& value) { SetType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The name of the location where the bucket will be created.

For + * directory buckets, the name of the location is the Zone ID of the Availability + * Zone (AZ) or Local Zone (LZ) where the bucket will be created. An example AZ ID + * value is usw2-az1.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline LocationInfo& WithName(const Aws::String& value) { SetName(value); return *this;} + inline LocationInfo& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline LocationInfo& WithName(const char* value) { SetName(value); return *this;} + ///@} + private: + + LocationType m_type; + bool m_typeHasBeenSet = false; + + Aws::String m_name; + bool m_nameHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/LocationType.h b/include/aws/s3/model/LocationType.h new file mode 100644 index 0000000000000000000000000000000000000000..b3e25bdfcf69dd5216e33727b23d032a81de7adc --- /dev/null +++ b/include/aws/s3/model/LocationType.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class LocationType + { + NOT_SET, + AvailabilityZone, + LocalZone + }; + +namespace LocationTypeMapper +{ +AWS_S3_API LocationType GetLocationTypeForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForLocationType(LocationType value); +} // namespace LocationTypeMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/LoggingEnabled.h b/include/aws/s3/model/LoggingEnabled.h new file mode 100644 index 0000000000000000000000000000000000000000..eb4d473b9c389da7aa62462d2faf36af63499dd2 --- /dev/null +++ b/include/aws/s3/model/LoggingEnabled.h @@ -0,0 +1,128 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Describes where logs are stored and the prefix that Amazon S3 assigns to all + * log object keys for a bucket. For more information, see PUT + * Bucket logging in the Amazon S3 API Reference.

See + * Also:

AWS + * API Reference

+ */ + class LoggingEnabled + { + public: + AWS_S3_API LoggingEnabled(); + AWS_S3_API LoggingEnabled(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API LoggingEnabled& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the bucket where you want Amazon S3 to store server access logs. + * You can have your logs delivered to any bucket that you own, including the same + * bucket that is being logged. You can also configure multiple buckets to deliver + * their logs to the same target bucket. In this case, you should choose a + * different TargetPrefix for each source bucket so that the delivered + * log files can be distinguished by key.

+ */ + inline const Aws::String& GetTargetBucket() const{ return m_targetBucket; } + inline bool TargetBucketHasBeenSet() const { return m_targetBucketHasBeenSet; } + inline void SetTargetBucket(const Aws::String& value) { m_targetBucketHasBeenSet = true; m_targetBucket = value; } + inline void SetTargetBucket(Aws::String&& value) { m_targetBucketHasBeenSet = true; m_targetBucket = std::move(value); } + inline void SetTargetBucket(const char* value) { m_targetBucketHasBeenSet = true; m_targetBucket.assign(value); } + inline LoggingEnabled& WithTargetBucket(const Aws::String& value) { SetTargetBucket(value); return *this;} + inline LoggingEnabled& WithTargetBucket(Aws::String&& value) { SetTargetBucket(std::move(value)); return *this;} + inline LoggingEnabled& WithTargetBucket(const char* value) { SetTargetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Container for granting information.

Buckets that use the bucket owner + * enforced setting for Object Ownership don't support target grants. For more + * information, see Permissions + * for server access log delivery in the Amazon S3 User Guide.

+ */ + inline const Aws::Vector& GetTargetGrants() const{ return m_targetGrants; } + inline bool TargetGrantsHasBeenSet() const { return m_targetGrantsHasBeenSet; } + inline void SetTargetGrants(const Aws::Vector& value) { m_targetGrantsHasBeenSet = true; m_targetGrants = value; } + inline void SetTargetGrants(Aws::Vector&& value) { m_targetGrantsHasBeenSet = true; m_targetGrants = std::move(value); } + inline LoggingEnabled& WithTargetGrants(const Aws::Vector& value) { SetTargetGrants(value); return *this;} + inline LoggingEnabled& WithTargetGrants(Aws::Vector&& value) { SetTargetGrants(std::move(value)); return *this;} + inline LoggingEnabled& AddTargetGrants(const TargetGrant& value) { m_targetGrantsHasBeenSet = true; m_targetGrants.push_back(value); return *this; } + inline LoggingEnabled& AddTargetGrants(TargetGrant&& value) { m_targetGrantsHasBeenSet = true; m_targetGrants.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A prefix for all log object keys. If you store log files from multiple Amazon + * S3 buckets in a single bucket, you can use a prefix to distinguish which log + * files came from which bucket.

+ */ + inline const Aws::String& GetTargetPrefix() const{ return m_targetPrefix; } + inline bool TargetPrefixHasBeenSet() const { return m_targetPrefixHasBeenSet; } + inline void SetTargetPrefix(const Aws::String& value) { m_targetPrefixHasBeenSet = true; m_targetPrefix = value; } + inline void SetTargetPrefix(Aws::String&& value) { m_targetPrefixHasBeenSet = true; m_targetPrefix = std::move(value); } + inline void SetTargetPrefix(const char* value) { m_targetPrefixHasBeenSet = true; m_targetPrefix.assign(value); } + inline LoggingEnabled& WithTargetPrefix(const Aws::String& value) { SetTargetPrefix(value); return *this;} + inline LoggingEnabled& WithTargetPrefix(Aws::String&& value) { SetTargetPrefix(std::move(value)); return *this;} + inline LoggingEnabled& WithTargetPrefix(const char* value) { SetTargetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon S3 key format for log objects.

+ */ + inline const TargetObjectKeyFormat& GetTargetObjectKeyFormat() const{ return m_targetObjectKeyFormat; } + inline bool TargetObjectKeyFormatHasBeenSet() const { return m_targetObjectKeyFormatHasBeenSet; } + inline void SetTargetObjectKeyFormat(const TargetObjectKeyFormat& value) { m_targetObjectKeyFormatHasBeenSet = true; m_targetObjectKeyFormat = value; } + inline void SetTargetObjectKeyFormat(TargetObjectKeyFormat&& value) { m_targetObjectKeyFormatHasBeenSet = true; m_targetObjectKeyFormat = std::move(value); } + inline LoggingEnabled& WithTargetObjectKeyFormat(const TargetObjectKeyFormat& value) { SetTargetObjectKeyFormat(value); return *this;} + inline LoggingEnabled& WithTargetObjectKeyFormat(TargetObjectKeyFormat&& value) { SetTargetObjectKeyFormat(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_targetBucket; + bool m_targetBucketHasBeenSet = false; + + Aws::Vector m_targetGrants; + bool m_targetGrantsHasBeenSet = false; + + Aws::String m_targetPrefix; + bool m_targetPrefixHasBeenSet = false; + + TargetObjectKeyFormat m_targetObjectKeyFormat; + bool m_targetObjectKeyFormatHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MFADelete.h b/include/aws/s3/model/MFADelete.h new file mode 100644 index 0000000000000000000000000000000000000000..aa98ae26cd7dd6128530ca73c513dbf3e76a3e36 --- /dev/null +++ b/include/aws/s3/model/MFADelete.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class MFADelete + { + NOT_SET, + Enabled, + Disabled + }; + +namespace MFADeleteMapper +{ +AWS_S3_API MFADelete GetMFADeleteForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForMFADelete(MFADelete value); +} // namespace MFADeleteMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MFADeleteStatus.h b/include/aws/s3/model/MFADeleteStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..c26ab6ab56acf69944b5c7f20aa2ef1f82cab59e --- /dev/null +++ b/include/aws/s3/model/MFADeleteStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class MFADeleteStatus + { + NOT_SET, + Enabled, + Disabled + }; + +namespace MFADeleteStatusMapper +{ +AWS_S3_API MFADeleteStatus GetMFADeleteStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForMFADeleteStatus(MFADeleteStatus value); +} // namespace MFADeleteStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MetadataEntry.h b/include/aws/s3/model/MetadataEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..c736f7a5e680fb401ace8b34ef2d795d5435e8ec --- /dev/null +++ b/include/aws/s3/model/MetadataEntry.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A metadata key-value pair to store with an object.

See Also:

+ * AWS + * API Reference

+ */ + class MetadataEntry + { + public: + AWS_S3_API MetadataEntry(); + AWS_S3_API MetadataEntry(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API MetadataEntry& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Name of the object.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline MetadataEntry& WithName(const Aws::String& value) { SetName(value); return *this;} + inline MetadataEntry& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline MetadataEntry& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

Value of the object.

+ */ + inline const Aws::String& GetValue() const{ return m_value; } + inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; } + inline void SetValue(const Aws::String& value) { m_valueHasBeenSet = true; m_value = value; } + inline void SetValue(Aws::String&& value) { m_valueHasBeenSet = true; m_value = std::move(value); } + inline void SetValue(const char* value) { m_valueHasBeenSet = true; m_value.assign(value); } + inline MetadataEntry& WithValue(const Aws::String& value) { SetValue(value); return *this;} + inline MetadataEntry& WithValue(Aws::String&& value) { SetValue(std::move(value)); return *this;} + inline MetadataEntry& WithValue(const char* value) { SetValue(value); return *this;} + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + Aws::String m_value; + bool m_valueHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MetadataTableConfiguration.h b/include/aws/s3/model/MetadataTableConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..f8134e08b88c08bbdde670d4c4e3d8416489c21c --- /dev/null +++ b/include/aws/s3/model/MetadataTableConfiguration.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The metadata table configuration for a general purpose bucket. + *

See Also:

AWS + * API Reference

+ */ + class MetadataTableConfiguration + { + public: + AWS_S3_API MetadataTableConfiguration(); + AWS_S3_API MetadataTableConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API MetadataTableConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The destination information for the metadata table configuration. The + * destination table bucket must be in the same Region and Amazon Web Services + * account as the general purpose bucket. The specified metadata table name must be + * unique within the aws_s3_metadata namespace in the destination + * table bucket.

+ */ + inline const S3TablesDestination& GetS3TablesDestination() const{ return m_s3TablesDestination; } + inline bool S3TablesDestinationHasBeenSet() const { return m_s3TablesDestinationHasBeenSet; } + inline void SetS3TablesDestination(const S3TablesDestination& value) { m_s3TablesDestinationHasBeenSet = true; m_s3TablesDestination = value; } + inline void SetS3TablesDestination(S3TablesDestination&& value) { m_s3TablesDestinationHasBeenSet = true; m_s3TablesDestination = std::move(value); } + inline MetadataTableConfiguration& WithS3TablesDestination(const S3TablesDestination& value) { SetS3TablesDestination(value); return *this;} + inline MetadataTableConfiguration& WithS3TablesDestination(S3TablesDestination&& value) { SetS3TablesDestination(std::move(value)); return *this;} + ///@} + private: + + S3TablesDestination m_s3TablesDestination; + bool m_s3TablesDestinationHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Metrics.h b/include/aws/s3/model/Metrics.h new file mode 100644 index 0000000000000000000000000000000000000000..a306140d49e5a5931a49155e7d7fab1cdfba3782 --- /dev/null +++ b/include/aws/s3/model/Metrics.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container specifying replication metrics-related settings enabling + * replication metrics and events.

See Also:

AWS API + * Reference

+ */ + class Metrics + { + public: + AWS_S3_API Metrics(); + AWS_S3_API Metrics(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Metrics& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies whether the replication metrics are enabled.

+ */ + inline const MetricsStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const MetricsStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(MetricsStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline Metrics& WithStatus(const MetricsStatus& value) { SetStatus(value); return *this;} + inline Metrics& WithStatus(MetricsStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A container specifying the time threshold for emitting the + * s3:Replication:OperationMissedThreshold event.

+ */ + inline const ReplicationTimeValue& GetEventThreshold() const{ return m_eventThreshold; } + inline bool EventThresholdHasBeenSet() const { return m_eventThresholdHasBeenSet; } + inline void SetEventThreshold(const ReplicationTimeValue& value) { m_eventThresholdHasBeenSet = true; m_eventThreshold = value; } + inline void SetEventThreshold(ReplicationTimeValue&& value) { m_eventThresholdHasBeenSet = true; m_eventThreshold = std::move(value); } + inline Metrics& WithEventThreshold(const ReplicationTimeValue& value) { SetEventThreshold(value); return *this;} + inline Metrics& WithEventThreshold(ReplicationTimeValue&& value) { SetEventThreshold(std::move(value)); return *this;} + ///@} + private: + + MetricsStatus m_status; + bool m_statusHasBeenSet = false; + + ReplicationTimeValue m_eventThreshold; + bool m_eventThresholdHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MetricsAndOperator.h b/include/aws/s3/model/MetricsAndOperator.h new file mode 100644 index 0000000000000000000000000000000000000000..d8eecf886c7971e685fae8e3d054433a4b410874 --- /dev/null +++ b/include/aws/s3/model/MetricsAndOperator.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A conjunction (logical AND) of predicates, which is used in evaluating a + * metrics filter. The operator must have at least two predicates, and an object + * must match all of the predicates in order for the filter to apply.

See + * Also:

AWS + * API Reference

+ */ + class MetricsAndOperator + { + public: + AWS_S3_API MetricsAndOperator(); + AWS_S3_API MetricsAndOperator(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API MetricsAndOperator& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The prefix used when evaluating an AND predicate.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline MetricsAndOperator& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline MetricsAndOperator& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline MetricsAndOperator& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

The list of tags used when evaluating an AND predicate.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline MetricsAndOperator& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline MetricsAndOperator& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline MetricsAndOperator& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline MetricsAndOperator& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The access point ARN used when evaluating an AND predicate.

+ */ + inline const Aws::String& GetAccessPointArn() const{ return m_accessPointArn; } + inline bool AccessPointArnHasBeenSet() const { return m_accessPointArnHasBeenSet; } + inline void SetAccessPointArn(const Aws::String& value) { m_accessPointArnHasBeenSet = true; m_accessPointArn = value; } + inline void SetAccessPointArn(Aws::String&& value) { m_accessPointArnHasBeenSet = true; m_accessPointArn = std::move(value); } + inline void SetAccessPointArn(const char* value) { m_accessPointArnHasBeenSet = true; m_accessPointArn.assign(value); } + inline MetricsAndOperator& WithAccessPointArn(const Aws::String& value) { SetAccessPointArn(value); return *this;} + inline MetricsAndOperator& WithAccessPointArn(Aws::String&& value) { SetAccessPointArn(std::move(value)); return *this;} + inline MetricsAndOperator& WithAccessPointArn(const char* value) { SetAccessPointArn(value); return *this;} + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + + Aws::String m_accessPointArn; + bool m_accessPointArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MetricsConfiguration.h b/include/aws/s3/model/MetricsConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..3e5925c00c3efe202900d80d281d89439886bf0c --- /dev/null +++ b/include/aws/s3/model/MetricsConfiguration.h @@ -0,0 +1,87 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies a metrics configuration for the CloudWatch request metrics + * (specified by the metrics configuration ID) from an Amazon S3 bucket. If you're + * updating an existing metrics configuration, note that this is a full replacement + * of the existing metrics configuration. If you don't include the elements you + * want to keep, they are erased. For more information, see PutBucketMetricsConfiguration.

See + * Also:

AWS + * API Reference

+ */ + class MetricsConfiguration + { + public: + AWS_S3_API MetricsConfiguration(); + AWS_S3_API MetricsConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API MetricsConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The ID used to identify the metrics configuration. The ID has a 64 character + * limit and can only contain letters, numbers, periods, dashes, and + * underscores.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline MetricsConfiguration& WithId(const Aws::String& value) { SetId(value); return *this;} + inline MetricsConfiguration& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline MetricsConfiguration& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies a metrics configuration filter. The metrics configuration will only + * include objects that meet the filter's criteria. A filter must be a prefix, an + * object tag, an access point ARN, or a conjunction (MetricsAndOperator).

+ */ + inline const MetricsFilter& GetFilter() const{ return m_filter; } + inline bool FilterHasBeenSet() const { return m_filterHasBeenSet; } + inline void SetFilter(const MetricsFilter& value) { m_filterHasBeenSet = true; m_filter = value; } + inline void SetFilter(MetricsFilter&& value) { m_filterHasBeenSet = true; m_filter = std::move(value); } + inline MetricsConfiguration& WithFilter(const MetricsFilter& value) { SetFilter(value); return *this;} + inline MetricsConfiguration& WithFilter(MetricsFilter&& value) { SetFilter(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + MetricsFilter m_filter; + bool m_filterHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MetricsStatus.h b/include/aws/s3/model/MetricsStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..bfe99cd77cd8b39b76204f544bae96b06675f922 --- /dev/null +++ b/include/aws/s3/model/MetricsStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class MetricsStatus + { + NOT_SET, + Enabled, + Disabled + }; + +namespace MetricsStatusMapper +{ +AWS_S3_API MetricsStatus GetMetricsStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForMetricsStatus(MetricsStatus value); +} // namespace MetricsStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/MultipartUpload.h b/include/aws/s3/model/MultipartUpload.h new file mode 100644 index 0000000000000000000000000000000000000000..cad5902e7fd269eda4566ba50f640f610dce6d6e --- /dev/null +++ b/include/aws/s3/model/MultipartUpload.h @@ -0,0 +1,182 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for the MultipartUpload for the Amazon S3 + * object.

See Also:

AWS + * API Reference

+ */ + class MultipartUpload + { + public: + AWS_S3_API MultipartUpload(); + AWS_S3_API MultipartUpload(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API MultipartUpload& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Upload ID that identifies the multipart upload.

+ */ + inline const Aws::String& GetUploadId() const{ return m_uploadId; } + inline bool UploadIdHasBeenSet() const { return m_uploadIdHasBeenSet; } + inline void SetUploadId(const Aws::String& value) { m_uploadIdHasBeenSet = true; m_uploadId = value; } + inline void SetUploadId(Aws::String&& value) { m_uploadIdHasBeenSet = true; m_uploadId = std::move(value); } + inline void SetUploadId(const char* value) { m_uploadIdHasBeenSet = true; m_uploadId.assign(value); } + inline MultipartUpload& WithUploadId(const Aws::String& value) { SetUploadId(value); return *this;} + inline MultipartUpload& WithUploadId(Aws::String&& value) { SetUploadId(std::move(value)); return *this;} + inline MultipartUpload& WithUploadId(const char* value) { SetUploadId(value); return *this;} + ///@} + + ///@{ + /** + *

Key of the object for which the multipart upload was initiated.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline MultipartUpload& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline MultipartUpload& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline MultipartUpload& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

Date and time at which the multipart upload was initiated.

+ */ + inline const Aws::Utils::DateTime& GetInitiated() const{ return m_initiated; } + inline bool InitiatedHasBeenSet() const { return m_initiatedHasBeenSet; } + inline void SetInitiated(const Aws::Utils::DateTime& value) { m_initiatedHasBeenSet = true; m_initiated = value; } + inline void SetInitiated(Aws::Utils::DateTime&& value) { m_initiatedHasBeenSet = true; m_initiated = std::move(value); } + inline MultipartUpload& WithInitiated(const Aws::Utils::DateTime& value) { SetInitiated(value); return *this;} + inline MultipartUpload& WithInitiated(Aws::Utils::DateTime&& value) { SetInitiated(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The class of storage used to store the object.

Directory + * buckets - Only the S3 Express One Zone storage class is supported by + * directory buckets to store objects.

+ */ + inline const StorageClass& GetStorageClass() const{ return m_storageClass; } + inline bool StorageClassHasBeenSet() const { return m_storageClassHasBeenSet; } + inline void SetStorageClass(const StorageClass& value) { m_storageClassHasBeenSet = true; m_storageClass = value; } + inline void SetStorageClass(StorageClass&& value) { m_storageClassHasBeenSet = true; m_storageClass = std::move(value); } + inline MultipartUpload& WithStorageClass(const StorageClass& value) { SetStorageClass(value); return *this;} + inline MultipartUpload& WithStorageClass(StorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the owner of the object that is part of the multipart upload.

+ *

Directory buckets - The bucket owner is returned as the object + * owner for all the objects.

+ */ + inline const Owner& GetOwner() const{ return m_owner; } + inline bool OwnerHasBeenSet() const { return m_ownerHasBeenSet; } + inline void SetOwner(const Owner& value) { m_ownerHasBeenSet = true; m_owner = value; } + inline void SetOwner(Owner&& value) { m_ownerHasBeenSet = true; m_owner = std::move(value); } + inline MultipartUpload& WithOwner(const Owner& value) { SetOwner(value); return *this;} + inline MultipartUpload& WithOwner(Owner&& value) { SetOwner(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Identifies who initiated the multipart upload.

+ */ + inline const Initiator& GetInitiator() const{ return m_initiator; } + inline bool InitiatorHasBeenSet() const { return m_initiatorHasBeenSet; } + inline void SetInitiator(const Initiator& value) { m_initiatorHasBeenSet = true; m_initiator = value; } + inline void SetInitiator(Initiator&& value) { m_initiatorHasBeenSet = true; m_initiator = std::move(value); } + inline MultipartUpload& WithInitiator(const Initiator& value) { SetInitiator(value); return *this;} + inline MultipartUpload& WithInitiator(Initiator&& value) { SetInitiator(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The algorithm that was used to create a checksum of the object.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline MultipartUpload& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline MultipartUpload& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The checksum type that is used to calculate the object’s checksum value. For + * more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline bool ChecksumTypeHasBeenSet() const { return m_checksumTypeHasBeenSet; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumTypeHasBeenSet = true; m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumTypeHasBeenSet = true; m_checksumType = std::move(value); } + inline MultipartUpload& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline MultipartUpload& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_uploadId; + bool m_uploadIdHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::Utils::DateTime m_initiated; + bool m_initiatedHasBeenSet = false; + + StorageClass m_storageClass; + bool m_storageClassHasBeenSet = false; + + Owner m_owner; + bool m_ownerHasBeenSet = false; + + Initiator m_initiator; + bool m_initiatorHasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + ChecksumType m_checksumType; + bool m_checksumTypeHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/NoncurrentVersionExpiration.h b/include/aws/s3/model/NoncurrentVersionExpiration.h new file mode 100644 index 0000000000000000000000000000000000000000..933b7ac1bcb7f3fe5f533f3861e4d7709c90637c --- /dev/null +++ b/include/aws/s3/model/NoncurrentVersionExpiration.h @@ -0,0 +1,88 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 + * permanently deletes the noncurrent object versions. You set this lifecycle + * configuration action on a bucket that has versioning enabled (or suspended) to + * request that Amazon S3 delete noncurrent object versions at a specific period in + * the object's lifetime.

This parameter applies to general purpose + * buckets only. It is not supported for directory bucket lifecycle + * configurations.

See Also:

AWS + * API Reference

+ */ + class NoncurrentVersionExpiration + { + public: + AWS_S3_API NoncurrentVersionExpiration(); + AWS_S3_API NoncurrentVersionExpiration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API NoncurrentVersionExpiration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the number of days an object is noncurrent before Amazon S3 can + * perform the associated action. The value must be a non-zero positive integer. + * For information about the noncurrent days calculations, see How + * Amazon S3 Calculates When an Object Became Noncurrent in the Amazon S3 + * User Guide.

This parameter applies to general purpose buckets + * only. It is not supported for directory bucket lifecycle configurations.

+ * + */ + inline int GetNoncurrentDays() const{ return m_noncurrentDays; } + inline bool NoncurrentDaysHasBeenSet() const { return m_noncurrentDaysHasBeenSet; } + inline void SetNoncurrentDays(int value) { m_noncurrentDaysHasBeenSet = true; m_noncurrentDays = value; } + inline NoncurrentVersionExpiration& WithNoncurrentDays(int value) { SetNoncurrentDays(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies how many noncurrent versions Amazon S3 will retain. You can specify + * up to 100 noncurrent versions to retain. Amazon S3 will permanently delete any + * additional noncurrent versions beyond the specified number to retain. For more + * information about noncurrent versions, see Lifecycle + * configuration elements in the Amazon S3 User Guide.

+ *

This parameter applies to general purpose buckets only. It is not supported + * for directory bucket lifecycle configurations.

+ */ + inline int GetNewerNoncurrentVersions() const{ return m_newerNoncurrentVersions; } + inline bool NewerNoncurrentVersionsHasBeenSet() const { return m_newerNoncurrentVersionsHasBeenSet; } + inline void SetNewerNoncurrentVersions(int value) { m_newerNoncurrentVersionsHasBeenSet = true; m_newerNoncurrentVersions = value; } + inline NoncurrentVersionExpiration& WithNewerNoncurrentVersions(int value) { SetNewerNoncurrentVersions(value); return *this;} + ///@} + private: + + int m_noncurrentDays; + bool m_noncurrentDaysHasBeenSet = false; + + int m_newerNoncurrentVersions; + bool m_newerNoncurrentVersionsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/NoncurrentVersionTransition.h b/include/aws/s3/model/NoncurrentVersionTransition.h new file mode 100644 index 0000000000000000000000000000000000000000..92d3fd47e03fb750ed35655af5d47748eba0f0bb --- /dev/null +++ b/include/aws/s3/model/NoncurrentVersionTransition.h @@ -0,0 +1,105 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for the transition rule that describes when noncurrent objects + * transition to the STANDARD_IA, ONEZONE_IA, + * INTELLIGENT_TIERING, GLACIER_IR, GLACIER, + * or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled + * (or versioning is suspended), you can set this action to request that Amazon S3 + * transition noncurrent object versions to the STANDARD_IA, + * ONEZONE_IA, INTELLIGENT_TIERING, + * GLACIER_IR, GLACIER, or DEEP_ARCHIVE + * storage class at a specific period in the object's lifetime.

See + * Also:

AWS + * API Reference

+ */ + class NoncurrentVersionTransition + { + public: + AWS_S3_API NoncurrentVersionTransition(); + AWS_S3_API NoncurrentVersionTransition(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API NoncurrentVersionTransition& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the number of days an object is noncurrent before Amazon S3 can + * perform the associated action. For information about the noncurrent days + * calculations, see How + * Amazon S3 Calculates How Long an Object Has Been Noncurrent in the Amazon + * S3 User Guide.

+ */ + inline int GetNoncurrentDays() const{ return m_noncurrentDays; } + inline bool NoncurrentDaysHasBeenSet() const { return m_noncurrentDaysHasBeenSet; } + inline void SetNoncurrentDays(int value) { m_noncurrentDaysHasBeenSet = true; m_noncurrentDays = value; } + inline NoncurrentVersionTransition& WithNoncurrentDays(int value) { SetNoncurrentDays(value); return *this;} + ///@} + + ///@{ + /** + *

The class of storage used to store the object.

+ */ + inline const TransitionStorageClass& GetStorageClass() const{ return m_storageClass; } + inline bool StorageClassHasBeenSet() const { return m_storageClassHasBeenSet; } + inline void SetStorageClass(const TransitionStorageClass& value) { m_storageClassHasBeenSet = true; m_storageClass = value; } + inline void SetStorageClass(TransitionStorageClass&& value) { m_storageClassHasBeenSet = true; m_storageClass = std::move(value); } + inline NoncurrentVersionTransition& WithStorageClass(const TransitionStorageClass& value) { SetStorageClass(value); return *this;} + inline NoncurrentVersionTransition& WithStorageClass(TransitionStorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies how many noncurrent versions Amazon S3 will retain in the same + * storage class before transitioning objects. You can specify up to 100 noncurrent + * versions to retain. Amazon S3 will transition any additional noncurrent versions + * beyond the specified number to retain. For more information about noncurrent + * versions, see Lifecycle + * configuration elements in the Amazon S3 User Guide.

+ */ + inline int GetNewerNoncurrentVersions() const{ return m_newerNoncurrentVersions; } + inline bool NewerNoncurrentVersionsHasBeenSet() const { return m_newerNoncurrentVersionsHasBeenSet; } + inline void SetNewerNoncurrentVersions(int value) { m_newerNoncurrentVersionsHasBeenSet = true; m_newerNoncurrentVersions = value; } + inline NoncurrentVersionTransition& WithNewerNoncurrentVersions(int value) { SetNewerNoncurrentVersions(value); return *this;} + ///@} + private: + + int m_noncurrentDays; + bool m_noncurrentDaysHasBeenSet = false; + + TransitionStorageClass m_storageClass; + bool m_storageClassHasBeenSet = false; + + int m_newerNoncurrentVersions; + bool m_newerNoncurrentVersionsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/NotificationConfiguration.h b/include/aws/s3/model/NotificationConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..960c536e87aa7d800ebef13e0b064cad5bc4ddb8 --- /dev/null +++ b/include/aws/s3/model/NotificationConfiguration.h @@ -0,0 +1,135 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container for specifying the notification configuration of the bucket. If + * this element is empty, notifications are turned off for the + * bucket.

See Also:

AWS + * API Reference

+ */ + class NotificationConfiguration + { + public: + AWS_S3_API NotificationConfiguration(); + AWS_S3_API NotificationConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API NotificationConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The topic to which notifications are sent and the events for which + * notifications are generated.

+ */ + inline const Aws::Vector& GetTopicConfigurations() const{ return m_topicConfigurations; } + inline bool TopicConfigurationsHasBeenSet() const { return m_topicConfigurationsHasBeenSet; } + inline void SetTopicConfigurations(const Aws::Vector& value) { m_topicConfigurationsHasBeenSet = true; m_topicConfigurations = value; } + inline void SetTopicConfigurations(Aws::Vector&& value) { m_topicConfigurationsHasBeenSet = true; m_topicConfigurations = std::move(value); } + inline NotificationConfiguration& WithTopicConfigurations(const Aws::Vector& value) { SetTopicConfigurations(value); return *this;} + inline NotificationConfiguration& WithTopicConfigurations(Aws::Vector&& value) { SetTopicConfigurations(std::move(value)); return *this;} + inline NotificationConfiguration& AddTopicConfigurations(const TopicConfiguration& value) { m_topicConfigurationsHasBeenSet = true; m_topicConfigurations.push_back(value); return *this; } + inline NotificationConfiguration& AddTopicConfigurations(TopicConfiguration&& value) { m_topicConfigurationsHasBeenSet = true; m_topicConfigurations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The Amazon Simple Queue Service queues to publish messages to and the events + * for which to publish messages.

+ */ + inline const Aws::Vector& GetQueueConfigurations() const{ return m_queueConfigurations; } + inline bool QueueConfigurationsHasBeenSet() const { return m_queueConfigurationsHasBeenSet; } + inline void SetQueueConfigurations(const Aws::Vector& value) { m_queueConfigurationsHasBeenSet = true; m_queueConfigurations = value; } + inline void SetQueueConfigurations(Aws::Vector&& value) { m_queueConfigurationsHasBeenSet = true; m_queueConfigurations = std::move(value); } + inline NotificationConfiguration& WithQueueConfigurations(const Aws::Vector& value) { SetQueueConfigurations(value); return *this;} + inline NotificationConfiguration& WithQueueConfigurations(Aws::Vector&& value) { SetQueueConfigurations(std::move(value)); return *this;} + inline NotificationConfiguration& AddQueueConfigurations(const QueueConfiguration& value) { m_queueConfigurationsHasBeenSet = true; m_queueConfigurations.push_back(value); return *this; } + inline NotificationConfiguration& AddQueueConfigurations(QueueConfiguration&& value) { m_queueConfigurationsHasBeenSet = true; m_queueConfigurations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Describes the Lambda functions to invoke and the events for which to invoke + * them.

+ */ + inline const Aws::Vector& GetLambdaFunctionConfigurations() const{ return m_lambdaFunctionConfigurations; } + inline bool LambdaFunctionConfigurationsHasBeenSet() const { return m_lambdaFunctionConfigurationsHasBeenSet; } + inline void SetLambdaFunctionConfigurations(const Aws::Vector& value) { m_lambdaFunctionConfigurationsHasBeenSet = true; m_lambdaFunctionConfigurations = value; } + inline void SetLambdaFunctionConfigurations(Aws::Vector&& value) { m_lambdaFunctionConfigurationsHasBeenSet = true; m_lambdaFunctionConfigurations = std::move(value); } + inline NotificationConfiguration& WithLambdaFunctionConfigurations(const Aws::Vector& value) { SetLambdaFunctionConfigurations(value); return *this;} + inline NotificationConfiguration& WithLambdaFunctionConfigurations(Aws::Vector&& value) { SetLambdaFunctionConfigurations(std::move(value)); return *this;} + inline NotificationConfiguration& AddLambdaFunctionConfigurations(const LambdaFunctionConfiguration& value) { m_lambdaFunctionConfigurationsHasBeenSet = true; m_lambdaFunctionConfigurations.push_back(value); return *this; } + inline NotificationConfiguration& AddLambdaFunctionConfigurations(LambdaFunctionConfiguration&& value) { m_lambdaFunctionConfigurationsHasBeenSet = true; m_lambdaFunctionConfigurations.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Enables delivery of events to Amazon EventBridge.

+ */ + inline const EventBridgeConfiguration& GetEventBridgeConfiguration() const{ return m_eventBridgeConfiguration; } + inline bool EventBridgeConfigurationHasBeenSet() const { return m_eventBridgeConfigurationHasBeenSet; } + inline void SetEventBridgeConfiguration(const EventBridgeConfiguration& value) { m_eventBridgeConfigurationHasBeenSet = true; m_eventBridgeConfiguration = value; } + inline void SetEventBridgeConfiguration(EventBridgeConfiguration&& value) { m_eventBridgeConfigurationHasBeenSet = true; m_eventBridgeConfiguration = std::move(value); } + inline NotificationConfiguration& WithEventBridgeConfiguration(const EventBridgeConfiguration& value) { SetEventBridgeConfiguration(value); return *this;} + inline NotificationConfiguration& WithEventBridgeConfiguration(EventBridgeConfiguration&& value) { SetEventBridgeConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline bool RequestIdHasBeenSet() const { return m_requestIdHasBeenSet; } + inline void SetRequestId(const Aws::String& value) { m_requestIdHasBeenSet = true; m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestIdHasBeenSet = true; m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestIdHasBeenSet = true; m_requestId.assign(value); } + inline NotificationConfiguration& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline NotificationConfiguration& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline NotificationConfiguration& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::Vector m_topicConfigurations; + bool m_topicConfigurationsHasBeenSet = false; + + Aws::Vector m_queueConfigurations; + bool m_queueConfigurationsHasBeenSet = false; + + Aws::Vector m_lambdaFunctionConfigurations; + bool m_lambdaFunctionConfigurationsHasBeenSet = false; + + EventBridgeConfiguration m_eventBridgeConfiguration; + bool m_eventBridgeConfigurationHasBeenSet = false; + + Aws::String m_requestId; + bool m_requestIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/NotificationConfigurationFilter.h b/include/aws/s3/model/NotificationConfigurationFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..fbe765c9be0fd18b7725cffe36b95e70471ec270 --- /dev/null +++ b/include/aws/s3/model/NotificationConfigurationFilter.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies object key name filtering rules. For information about key name + * filtering, see Configuring + * event notifications using object key name filtering in the Amazon S3 User + * Guide.

See Also:

AWS + * API Reference

+ */ + class NotificationConfigurationFilter + { + public: + AWS_S3_API NotificationConfigurationFilter(); + AWS_S3_API NotificationConfigurationFilter(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API NotificationConfigurationFilter& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + + inline const S3KeyFilter& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const S3KeyFilter& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(S3KeyFilter&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline NotificationConfigurationFilter& WithKey(const S3KeyFilter& value) { SetKey(value); return *this;} + inline NotificationConfigurationFilter& WithKey(S3KeyFilter&& value) { SetKey(std::move(value)); return *this;} + ///@} + private: + + S3KeyFilter m_key; + bool m_keyHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Object.h b/include/aws/s3/model/Object.h new file mode 100644 index 0000000000000000000000000000000000000000..261bf6e5a2362614ef465f08eb02190a076991d7 --- /dev/null +++ b/include/aws/s3/model/Object.h @@ -0,0 +1,220 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

An object consists of data and its descriptive metadata.

See + * Also:

AWS API + * Reference

+ */ + class Object + { + public: + AWS_S3_API Object(); + AWS_S3_API Object(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Object& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The name that you assign to an object. You use the object key to retrieve the + * object.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline Object& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline Object& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline Object& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

Creation date of the object.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline bool LastModifiedHasBeenSet() const { return m_lastModifiedHasBeenSet; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModifiedHasBeenSet = true; m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModifiedHasBeenSet = true; m_lastModified = std::move(value); } + inline Object& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline Object& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The entity tag is a hash of the object. The ETag reflects changes only to the + * contents of an object, not its metadata. The ETag may or may not be an MD5 + * digest of the object data. Whether or not it is depends on how the object was + * created and how it is encrypted as described below:

  • Objects + * created by the PUT Object, POST Object, or Copy operation, or through the Amazon + * Web Services Management Console, and are encrypted by SSE-S3 or plaintext, have + * ETags that are an MD5 digest of their object data.

  • Objects + * created by the PUT Object, POST Object, or Copy operation, or through the Amazon + * Web Services Management Console, and are encrypted by SSE-C or SSE-KMS, have + * ETags that are not an MD5 digest of their object data.

  • If an + * object is created by either the Multipart Upload or Part Copy operation, the + * ETag is not an MD5 digest, regardless of the method of encryption. If an object + * is larger than 16 MB, the Amazon Web Services Management Console will upload or + * copy that object as a Multipart Upload, and therefore the ETag will not be an + * MD5 digest.

Directory buckets - MD5 is not + * supported by directory buckets.

+ */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline bool ETagHasBeenSet() const { return m_eTagHasBeenSet; } + inline void SetETag(const Aws::String& value) { m_eTagHasBeenSet = true; m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTagHasBeenSet = true; m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTagHasBeenSet = true; m_eTag.assign(value); } + inline Object& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline Object& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline Object& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

The algorithm that was used to create a checksum of the object.

+ */ + inline const Aws::Vector& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const Aws::Vector& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(Aws::Vector&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline Object& WithChecksumAlgorithm(const Aws::Vector& value) { SetChecksumAlgorithm(value); return *this;} + inline Object& WithChecksumAlgorithm(Aws::Vector&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + inline Object& AddChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm.push_back(value); return *this; } + inline Object& AddChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The checksum type that is used to calculate the object’s checksum value. For + * more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline bool ChecksumTypeHasBeenSet() const { return m_checksumTypeHasBeenSet; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumTypeHasBeenSet = true; m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumTypeHasBeenSet = true; m_checksumType = std::move(value); } + inline Object& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline Object& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Size in bytes of the object

+ */ + inline long long GetSize() const{ return m_size; } + inline bool SizeHasBeenSet() const { return m_sizeHasBeenSet; } + inline void SetSize(long long value) { m_sizeHasBeenSet = true; m_size = value; } + inline Object& WithSize(long long value) { SetSize(value); return *this;} + ///@} + + ///@{ + /** + *

The class of storage used to store the object.

Directory + * buckets - Only the S3 Express One Zone storage class is supported by + * directory buckets to store objects.

+ */ + inline const ObjectStorageClass& GetStorageClass() const{ return m_storageClass; } + inline bool StorageClassHasBeenSet() const { return m_storageClassHasBeenSet; } + inline void SetStorageClass(const ObjectStorageClass& value) { m_storageClassHasBeenSet = true; m_storageClass = value; } + inline void SetStorageClass(ObjectStorageClass&& value) { m_storageClassHasBeenSet = true; m_storageClass = std::move(value); } + inline Object& WithStorageClass(const ObjectStorageClass& value) { SetStorageClass(value); return *this;} + inline Object& WithStorageClass(ObjectStorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The owner of the object

Directory buckets - The bucket + * owner is returned as the object owner.

+ */ + inline const Owner& GetOwner() const{ return m_owner; } + inline bool OwnerHasBeenSet() const { return m_ownerHasBeenSet; } + inline void SetOwner(const Owner& value) { m_ownerHasBeenSet = true; m_owner = value; } + inline void SetOwner(Owner&& value) { m_ownerHasBeenSet = true; m_owner = std::move(value); } + inline Object& WithOwner(const Owner& value) { SetOwner(value); return *this;} + inline Object& WithOwner(Owner&& value) { SetOwner(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the restoration status of an object. Objects in certain storage + * classes must be restored before they can be retrieved. For more information + * about these storage classes and how to work with archived objects, see + * Working with archived objects in the Amazon S3 User Guide.

+ *

This functionality is not supported for directory buckets. Only the S3 + * Express One Zone storage class is supported by directory buckets to store + * objects.

+ */ + inline const RestoreStatus& GetRestoreStatus() const{ return m_restoreStatus; } + inline bool RestoreStatusHasBeenSet() const { return m_restoreStatusHasBeenSet; } + inline void SetRestoreStatus(const RestoreStatus& value) { m_restoreStatusHasBeenSet = true; m_restoreStatus = value; } + inline void SetRestoreStatus(RestoreStatus&& value) { m_restoreStatusHasBeenSet = true; m_restoreStatus = std::move(value); } + inline Object& WithRestoreStatus(const RestoreStatus& value) { SetRestoreStatus(value); return *this;} + inline Object& WithRestoreStatus(RestoreStatus&& value) { SetRestoreStatus(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::Utils::DateTime m_lastModified; + bool m_lastModifiedHasBeenSet = false; + + Aws::String m_eTag; + bool m_eTagHasBeenSet = false; + + Aws::Vector m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + ChecksumType m_checksumType; + bool m_checksumTypeHasBeenSet = false; + + long long m_size; + bool m_sizeHasBeenSet = false; + + ObjectStorageClass m_storageClass; + bool m_storageClassHasBeenSet = false; + + Owner m_owner; + bool m_ownerHasBeenSet = false; + + RestoreStatus m_restoreStatus; + bool m_restoreStatusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectAttributes.h b/include/aws/s3/model/ObjectAttributes.h new file mode 100644 index 0000000000000000000000000000000000000000..c8ef346a4bf7cfb53dfccd91a36bbdece99dcffb --- /dev/null +++ b/include/aws/s3/model/ObjectAttributes.h @@ -0,0 +1,34 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ObjectAttributes + { + NOT_SET, + ETag, + Checksum, + ObjectParts, + StorageClass, + ObjectSize + }; + +namespace ObjectAttributesMapper +{ +AWS_S3_API ObjectAttributes GetObjectAttributesForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForObjectAttributes(ObjectAttributes value); +} // namespace ObjectAttributesMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectCannedACL.h b/include/aws/s3/model/ObjectCannedACL.h new file mode 100644 index 0000000000000000000000000000000000000000..c131a9a90d1c863d582445fca804d374dfbc1a84 --- /dev/null +++ b/include/aws/s3/model/ObjectCannedACL.h @@ -0,0 +1,36 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ObjectCannedACL + { + NOT_SET, + private_, + public_read, + public_read_write, + authenticated_read, + aws_exec_read, + bucket_owner_read, + bucket_owner_full_control + }; + +namespace ObjectCannedACLMapper +{ +AWS_S3_API ObjectCannedACL GetObjectCannedACLForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForObjectCannedACL(ObjectCannedACL value); +} // namespace ObjectCannedACLMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectIdentifier.h b/include/aws/s3/model/ObjectIdentifier.h new file mode 100644 index 0000000000000000000000000000000000000000..745fb75477b0e659c12d1313c3ed5b2d96f2b3c9 --- /dev/null +++ b/include/aws/s3/model/ObjectIdentifier.h @@ -0,0 +1,138 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Object Identifier is unique value to identify objects.

See + * Also:

AWS + * API Reference

+ */ + class ObjectIdentifier + { + public: + AWS_S3_API ObjectIdentifier(); + AWS_S3_API ObjectIdentifier(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ObjectIdentifier& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Key name of the object.

Replacement must be made for + * object keys containing special characters (such as carriage returns) when using + * XML requests. For more information, see + * XML related object key constraints.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline ObjectIdentifier& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline ObjectIdentifier& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline ObjectIdentifier& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

Version ID for the specific version of the object to delete.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline ObjectIdentifier& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline ObjectIdentifier& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline ObjectIdentifier& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

An entity tag (ETag) is an identifier assigned by a web server to a specific + * version of a resource found at a URL. This header field makes the request method + * conditional on ETags.

Entity tags (ETags) for S3 + * Express One Zone are random alphanumeric strings unique to the object.

+ * + */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline bool ETagHasBeenSet() const { return m_eTagHasBeenSet; } + inline void SetETag(const Aws::String& value) { m_eTagHasBeenSet = true; m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTagHasBeenSet = true; m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTagHasBeenSet = true; m_eTag.assign(value); } + inline ObjectIdentifier& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline ObjectIdentifier& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline ObjectIdentifier& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

If present, the objects are deleted only if its modification times matches + * the provided Timestamp.

This functionality is only + * supported for directory buckets.

+ */ + inline const Aws::Utils::DateTime& GetLastModifiedTime() const{ return m_lastModifiedTime; } + inline bool LastModifiedTimeHasBeenSet() const { return m_lastModifiedTimeHasBeenSet; } + inline void SetLastModifiedTime(const Aws::Utils::DateTime& value) { m_lastModifiedTimeHasBeenSet = true; m_lastModifiedTime = value; } + inline void SetLastModifiedTime(Aws::Utils::DateTime&& value) { m_lastModifiedTimeHasBeenSet = true; m_lastModifiedTime = std::move(value); } + inline ObjectIdentifier& WithLastModifiedTime(const Aws::Utils::DateTime& value) { SetLastModifiedTime(value); return *this;} + inline ObjectIdentifier& WithLastModifiedTime(Aws::Utils::DateTime&& value) { SetLastModifiedTime(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If present, the objects are deleted only if its size matches the provided + * size in bytes.

This functionality is only supported for directory + * buckets.

+ */ + inline long long GetSize() const{ return m_size; } + inline bool SizeHasBeenSet() const { return m_sizeHasBeenSet; } + inline void SetSize(long long value) { m_sizeHasBeenSet = true; m_size = value; } + inline ObjectIdentifier& WithSize(long long value) { SetSize(value); return *this;} + ///@} + private: + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + Aws::String m_eTag; + bool m_eTagHasBeenSet = false; + + Aws::Utils::DateTime m_lastModifiedTime; + bool m_lastModifiedTimeHasBeenSet = false; + + long long m_size; + bool m_sizeHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectLockEnabled.h b/include/aws/s3/model/ObjectLockEnabled.h new file mode 100644 index 0000000000000000000000000000000000000000..23aa06ad1effcb11a5e174296bc481102ab94513 --- /dev/null +++ b/include/aws/s3/model/ObjectLockEnabled.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ObjectLockEnabled + { + NOT_SET, + Enabled + }; + +namespace ObjectLockEnabledMapper +{ +AWS_S3_API ObjectLockEnabled GetObjectLockEnabledForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForObjectLockEnabled(ObjectLockEnabled value); +} // namespace ObjectLockEnabledMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectLockLegalHold.h b/include/aws/s3/model/ObjectLockLegalHold.h new file mode 100644 index 0000000000000000000000000000000000000000..4e9c06995098512973219ae263eaeb3ccaca5937 --- /dev/null +++ b/include/aws/s3/model/ObjectLockLegalHold.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A legal hold configuration for an object.

See Also:

AWS + * API Reference

+ */ + class ObjectLockLegalHold + { + public: + AWS_S3_API ObjectLockLegalHold(); + AWS_S3_API ObjectLockLegalHold(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ObjectLockLegalHold& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Indicates whether the specified object has a legal hold in place.

+ */ + inline const ObjectLockLegalHoldStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const ObjectLockLegalHoldStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(ObjectLockLegalHoldStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline ObjectLockLegalHold& WithStatus(const ObjectLockLegalHoldStatus& value) { SetStatus(value); return *this;} + inline ObjectLockLegalHold& WithStatus(ObjectLockLegalHoldStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + ObjectLockLegalHoldStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectPart.h b/include/aws/s3/model/ObjectPart.h new file mode 100644 index 0000000000000000000000000000000000000000..05a3aae2412c15faaa5e3d2dd0151c5c411c125f --- /dev/null +++ b/include/aws/s3/model/ObjectPart.h @@ -0,0 +1,179 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container for elements related to an individual part.

See + * Also:

AWS API + * Reference

+ */ + class ObjectPart + { + public: + AWS_S3_API ObjectPart(); + AWS_S3_API ObjectPart(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ObjectPart& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The part number identifying the part. This value is a positive integer + * between 1 and 10,000.

+ */ + inline int GetPartNumber() const{ return m_partNumber; } + inline bool PartNumberHasBeenSet() const { return m_partNumberHasBeenSet; } + inline void SetPartNumber(int value) { m_partNumberHasBeenSet = true; m_partNumber = value; } + inline ObjectPart& WithPartNumber(int value) { SetPartNumber(value); return *this;} + ///@} + + ///@{ + /** + *

The size of the uploaded part in bytes.

+ */ + inline long long GetSize() const{ return m_size; } + inline bool SizeHasBeenSet() const { return m_sizeHasBeenSet; } + inline void SetSize(long long value) { m_sizeHasBeenSet = true; m_size = value; } + inline ObjectPart& WithSize(long long value) { SetSize(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32 checksum of the part. This + * checksum is present if the multipart upload request was created with the + * CRC32 checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32() const{ return m_checksumCRC32; } + inline bool ChecksumCRC32HasBeenSet() const { return m_checksumCRC32HasBeenSet; } + inline void SetChecksumCRC32(const Aws::String& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = value; } + inline void SetChecksumCRC32(Aws::String&& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = std::move(value); } + inline void SetChecksumCRC32(const char* value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32.assign(value); } + inline ObjectPart& WithChecksumCRC32(const Aws::String& value) { SetChecksumCRC32(value); return *this;} + inline ObjectPart& WithChecksumCRC32(Aws::String&& value) { SetChecksumCRC32(std::move(value)); return *this;} + inline ObjectPart& WithChecksumCRC32(const char* value) { SetChecksumCRC32(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32C checksum of the part. This + * checksum is present if the multipart upload request was created with the + * CRC32C checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32C() const{ return m_checksumCRC32C; } + inline bool ChecksumCRC32CHasBeenSet() const { return m_checksumCRC32CHasBeenSet; } + inline void SetChecksumCRC32C(const Aws::String& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = value; } + inline void SetChecksumCRC32C(Aws::String&& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = std::move(value); } + inline void SetChecksumCRC32C(const char* value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C.assign(value); } + inline ObjectPart& WithChecksumCRC32C(const Aws::String& value) { SetChecksumCRC32C(value); return *this;} + inline ObjectPart& WithChecksumCRC32C(Aws::String&& value) { SetChecksumCRC32C(std::move(value)); return *this;} + inline ObjectPart& WithChecksumCRC32C(const char* value) { SetChecksumCRC32C(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 64-bit CRC64NVME checksum of the part. This + * checksum is present if the multipart upload request was created with the + * CRC64NVME checksum algorithm, or if the object was uploaded without + * a checksum (and Amazon S3 added the default checksum, CRC64NVME, to + * the uploaded object). For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC64NVME() const{ return m_checksumCRC64NVME; } + inline bool ChecksumCRC64NVMEHasBeenSet() const { return m_checksumCRC64NVMEHasBeenSet; } + inline void SetChecksumCRC64NVME(const Aws::String& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = value; } + inline void SetChecksumCRC64NVME(Aws::String&& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = std::move(value); } + inline void SetChecksumCRC64NVME(const char* value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME.assign(value); } + inline ObjectPart& WithChecksumCRC64NVME(const Aws::String& value) { SetChecksumCRC64NVME(value); return *this;} + inline ObjectPart& WithChecksumCRC64NVME(Aws::String&& value) { SetChecksumCRC64NVME(std::move(value)); return *this;} + inline ObjectPart& WithChecksumCRC64NVME(const char* value) { SetChecksumCRC64NVME(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 160-bit SHA1 checksum of the part. This + * checksum is present if the multipart upload request was created with the + * SHA1 checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA1() const{ return m_checksumSHA1; } + inline bool ChecksumSHA1HasBeenSet() const { return m_checksumSHA1HasBeenSet; } + inline void SetChecksumSHA1(const Aws::String& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = value; } + inline void SetChecksumSHA1(Aws::String&& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = std::move(value); } + inline void SetChecksumSHA1(const char* value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1.assign(value); } + inline ObjectPart& WithChecksumSHA1(const Aws::String& value) { SetChecksumSHA1(value); return *this;} + inline ObjectPart& WithChecksumSHA1(Aws::String&& value) { SetChecksumSHA1(std::move(value)); return *this;} + inline ObjectPart& WithChecksumSHA1(const char* value) { SetChecksumSHA1(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 256-bit SHA256 checksum of the part. This + * checksum is present if the multipart upload request was created with the + * SHA256 checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA256() const{ return m_checksumSHA256; } + inline bool ChecksumSHA256HasBeenSet() const { return m_checksumSHA256HasBeenSet; } + inline void SetChecksumSHA256(const Aws::String& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = value; } + inline void SetChecksumSHA256(Aws::String&& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = std::move(value); } + inline void SetChecksumSHA256(const char* value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256.assign(value); } + inline ObjectPart& WithChecksumSHA256(const Aws::String& value) { SetChecksumSHA256(value); return *this;} + inline ObjectPart& WithChecksumSHA256(Aws::String&& value) { SetChecksumSHA256(std::move(value)); return *this;} + inline ObjectPart& WithChecksumSHA256(const char* value) { SetChecksumSHA256(value); return *this;} + ///@} + private: + + int m_partNumber; + bool m_partNumberHasBeenSet = false; + + long long m_size; + bool m_sizeHasBeenSet = false; + + Aws::String m_checksumCRC32; + bool m_checksumCRC32HasBeenSet = false; + + Aws::String m_checksumCRC32C; + bool m_checksumCRC32CHasBeenSet = false; + + Aws::String m_checksumCRC64NVME; + bool m_checksumCRC64NVMEHasBeenSet = false; + + Aws::String m_checksumSHA1; + bool m_checksumSHA1HasBeenSet = false; + + Aws::String m_checksumSHA256; + bool m_checksumSHA256HasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectStorageClass.h b/include/aws/s3/model/ObjectStorageClass.h new file mode 100644 index 0000000000000000000000000000000000000000..9f642cd120b54a9194b1f736d290dc405fe64fae --- /dev/null +++ b/include/aws/s3/model/ObjectStorageClass.h @@ -0,0 +1,40 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ObjectStorageClass + { + NOT_SET, + STANDARD, + REDUCED_REDUNDANCY, + GLACIER, + STANDARD_IA, + ONEZONE_IA, + INTELLIGENT_TIERING, + DEEP_ARCHIVE, + OUTPOSTS, + GLACIER_IR, + SNOW, + EXPRESS_ONEZONE + }; + +namespace ObjectStorageClassMapper +{ +AWS_S3_API ObjectStorageClass GetObjectStorageClassForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForObjectStorageClass(ObjectStorageClass value); +} // namespace ObjectStorageClassMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ObjectVersion.h b/include/aws/s3/model/ObjectVersion.h new file mode 100644 index 0000000000000000000000000000000000000000..5c2e05d3afc96cf235bf63251c8ce69895d203f4 --- /dev/null +++ b/include/aws/s3/model/ObjectVersion.h @@ -0,0 +1,228 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The version of an object.

See Also:

AWS + * API Reference

+ */ + class ObjectVersion + { + public: + AWS_S3_API ObjectVersion(); + AWS_S3_API ObjectVersion(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ObjectVersion& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The entity tag is an MD5 hash of that version of the object.

+ */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline bool ETagHasBeenSet() const { return m_eTagHasBeenSet; } + inline void SetETag(const Aws::String& value) { m_eTagHasBeenSet = true; m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTagHasBeenSet = true; m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTagHasBeenSet = true; m_eTag.assign(value); } + inline ObjectVersion& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline ObjectVersion& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline ObjectVersion& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

The algorithm that was used to create a checksum of the object.

+ */ + inline const Aws::Vector& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const Aws::Vector& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(Aws::Vector&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline ObjectVersion& WithChecksumAlgorithm(const Aws::Vector& value) { SetChecksumAlgorithm(value); return *this;} + inline ObjectVersion& WithChecksumAlgorithm(Aws::Vector&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + inline ObjectVersion& AddChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm.push_back(value); return *this; } + inline ObjectVersion& AddChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The checksum type that is used to calculate the object’s checksum value. For + * more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const ChecksumType& GetChecksumType() const{ return m_checksumType; } + inline bool ChecksumTypeHasBeenSet() const { return m_checksumTypeHasBeenSet; } + inline void SetChecksumType(const ChecksumType& value) { m_checksumTypeHasBeenSet = true; m_checksumType = value; } + inline void SetChecksumType(ChecksumType&& value) { m_checksumTypeHasBeenSet = true; m_checksumType = std::move(value); } + inline ObjectVersion& WithChecksumType(const ChecksumType& value) { SetChecksumType(value); return *this;} + inline ObjectVersion& WithChecksumType(ChecksumType&& value) { SetChecksumType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Size in bytes of the object.

+ */ + inline long long GetSize() const{ return m_size; } + inline bool SizeHasBeenSet() const { return m_sizeHasBeenSet; } + inline void SetSize(long long value) { m_sizeHasBeenSet = true; m_size = value; } + inline ObjectVersion& WithSize(long long value) { SetSize(value); return *this;} + ///@} + + ///@{ + /** + *

The class of storage used to store the object.

+ */ + inline const ObjectVersionStorageClass& GetStorageClass() const{ return m_storageClass; } + inline bool StorageClassHasBeenSet() const { return m_storageClassHasBeenSet; } + inline void SetStorageClass(const ObjectVersionStorageClass& value) { m_storageClassHasBeenSet = true; m_storageClass = value; } + inline void SetStorageClass(ObjectVersionStorageClass&& value) { m_storageClassHasBeenSet = true; m_storageClass = std::move(value); } + inline ObjectVersion& WithStorageClass(const ObjectVersionStorageClass& value) { SetStorageClass(value); return *this;} + inline ObjectVersion& WithStorageClass(ObjectVersionStorageClass&& value) { SetStorageClass(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The object key.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline ObjectVersion& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline ObjectVersion& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline ObjectVersion& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

Version ID of an object.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline ObjectVersion& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline ObjectVersion& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline ObjectVersion& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether the object is (true) or is not (false) the latest version + * of an object.

+ */ + inline bool GetIsLatest() const{ return m_isLatest; } + inline bool IsLatestHasBeenSet() const { return m_isLatestHasBeenSet; } + inline void SetIsLatest(bool value) { m_isLatestHasBeenSet = true; m_isLatest = value; } + inline ObjectVersion& WithIsLatest(bool value) { SetIsLatest(value); return *this;} + ///@} + + ///@{ + /** + *

Date and time when the object was last modified.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline bool LastModifiedHasBeenSet() const { return m_lastModifiedHasBeenSet; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModifiedHasBeenSet = true; m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModifiedHasBeenSet = true; m_lastModified = std::move(value); } + inline ObjectVersion& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline ObjectVersion& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the owner of the object.

+ */ + inline const Owner& GetOwner() const{ return m_owner; } + inline bool OwnerHasBeenSet() const { return m_ownerHasBeenSet; } + inline void SetOwner(const Owner& value) { m_ownerHasBeenSet = true; m_owner = value; } + inline void SetOwner(Owner&& value) { m_ownerHasBeenSet = true; m_owner = std::move(value); } + inline ObjectVersion& WithOwner(const Owner& value) { SetOwner(value); return *this;} + inline ObjectVersion& WithOwner(Owner&& value) { SetOwner(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the restoration status of an object. Objects in certain storage + * classes must be restored before they can be retrieved. For more information + * about these storage classes and how to work with archived objects, see + * Working with archived objects in the Amazon S3 User Guide.

+ */ + inline const RestoreStatus& GetRestoreStatus() const{ return m_restoreStatus; } + inline bool RestoreStatusHasBeenSet() const { return m_restoreStatusHasBeenSet; } + inline void SetRestoreStatus(const RestoreStatus& value) { m_restoreStatusHasBeenSet = true; m_restoreStatus = value; } + inline void SetRestoreStatus(RestoreStatus&& value) { m_restoreStatusHasBeenSet = true; m_restoreStatus = std::move(value); } + inline ObjectVersion& WithRestoreStatus(const RestoreStatus& value) { SetRestoreStatus(value); return *this;} + inline ObjectVersion& WithRestoreStatus(RestoreStatus&& value) { SetRestoreStatus(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_eTag; + bool m_eTagHasBeenSet = false; + + Aws::Vector m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + ChecksumType m_checksumType; + bool m_checksumTypeHasBeenSet = false; + + long long m_size; + bool m_sizeHasBeenSet = false; + + ObjectVersionStorageClass m_storageClass; + bool m_storageClassHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + bool m_isLatest; + bool m_isLatestHasBeenSet = false; + + Aws::Utils::DateTime m_lastModified; + bool m_lastModifiedHasBeenSet = false; + + Owner m_owner; + bool m_ownerHasBeenSet = false; + + RestoreStatus m_restoreStatus; + bool m_restoreStatusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/OutputLocation.h b/include/aws/s3/model/OutputLocation.h new file mode 100644 index 0000000000000000000000000000000000000000..a1c353b48871098a10fdf8549b02596104e3c058 --- /dev/null +++ b/include/aws/s3/model/OutputLocation.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Describes the location where the restore job's output is + * stored.

See Also:

AWS + * API Reference

+ */ + class OutputLocation + { + public: + AWS_S3_API OutputLocation(); + AWS_S3_API OutputLocation(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API OutputLocation& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Describes an S3 location that will receive the results of the restore + * request.

+ */ + inline const S3Location& GetS3() const{ return m_s3; } + inline bool S3HasBeenSet() const { return m_s3HasBeenSet; } + inline void SetS3(const S3Location& value) { m_s3HasBeenSet = true; m_s3 = value; } + inline void SetS3(S3Location&& value) { m_s3HasBeenSet = true; m_s3 = std::move(value); } + inline OutputLocation& WithS3(const S3Location& value) { SetS3(value); return *this;} + inline OutputLocation& WithS3(S3Location&& value) { SetS3(std::move(value)); return *this;} + ///@} + private: + + S3Location m_s3; + bool m_s3HasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/OutputSerialization.h b/include/aws/s3/model/OutputSerialization.h new file mode 100644 index 0000000000000000000000000000000000000000..8e5fd808422bd97172ee4da33681b00c845eb73c --- /dev/null +++ b/include/aws/s3/model/OutputSerialization.h @@ -0,0 +1,76 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Describes how results of the Select job are serialized.

See + * Also:

AWS + * API Reference

+ */ + class OutputSerialization + { + public: + AWS_S3_API OutputSerialization(); + AWS_S3_API OutputSerialization(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API OutputSerialization& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Describes the serialization of CSV-encoded Select results.

+ */ + inline const CSVOutput& GetCSV() const{ return m_cSV; } + inline bool CSVHasBeenSet() const { return m_cSVHasBeenSet; } + inline void SetCSV(const CSVOutput& value) { m_cSVHasBeenSet = true; m_cSV = value; } + inline void SetCSV(CSVOutput&& value) { m_cSVHasBeenSet = true; m_cSV = std::move(value); } + inline OutputSerialization& WithCSV(const CSVOutput& value) { SetCSV(value); return *this;} + inline OutputSerialization& WithCSV(CSVOutput&& value) { SetCSV(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies JSON as request's output serialization format.

+ */ + inline const JSONOutput& GetJSON() const{ return m_jSON; } + inline bool JSONHasBeenSet() const { return m_jSONHasBeenSet; } + inline void SetJSON(const JSONOutput& value) { m_jSONHasBeenSet = true; m_jSON = value; } + inline void SetJSON(JSONOutput&& value) { m_jSONHasBeenSet = true; m_jSON = std::move(value); } + inline OutputSerialization& WithJSON(const JSONOutput& value) { SetJSON(value); return *this;} + inline OutputSerialization& WithJSON(JSONOutput&& value) { SetJSON(std::move(value)); return *this;} + ///@} + private: + + CSVOutput m_cSV; + bool m_cSVHasBeenSet = false; + + JSONOutput m_jSON; + bool m_jSONHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Owner.h b/include/aws/s3/model/Owner.h new file mode 100644 index 0000000000000000000000000000000000000000..de199ac8e174f08deba3069168a5cd0ad9d55fb1 --- /dev/null +++ b/include/aws/s3/model/Owner.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for the owner's display name and ID.

See Also:

AWS API + * Reference

+ */ + class Owner + { + public: + AWS_S3_API Owner(); + AWS_S3_API Owner(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Owner& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Container for the display name of the owner. This value is only supported in + * the following Amazon Web Services Regions:

  • US East (N. + * Virginia)

  • US West (N. California)

  • US West + * (Oregon)

  • Asia Pacific (Singapore)

  • Asia + * Pacific (Sydney)

  • Asia Pacific (Tokyo)

  • Europe + * (Ireland)

  • South America (São Paulo)

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetDisplayName() const{ return m_displayName; } + inline bool DisplayNameHasBeenSet() const { return m_displayNameHasBeenSet; } + inline void SetDisplayName(const Aws::String& value) { m_displayNameHasBeenSet = true; m_displayName = value; } + inline void SetDisplayName(Aws::String&& value) { m_displayNameHasBeenSet = true; m_displayName = std::move(value); } + inline void SetDisplayName(const char* value) { m_displayNameHasBeenSet = true; m_displayName.assign(value); } + inline Owner& WithDisplayName(const Aws::String& value) { SetDisplayName(value); return *this;} + inline Owner& WithDisplayName(Aws::String&& value) { SetDisplayName(std::move(value)); return *this;} + inline Owner& WithDisplayName(const char* value) { SetDisplayName(value); return *this;} + ///@} + + ///@{ + /** + *

Container for the ID of the owner.

+ */ + inline const Aws::String& GetID() const{ return m_iD; } + inline bool IDHasBeenSet() const { return m_iDHasBeenSet; } + inline void SetID(const Aws::String& value) { m_iDHasBeenSet = true; m_iD = value; } + inline void SetID(Aws::String&& value) { m_iDHasBeenSet = true; m_iD = std::move(value); } + inline void SetID(const char* value) { m_iDHasBeenSet = true; m_iD.assign(value); } + inline Owner& WithID(const Aws::String& value) { SetID(value); return *this;} + inline Owner& WithID(Aws::String&& value) { SetID(std::move(value)); return *this;} + inline Owner& WithID(const char* value) { SetID(value); return *this;} + ///@} + private: + + Aws::String m_displayName; + bool m_displayNameHasBeenSet = false; + + Aws::String m_iD; + bool m_iDHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/OwnerOverride.h b/include/aws/s3/model/OwnerOverride.h new file mode 100644 index 0000000000000000000000000000000000000000..75ed9f40a015b014f982aaac8afb35e5403be797 --- /dev/null +++ b/include/aws/s3/model/OwnerOverride.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class OwnerOverride + { + NOT_SET, + Destination + }; + +namespace OwnerOverrideMapper +{ +AWS_S3_API OwnerOverride GetOwnerOverrideForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForOwnerOverride(OwnerOverride value); +} // namespace OwnerOverrideMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ParquetInput.h b/include/aws/s3/model/ParquetInput.h new file mode 100644 index 0000000000000000000000000000000000000000..4d357f7b944932e7bf9bd7b50f1e70384770b809 --- /dev/null +++ b/include/aws/s3/model/ParquetInput.h @@ -0,0 +1,41 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for Parquet.

See Also:

AWS API + * Reference

+ */ + class ParquetInput + { + public: + AWS_S3_API ParquetInput(); + AWS_S3_API ParquetInput(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ParquetInput& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Part.h b/include/aws/s3/model/Part.h new file mode 100644 index 0000000000000000000000000000000000000000..47cf7c9062caf9bf2be2cf21540ebc4a293c14b8 --- /dev/null +++ b/include/aws/s3/model/Part.h @@ -0,0 +1,211 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for elements related to a part.

See Also:

AWS API + * Reference

+ */ + class Part + { + public: + AWS_S3_API Part(); + AWS_S3_API Part(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Part& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Part number identifying the part. This is a positive integer between 1 and + * 10,000.

+ */ + inline int GetPartNumber() const{ return m_partNumber; } + inline bool PartNumberHasBeenSet() const { return m_partNumberHasBeenSet; } + inline void SetPartNumber(int value) { m_partNumberHasBeenSet = true; m_partNumber = value; } + inline Part& WithPartNumber(int value) { SetPartNumber(value); return *this;} + ///@} + + ///@{ + /** + *

Date and time at which the part was uploaded.

+ */ + inline const Aws::Utils::DateTime& GetLastModified() const{ return m_lastModified; } + inline bool LastModifiedHasBeenSet() const { return m_lastModifiedHasBeenSet; } + inline void SetLastModified(const Aws::Utils::DateTime& value) { m_lastModifiedHasBeenSet = true; m_lastModified = value; } + inline void SetLastModified(Aws::Utils::DateTime&& value) { m_lastModifiedHasBeenSet = true; m_lastModified = std::move(value); } + inline Part& WithLastModified(const Aws::Utils::DateTime& value) { SetLastModified(value); return *this;} + inline Part& WithLastModified(Aws::Utils::DateTime&& value) { SetLastModified(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Entity tag returned when the part was uploaded.

+ */ + inline const Aws::String& GetETag() const{ return m_eTag; } + inline bool ETagHasBeenSet() const { return m_eTagHasBeenSet; } + inline void SetETag(const Aws::String& value) { m_eTagHasBeenSet = true; m_eTag = value; } + inline void SetETag(Aws::String&& value) { m_eTagHasBeenSet = true; m_eTag = std::move(value); } + inline void SetETag(const char* value) { m_eTagHasBeenSet = true; m_eTag.assign(value); } + inline Part& WithETag(const Aws::String& value) { SetETag(value); return *this;} + inline Part& WithETag(Aws::String&& value) { SetETag(std::move(value)); return *this;} + inline Part& WithETag(const char* value) { SetETag(value); return *this;} + ///@} + + ///@{ + /** + *

Size in bytes of the uploaded part data.

+ */ + inline long long GetSize() const{ return m_size; } + inline bool SizeHasBeenSet() const { return m_sizeHasBeenSet; } + inline void SetSize(long long value) { m_sizeHasBeenSet = true; m_size = value; } + inline Part& WithSize(long long value) { SetSize(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32 checksum of the part. This + * checksum is present if the object was uploaded with the CRC32 + * checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32() const{ return m_checksumCRC32; } + inline bool ChecksumCRC32HasBeenSet() const { return m_checksumCRC32HasBeenSet; } + inline void SetChecksumCRC32(const Aws::String& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = value; } + inline void SetChecksumCRC32(Aws::String&& value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32 = std::move(value); } + inline void SetChecksumCRC32(const char* value) { m_checksumCRC32HasBeenSet = true; m_checksumCRC32.assign(value); } + inline Part& WithChecksumCRC32(const Aws::String& value) { SetChecksumCRC32(value); return *this;} + inline Part& WithChecksumCRC32(Aws::String&& value) { SetChecksumCRC32(std::move(value)); return *this;} + inline Part& WithChecksumCRC32(const char* value) { SetChecksumCRC32(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 32-bit CRC32C checksum of the part. This + * checksum is present if the object was uploaded with the CRC32C + * checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC32C() const{ return m_checksumCRC32C; } + inline bool ChecksumCRC32CHasBeenSet() const { return m_checksumCRC32CHasBeenSet; } + inline void SetChecksumCRC32C(const Aws::String& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = value; } + inline void SetChecksumCRC32C(Aws::String&& value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C = std::move(value); } + inline void SetChecksumCRC32C(const char* value) { m_checksumCRC32CHasBeenSet = true; m_checksumCRC32C.assign(value); } + inline Part& WithChecksumCRC32C(const Aws::String& value) { SetChecksumCRC32C(value); return *this;} + inline Part& WithChecksumCRC32C(Aws::String&& value) { SetChecksumCRC32C(std::move(value)); return *this;} + inline Part& WithChecksumCRC32C(const char* value) { SetChecksumCRC32C(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 64-bit CRC64NVME checksum of the part. This + * checksum is present if the multipart upload request was created with the + * CRC64NVME checksum algorithm, or if the object was uploaded without + * a checksum (and Amazon S3 added the default checksum, CRC64NVME, to + * the uploaded object). For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumCRC64NVME() const{ return m_checksumCRC64NVME; } + inline bool ChecksumCRC64NVMEHasBeenSet() const { return m_checksumCRC64NVMEHasBeenSet; } + inline void SetChecksumCRC64NVME(const Aws::String& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = value; } + inline void SetChecksumCRC64NVME(Aws::String&& value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME = std::move(value); } + inline void SetChecksumCRC64NVME(const char* value) { m_checksumCRC64NVMEHasBeenSet = true; m_checksumCRC64NVME.assign(value); } + inline Part& WithChecksumCRC64NVME(const Aws::String& value) { SetChecksumCRC64NVME(value); return *this;} + inline Part& WithChecksumCRC64NVME(Aws::String&& value) { SetChecksumCRC64NVME(std::move(value)); return *this;} + inline Part& WithChecksumCRC64NVME(const char* value) { SetChecksumCRC64NVME(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 160-bit SHA1 checksum of the part. This + * checksum is present if the object was uploaded with the SHA1 + * checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA1() const{ return m_checksumSHA1; } + inline bool ChecksumSHA1HasBeenSet() const { return m_checksumSHA1HasBeenSet; } + inline void SetChecksumSHA1(const Aws::String& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = value; } + inline void SetChecksumSHA1(Aws::String&& value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1 = std::move(value); } + inline void SetChecksumSHA1(const char* value) { m_checksumSHA1HasBeenSet = true; m_checksumSHA1.assign(value); } + inline Part& WithChecksumSHA1(const Aws::String& value) { SetChecksumSHA1(value); return *this;} + inline Part& WithChecksumSHA1(Aws::String&& value) { SetChecksumSHA1(std::move(value)); return *this;} + inline Part& WithChecksumSHA1(const char* value) { SetChecksumSHA1(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded, 256-bit SHA256 checksum of the part. This + * checksum is present if the object was uploaded with the SHA256 + * checksum algorithm. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetChecksumSHA256() const{ return m_checksumSHA256; } + inline bool ChecksumSHA256HasBeenSet() const { return m_checksumSHA256HasBeenSet; } + inline void SetChecksumSHA256(const Aws::String& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = value; } + inline void SetChecksumSHA256(Aws::String&& value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256 = std::move(value); } + inline void SetChecksumSHA256(const char* value) { m_checksumSHA256HasBeenSet = true; m_checksumSHA256.assign(value); } + inline Part& WithChecksumSHA256(const Aws::String& value) { SetChecksumSHA256(value); return *this;} + inline Part& WithChecksumSHA256(Aws::String&& value) { SetChecksumSHA256(std::move(value)); return *this;} + inline Part& WithChecksumSHA256(const char* value) { SetChecksumSHA256(value); return *this;} + ///@} + private: + + int m_partNumber; + bool m_partNumberHasBeenSet = false; + + Aws::Utils::DateTime m_lastModified; + bool m_lastModifiedHasBeenSet = false; + + Aws::String m_eTag; + bool m_eTagHasBeenSet = false; + + long long m_size; + bool m_sizeHasBeenSet = false; + + Aws::String m_checksumCRC32; + bool m_checksumCRC32HasBeenSet = false; + + Aws::String m_checksumCRC32C; + bool m_checksumCRC32CHasBeenSet = false; + + Aws::String m_checksumCRC64NVME; + bool m_checksumCRC64NVMEHasBeenSet = false; + + Aws::String m_checksumSHA1; + bool m_checksumSHA1HasBeenSet = false; + + Aws::String m_checksumSHA256; + bool m_checksumSHA256HasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PartitionedPrefix.h b/include/aws/s3/model/PartitionedPrefix.h new file mode 100644 index 0000000000000000000000000000000000000000..3be9855466070878de63e2611c2878ba9eec9c55 --- /dev/null +++ b/include/aws/s3/model/PartitionedPrefix.h @@ -0,0 +1,69 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Amazon S3 keys for log objects are partitioned in the following format:

+ *

+ * [DestinationPrefix][SourceAccountId]/[SourceRegion]/[SourceBucket]/[YYYY]/[MM]/[DD]/[YYYY]-[MM]-[DD]-[hh]-[mm]-[ss]-[UniqueString] + *

PartitionedPrefix defaults to EventTime delivery when server access logs + * are delivered.

See Also:

AWS + * API Reference

+ */ + class PartitionedPrefix + { + public: + AWS_S3_API PartitionedPrefix(); + AWS_S3_API PartitionedPrefix(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API PartitionedPrefix& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the partition date source for the partitioned prefix. + * PartitionDateSource can be EventTime or + * DeliveryTime.

For DeliveryTime, the time in the + * log file names corresponds to the delivery time for the log files.

For + * EventTime, The logs delivered are for a specific day only. The + * year, month, and day correspond to the day on which the event occurred, and the + * hour, minutes and seconds are set to 00 in the key.

+ */ + inline const PartitionDateSource& GetPartitionDateSource() const{ return m_partitionDateSource; } + inline bool PartitionDateSourceHasBeenSet() const { return m_partitionDateSourceHasBeenSet; } + inline void SetPartitionDateSource(const PartitionDateSource& value) { m_partitionDateSourceHasBeenSet = true; m_partitionDateSource = value; } + inline void SetPartitionDateSource(PartitionDateSource&& value) { m_partitionDateSourceHasBeenSet = true; m_partitionDateSource = std::move(value); } + inline PartitionedPrefix& WithPartitionDateSource(const PartitionDateSource& value) { SetPartitionDateSource(value); return *this;} + inline PartitionedPrefix& WithPartitionDateSource(PartitionDateSource&& value) { SetPartitionDateSource(std::move(value)); return *this;} + ///@} + private: + + PartitionDateSource m_partitionDateSource; + bool m_partitionDateSourceHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PolicyStatus.h b/include/aws/s3/model/PolicyStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..c5e2cde1e7fbc88959bb25f016f9afdb9fa25442 --- /dev/null +++ b/include/aws/s3/model/PolicyStatus.h @@ -0,0 +1,57 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The container element for a bucket's policy status.

See Also:

+ * AWS + * API Reference

+ */ + class PolicyStatus + { + public: + AWS_S3_API PolicyStatus(); + AWS_S3_API PolicyStatus(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API PolicyStatus& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The policy status for this bucket. TRUE indicates that this + * bucket is public. FALSE indicates that the bucket is not + * public.

+ */ + inline bool GetIsPublic() const{ return m_isPublic; } + inline bool IsPublicHasBeenSet() const { return m_isPublicHasBeenSet; } + inline void SetIsPublic(bool value) { m_isPublicHasBeenSet = true; m_isPublic = value; } + inline PolicyStatus& WithIsPublic(bool value) { SetIsPublic(value); return *this;} + ///@} + private: + + bool m_isPublic; + bool m_isPublicHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ProgressEvent.h b/include/aws/s3/model/ProgressEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..dae953ea98707855f14422966f7824d158581b4f --- /dev/null +++ b/include/aws/s3/model/ProgressEvent.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

This data type contains information about the progress event of an + * operation.

See Also:

AWS + * API Reference

+ */ + class ProgressEvent + { + public: + AWS_S3_API ProgressEvent(); + AWS_S3_API ProgressEvent(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ProgressEvent& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The Progress event details.

+ */ + inline const Progress& GetDetails() const{ return m_details; } + inline bool DetailsHasBeenSet() const { return m_detailsHasBeenSet; } + inline void SetDetails(const Progress& value) { m_detailsHasBeenSet = true; m_details = value; } + inline void SetDetails(Progress&& value) { m_detailsHasBeenSet = true; m_details = std::move(value); } + inline ProgressEvent& WithDetails(const Progress& value) { SetDetails(value); return *this;} + inline ProgressEvent& WithDetails(Progress&& value) { SetDetails(std::move(value)); return *this;} + ///@} + private: + + Progress m_details; + bool m_detailsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketAclRequest.h b/include/aws/s3/model/PutBucketAclRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..3ee1dd8ddb713bb7ce4e87b2e6620ef98160c4f0 --- /dev/null +++ b/include/aws/s3/model/PutBucketAclRequest.h @@ -0,0 +1,280 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketAclRequest : public S3Request + { + public: + AWS_S3_API PutBucketAclRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketAcl"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The canned ACL to apply to the bucket.

+ */ + inline const BucketCannedACL& GetACL() const{ return m_aCL; } + inline bool ACLHasBeenSet() const { return m_aCLHasBeenSet; } + inline void SetACL(const BucketCannedACL& value) { m_aCLHasBeenSet = true; m_aCL = value; } + inline void SetACL(BucketCannedACL&& value) { m_aCLHasBeenSet = true; m_aCL = std::move(value); } + inline PutBucketAclRequest& WithACL(const BucketCannedACL& value) { SetACL(value); return *this;} + inline PutBucketAclRequest& WithACL(BucketCannedACL&& value) { SetACL(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Contains the elements that set the ACL permissions for an object per + * grantee.

+ */ + inline const AccessControlPolicy& GetAccessControlPolicy() const{ return m_accessControlPolicy; } + inline bool AccessControlPolicyHasBeenSet() const { return m_accessControlPolicyHasBeenSet; } + inline void SetAccessControlPolicy(const AccessControlPolicy& value) { m_accessControlPolicyHasBeenSet = true; m_accessControlPolicy = value; } + inline void SetAccessControlPolicy(AccessControlPolicy&& value) { m_accessControlPolicyHasBeenSet = true; m_accessControlPolicy = std::move(value); } + inline PutBucketAclRequest& WithAccessControlPolicy(const AccessControlPolicy& value) { SetAccessControlPolicy(value); return *this;} + inline PutBucketAclRequest& WithAccessControlPolicy(AccessControlPolicy&& value) { SetAccessControlPolicy(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The bucket to which to apply the ACL.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketAclRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketAclRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketAclRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded 128-bit MD5 digest of the data. This header + * must be used as a message integrity check to verify that the request body was + * not corrupted in transit. For more information, go to RFC 1864.

For requests + * made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web + * Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutBucketAclRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutBucketAclRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutBucketAclRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the request when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutBucketAclRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutBucketAclRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee the read, write, read ACP, and write ACP permissions on the + * bucket.

+ */ + inline const Aws::String& GetGrantFullControl() const{ return m_grantFullControl; } + inline bool GrantFullControlHasBeenSet() const { return m_grantFullControlHasBeenSet; } + inline void SetGrantFullControl(const Aws::String& value) { m_grantFullControlHasBeenSet = true; m_grantFullControl = value; } + inline void SetGrantFullControl(Aws::String&& value) { m_grantFullControlHasBeenSet = true; m_grantFullControl = std::move(value); } + inline void SetGrantFullControl(const char* value) { m_grantFullControlHasBeenSet = true; m_grantFullControl.assign(value); } + inline PutBucketAclRequest& WithGrantFullControl(const Aws::String& value) { SetGrantFullControl(value); return *this;} + inline PutBucketAclRequest& WithGrantFullControl(Aws::String&& value) { SetGrantFullControl(std::move(value)); return *this;} + inline PutBucketAclRequest& WithGrantFullControl(const char* value) { SetGrantFullControl(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to list the objects in the bucket.

+ */ + inline const Aws::String& GetGrantRead() const{ return m_grantRead; } + inline bool GrantReadHasBeenSet() const { return m_grantReadHasBeenSet; } + inline void SetGrantRead(const Aws::String& value) { m_grantReadHasBeenSet = true; m_grantRead = value; } + inline void SetGrantRead(Aws::String&& value) { m_grantReadHasBeenSet = true; m_grantRead = std::move(value); } + inline void SetGrantRead(const char* value) { m_grantReadHasBeenSet = true; m_grantRead.assign(value); } + inline PutBucketAclRequest& WithGrantRead(const Aws::String& value) { SetGrantRead(value); return *this;} + inline PutBucketAclRequest& WithGrantRead(Aws::String&& value) { SetGrantRead(std::move(value)); return *this;} + inline PutBucketAclRequest& WithGrantRead(const char* value) { SetGrantRead(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to read the bucket ACL.

+ */ + inline const Aws::String& GetGrantReadACP() const{ return m_grantReadACP; } + inline bool GrantReadACPHasBeenSet() const { return m_grantReadACPHasBeenSet; } + inline void SetGrantReadACP(const Aws::String& value) { m_grantReadACPHasBeenSet = true; m_grantReadACP = value; } + inline void SetGrantReadACP(Aws::String&& value) { m_grantReadACPHasBeenSet = true; m_grantReadACP = std::move(value); } + inline void SetGrantReadACP(const char* value) { m_grantReadACPHasBeenSet = true; m_grantReadACP.assign(value); } + inline PutBucketAclRequest& WithGrantReadACP(const Aws::String& value) { SetGrantReadACP(value); return *this;} + inline PutBucketAclRequest& WithGrantReadACP(Aws::String&& value) { SetGrantReadACP(std::move(value)); return *this;} + inline PutBucketAclRequest& WithGrantReadACP(const char* value) { SetGrantReadACP(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to create new objects in the bucket.

For the bucket and + * object owners of existing objects, also allows deletions and overwrites of those + * objects.

+ */ + inline const Aws::String& GetGrantWrite() const{ return m_grantWrite; } + inline bool GrantWriteHasBeenSet() const { return m_grantWriteHasBeenSet; } + inline void SetGrantWrite(const Aws::String& value) { m_grantWriteHasBeenSet = true; m_grantWrite = value; } + inline void SetGrantWrite(Aws::String&& value) { m_grantWriteHasBeenSet = true; m_grantWrite = std::move(value); } + inline void SetGrantWrite(const char* value) { m_grantWriteHasBeenSet = true; m_grantWrite.assign(value); } + inline PutBucketAclRequest& WithGrantWrite(const Aws::String& value) { SetGrantWrite(value); return *this;} + inline PutBucketAclRequest& WithGrantWrite(Aws::String&& value) { SetGrantWrite(std::move(value)); return *this;} + inline PutBucketAclRequest& WithGrantWrite(const char* value) { SetGrantWrite(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to write the ACL for the applicable bucket.

+ */ + inline const Aws::String& GetGrantWriteACP() const{ return m_grantWriteACP; } + inline bool GrantWriteACPHasBeenSet() const { return m_grantWriteACPHasBeenSet; } + inline void SetGrantWriteACP(const Aws::String& value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP = value; } + inline void SetGrantWriteACP(Aws::String&& value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP = std::move(value); } + inline void SetGrantWriteACP(const char* value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP.assign(value); } + inline PutBucketAclRequest& WithGrantWriteACP(const Aws::String& value) { SetGrantWriteACP(value); return *this;} + inline PutBucketAclRequest& WithGrantWriteACP(Aws::String&& value) { SetGrantWriteACP(std::move(value)); return *this;} + inline PutBucketAclRequest& WithGrantWriteACP(const char* value) { SetGrantWriteACP(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketAclRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketAclRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketAclRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketAclRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketAclRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketAclRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketAclRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketAclRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketAclRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketAclRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketAclRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketAclRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + BucketCannedACL m_aCL; + bool m_aCLHasBeenSet = false; + + AccessControlPolicy m_accessControlPolicy; + bool m_accessControlPolicyHasBeenSet = false; + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_grantFullControl; + bool m_grantFullControlHasBeenSet = false; + + Aws::String m_grantRead; + bool m_grantReadHasBeenSet = false; + + Aws::String m_grantReadACP; + bool m_grantReadACPHasBeenSet = false; + + Aws::String m_grantWrite; + bool m_grantWriteHasBeenSet = false; + + Aws::String m_grantWriteACP; + bool m_grantWriteACPHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketCorsRequest.h b/include/aws/s3/model/PutBucketCorsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..93dc4e9355d82562e46a81d198ebc73600b9c423 --- /dev/null +++ b/include/aws/s3/model/PutBucketCorsRequest.h @@ -0,0 +1,178 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketCorsRequest : public S3Request + { + public: + AWS_S3_API PutBucketCorsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketCors"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

Specifies the bucket impacted by the corsconfiguration.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketCorsRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketCorsRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketCorsRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Describes the cross-origin access configuration for objects in an Amazon S3 + * bucket. For more information, see Enabling + * Cross-Origin Resource Sharing in the Amazon S3 User Guide.

+ */ + inline const CORSConfiguration& GetCORSConfiguration() const{ return m_cORSConfiguration; } + inline bool CORSConfigurationHasBeenSet() const { return m_cORSConfigurationHasBeenSet; } + inline void SetCORSConfiguration(const CORSConfiguration& value) { m_cORSConfigurationHasBeenSet = true; m_cORSConfiguration = value; } + inline void SetCORSConfiguration(CORSConfiguration&& value) { m_cORSConfigurationHasBeenSet = true; m_cORSConfiguration = std::move(value); } + inline PutBucketCorsRequest& WithCORSConfiguration(const CORSConfiguration& value) { SetCORSConfiguration(value); return *this;} + inline PutBucketCorsRequest& WithCORSConfiguration(CORSConfiguration&& value) { SetCORSConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded 128-bit MD5 digest of the data. This header + * must be used as a message integrity check to verify that the request body was + * not corrupted in transit. For more information, go to RFC 1864.

For requests + * made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web + * Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutBucketCorsRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutBucketCorsRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutBucketCorsRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the request when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutBucketCorsRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutBucketCorsRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketCorsRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketCorsRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketCorsRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketCorsRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketCorsRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketCorsRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketCorsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketCorsRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketCorsRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketCorsRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketCorsRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketCorsRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + CORSConfiguration m_cORSConfiguration; + bool m_cORSConfigurationHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketIntelligentTieringConfigurationRequest.h b/include/aws/s3/model/PutBucketIntelligentTieringConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a2899faf133071700c623b2d2617496c14f81053 --- /dev/null +++ b/include/aws/s3/model/PutBucketIntelligentTieringConfigurationRequest.h @@ -0,0 +1,122 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketIntelligentTieringConfigurationRequest : public S3Request + { + public: + AWS_S3_API PutBucketIntelligentTieringConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketIntelligentTieringConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the Amazon S3 bucket whose configuration you want to modify or + * retrieve.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketIntelligentTieringConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketIntelligentTieringConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketIntelligentTieringConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The ID used to identify the S3 Intelligent-Tiering configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline PutBucketIntelligentTieringConfigurationRequest& WithId(const Aws::String& value) { SetId(value); return *this;} + inline PutBucketIntelligentTieringConfigurationRequest& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline PutBucketIntelligentTieringConfigurationRequest& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

Container for S3 Intelligent-Tiering configuration.

+ */ + inline const IntelligentTieringConfiguration& GetIntelligentTieringConfiguration() const{ return m_intelligentTieringConfiguration; } + inline bool IntelligentTieringConfigurationHasBeenSet() const { return m_intelligentTieringConfigurationHasBeenSet; } + inline void SetIntelligentTieringConfiguration(const IntelligentTieringConfiguration& value) { m_intelligentTieringConfigurationHasBeenSet = true; m_intelligentTieringConfiguration = value; } + inline void SetIntelligentTieringConfiguration(IntelligentTieringConfiguration&& value) { m_intelligentTieringConfigurationHasBeenSet = true; m_intelligentTieringConfiguration = std::move(value); } + inline PutBucketIntelligentTieringConfigurationRequest& WithIntelligentTieringConfiguration(const IntelligentTieringConfiguration& value) { SetIntelligentTieringConfiguration(value); return *this;} + inline PutBucketIntelligentTieringConfigurationRequest& WithIntelligentTieringConfiguration(IntelligentTieringConfiguration&& value) { SetIntelligentTieringConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketIntelligentTieringConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketIntelligentTieringConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketIntelligentTieringConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketIntelligentTieringConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketIntelligentTieringConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketIntelligentTieringConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketIntelligentTieringConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketIntelligentTieringConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketIntelligentTieringConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + IntelligentTieringConfiguration m_intelligentTieringConfiguration; + bool m_intelligentTieringConfigurationHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketInventoryConfigurationRequest.h b/include/aws/s3/model/PutBucketInventoryConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d9f1249965e81f96b6b79d7fb30d9d6067018d08 --- /dev/null +++ b/include/aws/s3/model/PutBucketInventoryConfigurationRequest.h @@ -0,0 +1,142 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketInventoryConfigurationRequest : public S3Request + { + public: + AWS_S3_API PutBucketInventoryConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketInventoryConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket where the inventory configuration will be stored.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketInventoryConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketInventoryConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketInventoryConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The ID used to identify the inventory configuration.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline PutBucketInventoryConfigurationRequest& WithId(const Aws::String& value) { SetId(value); return *this;} + inline PutBucketInventoryConfigurationRequest& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline PutBucketInventoryConfigurationRequest& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the inventory configuration.

+ */ + inline const InventoryConfiguration& GetInventoryConfiguration() const{ return m_inventoryConfiguration; } + inline bool InventoryConfigurationHasBeenSet() const { return m_inventoryConfigurationHasBeenSet; } + inline void SetInventoryConfiguration(const InventoryConfiguration& value) { m_inventoryConfigurationHasBeenSet = true; m_inventoryConfiguration = value; } + inline void SetInventoryConfiguration(InventoryConfiguration&& value) { m_inventoryConfigurationHasBeenSet = true; m_inventoryConfiguration = std::move(value); } + inline PutBucketInventoryConfigurationRequest& WithInventoryConfiguration(const InventoryConfiguration& value) { SetInventoryConfiguration(value); return *this;} + inline PutBucketInventoryConfigurationRequest& WithInventoryConfiguration(InventoryConfiguration&& value) { SetInventoryConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketInventoryConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketInventoryConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketInventoryConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketInventoryConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketInventoryConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketInventoryConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + InventoryConfiguration m_inventoryConfiguration; + bool m_inventoryConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketLifecycleConfigurationRequest.h b/include/aws/s3/model/PutBucketLifecycleConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..53e22d1a363abd298a1125a268bb21e27c9a8ff7 --- /dev/null +++ b/include/aws/s3/model/PutBucketLifecycleConfigurationRequest.h @@ -0,0 +1,183 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketLifecycleConfigurationRequest : public S3Request + { + public: + AWS_S3_API PutBucketLifecycleConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketLifecycleConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket for which to set the configuration.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketLifecycleConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the request when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutBucketLifecycleConfigurationRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container for lifecycle rules. You can add as many as 1,000 rules.

+ */ + inline const BucketLifecycleConfiguration& GetLifecycleConfiguration() const{ return m_lifecycleConfiguration; } + inline bool LifecycleConfigurationHasBeenSet() const { return m_lifecycleConfigurationHasBeenSet; } + inline void SetLifecycleConfiguration(const BucketLifecycleConfiguration& value) { m_lifecycleConfigurationHasBeenSet = true; m_lifecycleConfiguration = value; } + inline void SetLifecycleConfiguration(BucketLifecycleConfiguration&& value) { m_lifecycleConfigurationHasBeenSet = true; m_lifecycleConfiguration = std::move(value); } + inline PutBucketLifecycleConfigurationRequest& WithLifecycleConfiguration(const BucketLifecycleConfiguration& value) { SetLifecycleConfiguration(value); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithLifecycleConfiguration(BucketLifecycleConfiguration&& value) { SetLifecycleConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ *

This parameter applies to general purpose buckets only. It is not supported + * for directory bucket lifecycle configurations.

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketLifecycleConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates which default minimum object size behavior is applied to the + * lifecycle configuration.

This parameter applies to general purpose + * buckets only. It is not supported for directory bucket lifecycle + * configurations.

  • all_storage_classes_128K + * - Objects smaller than 128 KB will not transition to any storage class by + * default.

  • varies_by_storage_class - Objects + * smaller than 128 KB will transition to Glacier Flexible Retrieval or Glacier + * Deep Archive storage classes. By default, all other storage classes will prevent + * transitions smaller than 128 KB.

To customize the minimum + * object size for any transition you can add a filter that specifies a custom + * ObjectSizeGreaterThan or ObjectSizeLessThan in the + * body of your transition rule. Custom filters always take precedence over the + * default transition behavior.

+ */ + inline const TransitionDefaultMinimumObjectSize& GetTransitionDefaultMinimumObjectSize() const{ return m_transitionDefaultMinimumObjectSize; } + inline bool TransitionDefaultMinimumObjectSizeHasBeenSet() const { return m_transitionDefaultMinimumObjectSizeHasBeenSet; } + inline void SetTransitionDefaultMinimumObjectSize(const TransitionDefaultMinimumObjectSize& value) { m_transitionDefaultMinimumObjectSizeHasBeenSet = true; m_transitionDefaultMinimumObjectSize = value; } + inline void SetTransitionDefaultMinimumObjectSize(TransitionDefaultMinimumObjectSize&& value) { m_transitionDefaultMinimumObjectSizeHasBeenSet = true; m_transitionDefaultMinimumObjectSize = std::move(value); } + inline PutBucketLifecycleConfigurationRequest& WithTransitionDefaultMinimumObjectSize(const TransitionDefaultMinimumObjectSize& value) { SetTransitionDefaultMinimumObjectSize(value); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithTransitionDefaultMinimumObjectSize(TransitionDefaultMinimumObjectSize&& value) { SetTransitionDefaultMinimumObjectSize(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketLifecycleConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketLifecycleConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketLifecycleConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketLifecycleConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketLifecycleConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketLifecycleConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketLifecycleConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketLifecycleConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketLifecycleConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + BucketLifecycleConfiguration m_lifecycleConfiguration; + bool m_lifecycleConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + TransitionDefaultMinimumObjectSize m_transitionDefaultMinimumObjectSize; + bool m_transitionDefaultMinimumObjectSizeHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketLifecycleConfigurationResult.h b/include/aws/s3/model/PutBucketLifecycleConfigurationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..54d5c7f48fd993a637a2c76b1bcbeb716fc88c9f --- /dev/null +++ b/include/aws/s3/model/PutBucketLifecycleConfigurationResult.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class PutBucketLifecycleConfigurationResult + { + public: + AWS_S3_API PutBucketLifecycleConfigurationResult(); + AWS_S3_API PutBucketLifecycleConfigurationResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API PutBucketLifecycleConfigurationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates which default minimum object size behavior is applied to the + * lifecycle configuration.

This parameter applies to general purpose + * buckets only. It is not supported for directory bucket lifecycle + * configurations.

  • all_storage_classes_128K + * - Objects smaller than 128 KB will not transition to any storage class by + * default.

  • varies_by_storage_class - Objects + * smaller than 128 KB will transition to Glacier Flexible Retrieval or Glacier + * Deep Archive storage classes. By default, all other storage classes will prevent + * transitions smaller than 128 KB.

To customize the minimum + * object size for any transition you can add a filter that specifies a custom + * ObjectSizeGreaterThan or ObjectSizeLessThan in the + * body of your transition rule. Custom filters always take precedence over the + * default transition behavior.

+ */ + inline const TransitionDefaultMinimumObjectSize& GetTransitionDefaultMinimumObjectSize() const{ return m_transitionDefaultMinimumObjectSize; } + inline void SetTransitionDefaultMinimumObjectSize(const TransitionDefaultMinimumObjectSize& value) { m_transitionDefaultMinimumObjectSize = value; } + inline void SetTransitionDefaultMinimumObjectSize(TransitionDefaultMinimumObjectSize&& value) { m_transitionDefaultMinimumObjectSize = std::move(value); } + inline PutBucketLifecycleConfigurationResult& WithTransitionDefaultMinimumObjectSize(const TransitionDefaultMinimumObjectSize& value) { SetTransitionDefaultMinimumObjectSize(value); return *this;} + inline PutBucketLifecycleConfigurationResult& WithTransitionDefaultMinimumObjectSize(TransitionDefaultMinimumObjectSize&& value) { SetTransitionDefaultMinimumObjectSize(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutBucketLifecycleConfigurationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutBucketLifecycleConfigurationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutBucketLifecycleConfigurationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + TransitionDefaultMinimumObjectSize m_transitionDefaultMinimumObjectSize; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketMetricsConfigurationRequest.h b/include/aws/s3/model/PutBucketMetricsConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..8b90e7df5774397dab38fcecccd2cf42a86dce8f --- /dev/null +++ b/include/aws/s3/model/PutBucketMetricsConfigurationRequest.h @@ -0,0 +1,144 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketMetricsConfigurationRequest : public S3Request + { + public: + AWS_S3_API PutBucketMetricsConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketMetricsConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket for which the metrics configuration is set.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketMetricsConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketMetricsConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketMetricsConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The ID used to identify the metrics configuration. The ID has a 64 character + * limit and can only contain letters, numbers, periods, dashes, and + * underscores.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline PutBucketMetricsConfigurationRequest& WithId(const Aws::String& value) { SetId(value); return *this;} + inline PutBucketMetricsConfigurationRequest& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline PutBucketMetricsConfigurationRequest& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies the metrics configuration.

+ */ + inline const MetricsConfiguration& GetMetricsConfiguration() const{ return m_metricsConfiguration; } + inline bool MetricsConfigurationHasBeenSet() const { return m_metricsConfigurationHasBeenSet; } + inline void SetMetricsConfiguration(const MetricsConfiguration& value) { m_metricsConfigurationHasBeenSet = true; m_metricsConfiguration = value; } + inline void SetMetricsConfiguration(MetricsConfiguration&& value) { m_metricsConfigurationHasBeenSet = true; m_metricsConfiguration = std::move(value); } + inline PutBucketMetricsConfigurationRequest& WithMetricsConfiguration(const MetricsConfiguration& value) { SetMetricsConfiguration(value); return *this;} + inline PutBucketMetricsConfigurationRequest& WithMetricsConfiguration(MetricsConfiguration&& value) { SetMetricsConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketMetricsConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketMetricsConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketMetricsConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketMetricsConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketMetricsConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketMetricsConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketMetricsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketMetricsConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketMetricsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketMetricsConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketMetricsConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketMetricsConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_id; + bool m_idHasBeenSet = false; + + MetricsConfiguration m_metricsConfiguration; + bool m_metricsConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketNotificationConfigurationRequest.h b/include/aws/s3/model/PutBucketNotificationConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..337c48ec1063b481d0f3813011d8b3651c190093 --- /dev/null +++ b/include/aws/s3/model/PutBucketNotificationConfigurationRequest.h @@ -0,0 +1,137 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketNotificationConfigurationRequest : public S3Request + { + public: + AWS_S3_API PutBucketNotificationConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketNotificationConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the bucket.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketNotificationConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketNotificationConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketNotificationConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + + inline const NotificationConfiguration& GetNotificationConfiguration() const{ return m_notificationConfiguration; } + inline bool NotificationConfigurationHasBeenSet() const { return m_notificationConfigurationHasBeenSet; } + inline void SetNotificationConfiguration(const NotificationConfiguration& value) { m_notificationConfigurationHasBeenSet = true; m_notificationConfiguration = value; } + inline void SetNotificationConfiguration(NotificationConfiguration&& value) { m_notificationConfigurationHasBeenSet = true; m_notificationConfiguration = std::move(value); } + inline PutBucketNotificationConfigurationRequest& WithNotificationConfiguration(const NotificationConfiguration& value) { SetNotificationConfiguration(value); return *this;} + inline PutBucketNotificationConfigurationRequest& WithNotificationConfiguration(NotificationConfiguration&& value) { SetNotificationConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketNotificationConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketNotificationConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketNotificationConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + /** + *

Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations. True or + * false value.

+ */ + inline bool GetSkipDestinationValidation() const{ return m_skipDestinationValidation; } + inline bool SkipDestinationValidationHasBeenSet() const { return m_skipDestinationValidationHasBeenSet; } + inline void SetSkipDestinationValidation(bool value) { m_skipDestinationValidationHasBeenSet = true; m_skipDestinationValidation = value; } + inline PutBucketNotificationConfigurationRequest& WithSkipDestinationValidation(bool value) { SetSkipDestinationValidation(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketNotificationConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketNotificationConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketNotificationConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + NotificationConfiguration m_notificationConfiguration; + bool m_notificationConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + bool m_skipDestinationValidation; + bool m_skipDestinationValidationHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketRequestPaymentRequest.h b/include/aws/s3/model/PutBucketRequestPaymentRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..0a7aae953b7a7ee54bacc9830a484210be482e7b --- /dev/null +++ b/include/aws/s3/model/PutBucketRequestPaymentRequest.h @@ -0,0 +1,175 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketRequestPaymentRequest : public S3Request + { + public: + AWS_S3_API PutBucketRequestPaymentRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketRequestPayment"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketRequestPaymentRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketRequestPaymentRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketRequestPaymentRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded 128-bit MD5 digest of the data. You must use + * this header as a message integrity check to verify that the request body was not + * corrupted in transit. For more information, see RFC 1864.

For requests + * made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web + * Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutBucketRequestPaymentRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutBucketRequestPaymentRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutBucketRequestPaymentRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the request when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutBucketRequestPaymentRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutBucketRequestPaymentRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container for Payer.

+ */ + inline const RequestPaymentConfiguration& GetRequestPaymentConfiguration() const{ return m_requestPaymentConfiguration; } + inline bool RequestPaymentConfigurationHasBeenSet() const { return m_requestPaymentConfigurationHasBeenSet; } + inline void SetRequestPaymentConfiguration(const RequestPaymentConfiguration& value) { m_requestPaymentConfigurationHasBeenSet = true; m_requestPaymentConfiguration = value; } + inline void SetRequestPaymentConfiguration(RequestPaymentConfiguration&& value) { m_requestPaymentConfigurationHasBeenSet = true; m_requestPaymentConfiguration = std::move(value); } + inline PutBucketRequestPaymentRequest& WithRequestPaymentConfiguration(const RequestPaymentConfiguration& value) { SetRequestPaymentConfiguration(value); return *this;} + inline PutBucketRequestPaymentRequest& WithRequestPaymentConfiguration(RequestPaymentConfiguration&& value) { SetRequestPaymentConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketRequestPaymentRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketRequestPaymentRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketRequestPaymentRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketRequestPaymentRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketRequestPaymentRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketRequestPaymentRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketRequestPaymentRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketRequestPaymentRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketRequestPaymentRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + RequestPaymentConfiguration m_requestPaymentConfiguration; + bool m_requestPaymentConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketTaggingRequest.h b/include/aws/s3/model/PutBucketTaggingRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..65f0fd7b18e8534795ca7673764ca4dbb5d63a2d --- /dev/null +++ b/include/aws/s3/model/PutBucketTaggingRequest.h @@ -0,0 +1,175 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketTaggingRequest : public S3Request + { + public: + AWS_S3_API PutBucketTaggingRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketTagging"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketTaggingRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketTaggingRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketTaggingRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded 128-bit MD5 digest of the data. You must use + * this header as a message integrity check to verify that the request body was not + * corrupted in transit. For more information, see RFC 1864.

For requests + * made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web + * Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutBucketTaggingRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutBucketTaggingRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutBucketTaggingRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the request when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutBucketTaggingRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutBucketTaggingRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container for the TagSet and Tag elements.

+ */ + inline const Tagging& GetTagging() const{ return m_tagging; } + inline bool TaggingHasBeenSet() const { return m_taggingHasBeenSet; } + inline void SetTagging(const Tagging& value) { m_taggingHasBeenSet = true; m_tagging = value; } + inline void SetTagging(Tagging&& value) { m_taggingHasBeenSet = true; m_tagging = std::move(value); } + inline PutBucketTaggingRequest& WithTagging(const Tagging& value) { SetTagging(value); return *this;} + inline PutBucketTaggingRequest& WithTagging(Tagging&& value) { SetTagging(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketTaggingRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketTaggingRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketTaggingRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketTaggingRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketTaggingRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Tagging m_tagging; + bool m_taggingHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketVersioningRequest.h b/include/aws/s3/model/PutBucketVersioningRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a439a98645895832ae565033ef1bf305eeb8f226 --- /dev/null +++ b/include/aws/s3/model/PutBucketVersioningRequest.h @@ -0,0 +1,193 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketVersioningRequest : public S3Request + { + public: + AWS_S3_API PutBucketVersioningRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketVersioning"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketVersioningRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketVersioningRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketVersioningRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

>The Base64 encoded 128-bit MD5 digest of the data. You must + * use this header as a message integrity check to verify that the request body was + * not corrupted in transit. For more information, see RFC 1864.

For requests + * made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web + * Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutBucketVersioningRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutBucketVersioningRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutBucketVersioningRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the request when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutBucketVersioningRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutBucketVersioningRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The concatenation of the authentication device's serial number, a space, and + * the value that is displayed on your authentication device.

+ */ + inline const Aws::String& GetMFA() const{ return m_mFA; } + inline bool MFAHasBeenSet() const { return m_mFAHasBeenSet; } + inline void SetMFA(const Aws::String& value) { m_mFAHasBeenSet = true; m_mFA = value; } + inline void SetMFA(Aws::String&& value) { m_mFAHasBeenSet = true; m_mFA = std::move(value); } + inline void SetMFA(const char* value) { m_mFAHasBeenSet = true; m_mFA.assign(value); } + inline PutBucketVersioningRequest& WithMFA(const Aws::String& value) { SetMFA(value); return *this;} + inline PutBucketVersioningRequest& WithMFA(Aws::String&& value) { SetMFA(std::move(value)); return *this;} + inline PutBucketVersioningRequest& WithMFA(const char* value) { SetMFA(value); return *this;} + ///@} + + ///@{ + /** + *

Container for setting the versioning state.

+ */ + inline const VersioningConfiguration& GetVersioningConfiguration() const{ return m_versioningConfiguration; } + inline bool VersioningConfigurationHasBeenSet() const { return m_versioningConfigurationHasBeenSet; } + inline void SetVersioningConfiguration(const VersioningConfiguration& value) { m_versioningConfigurationHasBeenSet = true; m_versioningConfiguration = value; } + inline void SetVersioningConfiguration(VersioningConfiguration&& value) { m_versioningConfigurationHasBeenSet = true; m_versioningConfiguration = std::move(value); } + inline PutBucketVersioningRequest& WithVersioningConfiguration(const VersioningConfiguration& value) { SetVersioningConfiguration(value); return *this;} + inline PutBucketVersioningRequest& WithVersioningConfiguration(VersioningConfiguration&& value) { SetVersioningConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketVersioningRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketVersioningRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketVersioningRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketVersioningRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketVersioningRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketVersioningRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketVersioningRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketVersioningRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketVersioningRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketVersioningRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketVersioningRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketVersioningRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_mFA; + bool m_mFAHasBeenSet = false; + + VersioningConfiguration m_versioningConfiguration; + bool m_versioningConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutBucketWebsiteRequest.h b/include/aws/s3/model/PutBucketWebsiteRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d68948b9c67f0c684be477dbde68539d63e99591 --- /dev/null +++ b/include/aws/s3/model/PutBucketWebsiteRequest.h @@ -0,0 +1,175 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutBucketWebsiteRequest : public S3Request + { + public: + AWS_S3_API PutBucketWebsiteRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutBucketWebsite"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutBucketWebsiteRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutBucketWebsiteRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutBucketWebsiteRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded 128-bit MD5 digest of the data. You must use + * this header as a message integrity check to verify that the request body was not + * corrupted in transit. For more information, see RFC 1864.

For requests + * made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web + * Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutBucketWebsiteRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutBucketWebsiteRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutBucketWebsiteRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the request when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutBucketWebsiteRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutBucketWebsiteRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container for the request.

+ */ + inline const WebsiteConfiguration& GetWebsiteConfiguration() const{ return m_websiteConfiguration; } + inline bool WebsiteConfigurationHasBeenSet() const { return m_websiteConfigurationHasBeenSet; } + inline void SetWebsiteConfiguration(const WebsiteConfiguration& value) { m_websiteConfigurationHasBeenSet = true; m_websiteConfiguration = value; } + inline void SetWebsiteConfiguration(WebsiteConfiguration&& value) { m_websiteConfigurationHasBeenSet = true; m_websiteConfiguration = std::move(value); } + inline PutBucketWebsiteRequest& WithWebsiteConfiguration(const WebsiteConfiguration& value) { SetWebsiteConfiguration(value); return *this;} + inline PutBucketWebsiteRequest& WithWebsiteConfiguration(WebsiteConfiguration&& value) { SetWebsiteConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutBucketWebsiteRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutBucketWebsiteRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutBucketWebsiteRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutBucketWebsiteRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutBucketWebsiteRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutBucketWebsiteRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketWebsiteRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutBucketWebsiteRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutBucketWebsiteRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutBucketWebsiteRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + WebsiteConfiguration m_websiteConfiguration; + bool m_websiteConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectAclRequest.h b/include/aws/s3/model/PutObjectAclRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..75eda517f2e1351ba76f24e63a8028ef4c54b857 --- /dev/null +++ b/include/aws/s3/model/PutObjectAclRequest.h @@ -0,0 +1,354 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutObjectAclRequest : public S3Request + { + public: + AWS_S3_API PutObjectAclRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutObjectAcl"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The canned ACL to apply to the object. For more information, see Canned + * ACL.

+ */ + inline const ObjectCannedACL& GetACL() const{ return m_aCL; } + inline bool ACLHasBeenSet() const { return m_aCLHasBeenSet; } + inline void SetACL(const ObjectCannedACL& value) { m_aCLHasBeenSet = true; m_aCL = value; } + inline void SetACL(ObjectCannedACL&& value) { m_aCLHasBeenSet = true; m_aCL = std::move(value); } + inline PutObjectAclRequest& WithACL(const ObjectCannedACL& value) { SetACL(value); return *this;} + inline PutObjectAclRequest& WithACL(ObjectCannedACL&& value) { SetACL(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Contains the elements that set the ACL permissions for an object per + * grantee.

+ */ + inline const AccessControlPolicy& GetAccessControlPolicy() const{ return m_accessControlPolicy; } + inline bool AccessControlPolicyHasBeenSet() const { return m_accessControlPolicyHasBeenSet; } + inline void SetAccessControlPolicy(const AccessControlPolicy& value) { m_accessControlPolicyHasBeenSet = true; m_accessControlPolicy = value; } + inline void SetAccessControlPolicy(AccessControlPolicy&& value) { m_accessControlPolicyHasBeenSet = true; m_accessControlPolicy = std::move(value); } + inline PutObjectAclRequest& WithAccessControlPolicy(const AccessControlPolicy& value) { SetAccessControlPolicy(value); return *this;} + inline PutObjectAclRequest& WithAccessControlPolicy(AccessControlPolicy&& value) { SetAccessControlPolicy(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The bucket name that contains the object to which you want to attach the ACL. + *

Access points - When you use this action with an access point, + * you must provide the alias of the access point in place of the bucket name or + * specify the access point ARN. When using the access point ARN, you must direct + * requests to the access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

S3 on + * Outposts - When you use this action with S3 on Outposts, you must direct + * requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the + * form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutObjectAclRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutObjectAclRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutObjectAclRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The Base64 encoded 128-bit MD5 digest of the data. This header + * must be used as a message integrity check to verify that the request body was + * not corrupted in transit. For more information, go to RFC 1864.>

For + * requests made using the Amazon Web Services Command Line Interface (CLI) or + * Amazon Web Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutObjectAclRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutObjectAclRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutObjectAclRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutObjectAclRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutObjectAclRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee the read, write, read ACP, and write ACP permissions on the + * bucket.

This functionality is not supported for Amazon S3 on + * Outposts.

+ */ + inline const Aws::String& GetGrantFullControl() const{ return m_grantFullControl; } + inline bool GrantFullControlHasBeenSet() const { return m_grantFullControlHasBeenSet; } + inline void SetGrantFullControl(const Aws::String& value) { m_grantFullControlHasBeenSet = true; m_grantFullControl = value; } + inline void SetGrantFullControl(Aws::String&& value) { m_grantFullControlHasBeenSet = true; m_grantFullControl = std::move(value); } + inline void SetGrantFullControl(const char* value) { m_grantFullControlHasBeenSet = true; m_grantFullControl.assign(value); } + inline PutObjectAclRequest& WithGrantFullControl(const Aws::String& value) { SetGrantFullControl(value); return *this;} + inline PutObjectAclRequest& WithGrantFullControl(Aws::String&& value) { SetGrantFullControl(std::move(value)); return *this;} + inline PutObjectAclRequest& WithGrantFullControl(const char* value) { SetGrantFullControl(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to list the objects in the bucket.

This functionality + * is not supported for Amazon S3 on Outposts.

+ */ + inline const Aws::String& GetGrantRead() const{ return m_grantRead; } + inline bool GrantReadHasBeenSet() const { return m_grantReadHasBeenSet; } + inline void SetGrantRead(const Aws::String& value) { m_grantReadHasBeenSet = true; m_grantRead = value; } + inline void SetGrantRead(Aws::String&& value) { m_grantReadHasBeenSet = true; m_grantRead = std::move(value); } + inline void SetGrantRead(const char* value) { m_grantReadHasBeenSet = true; m_grantRead.assign(value); } + inline PutObjectAclRequest& WithGrantRead(const Aws::String& value) { SetGrantRead(value); return *this;} + inline PutObjectAclRequest& WithGrantRead(Aws::String&& value) { SetGrantRead(std::move(value)); return *this;} + inline PutObjectAclRequest& WithGrantRead(const char* value) { SetGrantRead(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to read the bucket ACL.

This functionality is not + * supported for Amazon S3 on Outposts.

+ */ + inline const Aws::String& GetGrantReadACP() const{ return m_grantReadACP; } + inline bool GrantReadACPHasBeenSet() const { return m_grantReadACPHasBeenSet; } + inline void SetGrantReadACP(const Aws::String& value) { m_grantReadACPHasBeenSet = true; m_grantReadACP = value; } + inline void SetGrantReadACP(Aws::String&& value) { m_grantReadACPHasBeenSet = true; m_grantReadACP = std::move(value); } + inline void SetGrantReadACP(const char* value) { m_grantReadACPHasBeenSet = true; m_grantReadACP.assign(value); } + inline PutObjectAclRequest& WithGrantReadACP(const Aws::String& value) { SetGrantReadACP(value); return *this;} + inline PutObjectAclRequest& WithGrantReadACP(Aws::String&& value) { SetGrantReadACP(std::move(value)); return *this;} + inline PutObjectAclRequest& WithGrantReadACP(const char* value) { SetGrantReadACP(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to create new objects in the bucket.

For the bucket and + * object owners of existing objects, also allows deletions and overwrites of those + * objects.

+ */ + inline const Aws::String& GetGrantWrite() const{ return m_grantWrite; } + inline bool GrantWriteHasBeenSet() const { return m_grantWriteHasBeenSet; } + inline void SetGrantWrite(const Aws::String& value) { m_grantWriteHasBeenSet = true; m_grantWrite = value; } + inline void SetGrantWrite(Aws::String&& value) { m_grantWriteHasBeenSet = true; m_grantWrite = std::move(value); } + inline void SetGrantWrite(const char* value) { m_grantWriteHasBeenSet = true; m_grantWrite.assign(value); } + inline PutObjectAclRequest& WithGrantWrite(const Aws::String& value) { SetGrantWrite(value); return *this;} + inline PutObjectAclRequest& WithGrantWrite(Aws::String&& value) { SetGrantWrite(std::move(value)); return *this;} + inline PutObjectAclRequest& WithGrantWrite(const char* value) { SetGrantWrite(value); return *this;} + ///@} + + ///@{ + /** + *

Allows grantee to write the ACL for the applicable bucket.

This + * functionality is not supported for Amazon S3 on Outposts.

+ */ + inline const Aws::String& GetGrantWriteACP() const{ return m_grantWriteACP; } + inline bool GrantWriteACPHasBeenSet() const { return m_grantWriteACPHasBeenSet; } + inline void SetGrantWriteACP(const Aws::String& value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP = value; } + inline void SetGrantWriteACP(Aws::String&& value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP = std::move(value); } + inline void SetGrantWriteACP(const char* value) { m_grantWriteACPHasBeenSet = true; m_grantWriteACP.assign(value); } + inline PutObjectAclRequest& WithGrantWriteACP(const Aws::String& value) { SetGrantWriteACP(value); return *this;} + inline PutObjectAclRequest& WithGrantWriteACP(Aws::String&& value) { SetGrantWriteACP(std::move(value)); return *this;} + inline PutObjectAclRequest& WithGrantWriteACP(const char* value) { SetGrantWriteACP(value); return *this;} + ///@} + + ///@{ + /** + *

Key for which the PUT action was initiated.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline PutObjectAclRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline PutObjectAclRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline PutObjectAclRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline PutObjectAclRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline PutObjectAclRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Version ID used to reference a specific version of the object.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline PutObjectAclRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline PutObjectAclRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline PutObjectAclRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutObjectAclRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutObjectAclRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutObjectAclRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutObjectAclRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutObjectAclRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutObjectAclRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutObjectAclRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectAclRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectAclRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutObjectAclRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectAclRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectAclRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + ObjectCannedACL m_aCL; + bool m_aCLHasBeenSet = false; + + AccessControlPolicy m_accessControlPolicy; + bool m_accessControlPolicyHasBeenSet = false; + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_grantFullControl; + bool m_grantFullControlHasBeenSet = false; + + Aws::String m_grantRead; + bool m_grantReadHasBeenSet = false; + + Aws::String m_grantReadACP; + bool m_grantReadACPHasBeenSet = false; + + Aws::String m_grantWrite; + bool m_grantWriteHasBeenSet = false; + + Aws::String m_grantWriteACP; + bool m_grantWriteACPHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectAclResult.h b/include/aws/s3/model/PutObjectAclResult.h new file mode 100644 index 0000000000000000000000000000000000000000..14d9f51cf723bc767fcaff53a0e27163db520a62 --- /dev/null +++ b/include/aws/s3/model/PutObjectAclResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class PutObjectAclResult + { + public: + AWS_S3_API PutObjectAclResult(); + AWS_S3_API PutObjectAclResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API PutObjectAclResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline PutObjectAclResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline PutObjectAclResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutObjectAclResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutObjectAclResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutObjectAclResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectLegalHoldRequest.h b/include/aws/s3/model/PutObjectLegalHoldRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..781118ddcd3215a812c1395ca73e78e580dfdcd3 --- /dev/null +++ b/include/aws/s3/model/PutObjectLegalHoldRequest.h @@ -0,0 +1,231 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutObjectLegalHoldRequest : public S3Request + { + public: + AWS_S3_API PutObjectLegalHoldRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutObjectLegalHold"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name containing the object that you want to place a legal hold on. + *

Access points - When you use this action with an access point, + * you must provide the alias of the access point in place of the bucket name or + * specify the access point ARN. When using the access point ARN, you must direct + * requests to the access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutObjectLegalHoldRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutObjectLegalHoldRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutObjectLegalHoldRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The key name for the object that you want to place a legal hold on.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline PutObjectLegalHoldRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline PutObjectLegalHoldRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline PutObjectLegalHoldRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

Container element for the legal hold configuration you want to apply to the + * specified object.

+ */ + inline const ObjectLockLegalHold& GetLegalHold() const{ return m_legalHold; } + inline bool LegalHoldHasBeenSet() const { return m_legalHoldHasBeenSet; } + inline void SetLegalHold(const ObjectLockLegalHold& value) { m_legalHoldHasBeenSet = true; m_legalHold = value; } + inline void SetLegalHold(ObjectLockLegalHold&& value) { m_legalHoldHasBeenSet = true; m_legalHold = std::move(value); } + inline PutObjectLegalHoldRequest& WithLegalHold(const ObjectLockLegalHold& value) { SetLegalHold(value); return *this;} + inline PutObjectLegalHoldRequest& WithLegalHold(ObjectLockLegalHold&& value) { SetLegalHold(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline PutObjectLegalHoldRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline PutObjectLegalHoldRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The version ID of the object that you want to place a legal hold on.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline PutObjectLegalHoldRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline PutObjectLegalHoldRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline PutObjectLegalHoldRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

The MD5 hash for the request body.

For requests made using the Amazon + * Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this + * field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutObjectLegalHoldRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutObjectLegalHoldRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutObjectLegalHoldRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutObjectLegalHoldRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutObjectLegalHoldRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutObjectLegalHoldRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutObjectLegalHoldRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutObjectLegalHoldRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutObjectLegalHoldRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutObjectLegalHoldRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutObjectLegalHoldRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutObjectLegalHoldRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectLegalHoldRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectLegalHoldRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutObjectLegalHoldRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectLegalHoldRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectLegalHoldRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + ObjectLockLegalHold m_legalHold; + bool m_legalHoldHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectLegalHoldResult.h b/include/aws/s3/model/PutObjectLegalHoldResult.h new file mode 100644 index 0000000000000000000000000000000000000000..7c0a7201fb579e24a56664d0569f49544a9d24ae --- /dev/null +++ b/include/aws/s3/model/PutObjectLegalHoldResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class PutObjectLegalHoldResult + { + public: + AWS_S3_API PutObjectLegalHoldResult(); + AWS_S3_API PutObjectLegalHoldResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API PutObjectLegalHoldResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline PutObjectLegalHoldResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline PutObjectLegalHoldResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutObjectLegalHoldResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutObjectLegalHoldResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutObjectLegalHoldResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectLockConfigurationRequest.h b/include/aws/s3/model/PutObjectLockConfigurationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..fc86838d8325c820ad5810377c4a873eaa0bfbba --- /dev/null +++ b/include/aws/s3/model/PutObjectLockConfigurationRequest.h @@ -0,0 +1,204 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutObjectLockConfigurationRequest : public S3Request + { + public: + AWS_S3_API PutObjectLockConfigurationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutObjectLockConfiguration"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket whose Object Lock configuration you want to create or replace.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutObjectLockConfigurationRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutObjectLockConfigurationRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutObjectLockConfigurationRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The Object Lock configuration that you want to apply to the specified + * bucket.

+ */ + inline const ObjectLockConfiguration& GetObjectLockConfiguration() const{ return m_objectLockConfiguration; } + inline bool ObjectLockConfigurationHasBeenSet() const { return m_objectLockConfigurationHasBeenSet; } + inline void SetObjectLockConfiguration(const ObjectLockConfiguration& value) { m_objectLockConfigurationHasBeenSet = true; m_objectLockConfiguration = value; } + inline void SetObjectLockConfiguration(ObjectLockConfiguration&& value) { m_objectLockConfigurationHasBeenSet = true; m_objectLockConfiguration = std::move(value); } + inline PutObjectLockConfigurationRequest& WithObjectLockConfiguration(const ObjectLockConfiguration& value) { SetObjectLockConfiguration(value); return *this;} + inline PutObjectLockConfigurationRequest& WithObjectLockConfiguration(ObjectLockConfiguration&& value) { SetObjectLockConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline PutObjectLockConfigurationRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline PutObjectLockConfigurationRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A token to allow Object Lock to be enabled for an existing bucket.

+ */ + inline const Aws::String& GetToken() const{ return m_token; } + inline bool TokenHasBeenSet() const { return m_tokenHasBeenSet; } + inline void SetToken(const Aws::String& value) { m_tokenHasBeenSet = true; m_token = value; } + inline void SetToken(Aws::String&& value) { m_tokenHasBeenSet = true; m_token = std::move(value); } + inline void SetToken(const char* value) { m_tokenHasBeenSet = true; m_token.assign(value); } + inline PutObjectLockConfigurationRequest& WithToken(const Aws::String& value) { SetToken(value); return *this;} + inline PutObjectLockConfigurationRequest& WithToken(Aws::String&& value) { SetToken(std::move(value)); return *this;} + inline PutObjectLockConfigurationRequest& WithToken(const char* value) { SetToken(value); return *this;} + ///@} + + ///@{ + /** + *

The MD5 hash for the request body.

For requests made using the Amazon + * Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this + * field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutObjectLockConfigurationRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutObjectLockConfigurationRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutObjectLockConfigurationRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutObjectLockConfigurationRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutObjectLockConfigurationRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutObjectLockConfigurationRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutObjectLockConfigurationRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutObjectLockConfigurationRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutObjectLockConfigurationRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutObjectLockConfigurationRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutObjectLockConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectLockConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectLockConfigurationRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectLockConfigurationRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + ObjectLockConfiguration m_objectLockConfiguration; + bool m_objectLockConfigurationHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_token; + bool m_tokenHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectLockConfigurationResult.h b/include/aws/s3/model/PutObjectLockConfigurationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c924992a399c58c2c93955551d088dd3415c6920 --- /dev/null +++ b/include/aws/s3/model/PutObjectLockConfigurationResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class PutObjectLockConfigurationResult + { + public: + AWS_S3_API PutObjectLockConfigurationResult(); + AWS_S3_API PutObjectLockConfigurationResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API PutObjectLockConfigurationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline PutObjectLockConfigurationResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline PutObjectLockConfigurationResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutObjectLockConfigurationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutObjectLockConfigurationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutObjectLockConfigurationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectRetentionRequest.h b/include/aws/s3/model/PutObjectRetentionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e73ba2301c51d4bd763807c9e73c4ca75cbcb52f --- /dev/null +++ b/include/aws/s3/model/PutObjectRetentionRequest.h @@ -0,0 +1,246 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutObjectRetentionRequest : public S3Request + { + public: + AWS_S3_API PutObjectRetentionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutObjectRetention"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name that contains the object you want to apply this Object + * Retention configuration to.

Access points - When you use this + * action with an access point, you must provide the alias of the access point in + * place of the bucket name or specify the access point ARN. When using the access + * point ARN, you must direct requests to the access point hostname. The access + * point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutObjectRetentionRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutObjectRetentionRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutObjectRetentionRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The key name for the object that you want to apply this Object Retention + * configuration to.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline PutObjectRetentionRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline PutObjectRetentionRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline PutObjectRetentionRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The container element for the Object Retention configuration.

+ */ + inline const ObjectLockRetention& GetRetention() const{ return m_retention; } + inline bool RetentionHasBeenSet() const { return m_retentionHasBeenSet; } + inline void SetRetention(const ObjectLockRetention& value) { m_retentionHasBeenSet = true; m_retention = value; } + inline void SetRetention(ObjectLockRetention&& value) { m_retentionHasBeenSet = true; m_retention = std::move(value); } + inline PutObjectRetentionRequest& WithRetention(const ObjectLockRetention& value) { SetRetention(value); return *this;} + inline PutObjectRetentionRequest& WithRetention(ObjectLockRetention&& value) { SetRetention(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline PutObjectRetentionRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline PutObjectRetentionRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The version ID for the object that you want to apply this Object Retention + * configuration to.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline PutObjectRetentionRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline PutObjectRetentionRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline PutObjectRetentionRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether this action should bypass Governance-mode restrictions.

+ */ + inline bool GetBypassGovernanceRetention() const{ return m_bypassGovernanceRetention; } + inline bool BypassGovernanceRetentionHasBeenSet() const { return m_bypassGovernanceRetentionHasBeenSet; } + inline void SetBypassGovernanceRetention(bool value) { m_bypassGovernanceRetentionHasBeenSet = true; m_bypassGovernanceRetention = value; } + inline PutObjectRetentionRequest& WithBypassGovernanceRetention(bool value) { SetBypassGovernanceRetention(value); return *this;} + ///@} + + ///@{ + /** + *

The MD5 hash for the request body.

For requests made using the Amazon + * Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this + * field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutObjectRetentionRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutObjectRetentionRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutObjectRetentionRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutObjectRetentionRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutObjectRetentionRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutObjectRetentionRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutObjectRetentionRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutObjectRetentionRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutObjectRetentionRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutObjectRetentionRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutObjectRetentionRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutObjectRetentionRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectRetentionRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectRetentionRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutObjectRetentionRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectRetentionRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectRetentionRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + ObjectLockRetention m_retention; + bool m_retentionHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + bool m_bypassGovernanceRetention; + bool m_bypassGovernanceRetentionHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectRetentionResult.h b/include/aws/s3/model/PutObjectRetentionResult.h new file mode 100644 index 0000000000000000000000000000000000000000..65ef526504f9f4cc7a7f31d62ed033995789fb08 --- /dev/null +++ b/include/aws/s3/model/PutObjectRetentionResult.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class PutObjectRetentionResult + { + public: + AWS_S3_API PutObjectRetentionResult(); + AWS_S3_API PutObjectRetentionResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API PutObjectRetentionResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline PutObjectRetentionResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline PutObjectRetentionResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutObjectRetentionResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutObjectRetentionResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutObjectRetentionResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectTaggingRequest.h b/include/aws/s3/model/PutObjectTaggingRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..0b438bf9d18e89411a43339823a1a68e623763cb --- /dev/null +++ b/include/aws/s3/model/PutObjectTaggingRequest.h @@ -0,0 +1,239 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutObjectTaggingRequest : public S3Request + { + public: + AWS_S3_API PutObjectTaggingRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutObjectTagging"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name containing the object.

Access points - When + * you use this action with an access point, you must provide the alias of the + * access point in place of the bucket name or specify the access point ARN. When + * using the access point ARN, you must direct requests to the access point + * hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

S3 on + * Outposts - When you use this action with S3 on Outposts, you must direct + * requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the + * form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutObjectTaggingRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutObjectTaggingRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutObjectTaggingRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Name of the object key.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline PutObjectTaggingRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline PutObjectTaggingRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline PutObjectTaggingRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The versionId of the object that the tag-set will be added to.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline PutObjectTaggingRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline PutObjectTaggingRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline PutObjectTaggingRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

The MD5 hash for the request body.

For requests made using the Amazon + * Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this + * field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutObjectTaggingRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutObjectTaggingRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutObjectTaggingRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutObjectTaggingRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutObjectTaggingRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container for the TagSet and Tag elements

+ */ + inline const Tagging& GetTagging() const{ return m_tagging; } + inline bool TaggingHasBeenSet() const { return m_taggingHasBeenSet; } + inline void SetTagging(const Tagging& value) { m_taggingHasBeenSet = true; m_tagging = value; } + inline void SetTagging(Tagging&& value) { m_taggingHasBeenSet = true; m_tagging = std::move(value); } + inline PutObjectTaggingRequest& WithTagging(const Tagging& value) { SetTagging(value); return *this;} + inline PutObjectTaggingRequest& WithTagging(Tagging&& value) { SetTagging(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutObjectTaggingRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutObjectTaggingRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutObjectTaggingRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline PutObjectTaggingRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline PutObjectTaggingRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutObjectTaggingRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutObjectTaggingRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutObjectTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutObjectTaggingRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutObjectTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutObjectTaggingRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Tagging m_tagging; + bool m_taggingHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutObjectTaggingResult.h b/include/aws/s3/model/PutObjectTaggingResult.h new file mode 100644 index 0000000000000000000000000000000000000000..3842963cc805ec8390424898117ea4aaac5d0844 --- /dev/null +++ b/include/aws/s3/model/PutObjectTaggingResult.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class PutObjectTaggingResult + { + public: + AWS_S3_API PutObjectTaggingResult(); + AWS_S3_API PutObjectTaggingResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API PutObjectTaggingResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The versionId of the object the tag-set was added to.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline void SetVersionId(const Aws::String& value) { m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionId.assign(value); } + inline PutObjectTaggingResult& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline PutObjectTaggingResult& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline PutObjectTaggingResult& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline PutObjectTaggingResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline PutObjectTaggingResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline PutObjectTaggingResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_versionId; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/PutPublicAccessBlockRequest.h b/include/aws/s3/model/PutPublicAccessBlockRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..4dc7443be62d2da9b83206c68fedf2a550a856fb --- /dev/null +++ b/include/aws/s3/model/PutPublicAccessBlockRequest.h @@ -0,0 +1,178 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class PutPublicAccessBlockRequest : public S3Request + { + public: + AWS_S3_API PutPublicAccessBlockRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutPublicAccessBlock"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + inline bool RequestChecksumRequired() const override { return true; }; + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The name of the Amazon S3 bucket whose PublicAccessBlock + * configuration you want to set.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline PutPublicAccessBlockRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline PutPublicAccessBlockRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline PutPublicAccessBlockRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The MD5 hash of the PutPublicAccessBlock request body.

+ *

For requests made using the Amazon Web Services Command Line Interface (CLI) + * or Amazon Web Services SDKs, this field is calculated automatically.

+ */ + inline const Aws::String& GetContentMD5() const{ return m_contentMD5; } + inline bool ContentMD5HasBeenSet() const { return m_contentMD5HasBeenSet; } + inline void SetContentMD5(const Aws::String& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = value; } + inline void SetContentMD5(Aws::String&& value) { m_contentMD5HasBeenSet = true; m_contentMD5 = std::move(value); } + inline void SetContentMD5(const char* value) { m_contentMD5HasBeenSet = true; m_contentMD5.assign(value); } + inline PutPublicAccessBlockRequest& WithContentMD5(const Aws::String& value) { SetContentMD5(value); return *this;} + inline PutPublicAccessBlockRequest& WithContentMD5(Aws::String&& value) { SetContentMD5(std::move(value)); return *this;} + inline PutPublicAccessBlockRequest& WithContentMD5(const char* value) { SetContentMD5(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline PutPublicAccessBlockRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline PutPublicAccessBlockRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The PublicAccessBlock configuration that you want to apply to + * this Amazon S3 bucket. You can enable the configuration options in any + * combination. For more information about when Amazon S3 considers a bucket or + * object public, see The + * Meaning of "Public" in the Amazon S3 User Guide.

+ */ + inline const PublicAccessBlockConfiguration& GetPublicAccessBlockConfiguration() const{ return m_publicAccessBlockConfiguration; } + inline bool PublicAccessBlockConfigurationHasBeenSet() const { return m_publicAccessBlockConfigurationHasBeenSet; } + inline void SetPublicAccessBlockConfiguration(const PublicAccessBlockConfiguration& value) { m_publicAccessBlockConfigurationHasBeenSet = true; m_publicAccessBlockConfiguration = value; } + inline void SetPublicAccessBlockConfiguration(PublicAccessBlockConfiguration&& value) { m_publicAccessBlockConfigurationHasBeenSet = true; m_publicAccessBlockConfiguration = std::move(value); } + inline PutPublicAccessBlockRequest& WithPublicAccessBlockConfiguration(const PublicAccessBlockConfiguration& value) { SetPublicAccessBlockConfiguration(value); return *this;} + inline PutPublicAccessBlockRequest& WithPublicAccessBlockConfiguration(PublicAccessBlockConfiguration&& value) { SetPublicAccessBlockConfiguration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline PutPublicAccessBlockRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline PutPublicAccessBlockRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline PutPublicAccessBlockRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline PutPublicAccessBlockRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline PutPublicAccessBlockRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline PutPublicAccessBlockRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline PutPublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutPublicAccessBlockRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutPublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline PutPublicAccessBlockRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline PutPublicAccessBlockRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline PutPublicAccessBlockRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_contentMD5; + bool m_contentMD5HasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + PublicAccessBlockConfiguration m_publicAccessBlockConfiguration; + bool m_publicAccessBlockConfigurationHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/QueueConfigurationDeprecated.h b/include/aws/s3/model/QueueConfigurationDeprecated.h new file mode 100644 index 0000000000000000000000000000000000000000..0fac09b5adcb480c127ed26db0542f185ed571ed --- /dev/null +++ b/include/aws/s3/model/QueueConfigurationDeprecated.h @@ -0,0 +1,100 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

This data type is deprecated. Use QueueConfiguration + * for the same purposes. This data type specifies the configuration for publishing + * messages to an Amazon Simple Queue Service (Amazon SQS) queue when Amazon S3 + * detects specified events.

See Also:

AWS + * API Reference

+ */ + class QueueConfigurationDeprecated + { + public: + AWS_S3_API QueueConfigurationDeprecated(); + AWS_S3_API QueueConfigurationDeprecated(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API QueueConfigurationDeprecated& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline QueueConfigurationDeprecated& WithId(const Aws::String& value) { SetId(value); return *this;} + inline QueueConfigurationDeprecated& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline QueueConfigurationDeprecated& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

A collection of bucket events for which to send notifications.

+ */ + inline const Aws::Vector& GetEvents() const{ return m_events; } + inline bool EventsHasBeenSet() const { return m_eventsHasBeenSet; } + inline void SetEvents(const Aws::Vector& value) { m_eventsHasBeenSet = true; m_events = value; } + inline void SetEvents(Aws::Vector&& value) { m_eventsHasBeenSet = true; m_events = std::move(value); } + inline QueueConfigurationDeprecated& WithEvents(const Aws::Vector& value) { SetEvents(value); return *this;} + inline QueueConfigurationDeprecated& WithEvents(Aws::Vector&& value) { SetEvents(std::move(value)); return *this;} + inline QueueConfigurationDeprecated& AddEvents(const Event& value) { m_eventsHasBeenSet = true; m_events.push_back(value); return *this; } + inline QueueConfigurationDeprecated& AddEvents(Event&& value) { m_eventsHasBeenSet = true; m_events.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 + * publishes a message when it detects events of the specified type.

+ */ + inline const Aws::String& GetQueue() const{ return m_queue; } + inline bool QueueHasBeenSet() const { return m_queueHasBeenSet; } + inline void SetQueue(const Aws::String& value) { m_queueHasBeenSet = true; m_queue = value; } + inline void SetQueue(Aws::String&& value) { m_queueHasBeenSet = true; m_queue = std::move(value); } + inline void SetQueue(const char* value) { m_queueHasBeenSet = true; m_queue.assign(value); } + inline QueueConfigurationDeprecated& WithQueue(const Aws::String& value) { SetQueue(value); return *this;} + inline QueueConfigurationDeprecated& WithQueue(Aws::String&& value) { SetQueue(std::move(value)); return *this;} + inline QueueConfigurationDeprecated& WithQueue(const char* value) { SetQueue(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::Vector m_events; + bool m_eventsHasBeenSet = false; + + Aws::String m_queue; + bool m_queueHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/QuoteFields.h b/include/aws/s3/model/QuoteFields.h new file mode 100644 index 0000000000000000000000000000000000000000..522e747eadcb275c2dcf585fcadc468d053ba225 --- /dev/null +++ b/include/aws/s3/model/QuoteFields.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class QuoteFields + { + NOT_SET, + ALWAYS, + ASNEEDED + }; + +namespace QuoteFieldsMapper +{ +AWS_S3_API QuoteFields GetQuoteFieldsForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForQuoteFields(QuoteFields value); +} // namespace QuoteFieldsMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ReplicaModifications.h b/include/aws/s3/model/ReplicaModifications.h new file mode 100644 index 0000000000000000000000000000000000000000..343afbd1825243d6f88572b1670d7b7ef65d796b --- /dev/null +++ b/include/aws/s3/model/ReplicaModifications.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A filter that you can specify for selection for modifications on replicas. + * Amazon S3 doesn't replicate replica modifications by default. In the latest + * version of replication configuration (when Filter is specified), + * you can specify this element and set the status to Enabled to + * replicate modifications on replicas.

If you don't specify the + * Filter element, Amazon S3 assumes that the replication + * configuration is the earlier version, V1. In the earlier version, this element + * is not allowed.

See Also:

AWS + * API Reference

+ */ + class ReplicaModifications + { + public: + AWS_S3_API ReplicaModifications(); + AWS_S3_API ReplicaModifications(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ReplicaModifications& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies whether Amazon S3 replicates modifications on replicas.

+ */ + inline const ReplicaModificationsStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const ReplicaModificationsStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(ReplicaModificationsStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline ReplicaModifications& WithStatus(const ReplicaModificationsStatus& value) { SetStatus(value); return *this;} + inline ReplicaModifications& WithStatus(ReplicaModificationsStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + ReplicaModificationsStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ReplicaModificationsStatus.h b/include/aws/s3/model/ReplicaModificationsStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..184b59b7f23540f9c2b964591807e0575c7eca21 --- /dev/null +++ b/include/aws/s3/model/ReplicaModificationsStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ReplicaModificationsStatus + { + NOT_SET, + Enabled, + Disabled + }; + +namespace ReplicaModificationsStatusMapper +{ +AWS_S3_API ReplicaModificationsStatus GetReplicaModificationsStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForReplicaModificationsStatus(ReplicaModificationsStatus value); +} // namespace ReplicaModificationsStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ReplicationRule.h b/include/aws/s3/model/ReplicationRule.h new file mode 100644 index 0000000000000000000000000000000000000000..e1e2e60b9535c0eb38a5889c7b6ace3a22750249 --- /dev/null +++ b/include/aws/s3/model/ReplicationRule.h @@ -0,0 +1,184 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies which Amazon S3 objects to replicate and where to store the + * replicas.

See Also:

AWS + * API Reference

+ */ + class ReplicationRule + { + public: + AWS_S3_API ReplicationRule(); + AWS_S3_API ReplicationRule(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ReplicationRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

A unique identifier for the rule. The maximum value is 255 characters.

+ */ + inline const Aws::String& GetID() const{ return m_iD; } + inline bool IDHasBeenSet() const { return m_iDHasBeenSet; } + inline void SetID(const Aws::String& value) { m_iDHasBeenSet = true; m_iD = value; } + inline void SetID(Aws::String&& value) { m_iDHasBeenSet = true; m_iD = std::move(value); } + inline void SetID(const char* value) { m_iDHasBeenSet = true; m_iD.assign(value); } + inline ReplicationRule& WithID(const Aws::String& value) { SetID(value); return *this;} + inline ReplicationRule& WithID(Aws::String&& value) { SetID(std::move(value)); return *this;} + inline ReplicationRule& WithID(const char* value) { SetID(value); return *this;} + ///@} + + ///@{ + /** + *

The priority indicates which rule has precedence whenever two or more + * replication rules conflict. Amazon S3 will attempt to replicate objects + * according to all replication rules. However, if there are two or more rules with + * the same destination bucket, then objects will be replicated according to the + * rule with the highest priority. The higher the number, the higher the priority. + *

For more information, see Replication + * in the Amazon S3 User Guide.

+ */ + inline int GetPriority() const{ return m_priority; } + inline bool PriorityHasBeenSet() const { return m_priorityHasBeenSet; } + inline void SetPriority(int value) { m_priorityHasBeenSet = true; m_priority = value; } + inline ReplicationRule& WithPriority(int value) { SetPriority(value); return *this;} + ///@} + + ///@{ + + inline const ReplicationRuleFilter& GetFilter() const{ return m_filter; } + inline bool FilterHasBeenSet() const { return m_filterHasBeenSet; } + inline void SetFilter(const ReplicationRuleFilter& value) { m_filterHasBeenSet = true; m_filter = value; } + inline void SetFilter(ReplicationRuleFilter&& value) { m_filterHasBeenSet = true; m_filter = std::move(value); } + inline ReplicationRule& WithFilter(const ReplicationRuleFilter& value) { SetFilter(value); return *this;} + inline ReplicationRule& WithFilter(ReplicationRuleFilter&& value) { SetFilter(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether the rule is enabled.

+ */ + inline const ReplicationRuleStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const ReplicationRuleStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(ReplicationRuleStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline ReplicationRule& WithStatus(const ReplicationRuleStatus& value) { SetStatus(value); return *this;} + inline ReplicationRule& WithStatus(ReplicationRuleStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A container that describes additional filters for identifying the source + * objects that you want to replicate. You can choose to enable or disable the + * replication of these objects. Currently, Amazon S3 supports only the filter that + * you can specify for objects created with server-side encryption using a customer + * managed key stored in Amazon Web Services Key Management Service (SSE-KMS).

+ */ + inline const SourceSelectionCriteria& GetSourceSelectionCriteria() const{ return m_sourceSelectionCriteria; } + inline bool SourceSelectionCriteriaHasBeenSet() const { return m_sourceSelectionCriteriaHasBeenSet; } + inline void SetSourceSelectionCriteria(const SourceSelectionCriteria& value) { m_sourceSelectionCriteriaHasBeenSet = true; m_sourceSelectionCriteria = value; } + inline void SetSourceSelectionCriteria(SourceSelectionCriteria&& value) { m_sourceSelectionCriteriaHasBeenSet = true; m_sourceSelectionCriteria = std::move(value); } + inline ReplicationRule& WithSourceSelectionCriteria(const SourceSelectionCriteria& value) { SetSourceSelectionCriteria(value); return *this;} + inline ReplicationRule& WithSourceSelectionCriteria(SourceSelectionCriteria&& value) { SetSourceSelectionCriteria(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Optional configuration to replicate existing source bucket objects.

+ *

This parameter is no longer supported. To replicate existing objects, + * see Replicating + * existing objects with S3 Batch Replication in the Amazon S3 User + * Guide.

+ */ + inline const ExistingObjectReplication& GetExistingObjectReplication() const{ return m_existingObjectReplication; } + inline bool ExistingObjectReplicationHasBeenSet() const { return m_existingObjectReplicationHasBeenSet; } + inline void SetExistingObjectReplication(const ExistingObjectReplication& value) { m_existingObjectReplicationHasBeenSet = true; m_existingObjectReplication = value; } + inline void SetExistingObjectReplication(ExistingObjectReplication&& value) { m_existingObjectReplicationHasBeenSet = true; m_existingObjectReplication = std::move(value); } + inline ReplicationRule& WithExistingObjectReplication(const ExistingObjectReplication& value) { SetExistingObjectReplication(value); return *this;} + inline ReplicationRule& WithExistingObjectReplication(ExistingObjectReplication&& value) { SetExistingObjectReplication(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A container for information about the replication destination and its + * configurations including enabling the S3 Replication Time Control (S3 RTC).

+ */ + inline const Destination& GetDestination() const{ return m_destination; } + inline bool DestinationHasBeenSet() const { return m_destinationHasBeenSet; } + inline void SetDestination(const Destination& value) { m_destinationHasBeenSet = true; m_destination = value; } + inline void SetDestination(Destination&& value) { m_destinationHasBeenSet = true; m_destination = std::move(value); } + inline ReplicationRule& WithDestination(const Destination& value) { SetDestination(value); return *this;} + inline ReplicationRule& WithDestination(Destination&& value) { SetDestination(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const DeleteMarkerReplication& GetDeleteMarkerReplication() const{ return m_deleteMarkerReplication; } + inline bool DeleteMarkerReplicationHasBeenSet() const { return m_deleteMarkerReplicationHasBeenSet; } + inline void SetDeleteMarkerReplication(const DeleteMarkerReplication& value) { m_deleteMarkerReplicationHasBeenSet = true; m_deleteMarkerReplication = value; } + inline void SetDeleteMarkerReplication(DeleteMarkerReplication&& value) { m_deleteMarkerReplicationHasBeenSet = true; m_deleteMarkerReplication = std::move(value); } + inline ReplicationRule& WithDeleteMarkerReplication(const DeleteMarkerReplication& value) { SetDeleteMarkerReplication(value); return *this;} + inline ReplicationRule& WithDeleteMarkerReplication(DeleteMarkerReplication&& value) { SetDeleteMarkerReplication(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_iD; + bool m_iDHasBeenSet = false; + + int m_priority; + bool m_priorityHasBeenSet = false; + + ReplicationRuleFilter m_filter; + bool m_filterHasBeenSet = false; + + ReplicationRuleStatus m_status; + bool m_statusHasBeenSet = false; + + SourceSelectionCriteria m_sourceSelectionCriteria; + bool m_sourceSelectionCriteriaHasBeenSet = false; + + ExistingObjectReplication m_existingObjectReplication; + bool m_existingObjectReplicationHasBeenSet = false; + + Destination m_destination; + bool m_destinationHasBeenSet = false; + + DeleteMarkerReplication m_deleteMarkerReplication; + bool m_deleteMarkerReplicationHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ReplicationRuleAndOperator.h b/include/aws/s3/model/ReplicationRuleAndOperator.h new file mode 100644 index 0000000000000000000000000000000000000000..436ed06f8237a1714557406b722c055ff383cc28 --- /dev/null +++ b/include/aws/s3/model/ReplicationRuleAndOperator.h @@ -0,0 +1,87 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container for specifying rule filters. The filters determine the subset of + * objects to which the rule applies. This element is required only if you specify + * more than one filter.

For example:

  • If you specify both + * a Prefix and a Tag filter, wrap these filters in an + * And tag.

  • If you specify a filter based on + * multiple tags, wrap the Tag elements in an And + * tag.

See Also:

AWS + * API Reference

+ */ + class ReplicationRuleAndOperator + { + public: + AWS_S3_API ReplicationRuleAndOperator(); + AWS_S3_API ReplicationRuleAndOperator(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ReplicationRuleAndOperator& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

An object key name prefix that identifies the subset of objects to which the + * rule applies.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline ReplicationRuleAndOperator& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ReplicationRuleAndOperator& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ReplicationRuleAndOperator& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

An array of tags containing key and value pairs.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline ReplicationRuleAndOperator& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline ReplicationRuleAndOperator& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline ReplicationRuleAndOperator& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline ReplicationRuleAndOperator& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ReplicationRuleFilter.h b/include/aws/s3/model/ReplicationRuleFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..66a3c547ba65afcd1fc258676c0de811900c0501 --- /dev/null +++ b/include/aws/s3/model/ReplicationRuleFilter.h @@ -0,0 +1,108 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A filter that identifies the subset of objects to which the replication rule + * applies. A Filter must specify exactly one Prefix, + * Tag, or an And child element.

See Also:

+ * AWS + * API Reference

+ */ + class ReplicationRuleFilter + { + public: + AWS_S3_API ReplicationRuleFilter(); + AWS_S3_API ReplicationRuleFilter(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ReplicationRuleFilter& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

An object key name prefix that identifies the subset of objects to which the + * rule applies.

Replacement must be made for object keys + * containing special characters (such as carriage returns) when using XML + * requests. For more information, see + * XML related object key constraints.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline ReplicationRuleFilter& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline ReplicationRuleFilter& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline ReplicationRuleFilter& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

A container for specifying a tag key and value.

The rule applies only + * to objects that have the tag in their tag set.

+ */ + inline const Tag& GetTag() const{ return m_tag; } + inline bool TagHasBeenSet() const { return m_tagHasBeenSet; } + inline void SetTag(const Tag& value) { m_tagHasBeenSet = true; m_tag = value; } + inline void SetTag(Tag&& value) { m_tagHasBeenSet = true; m_tag = std::move(value); } + inline ReplicationRuleFilter& WithTag(const Tag& value) { SetTag(value); return *this;} + inline ReplicationRuleFilter& WithTag(Tag&& value) { SetTag(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A container for specifying rule filters. The filters determine the subset of + * objects to which the rule applies. This element is required only if you specify + * more than one filter. For example:

  • If you specify both a + * Prefix and a Tag filter, wrap these filters in an + * And tag.

  • If you specify a filter based on + * multiple tags, wrap the Tag elements in an And + * tag.

+ */ + inline const ReplicationRuleAndOperator& GetAnd() const{ return m_and; } + inline bool AndHasBeenSet() const { return m_andHasBeenSet; } + inline void SetAnd(const ReplicationRuleAndOperator& value) { m_andHasBeenSet = true; m_and = value; } + inline void SetAnd(ReplicationRuleAndOperator&& value) { m_andHasBeenSet = true; m_and = std::move(value); } + inline ReplicationRuleFilter& WithAnd(const ReplicationRuleAndOperator& value) { SetAnd(value); return *this;} + inline ReplicationRuleFilter& WithAnd(ReplicationRuleAndOperator&& value) { SetAnd(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + Tag m_tag; + bool m_tagHasBeenSet = false; + + ReplicationRuleAndOperator m_and; + bool m_andHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ReplicationTimeStatus.h b/include/aws/s3/model/ReplicationTimeStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..fd99decae0f1965bc7d2ba121d35fbb7f6db61c1 --- /dev/null +++ b/include/aws/s3/model/ReplicationTimeStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ReplicationTimeStatus + { + NOT_SET, + Enabled, + Disabled + }; + +namespace ReplicationTimeStatusMapper +{ +AWS_S3_API ReplicationTimeStatus GetReplicationTimeStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForReplicationTimeStatus(ReplicationTimeStatus value); +} // namespace ReplicationTimeStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/RequestPaymentConfiguration.h b/include/aws/s3/model/RequestPaymentConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..f3e4414b92852120a2d95f1cc1d81ed7e3ff9c37 --- /dev/null +++ b/include/aws/s3/model/RequestPaymentConfiguration.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for Payer.

See Also:

AWS + * API Reference

+ */ + class RequestPaymentConfiguration + { + public: + AWS_S3_API RequestPaymentConfiguration(); + AWS_S3_API RequestPaymentConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API RequestPaymentConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies who pays for the download and request fees.

+ */ + inline const Payer& GetPayer() const{ return m_payer; } + inline bool PayerHasBeenSet() const { return m_payerHasBeenSet; } + inline void SetPayer(const Payer& value) { m_payerHasBeenSet = true; m_payer = value; } + inline void SetPayer(Payer&& value) { m_payerHasBeenSet = true; m_payer = std::move(value); } + inline RequestPaymentConfiguration& WithPayer(const Payer& value) { SetPayer(value); return *this;} + inline RequestPaymentConfiguration& WithPayer(Payer&& value) { SetPayer(std::move(value)); return *this;} + ///@} + private: + + Payer m_payer; + bool m_payerHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/RequestProgress.h b/include/aws/s3/model/RequestProgress.h new file mode 100644 index 0000000000000000000000000000000000000000..6d9587c97664b897372749c4a601716084f3b3ad --- /dev/null +++ b/include/aws/s3/model/RequestProgress.h @@ -0,0 +1,57 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for specifying if periodic QueryProgress messages + * should be sent.

See Also:

AWS + * API Reference

+ */ + class RequestProgress + { + public: + AWS_S3_API RequestProgress(); + AWS_S3_API RequestProgress(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API RequestProgress& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies whether periodic QueryProgress frames should be sent. Valid values: + * TRUE, FALSE. Default value: FALSE.

+ */ + inline bool GetEnabled() const{ return m_enabled; } + inline bool EnabledHasBeenSet() const { return m_enabledHasBeenSet; } + inline void SetEnabled(bool value) { m_enabledHasBeenSet = true; m_enabled = value; } + inline RequestProgress& WithEnabled(bool value) { SetEnabled(value); return *this;} + ///@} + private: + + bool m_enabled; + bool m_enabledHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/RestoreObjectRequest.h b/include/aws/s3/model/RestoreObjectRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2d60c70b1259dfb5d87121cd3bf2ed332b15b926 --- /dev/null +++ b/include/aws/s3/model/RestoreObjectRequest.h @@ -0,0 +1,216 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + */ + class RestoreObjectRequest : public S3Request + { + public: + AWS_S3_API RestoreObjectRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "RestoreObject"; } + + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + AWS_S3_API Aws::String GetChecksumAlgorithmName() const override; + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The bucket name containing the object to restore.

Access + * points - When you use this action with an access point, you must provide the + * alias of the access point in place of the bucket name or specify the access + * point ARN. When using the access point ARN, you must direct requests to the + * access point hostname. The access point hostname takes the form + * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + * When using this action with an access point through the Amazon Web Services + * SDKs, you provide the access point ARN in place of the bucket name. For more + * information about access point ARNs, see Using + * access points in the Amazon S3 User Guide.

S3 on + * Outposts - When you use this action with S3 on Outposts, you must direct + * requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the + * form + * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + * When you use this action with S3 on Outposts, the destination bucket must be the + * Outposts access point ARN or the access point alias. For more information about + * S3 on Outposts, see What + * is S3 on Outposts? in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline RestoreObjectRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline RestoreObjectRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline RestoreObjectRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

Object key for which the action was initiated.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline RestoreObjectRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline RestoreObjectRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline RestoreObjectRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

VersionId used to reference a specific version of the object.

+ */ + inline const Aws::String& GetVersionId() const{ return m_versionId; } + inline bool VersionIdHasBeenSet() const { return m_versionIdHasBeenSet; } + inline void SetVersionId(const Aws::String& value) { m_versionIdHasBeenSet = true; m_versionId = value; } + inline void SetVersionId(Aws::String&& value) { m_versionIdHasBeenSet = true; m_versionId = std::move(value); } + inline void SetVersionId(const char* value) { m_versionIdHasBeenSet = true; m_versionId.assign(value); } + inline RestoreObjectRequest& WithVersionId(const Aws::String& value) { SetVersionId(value); return *this;} + inline RestoreObjectRequest& WithVersionId(Aws::String&& value) { SetVersionId(std::move(value)); return *this;} + inline RestoreObjectRequest& WithVersionId(const char* value) { SetVersionId(value); return *this;} + ///@} + + ///@{ + + inline const RestoreRequest& GetRestoreRequest() const{ return m_restoreRequest; } + inline bool RestoreRequestHasBeenSet() const { return m_restoreRequestHasBeenSet; } + inline void SetRestoreRequest(const RestoreRequest& value) { m_restoreRequestHasBeenSet = true; m_restoreRequest = value; } + inline void SetRestoreRequest(RestoreRequest&& value) { m_restoreRequestHasBeenSet = true; m_restoreRequest = std::move(value); } + inline RestoreObjectRequest& WithRestoreRequest(const RestoreRequest& value) { SetRestoreRequest(value); return *this;} + inline RestoreObjectRequest& WithRestoreRequest(RestoreRequest&& value) { SetRestoreRequest(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const RequestPayer& GetRequestPayer() const{ return m_requestPayer; } + inline bool RequestPayerHasBeenSet() const { return m_requestPayerHasBeenSet; } + inline void SetRequestPayer(const RequestPayer& value) { m_requestPayerHasBeenSet = true; m_requestPayer = value; } + inline void SetRequestPayer(RequestPayer&& value) { m_requestPayerHasBeenSet = true; m_requestPayer = std::move(value); } + inline RestoreObjectRequest& WithRequestPayer(const RequestPayer& value) { SetRequestPayer(value); return *this;} + inline RestoreObjectRequest& WithRequestPayer(RequestPayer&& value) { SetRequestPayer(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Indicates the algorithm used to create the checksum for the object when you + * use the SDK. This header will not provide any additional functionality if you + * don't use the SDK. When you send this header, there must be a corresponding + * x-amz-checksum or x-amz-trailer header sent. + * Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad + * Request. For more information, see Checking + * object integrity in the Amazon S3 User Guide.

If you provide + * an individual checksum, Amazon S3 ignores any provided + * ChecksumAlgorithm parameter.

+ */ + inline const ChecksumAlgorithm& GetChecksumAlgorithm() const{ return m_checksumAlgorithm; } + inline bool ChecksumAlgorithmHasBeenSet() const { return m_checksumAlgorithmHasBeenSet; } + inline void SetChecksumAlgorithm(const ChecksumAlgorithm& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = value; } + inline void SetChecksumAlgorithm(ChecksumAlgorithm&& value) { m_checksumAlgorithmHasBeenSet = true; m_checksumAlgorithm = std::move(value); } + inline RestoreObjectRequest& WithChecksumAlgorithm(const ChecksumAlgorithm& value) { SetChecksumAlgorithm(value); return *this;} + inline RestoreObjectRequest& WithChecksumAlgorithm(ChecksumAlgorithm&& value) { SetChecksumAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline RestoreObjectRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline RestoreObjectRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline RestoreObjectRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline RestoreObjectRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline RestoreObjectRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline RestoreObjectRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline RestoreObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline RestoreObjectRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline RestoreObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline RestoreObjectRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline RestoreObjectRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline RestoreObjectRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_versionId; + bool m_versionIdHasBeenSet = false; + + RestoreRequest m_restoreRequest; + bool m_restoreRequestHasBeenSet = false; + + RequestPayer m_requestPayer; + bool m_requestPayerHasBeenSet = false; + + ChecksumAlgorithm m_checksumAlgorithm; + bool m_checksumAlgorithmHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/RestoreObjectResult.h b/include/aws/s3/model/RestoreObjectResult.h new file mode 100644 index 0000000000000000000000000000000000000000..8ad1d231b5aa9aa9e969a93b64c9a91fb5039572 --- /dev/null +++ b/include/aws/s3/model/RestoreObjectResult.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class RestoreObjectResult + { + public: + AWS_S3_API RestoreObjectResult(); + AWS_S3_API RestoreObjectResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API RestoreObjectResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline RestoreObjectResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline RestoreObjectResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Indicates the path in the provided S3 output location where Select results + * will be restored to.

+ */ + inline const Aws::String& GetRestoreOutputPath() const{ return m_restoreOutputPath; } + inline void SetRestoreOutputPath(const Aws::String& value) { m_restoreOutputPath = value; } + inline void SetRestoreOutputPath(Aws::String&& value) { m_restoreOutputPath = std::move(value); } + inline void SetRestoreOutputPath(const char* value) { m_restoreOutputPath.assign(value); } + inline RestoreObjectResult& WithRestoreOutputPath(const Aws::String& value) { SetRestoreOutputPath(value); return *this;} + inline RestoreObjectResult& WithRestoreOutputPath(Aws::String&& value) { SetRestoreOutputPath(std::move(value)); return *this;} + inline RestoreObjectResult& WithRestoreOutputPath(const char* value) { SetRestoreOutputPath(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline RestoreObjectResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline RestoreObjectResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline RestoreObjectResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + RequestCharged m_requestCharged; + + Aws::String m_restoreOutputPath; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/RestoreRequest.h b/include/aws/s3/model/RestoreRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..984c7d8046b32e2b34bdd4c195aed9c54d25adc3 --- /dev/null +++ b/include/aws/s3/model/RestoreRequest.h @@ -0,0 +1,165 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for restore job parameters.

See Also:

AWS + * API Reference

+ */ + class RestoreRequest + { + public: + AWS_S3_API RestoreRequest(); + AWS_S3_API RestoreRequest(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API RestoreRequest& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Lifetime of the active copy in days. Do not use with restores that specify + * OutputLocation.

The Days element is required for regular + * restores, and must not be provided for select requests.

+ */ + inline int GetDays() const{ return m_days; } + inline bool DaysHasBeenSet() const { return m_daysHasBeenSet; } + inline void SetDays(int value) { m_daysHasBeenSet = true; m_days = value; } + inline RestoreRequest& WithDays(int value) { SetDays(value); return *this;} + ///@} + + ///@{ + /** + *

S3 Glacier related parameters pertaining to this job. Do not use with + * restores that specify OutputLocation.

+ */ + inline const GlacierJobParameters& GetGlacierJobParameters() const{ return m_glacierJobParameters; } + inline bool GlacierJobParametersHasBeenSet() const { return m_glacierJobParametersHasBeenSet; } + inline void SetGlacierJobParameters(const GlacierJobParameters& value) { m_glacierJobParametersHasBeenSet = true; m_glacierJobParameters = value; } + inline void SetGlacierJobParameters(GlacierJobParameters&& value) { m_glacierJobParametersHasBeenSet = true; m_glacierJobParameters = std::move(value); } + inline RestoreRequest& WithGlacierJobParameters(const GlacierJobParameters& value) { SetGlacierJobParameters(value); return *this;} + inline RestoreRequest& WithGlacierJobParameters(GlacierJobParameters&& value) { SetGlacierJobParameters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Amazon S3 Select is no longer available to new customers. + * Existing customers of Amazon S3 Select can continue to use the feature as usual. + * Learn + * more

Type of restore request.

+ */ + inline const RestoreRequestType& GetType() const{ return m_type; } + inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } + inline void SetType(const RestoreRequestType& value) { m_typeHasBeenSet = true; m_type = value; } + inline void SetType(RestoreRequestType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } + inline RestoreRequest& WithType(const RestoreRequestType& value) { SetType(value); return *this;} + inline RestoreRequest& WithType(RestoreRequestType&& value) { SetType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Retrieval tier at which the restore will be processed.

+ */ + inline const Tier& GetTier() const{ return m_tier; } + inline bool TierHasBeenSet() const { return m_tierHasBeenSet; } + inline void SetTier(const Tier& value) { m_tierHasBeenSet = true; m_tier = value; } + inline void SetTier(Tier&& value) { m_tierHasBeenSet = true; m_tier = std::move(value); } + inline RestoreRequest& WithTier(const Tier& value) { SetTier(value); return *this;} + inline RestoreRequest& WithTier(Tier&& value) { SetTier(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The optional description for the job.

+ */ + inline const Aws::String& GetDescription() const{ return m_description; } + inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } + inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } + inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } + inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } + inline RestoreRequest& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} + inline RestoreRequest& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} + inline RestoreRequest& WithDescription(const char* value) { SetDescription(value); return *this;} + ///@} + + ///@{ + /** + *

Amazon S3 Select is no longer available to new customers. + * Existing customers of Amazon S3 Select can continue to use the feature as usual. + * Learn + * more

Describes the parameters for Select job types.

+ */ + inline const SelectParameters& GetSelectParameters() const{ return m_selectParameters; } + inline bool SelectParametersHasBeenSet() const { return m_selectParametersHasBeenSet; } + inline void SetSelectParameters(const SelectParameters& value) { m_selectParametersHasBeenSet = true; m_selectParameters = value; } + inline void SetSelectParameters(SelectParameters&& value) { m_selectParametersHasBeenSet = true; m_selectParameters = std::move(value); } + inline RestoreRequest& WithSelectParameters(const SelectParameters& value) { SetSelectParameters(value); return *this;} + inline RestoreRequest& WithSelectParameters(SelectParameters&& value) { SetSelectParameters(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Describes the location where the restore job's output is stored.

+ */ + inline const OutputLocation& GetOutputLocation() const{ return m_outputLocation; } + inline bool OutputLocationHasBeenSet() const { return m_outputLocationHasBeenSet; } + inline void SetOutputLocation(const OutputLocation& value) { m_outputLocationHasBeenSet = true; m_outputLocation = value; } + inline void SetOutputLocation(OutputLocation&& value) { m_outputLocationHasBeenSet = true; m_outputLocation = std::move(value); } + inline RestoreRequest& WithOutputLocation(const OutputLocation& value) { SetOutputLocation(value); return *this;} + inline RestoreRequest& WithOutputLocation(OutputLocation&& value) { SetOutputLocation(std::move(value)); return *this;} + ///@} + private: + + int m_days; + bool m_daysHasBeenSet = false; + + GlacierJobParameters m_glacierJobParameters; + bool m_glacierJobParametersHasBeenSet = false; + + RestoreRequestType m_type; + bool m_typeHasBeenSet = false; + + Tier m_tier; + bool m_tierHasBeenSet = false; + + Aws::String m_description; + bool m_descriptionHasBeenSet = false; + + SelectParameters m_selectParameters; + bool m_selectParametersHasBeenSet = false; + + OutputLocation m_outputLocation; + bool m_outputLocationHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/RoutingRule.h b/include/aws/s3/model/RoutingRule.h new file mode 100644 index 0000000000000000000000000000000000000000..ad6e34e3dc4a62b801ba2ca29a74af67bf5dd43f --- /dev/null +++ b/include/aws/s3/model/RoutingRule.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the redirect behavior and when a redirect is applied. For more + * information about routing rules, see Configuring + * advanced conditional redirects in the Amazon S3 User + * Guide.

See Also:

AWS API + * Reference

+ */ + class RoutingRule + { + public: + AWS_S3_API RoutingRule(); + AWS_S3_API RoutingRule(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API RoutingRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

A container for describing a condition that must be met for the specified + * redirect to apply. For example, 1. If request is for pages in the + * /docs folder, redirect to the /documents folder. 2. If + * request results in HTTP error 4xx, redirect request to another host where you + * might process the error.

+ */ + inline const Condition& GetCondition() const{ return m_condition; } + inline bool ConditionHasBeenSet() const { return m_conditionHasBeenSet; } + inline void SetCondition(const Condition& value) { m_conditionHasBeenSet = true; m_condition = value; } + inline void SetCondition(Condition&& value) { m_conditionHasBeenSet = true; m_condition = std::move(value); } + inline RoutingRule& WithCondition(const Condition& value) { SetCondition(value); return *this;} + inline RoutingRule& WithCondition(Condition&& value) { SetCondition(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Container for redirect information. You can redirect requests to another + * host, to another page, or with another protocol. In the event of an error, you + * can specify a different error code to return.

+ */ + inline const Redirect& GetRedirect() const{ return m_redirect; } + inline bool RedirectHasBeenSet() const { return m_redirectHasBeenSet; } + inline void SetRedirect(const Redirect& value) { m_redirectHasBeenSet = true; m_redirect = value; } + inline void SetRedirect(Redirect&& value) { m_redirectHasBeenSet = true; m_redirect = std::move(value); } + inline RoutingRule& WithRedirect(const Redirect& value) { SetRedirect(value); return *this;} + inline RoutingRule& WithRedirect(Redirect&& value) { SetRedirect(std::move(value)); return *this;} + ///@} + private: + + Condition m_condition; + bool m_conditionHasBeenSet = false; + + Redirect m_redirect; + bool m_redirectHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Rule.h b/include/aws/s3/model/Rule.h new file mode 100644 index 0000000000000000000000000000000000000000..75ef8a52f8b0e0f370ff0d43e7ee00150315a2e2 --- /dev/null +++ b/include/aws/s3/model/Rule.h @@ -0,0 +1,184 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies lifecycle rules for an Amazon S3 bucket. For more information, see + * Put + * Bucket Lifecycle Configuration in the Amazon S3 API Reference. For + * examples, see Put + * Bucket Lifecycle Configuration Examples.

See Also:

AWS API + * Reference

+ */ + class Rule + { + public: + AWS_S3_API Rule(); + AWS_S3_API Rule(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Rule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the expiration for the lifecycle of the object.

+ */ + inline const LifecycleExpiration& GetExpiration() const{ return m_expiration; } + inline bool ExpirationHasBeenSet() const { return m_expirationHasBeenSet; } + inline void SetExpiration(const LifecycleExpiration& value) { m_expirationHasBeenSet = true; m_expiration = value; } + inline void SetExpiration(LifecycleExpiration&& value) { m_expirationHasBeenSet = true; m_expiration = std::move(value); } + inline Rule& WithExpiration(const LifecycleExpiration& value) { SetExpiration(value); return *this;} + inline Rule& WithExpiration(LifecycleExpiration&& value) { SetExpiration(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Unique identifier for the rule. The value can't be longer than 255 + * characters.

+ */ + inline const Aws::String& GetID() const{ return m_iD; } + inline bool IDHasBeenSet() const { return m_iDHasBeenSet; } + inline void SetID(const Aws::String& value) { m_iDHasBeenSet = true; m_iD = value; } + inline void SetID(Aws::String&& value) { m_iDHasBeenSet = true; m_iD = std::move(value); } + inline void SetID(const char* value) { m_iDHasBeenSet = true; m_iD.assign(value); } + inline Rule& WithID(const Aws::String& value) { SetID(value); return *this;} + inline Rule& WithID(Aws::String&& value) { SetID(std::move(value)); return *this;} + inline Rule& WithID(const char* value) { SetID(value); return *this;} + ///@} + + ///@{ + /** + *

Object key prefix that identifies one or more objects to which this rule + * applies.

Replacement must be made for object keys containing + * special characters (such as carriage returns) when using XML requests. For more + * information, see + * XML related object key constraints.

+ */ + inline const Aws::String& GetPrefix() const{ return m_prefix; } + inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } + inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } + inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } + inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } + inline Rule& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} + inline Rule& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} + inline Rule& WithPrefix(const char* value) { SetPrefix(value); return *this;} + ///@} + + ///@{ + /** + *

If Enabled, the rule is currently being applied. If + * Disabled, the rule is not currently being applied.

+ */ + inline const ExpirationStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const ExpirationStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(ExpirationStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline Rule& WithStatus(const ExpirationStatus& value) { SetStatus(value); return *this;} + inline Rule& WithStatus(ExpirationStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies when an object transitions to a specified storage class. For more + * information about Amazon S3 lifecycle configuration rules, see Transitioning + * Objects Using Amazon S3 Lifecycle in the Amazon S3 User Guide.

+ */ + inline const Transition& GetTransition() const{ return m_transition; } + inline bool TransitionHasBeenSet() const { return m_transitionHasBeenSet; } + inline void SetTransition(const Transition& value) { m_transitionHasBeenSet = true; m_transition = value; } + inline void SetTransition(Transition&& value) { m_transitionHasBeenSet = true; m_transition = std::move(value); } + inline Rule& WithTransition(const Transition& value) { SetTransition(value); return *this;} + inline Rule& WithTransition(Transition&& value) { SetTransition(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const NoncurrentVersionTransition& GetNoncurrentVersionTransition() const{ return m_noncurrentVersionTransition; } + inline bool NoncurrentVersionTransitionHasBeenSet() const { return m_noncurrentVersionTransitionHasBeenSet; } + inline void SetNoncurrentVersionTransition(const NoncurrentVersionTransition& value) { m_noncurrentVersionTransitionHasBeenSet = true; m_noncurrentVersionTransition = value; } + inline void SetNoncurrentVersionTransition(NoncurrentVersionTransition&& value) { m_noncurrentVersionTransitionHasBeenSet = true; m_noncurrentVersionTransition = std::move(value); } + inline Rule& WithNoncurrentVersionTransition(const NoncurrentVersionTransition& value) { SetNoncurrentVersionTransition(value); return *this;} + inline Rule& WithNoncurrentVersionTransition(NoncurrentVersionTransition&& value) { SetNoncurrentVersionTransition(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const NoncurrentVersionExpiration& GetNoncurrentVersionExpiration() const{ return m_noncurrentVersionExpiration; } + inline bool NoncurrentVersionExpirationHasBeenSet() const { return m_noncurrentVersionExpirationHasBeenSet; } + inline void SetNoncurrentVersionExpiration(const NoncurrentVersionExpiration& value) { m_noncurrentVersionExpirationHasBeenSet = true; m_noncurrentVersionExpiration = value; } + inline void SetNoncurrentVersionExpiration(NoncurrentVersionExpiration&& value) { m_noncurrentVersionExpirationHasBeenSet = true; m_noncurrentVersionExpiration = std::move(value); } + inline Rule& WithNoncurrentVersionExpiration(const NoncurrentVersionExpiration& value) { SetNoncurrentVersionExpiration(value); return *this;} + inline Rule& WithNoncurrentVersionExpiration(NoncurrentVersionExpiration&& value) { SetNoncurrentVersionExpiration(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const AbortIncompleteMultipartUpload& GetAbortIncompleteMultipartUpload() const{ return m_abortIncompleteMultipartUpload; } + inline bool AbortIncompleteMultipartUploadHasBeenSet() const { return m_abortIncompleteMultipartUploadHasBeenSet; } + inline void SetAbortIncompleteMultipartUpload(const AbortIncompleteMultipartUpload& value) { m_abortIncompleteMultipartUploadHasBeenSet = true; m_abortIncompleteMultipartUpload = value; } + inline void SetAbortIncompleteMultipartUpload(AbortIncompleteMultipartUpload&& value) { m_abortIncompleteMultipartUploadHasBeenSet = true; m_abortIncompleteMultipartUpload = std::move(value); } + inline Rule& WithAbortIncompleteMultipartUpload(const AbortIncompleteMultipartUpload& value) { SetAbortIncompleteMultipartUpload(value); return *this;} + inline Rule& WithAbortIncompleteMultipartUpload(AbortIncompleteMultipartUpload&& value) { SetAbortIncompleteMultipartUpload(std::move(value)); return *this;} + ///@} + private: + + LifecycleExpiration m_expiration; + bool m_expirationHasBeenSet = false; + + Aws::String m_iD; + bool m_iDHasBeenSet = false; + + Aws::String m_prefix; + bool m_prefixHasBeenSet = false; + + ExpirationStatus m_status; + bool m_statusHasBeenSet = false; + + Transition m_transition; + bool m_transitionHasBeenSet = false; + + NoncurrentVersionTransition m_noncurrentVersionTransition; + bool m_noncurrentVersionTransitionHasBeenSet = false; + + NoncurrentVersionExpiration m_noncurrentVersionExpiration; + bool m_noncurrentVersionExpirationHasBeenSet = false; + + AbortIncompleteMultipartUpload m_abortIncompleteMultipartUpload; + bool m_abortIncompleteMultipartUploadHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/S3TablesDestination.h b/include/aws/s3/model/S3TablesDestination.h new file mode 100644 index 0000000000000000000000000000000000000000..be4a01af6af237f55c311fe068d54ce1e441b4bc --- /dev/null +++ b/include/aws/s3/model/S3TablesDestination.h @@ -0,0 +1,87 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The destination information for the metadata table configuration. The + * destination table bucket must be in the same Region and Amazon Web Services + * account as the general purpose bucket. The specified metadata table name must be + * unique within the aws_s3_metadata namespace in the destination + * table bucket.

See Also:

AWS + * API Reference

+ */ + class S3TablesDestination + { + public: + AWS_S3_API S3TablesDestination(); + AWS_S3_API S3TablesDestination(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API S3TablesDestination& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) for the table bucket that's specified as the + * destination in the metadata table configuration. The destination table bucket + * must be in the same Region and Amazon Web Services account as the general + * purpose bucket.

+ */ + inline const Aws::String& GetTableBucketArn() const{ return m_tableBucketArn; } + inline bool TableBucketArnHasBeenSet() const { return m_tableBucketArnHasBeenSet; } + inline void SetTableBucketArn(const Aws::String& value) { m_tableBucketArnHasBeenSet = true; m_tableBucketArn = value; } + inline void SetTableBucketArn(Aws::String&& value) { m_tableBucketArnHasBeenSet = true; m_tableBucketArn = std::move(value); } + inline void SetTableBucketArn(const char* value) { m_tableBucketArnHasBeenSet = true; m_tableBucketArn.assign(value); } + inline S3TablesDestination& WithTableBucketArn(const Aws::String& value) { SetTableBucketArn(value); return *this;} + inline S3TablesDestination& WithTableBucketArn(Aws::String&& value) { SetTableBucketArn(std::move(value)); return *this;} + inline S3TablesDestination& WithTableBucketArn(const char* value) { SetTableBucketArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name for the metadata table in your metadata table configuration. The + * specified metadata table name must be unique within the + * aws_s3_metadata namespace in the destination table bucket.

+ */ + inline const Aws::String& GetTableName() const{ return m_tableName; } + inline bool TableNameHasBeenSet() const { return m_tableNameHasBeenSet; } + inline void SetTableName(const Aws::String& value) { m_tableNameHasBeenSet = true; m_tableName = value; } + inline void SetTableName(Aws::String&& value) { m_tableNameHasBeenSet = true; m_tableName = std::move(value); } + inline void SetTableName(const char* value) { m_tableNameHasBeenSet = true; m_tableName.assign(value); } + inline S3TablesDestination& WithTableName(const Aws::String& value) { SetTableName(value); return *this;} + inline S3TablesDestination& WithTableName(Aws::String&& value) { SetTableName(std::move(value)); return *this;} + inline S3TablesDestination& WithTableName(const char* value) { SetTableName(value); return *this;} + ///@} + private: + + Aws::String m_tableBucketArn; + bool m_tableBucketArnHasBeenSet = false; + + Aws::String m_tableName; + bool m_tableNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/S3TablesDestinationResult.h b/include/aws/s3/model/S3TablesDestinationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..b35f295855de2c1b65af0d1ac2051536795ad609 --- /dev/null +++ b/include/aws/s3/model/S3TablesDestinationResult.h @@ -0,0 +1,124 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The destination information for the metadata table configuration. The + * destination table bucket must be in the same Region and Amazon Web Services + * account as the general purpose bucket. The specified metadata table name must be + * unique within the aws_s3_metadata namespace in the destination + * table bucket.

See Also:

AWS + * API Reference

+ */ + class S3TablesDestinationResult + { + public: + AWS_S3_API S3TablesDestinationResult(); + AWS_S3_API S3TablesDestinationResult(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API S3TablesDestinationResult& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The Amazon Resource Name (ARN) for the table bucket that's specified as the + * destination in the metadata table configuration. The destination table bucket + * must be in the same Region and Amazon Web Services account as the general + * purpose bucket.

+ */ + inline const Aws::String& GetTableBucketArn() const{ return m_tableBucketArn; } + inline bool TableBucketArnHasBeenSet() const { return m_tableBucketArnHasBeenSet; } + inline void SetTableBucketArn(const Aws::String& value) { m_tableBucketArnHasBeenSet = true; m_tableBucketArn = value; } + inline void SetTableBucketArn(Aws::String&& value) { m_tableBucketArnHasBeenSet = true; m_tableBucketArn = std::move(value); } + inline void SetTableBucketArn(const char* value) { m_tableBucketArnHasBeenSet = true; m_tableBucketArn.assign(value); } + inline S3TablesDestinationResult& WithTableBucketArn(const Aws::String& value) { SetTableBucketArn(value); return *this;} + inline S3TablesDestinationResult& WithTableBucketArn(Aws::String&& value) { SetTableBucketArn(std::move(value)); return *this;} + inline S3TablesDestinationResult& WithTableBucketArn(const char* value) { SetTableBucketArn(value); return *this;} + ///@} + + ///@{ + /** + *

The name for the metadata table in your metadata table configuration. The + * specified metadata table name must be unique within the + * aws_s3_metadata namespace in the destination table bucket.

+ */ + inline const Aws::String& GetTableName() const{ return m_tableName; } + inline bool TableNameHasBeenSet() const { return m_tableNameHasBeenSet; } + inline void SetTableName(const Aws::String& value) { m_tableNameHasBeenSet = true; m_tableName = value; } + inline void SetTableName(Aws::String&& value) { m_tableNameHasBeenSet = true; m_tableName = std::move(value); } + inline void SetTableName(const char* value) { m_tableNameHasBeenSet = true; m_tableName.assign(value); } + inline S3TablesDestinationResult& WithTableName(const Aws::String& value) { SetTableName(value); return *this;} + inline S3TablesDestinationResult& WithTableName(Aws::String&& value) { SetTableName(std::move(value)); return *this;} + inline S3TablesDestinationResult& WithTableName(const char* value) { SetTableName(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) for the metadata table in the metadata table + * configuration. The specified metadata table name must be unique within the + * aws_s3_metadata namespace in the destination table bucket.

+ */ + inline const Aws::String& GetTableArn() const{ return m_tableArn; } + inline bool TableArnHasBeenSet() const { return m_tableArnHasBeenSet; } + inline void SetTableArn(const Aws::String& value) { m_tableArnHasBeenSet = true; m_tableArn = value; } + inline void SetTableArn(Aws::String&& value) { m_tableArnHasBeenSet = true; m_tableArn = std::move(value); } + inline void SetTableArn(const char* value) { m_tableArnHasBeenSet = true; m_tableArn.assign(value); } + inline S3TablesDestinationResult& WithTableArn(const Aws::String& value) { SetTableArn(value); return *this;} + inline S3TablesDestinationResult& WithTableArn(Aws::String&& value) { SetTableArn(std::move(value)); return *this;} + inline S3TablesDestinationResult& WithTableArn(const char* value) { SetTableArn(value); return *this;} + ///@} + + ///@{ + /** + *

The table bucket namespace for the metadata table in your metadata table + * configuration. This value is always aws_s3_metadata.

+ */ + inline const Aws::String& GetTableNamespace() const{ return m_tableNamespace; } + inline bool TableNamespaceHasBeenSet() const { return m_tableNamespaceHasBeenSet; } + inline void SetTableNamespace(const Aws::String& value) { m_tableNamespaceHasBeenSet = true; m_tableNamespace = value; } + inline void SetTableNamespace(Aws::String&& value) { m_tableNamespaceHasBeenSet = true; m_tableNamespace = std::move(value); } + inline void SetTableNamespace(const char* value) { m_tableNamespaceHasBeenSet = true; m_tableNamespace.assign(value); } + inline S3TablesDestinationResult& WithTableNamespace(const Aws::String& value) { SetTableNamespace(value); return *this;} + inline S3TablesDestinationResult& WithTableNamespace(Aws::String&& value) { SetTableNamespace(std::move(value)); return *this;} + inline S3TablesDestinationResult& WithTableNamespace(const char* value) { SetTableNamespace(value); return *this;} + ///@} + private: + + Aws::String m_tableBucketArn; + bool m_tableBucketArnHasBeenSet = false; + + Aws::String m_tableName; + bool m_tableNameHasBeenSet = false; + + Aws::String m_tableArn; + bool m_tableArnHasBeenSet = false; + + Aws::String m_tableNamespace; + bool m_tableNamespaceHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SSES3.h b/include/aws/s3/model/SSES3.h new file mode 100644 index 0000000000000000000000000000000000000000..0d2db9dd84c16fa02e55d4bc5dc7f073ba6597fe --- /dev/null +++ b/include/aws/s3/model/SSES3.h @@ -0,0 +1,42 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the use of SSE-S3 to encrypt delivered inventory + * reports.

See Also:

AWS API + * Reference

+ */ + class SSES3 + { + public: + AWS_S3_API SSES3(); + AWS_S3_API SSES3(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API SSES3& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SelectObjectContentHandler.h b/include/aws/s3/model/SelectObjectContentHandler.h new file mode 100644 index 0000000000000000000000000000000000000000..ed40ef5305a7ede79c6e9f957ed8524f558187d8 --- /dev/null +++ b/include/aws/s3/model/SelectObjectContentHandler.h @@ -0,0 +1,99 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class SelectObjectContentEventType + { + INITIAL_RESPONSE, + RECORDS, + STATS, + PROGRESS, + CONT, + END, + UNKNOWN + }; + + class SelectObjectContentHandler : public Aws::Utils::Event::EventStreamHandler + { + typedef std::function SelectObjectContentInitialResponseCallback; + typedef std::function SelectObjectContentInitialResponseCallbackEx; + typedef std::function RecordsEventCallback; + typedef std::function StatsEventCallback; + typedef std::function ProgressEventCallback; + typedef std::function ContinuationEventCallback; + typedef std::function EndEventCallback; + typedef std::function& error)> ErrorCallback; + + public: + AWS_S3_API SelectObjectContentHandler(); + AWS_S3_API SelectObjectContentHandler& operator=(const SelectObjectContentHandler&) = default; + + AWS_S3_API virtual void OnEvent() override; + + ///@{ + /** + * Sets an initial response callback. This callback gets called on the initial SelectObjectContent Operation response. + * This can be either "initial-response" decoded event frame or decoded HTTP headers received on connection. + * This callback may get called more than once (i.e. on connection headers received and then on the initial-response event received). + * @param callback + */ + inline void SetInitialResponseCallbackEx(const SelectObjectContentInitialResponseCallbackEx& callback) { m_onInitialResponse = callback; } + /** + * Sets an initial response callback (a legacy one that does not distinguish whether response originates from headers or from the event). + */ + inline void SetInitialResponseCallback(const SelectObjectContentInitialResponseCallback& noArgCallback) + { + m_onInitialResponse = [noArgCallback](const SelectObjectContentInitialResponse& rs, const Utils::Event::InitialResponseType) { return noArgCallback(rs); }; + } + ///@} + inline void SetRecordsEventCallback(const RecordsEventCallback& callback) { m_onRecordsEvent = callback; } + inline void SetStatsEventCallback(const StatsEventCallback& callback) { m_onStatsEvent = callback; } + inline void SetProgressEventCallback(const ProgressEventCallback& callback) { m_onProgressEvent = callback; } + inline void SetContinuationEventCallback(const ContinuationEventCallback& callback) { m_onContinuationEvent = callback; } + inline void SetEndEventCallback(const EndEventCallback& callback) { m_onEndEvent = callback; } + inline void SetOnErrorCallback(const ErrorCallback& callback) { m_onError = callback; } + + inline SelectObjectContentInitialResponseCallbackEx& GetInitialResponseCallbackEx() { return m_onInitialResponse; } + + private: + AWS_S3_API void HandleEventInMessage(); + AWS_S3_API void HandleErrorInMessage(); + AWS_S3_API void MarshallError(const Aws::String& errorCode, const Aws::String& errorMessage); + + SelectObjectContentInitialResponseCallbackEx m_onInitialResponse; + RecordsEventCallback m_onRecordsEvent; + StatsEventCallback m_onStatsEvent; + ProgressEventCallback m_onProgressEvent; + ContinuationEventCallback m_onContinuationEvent; + EndEventCallback m_onEndEvent; + ErrorCallback m_onError; + }; + +namespace SelectObjectContentEventMapper +{ + AWS_S3_API SelectObjectContentEventType GetSelectObjectContentEventTypeForName(const Aws::String& name); + + AWS_S3_API Aws::String GetNameForSelectObjectContentEventType(SelectObjectContentEventType value); +} // namespace SelectObjectContentEventMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SelectObjectContentRequest.h b/include/aws/s3/model/SelectObjectContentRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..6b7a8e3a5a9e78b10e1889e76ff0887f708aedcd --- /dev/null +++ b/include/aws/s3/model/SelectObjectContentRequest.h @@ -0,0 +1,339 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Http +{ + class URI; +} //namespace Http +namespace S3 +{ +namespace Model +{ + + /** + *

Learn Amazon S3 Select is no longer available to new customers. + * Existing customers of Amazon S3 Select can continue to use the feature as usual. + * Learn + * more

Request to filter the contents of an Amazon S3 object + * based on a simple Structured Query Language (SQL) statement. In the request, + * along with the SQL expression, you must specify a data serialization format + * (JSON or CSV) of the object. Amazon S3 uses this to parse object data into + * records. It returns only records that match the specified SQL expression. You + * must also specify the data serialization format for the response. For more + * information, see S3Select + * API Documentation.

See Also:

AWS + * API Reference

+ */ + class SelectObjectContentRequest : public S3Request + { + public: + AWS_S3_API SelectObjectContentRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SelectObjectContent"; } + + inline virtual bool HasEventStreamResponse() const override { return true; } + AWS_S3_API Aws::String SerializePayload() const override; + + AWS_S3_API void AddQueryStringParameters(Aws::Http::URI& uri) const override; + + AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + AWS_S3_API bool HasEmbeddedError(IOStream &body, const Http::HeaderValueCollection &header) const override; + /** + * Underlying Event Stream Decoder. + */ + inline Aws::Utils::Event::EventStreamDecoder& GetEventStreamDecoder() { return m_decoder; } + + /** + * Underlying Event Stream Handler which is used to define callback functions. + */ + inline const SelectObjectContentHandler& GetEventStreamHandler() const { return m_handler; } + + /** + * Underlying Event Stream Handler which is used to define callback functions. + */ + inline void SetEventStreamHandler(const SelectObjectContentHandler& value) { m_handler = value; m_decoder.ResetEventStreamHandler(&m_handler); } + + /** + * Underlying Event Stream Handler which is used to define callback functions. + */ + inline SelectObjectContentRequest& WithEventStreamHandler(const SelectObjectContentHandler& value) { SetEventStreamHandler(value); return *this; } + + /** + * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. + */ + AWS_S3_API EndpointParameters GetEndpointContextParams() const override; + + ///@{ + /** + *

The S3 bucket.

+ */ + inline const Aws::String& GetBucket() const{ return m_bucket; } + inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } + inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } + inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } + inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } + inline SelectObjectContentRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} + inline SelectObjectContentRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} + inline SelectObjectContentRequest& WithBucket(const char* value) { SetBucket(value); return *this;} + ///@} + + ///@{ + /** + *

The object key.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline SelectObjectContentRequest& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline SelectObjectContentRequest& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline SelectObjectContentRequest& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption (SSE) algorithm used to encrypt the object. This + * parameter is needed only when the object was created using a checksum algorithm. + * For more information, see Protecting + * data using SSE-C keys in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline bool SSECustomerAlgorithmHasBeenSet() const { return m_sSECustomerAlgorithmHasBeenSet; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithmHasBeenSet = true; m_sSECustomerAlgorithm.assign(value); } + inline SelectObjectContentRequest& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline SelectObjectContentRequest& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline SelectObjectContentRequest& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption (SSE) customer managed key. This parameter is + * needed only when the object was created using a checksum algorithm. For more + * information, see Protecting + * data using SSE-C keys in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetSSECustomerKey() const{ return m_sSECustomerKey; } + inline bool SSECustomerKeyHasBeenSet() const { return m_sSECustomerKeyHasBeenSet; } + inline void SetSSECustomerKey(const Aws::String& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = value; } + inline void SetSSECustomerKey(Aws::String&& value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey = std::move(value); } + inline void SetSSECustomerKey(const char* value) { m_sSECustomerKeyHasBeenSet = true; m_sSECustomerKey.assign(value); } + inline SelectObjectContentRequest& WithSSECustomerKey(const Aws::String& value) { SetSSECustomerKey(value); return *this;} + inline SelectObjectContentRequest& WithSSECustomerKey(Aws::String&& value) { SetSSECustomerKey(std::move(value)); return *this;} + inline SelectObjectContentRequest& WithSSECustomerKey(const char* value) { SetSSECustomerKey(value); return *this;} + ///@} + + ///@{ + /** + *

The MD5 server-side encryption (SSE) customer managed key. This parameter is + * needed only when the object was created using a checksum algorithm. For more + * information, see Protecting + * data using SSE-C keys in the Amazon S3 User Guide.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline bool SSECustomerKeyMD5HasBeenSet() const { return m_sSECustomerKeyMD5HasBeenSet; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5HasBeenSet = true; m_sSECustomerKeyMD5.assign(value); } + inline SelectObjectContentRequest& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline SelectObjectContentRequest& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline SelectObjectContentRequest& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + /** + *

The expression that is used to query the object.

+ */ + inline const Aws::String& GetExpression() const{ return m_expression; } + inline bool ExpressionHasBeenSet() const { return m_expressionHasBeenSet; } + inline void SetExpression(const Aws::String& value) { m_expressionHasBeenSet = true; m_expression = value; } + inline void SetExpression(Aws::String&& value) { m_expressionHasBeenSet = true; m_expression = std::move(value); } + inline void SetExpression(const char* value) { m_expressionHasBeenSet = true; m_expression.assign(value); } + inline SelectObjectContentRequest& WithExpression(const Aws::String& value) { SetExpression(value); return *this;} + inline SelectObjectContentRequest& WithExpression(Aws::String&& value) { SetExpression(std::move(value)); return *this;} + inline SelectObjectContentRequest& WithExpression(const char* value) { SetExpression(value); return *this;} + ///@} + + ///@{ + /** + *

The type of the provided expression (for example, SQL).

+ */ + inline const ExpressionType& GetExpressionType() const{ return m_expressionType; } + inline bool ExpressionTypeHasBeenSet() const { return m_expressionTypeHasBeenSet; } + inline void SetExpressionType(const ExpressionType& value) { m_expressionTypeHasBeenSet = true; m_expressionType = value; } + inline void SetExpressionType(ExpressionType&& value) { m_expressionTypeHasBeenSet = true; m_expressionType = std::move(value); } + inline SelectObjectContentRequest& WithExpressionType(const ExpressionType& value) { SetExpressionType(value); return *this;} + inline SelectObjectContentRequest& WithExpressionType(ExpressionType&& value) { SetExpressionType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies if periodic request progress information should be enabled.

+ */ + inline const RequestProgress& GetRequestProgress() const{ return m_requestProgress; } + inline bool RequestProgressHasBeenSet() const { return m_requestProgressHasBeenSet; } + inline void SetRequestProgress(const RequestProgress& value) { m_requestProgressHasBeenSet = true; m_requestProgress = value; } + inline void SetRequestProgress(RequestProgress&& value) { m_requestProgressHasBeenSet = true; m_requestProgress = std::move(value); } + inline SelectObjectContentRequest& WithRequestProgress(const RequestProgress& value) { SetRequestProgress(value); return *this;} + inline SelectObjectContentRequest& WithRequestProgress(RequestProgress&& value) { SetRequestProgress(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Describes the format of the data in the object that is being queried.

+ */ + inline const InputSerialization& GetInputSerialization() const{ return m_inputSerialization; } + inline bool InputSerializationHasBeenSet() const { return m_inputSerializationHasBeenSet; } + inline void SetInputSerialization(const InputSerialization& value) { m_inputSerializationHasBeenSet = true; m_inputSerialization = value; } + inline void SetInputSerialization(InputSerialization&& value) { m_inputSerializationHasBeenSet = true; m_inputSerialization = std::move(value); } + inline SelectObjectContentRequest& WithInputSerialization(const InputSerialization& value) { SetInputSerialization(value); return *this;} + inline SelectObjectContentRequest& WithInputSerialization(InputSerialization&& value) { SetInputSerialization(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Describes the format of the data that you want Amazon S3 to return in + * response.

+ */ + inline const OutputSerialization& GetOutputSerialization() const{ return m_outputSerialization; } + inline bool OutputSerializationHasBeenSet() const { return m_outputSerializationHasBeenSet; } + inline void SetOutputSerialization(const OutputSerialization& value) { m_outputSerializationHasBeenSet = true; m_outputSerialization = value; } + inline void SetOutputSerialization(OutputSerialization&& value) { m_outputSerializationHasBeenSet = true; m_outputSerialization = std::move(value); } + inline SelectObjectContentRequest& WithOutputSerialization(const OutputSerialization& value) { SetOutputSerialization(value); return *this;} + inline SelectObjectContentRequest& WithOutputSerialization(OutputSerialization&& value) { SetOutputSerialization(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies the byte range of the object to get the records from. A record is + * processed when its first byte is contained by the range. This parameter is + * optional, but when specified, it must not be empty. See RFC 2616, Section + * 14.35.1 about how to specify the start and end of the range.

+ * ScanRangemay be used in the following ways:

  • + * <scanrange><start>50</start><end>100</end></scanrange> + * - process only the records starting between the bytes 50 and 100 (inclusive, + * counting from zero)

  • + * <scanrange><start>50</start></scanrange> - + * process only the records starting after the byte 50

  • + * <scanrange><end>50</end></scanrange> - + * process only the records within the last 50 bytes of the file.

+ */ + inline const ScanRange& GetScanRange() const{ return m_scanRange; } + inline bool ScanRangeHasBeenSet() const { return m_scanRangeHasBeenSet; } + inline void SetScanRange(const ScanRange& value) { m_scanRangeHasBeenSet = true; m_scanRange = value; } + inline void SetScanRange(ScanRange&& value) { m_scanRangeHasBeenSet = true; m_scanRange = std::move(value); } + inline SelectObjectContentRequest& WithScanRange(const ScanRange& value) { SetScanRange(value); return *this;} + inline SelectObjectContentRequest& WithScanRange(ScanRange&& value) { SetScanRange(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The account ID of the expected bucket owner. If the account ID that you + * provide does not match the actual owner of the bucket, the request fails with + * the HTTP status code 403 Forbidden (access denied).

+ */ + inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } + inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } + inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } + inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } + inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } + inline SelectObjectContentRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} + inline SelectObjectContentRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} + inline SelectObjectContentRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} + ///@} + + ///@{ + + inline const Aws::Map& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } + inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } + inline void SetCustomizedAccessLogTag(const Aws::Map& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } + inline void SetCustomizedAccessLogTag(Aws::Map&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } + inline SelectObjectContentRequest& WithCustomizedAccessLogTag(const Aws::Map& value) { SetCustomizedAccessLogTag(value); return *this;} + inline SelectObjectContentRequest& WithCustomizedAccessLogTag(Aws::Map&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} + inline SelectObjectContentRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + inline SelectObjectContentRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline SelectObjectContentRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline SelectObjectContentRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } + inline SelectObjectContentRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } + inline SelectObjectContentRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } + inline SelectObjectContentRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_bucket; + bool m_bucketHasBeenSet = false; + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_sSECustomerAlgorithm; + bool m_sSECustomerAlgorithmHasBeenSet = false; + + Aws::String m_sSECustomerKey; + bool m_sSECustomerKeyHasBeenSet = false; + + Aws::String m_sSECustomerKeyMD5; + bool m_sSECustomerKeyMD5HasBeenSet = false; + + Aws::String m_expression; + bool m_expressionHasBeenSet = false; + + ExpressionType m_expressionType; + bool m_expressionTypeHasBeenSet = false; + + RequestProgress m_requestProgress; + bool m_requestProgressHasBeenSet = false; + + InputSerialization m_inputSerialization; + bool m_inputSerializationHasBeenSet = false; + + OutputSerialization m_outputSerialization; + bool m_outputSerializationHasBeenSet = false; + + ScanRange m_scanRange; + bool m_scanRangeHasBeenSet = false; + + Aws::String m_expectedBucketOwner; + bool m_expectedBucketOwnerHasBeenSet = false; + + Aws::Map m_customizedAccessLogTag; + bool m_customizedAccessLogTagHasBeenSet = false; + SelectObjectContentHandler m_handler; + Aws::Utils::Event::EventStreamDecoder m_decoder; + + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ServerSideEncryption.h b/include/aws/s3/model/ServerSideEncryption.h new file mode 100644 index 0000000000000000000000000000000000000000..1726fe95130c91f0a499f3b3d390a61ae9dade11 --- /dev/null +++ b/include/aws/s3/model/ServerSideEncryption.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class ServerSideEncryption + { + NOT_SET, + AES256, + aws_kms, + aws_kms_dsse + }; + +namespace ServerSideEncryptionMapper +{ +AWS_S3_API ServerSideEncryption GetServerSideEncryptionForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForServerSideEncryption(ServerSideEncryption value); +} // namespace ServerSideEncryptionMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ServerSideEncryptionByDefault.h b/include/aws/s3/model/ServerSideEncryptionByDefault.h new file mode 100644 index 0000000000000000000000000000000000000000..e37a590e968a3c558b0b66e7a53af8cfa93f1dbd --- /dev/null +++ b/include/aws/s3/model/ServerSideEncryptionByDefault.h @@ -0,0 +1,126 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Describes the default server-side encryption to apply to new objects in the + * bucket. If a PUT Object request doesn't specify any server-side encryption, this + * default encryption will be applied. For more information, see PutBucketEncryption.

+ *
  • General purpose buckets - If you don't specify a + * customer managed key at configuration, Amazon S3 automatically creates an Amazon + * Web Services KMS key (aws/s3) in your Amazon Web Services account + * the first time that you add an object encrypted with SSE-KMS to a bucket. By + * default, Amazon S3 uses this KMS key for SSE-KMS.

  • + * Directory buckets - Your SSE-KMS configuration can only support 1 customer + * managed key per directory bucket's lifetime. The Amazon + * Web Services managed key (aws/s3) isn't supported.

  • + *
  • Directory buckets - For directory buckets, there are only two + * supported options for server-side encryption: SSE-S3 and SSE-KMS.

  • + *

See Also:

AWS + * API Reference

+ */ + class ServerSideEncryptionByDefault + { + public: + AWS_S3_API ServerSideEncryptionByDefault(); + AWS_S3_API ServerSideEncryptionByDefault(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ServerSideEncryptionByDefault& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Server-side encryption algorithm to use for the default encryption.

+ *

For directory buckets, there are only two supported values for + * server-side encryption: AES256 and aws:kms.

+ * + */ + inline const ServerSideEncryption& GetSSEAlgorithm() const{ return m_sSEAlgorithm; } + inline bool SSEAlgorithmHasBeenSet() const { return m_sSEAlgorithmHasBeenSet; } + inline void SetSSEAlgorithm(const ServerSideEncryption& value) { m_sSEAlgorithmHasBeenSet = true; m_sSEAlgorithm = value; } + inline void SetSSEAlgorithm(ServerSideEncryption&& value) { m_sSEAlgorithmHasBeenSet = true; m_sSEAlgorithm = std::move(value); } + inline ServerSideEncryptionByDefault& WithSSEAlgorithm(const ServerSideEncryption& value) { SetSSEAlgorithm(value); return *this;} + inline ServerSideEncryptionByDefault& WithSSEAlgorithm(ServerSideEncryption&& value) { SetSSEAlgorithm(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Amazon Web Services Key Management Service (KMS) customer managed key ID to + * use for the default encryption.

  • General purpose + * buckets - This parameter is allowed if and only if SSEAlgorithm + * is set to aws:kms or aws:kms:dsse.

  • + * Directory buckets - This parameter is allowed if and only if + * SSEAlgorithm is set to aws:kms.

+ *

You can specify the key ID, key alias, or the Amazon Resource Name + * (ARN) of the KMS key.

  • Key ID: + * 1234abcd-12ab-34cd-56ef-1234567890ab

  • Key ARN: + * arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab + *

  • Key Alias: alias/alias-name

+ *

If you are using encryption with cross-account or Amazon Web Services service + * operations, you must use a fully qualified KMS key ARN. For more information, + * see Using + * encryption for cross-account operations.

  • General + * purpose buckets - If you're specifying a customer managed KMS key, we + * recommend using a fully qualified KMS key ARN. If you use a KMS key alias + * instead, then KMS resolves the key within the requester’s account. This behavior + * can result in data that's encrypted with a KMS key that belongs to the + * requester, and not the bucket owner. Also, if you use a key ID, you can run into + * a LogDestination undeliverable error when creating a VPC flow log.

  • + *
  • Directory buckets - When you specify an KMS + * customer managed key for encryption in your directory bucket, only use the + * key ID or key ARN. The key alias format of the KMS key isn't supported.

    + *

Amazon S3 only supports symmetric encryption + * KMS keys. For more information, see Asymmetric + * keys in Amazon Web Services KMS in the Amazon Web Services Key Management + * Service Developer Guide.

+ */ + inline const Aws::String& GetKMSMasterKeyID() const{ return m_kMSMasterKeyID; } + inline bool KMSMasterKeyIDHasBeenSet() const { return m_kMSMasterKeyIDHasBeenSet; } + inline void SetKMSMasterKeyID(const Aws::String& value) { m_kMSMasterKeyIDHasBeenSet = true; m_kMSMasterKeyID = value; } + inline void SetKMSMasterKeyID(Aws::String&& value) { m_kMSMasterKeyIDHasBeenSet = true; m_kMSMasterKeyID = std::move(value); } + inline void SetKMSMasterKeyID(const char* value) { m_kMSMasterKeyIDHasBeenSet = true; m_kMSMasterKeyID.assign(value); } + inline ServerSideEncryptionByDefault& WithKMSMasterKeyID(const Aws::String& value) { SetKMSMasterKeyID(value); return *this;} + inline ServerSideEncryptionByDefault& WithKMSMasterKeyID(Aws::String&& value) { SetKMSMasterKeyID(std::move(value)); return *this;} + inline ServerSideEncryptionByDefault& WithKMSMasterKeyID(const char* value) { SetKMSMasterKeyID(value); return *this;} + ///@} + private: + + ServerSideEncryption m_sSEAlgorithm; + bool m_sSEAlgorithmHasBeenSet = false; + + Aws::String m_kMSMasterKeyID; + bool m_kMSMasterKeyIDHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ServerSideEncryptionConfiguration.h b/include/aws/s3/model/ServerSideEncryptionConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..bc398483af78f8fc156a6f17aa62d271e0f77f45 --- /dev/null +++ b/include/aws/s3/model/ServerSideEncryptionConfiguration.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the default server-side-encryption configuration.

See + * Also:

AWS + * API Reference

+ */ + class ServerSideEncryptionConfiguration + { + public: + AWS_S3_API ServerSideEncryptionConfiguration(); + AWS_S3_API ServerSideEncryptionConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ServerSideEncryptionConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Container for information about a particular server-side encryption + * configuration rule.

+ */ + inline const Aws::Vector& GetRules() const{ return m_rules; } + inline bool RulesHasBeenSet() const { return m_rulesHasBeenSet; } + inline void SetRules(const Aws::Vector& value) { m_rulesHasBeenSet = true; m_rules = value; } + inline void SetRules(Aws::Vector&& value) { m_rulesHasBeenSet = true; m_rules = std::move(value); } + inline ServerSideEncryptionConfiguration& WithRules(const Aws::Vector& value) { SetRules(value); return *this;} + inline ServerSideEncryptionConfiguration& WithRules(Aws::Vector&& value) { SetRules(std::move(value)); return *this;} + inline ServerSideEncryptionConfiguration& AddRules(const ServerSideEncryptionRule& value) { m_rulesHasBeenSet = true; m_rules.push_back(value); return *this; } + inline ServerSideEncryptionConfiguration& AddRules(ServerSideEncryptionRule&& value) { m_rulesHasBeenSet = true; m_rules.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_rules; + bool m_rulesHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/ServerSideEncryptionRule.h b/include/aws/s3/model/ServerSideEncryptionRule.h new file mode 100644 index 0000000000000000000000000000000000000000..d56f9b44b050888d57dfa93d1f11ea277d5de5f3 --- /dev/null +++ b/include/aws/s3/model/ServerSideEncryptionRule.h @@ -0,0 +1,105 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Specifies the default server-side encryption configuration.

    + *
  • General purpose buckets - If you're specifying a customer + * managed KMS key, we recommend using a fully qualified KMS key ARN. If you use a + * KMS key alias instead, then KMS resolves the key within the requester’s account. + * This behavior can result in data that's encrypted with a KMS key that belongs to + * the requester, and not the bucket owner.

  • Directory + * buckets - When you specify an KMS + * customer managed key for encryption in your directory bucket, only use the + * key ID or key ARN. The key alias format of the KMS key isn't supported.

    + *

See Also:

AWS + * API Reference

+ */ + class ServerSideEncryptionRule + { + public: + AWS_S3_API ServerSideEncryptionRule(); + AWS_S3_API ServerSideEncryptionRule(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API ServerSideEncryptionRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies the default server-side encryption to apply to new objects in the + * bucket. If a PUT Object request doesn't specify any server-side encryption, this + * default encryption will be applied.

+ */ + inline const ServerSideEncryptionByDefault& GetApplyServerSideEncryptionByDefault() const{ return m_applyServerSideEncryptionByDefault; } + inline bool ApplyServerSideEncryptionByDefaultHasBeenSet() const { return m_applyServerSideEncryptionByDefaultHasBeenSet; } + inline void SetApplyServerSideEncryptionByDefault(const ServerSideEncryptionByDefault& value) { m_applyServerSideEncryptionByDefaultHasBeenSet = true; m_applyServerSideEncryptionByDefault = value; } + inline void SetApplyServerSideEncryptionByDefault(ServerSideEncryptionByDefault&& value) { m_applyServerSideEncryptionByDefaultHasBeenSet = true; m_applyServerSideEncryptionByDefault = std::move(value); } + inline ServerSideEncryptionRule& WithApplyServerSideEncryptionByDefault(const ServerSideEncryptionByDefault& value) { SetApplyServerSideEncryptionByDefault(value); return *this;} + inline ServerSideEncryptionRule& WithApplyServerSideEncryptionByDefault(ServerSideEncryptionByDefault&& value) { SetApplyServerSideEncryptionByDefault(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether Amazon S3 should use an S3 Bucket Key with server-side + * encryption using KMS (SSE-KMS) for new objects in the bucket. Existing objects + * are not affected. Setting the BucketKeyEnabled element to + * true causes Amazon S3 to use an S3 Bucket Key.

    + *
  • General purpose buckets - By default, S3 Bucket Key is not + * enabled. For more information, see Amazon S3 + * Bucket Keys in the Amazon S3 User Guide.

  • + * Directory buckets - S3 Bucket Keys are always enabled for + * GET and PUT operations in a directory bucket and can’t + * be disabled. S3 Bucket Keys aren't supported, when you copy SSE-KMS encrypted + * objects from general purpose buckets to directory buckets, from directory + * buckets to general purpose buckets, or between directory buckets, through CopyObject, + * UploadPartCopy, + * the + * Copy operation in Batch Operations, or the + * import jobs. In this case, Amazon S3 makes a call to KMS every time a copy + * request is made for a KMS-encrypted object.

+ */ + inline bool GetBucketKeyEnabled() const{ return m_bucketKeyEnabled; } + inline bool BucketKeyEnabledHasBeenSet() const { return m_bucketKeyEnabledHasBeenSet; } + inline void SetBucketKeyEnabled(bool value) { m_bucketKeyEnabledHasBeenSet = true; m_bucketKeyEnabled = value; } + inline ServerSideEncryptionRule& WithBucketKeyEnabled(bool value) { SetBucketKeyEnabled(value); return *this;} + ///@} + private: + + ServerSideEncryptionByDefault m_applyServerSideEncryptionByDefault; + bool m_applyServerSideEncryptionByDefaultHasBeenSet = false; + + bool m_bucketKeyEnabled; + bool m_bucketKeyEnabledHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SessionCredentials.h b/include/aws/s3/model/SessionCredentials.h new file mode 100644 index 0000000000000000000000000000000000000000..cc45cc32b5bdb1466b79b92cbbcfaa76edb4c928 --- /dev/null +++ b/include/aws/s3/model/SessionCredentials.h @@ -0,0 +1,123 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The established temporary security credentials of the session.

+ * Directory buckets - These session credentials are only supported for the + * authentication and authorization of Zonal endpoint API operations on directory + * buckets.

See Also:

AWS + * API Reference

+ */ + class SessionCredentials + { + public: + AWS_S3_API SessionCredentials(); + AWS_S3_API SessionCredentials(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API SessionCredentials& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

A unique identifier that's associated with a secret access key. The access + * key ID and the secret access key are used together to sign programmatic Amazon + * Web Services requests cryptographically.

+ */ + inline const Aws::String& GetAccessKeyId() const{ return m_accessKeyId; } + inline bool AccessKeyIdHasBeenSet() const { return m_accessKeyIdHasBeenSet; } + inline void SetAccessKeyId(const Aws::String& value) { m_accessKeyIdHasBeenSet = true; m_accessKeyId = value; } + inline void SetAccessKeyId(Aws::String&& value) { m_accessKeyIdHasBeenSet = true; m_accessKeyId = std::move(value); } + inline void SetAccessKeyId(const char* value) { m_accessKeyIdHasBeenSet = true; m_accessKeyId.assign(value); } + inline SessionCredentials& WithAccessKeyId(const Aws::String& value) { SetAccessKeyId(value); return *this;} + inline SessionCredentials& WithAccessKeyId(Aws::String&& value) { SetAccessKeyId(std::move(value)); return *this;} + inline SessionCredentials& WithAccessKeyId(const char* value) { SetAccessKeyId(value); return *this;} + ///@} + + ///@{ + /** + *

A key that's used with the access key ID to cryptographically sign + * programmatic Amazon Web Services requests. Signing a request identifies the + * sender and prevents the request from being altered.

+ */ + inline const Aws::String& GetSecretAccessKey() const{ return m_secretAccessKey; } + inline bool SecretAccessKeyHasBeenSet() const { return m_secretAccessKeyHasBeenSet; } + inline void SetSecretAccessKey(const Aws::String& value) { m_secretAccessKeyHasBeenSet = true; m_secretAccessKey = value; } + inline void SetSecretAccessKey(Aws::String&& value) { m_secretAccessKeyHasBeenSet = true; m_secretAccessKey = std::move(value); } + inline void SetSecretAccessKey(const char* value) { m_secretAccessKeyHasBeenSet = true; m_secretAccessKey.assign(value); } + inline SessionCredentials& WithSecretAccessKey(const Aws::String& value) { SetSecretAccessKey(value); return *this;} + inline SessionCredentials& WithSecretAccessKey(Aws::String&& value) { SetSecretAccessKey(std::move(value)); return *this;} + inline SessionCredentials& WithSecretAccessKey(const char* value) { SetSecretAccessKey(value); return *this;} + ///@} + + ///@{ + /** + *

A part of the temporary security credentials. The session token is used to + * validate the temporary security credentials.

+ */ + inline const Aws::String& GetSessionToken() const{ return m_sessionToken; } + inline bool SessionTokenHasBeenSet() const { return m_sessionTokenHasBeenSet; } + inline void SetSessionToken(const Aws::String& value) { m_sessionTokenHasBeenSet = true; m_sessionToken = value; } + inline void SetSessionToken(Aws::String&& value) { m_sessionTokenHasBeenSet = true; m_sessionToken = std::move(value); } + inline void SetSessionToken(const char* value) { m_sessionTokenHasBeenSet = true; m_sessionToken.assign(value); } + inline SessionCredentials& WithSessionToken(const Aws::String& value) { SetSessionToken(value); return *this;} + inline SessionCredentials& WithSessionToken(Aws::String&& value) { SetSessionToken(std::move(value)); return *this;} + inline SessionCredentials& WithSessionToken(const char* value) { SetSessionToken(value); return *this;} + ///@} + + ///@{ + /** + *

Temporary security credentials expire after a specified interval. After + * temporary credentials expire, any calls that you make with those credentials + * will fail. So you must generate a new set of temporary credentials. Temporary + * credentials cannot be extended or refreshed beyond the original specified + * interval.

+ */ + inline const Aws::Utils::DateTime& GetExpiration() const{ return m_expiration; } + inline bool ExpirationHasBeenSet() const { return m_expirationHasBeenSet; } + inline void SetExpiration(const Aws::Utils::DateTime& value) { m_expirationHasBeenSet = true; m_expiration = value; } + inline void SetExpiration(Aws::Utils::DateTime&& value) { m_expirationHasBeenSet = true; m_expiration = std::move(value); } + inline SessionCredentials& WithExpiration(const Aws::Utils::DateTime& value) { SetExpiration(value); return *this;} + inline SessionCredentials& WithExpiration(Aws::Utils::DateTime&& value) { SetExpiration(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_accessKeyId; + bool m_accessKeyIdHasBeenSet = false; + + Aws::String m_secretAccessKey; + bool m_secretAccessKeyHasBeenSet = false; + + Aws::String m_sessionToken; + bool m_sessionTokenHasBeenSet = false; + + Aws::Utils::DateTime m_expiration; + bool m_expirationHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SessionMode.h b/include/aws/s3/model/SessionMode.h new file mode 100644 index 0000000000000000000000000000000000000000..0fd8e6fabedaea082b71f7f425bf7aa3357ba7a7 --- /dev/null +++ b/include/aws/s3/model/SessionMode.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class SessionMode + { + NOT_SET, + ReadOnly, + ReadWrite + }; + +namespace SessionModeMapper +{ +AWS_S3_API SessionMode GetSessionModeForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForSessionMode(SessionMode value); +} // namespace SessionModeMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SimplePrefix.h b/include/aws/s3/model/SimplePrefix.h new file mode 100644 index 0000000000000000000000000000000000000000..7d9ddd603553a507f043e2a055f4adbafaa8d0b7 --- /dev/null +++ b/include/aws/s3/model/SimplePrefix.h @@ -0,0 +1,44 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

To use simple format for S3 keys for log objects, set SimplePrefix to an + * empty object.

+ * [DestinationPrefix][YYYY]-[MM]-[DD]-[hh]-[mm]-[ss]-[UniqueString] + *

See Also:

AWS API + * Reference

+ */ + class SimplePrefix + { + public: + AWS_S3_API SimplePrefix(); + AWS_S3_API SimplePrefix(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API SimplePrefix& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SourceSelectionCriteria.h b/include/aws/s3/model/SourceSelectionCriteria.h new file mode 100644 index 0000000000000000000000000000000000000000..f516821cc37b4d63b3f3a0d2fe3ad81ac6737787 --- /dev/null +++ b/include/aws/s3/model/SourceSelectionCriteria.h @@ -0,0 +1,90 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container that describes additional filters for identifying the source + * objects that you want to replicate. You can choose to enable or disable the + * replication of these objects. Currently, Amazon S3 supports only the filter that + * you can specify for objects created with server-side encryption using a customer + * managed key stored in Amazon Web Services Key Management Service + * (SSE-KMS).

See Also:

AWS + * API Reference

+ */ + class SourceSelectionCriteria + { + public: + AWS_S3_API SourceSelectionCriteria(); + AWS_S3_API SourceSelectionCriteria(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API SourceSelectionCriteria& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

A container for filter information for the selection of Amazon S3 objects + * encrypted with Amazon Web Services KMS. If you include + * SourceSelectionCriteria in the replication configuration, this + * element is required.

+ */ + inline const SseKmsEncryptedObjects& GetSseKmsEncryptedObjects() const{ return m_sseKmsEncryptedObjects; } + inline bool SseKmsEncryptedObjectsHasBeenSet() const { return m_sseKmsEncryptedObjectsHasBeenSet; } + inline void SetSseKmsEncryptedObjects(const SseKmsEncryptedObjects& value) { m_sseKmsEncryptedObjectsHasBeenSet = true; m_sseKmsEncryptedObjects = value; } + inline void SetSseKmsEncryptedObjects(SseKmsEncryptedObjects&& value) { m_sseKmsEncryptedObjectsHasBeenSet = true; m_sseKmsEncryptedObjects = std::move(value); } + inline SourceSelectionCriteria& WithSseKmsEncryptedObjects(const SseKmsEncryptedObjects& value) { SetSseKmsEncryptedObjects(value); return *this;} + inline SourceSelectionCriteria& WithSseKmsEncryptedObjects(SseKmsEncryptedObjects&& value) { SetSseKmsEncryptedObjects(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

A filter that you can specify for selections for modifications on replicas. + * Amazon S3 doesn't replicate replica modifications by default. In the latest + * version of replication configuration (when Filter is specified), + * you can specify this element and set the status to Enabled to + * replicate modifications on replicas.

If you don't specify the + * Filter element, Amazon S3 assumes that the replication + * configuration is the earlier version, V1. In the earlier version, this element + * is not allowed

+ */ + inline const ReplicaModifications& GetReplicaModifications() const{ return m_replicaModifications; } + inline bool ReplicaModificationsHasBeenSet() const { return m_replicaModificationsHasBeenSet; } + inline void SetReplicaModifications(const ReplicaModifications& value) { m_replicaModificationsHasBeenSet = true; m_replicaModifications = value; } + inline void SetReplicaModifications(ReplicaModifications&& value) { m_replicaModificationsHasBeenSet = true; m_replicaModifications = std::move(value); } + inline SourceSelectionCriteria& WithReplicaModifications(const ReplicaModifications& value) { SetReplicaModifications(value); return *this;} + inline SourceSelectionCriteria& WithReplicaModifications(ReplicaModifications&& value) { SetReplicaModifications(std::move(value)); return *this;} + ///@} + private: + + SseKmsEncryptedObjects m_sseKmsEncryptedObjects; + bool m_sseKmsEncryptedObjectsHasBeenSet = false; + + ReplicaModifications m_replicaModifications; + bool m_replicaModificationsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SseKmsEncryptedObjects.h b/include/aws/s3/model/SseKmsEncryptedObjects.h new file mode 100644 index 0000000000000000000000000000000000000000..3a2026e2161f10596f1f832448ce31f5fce7c7e4 --- /dev/null +++ b/include/aws/s3/model/SseKmsEncryptedObjects.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container for filter information for the selection of S3 objects encrypted + * with Amazon Web Services KMS.

See Also:

AWS + * API Reference

+ */ + class SseKmsEncryptedObjects + { + public: + AWS_S3_API SseKmsEncryptedObjects(); + AWS_S3_API SseKmsEncryptedObjects(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API SseKmsEncryptedObjects& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies whether Amazon S3 replicates objects created with server-side + * encryption using an Amazon Web Services KMS key stored in Amazon Web Services + * Key Management Service.

+ */ + inline const SseKmsEncryptedObjectsStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const SseKmsEncryptedObjectsStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(SseKmsEncryptedObjectsStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline SseKmsEncryptedObjects& WithStatus(const SseKmsEncryptedObjectsStatus& value) { SetStatus(value); return *this;} + inline SseKmsEncryptedObjects& WithStatus(SseKmsEncryptedObjectsStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + SseKmsEncryptedObjectsStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/SseKmsEncryptedObjectsStatus.h b/include/aws/s3/model/SseKmsEncryptedObjectsStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..d9a537b44c4afa2713dbc7d9d304f3e8022906e3 --- /dev/null +++ b/include/aws/s3/model/SseKmsEncryptedObjectsStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class SseKmsEncryptedObjectsStatus + { + NOT_SET, + Enabled, + Disabled + }; + +namespace SseKmsEncryptedObjectsStatusMapper +{ +AWS_S3_API SseKmsEncryptedObjectsStatus GetSseKmsEncryptedObjectsStatusForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForSseKmsEncryptedObjectsStatus(SseKmsEncryptedObjectsStatus value); +} // namespace SseKmsEncryptedObjectsStatusMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Stats.h b/include/aws/s3/model/Stats.h new file mode 100644 index 0000000000000000000000000000000000000000..973971e1f362d51b8601b6df6320a5c0f0cdd569 --- /dev/null +++ b/include/aws/s3/model/Stats.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for the stats details.

See Also:

AWS API + * Reference

+ */ + class Stats + { + public: + AWS_S3_API Stats(); + AWS_S3_API Stats(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Stats& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The total number of object bytes scanned.

+ */ + inline long long GetBytesScanned() const{ return m_bytesScanned; } + inline bool BytesScannedHasBeenSet() const { return m_bytesScannedHasBeenSet; } + inline void SetBytesScanned(long long value) { m_bytesScannedHasBeenSet = true; m_bytesScanned = value; } + inline Stats& WithBytesScanned(long long value) { SetBytesScanned(value); return *this;} + ///@} + + ///@{ + /** + *

The total number of uncompressed object bytes processed.

+ */ + inline long long GetBytesProcessed() const{ return m_bytesProcessed; } + inline bool BytesProcessedHasBeenSet() const { return m_bytesProcessedHasBeenSet; } + inline void SetBytesProcessed(long long value) { m_bytesProcessedHasBeenSet = true; m_bytesProcessed = value; } + inline Stats& WithBytesProcessed(long long value) { SetBytesProcessed(value); return *this;} + ///@} + + ///@{ + /** + *

The total number of bytes of records payload data returned.

+ */ + inline long long GetBytesReturned() const{ return m_bytesReturned; } + inline bool BytesReturnedHasBeenSet() const { return m_bytesReturnedHasBeenSet; } + inline void SetBytesReturned(long long value) { m_bytesReturnedHasBeenSet = true; m_bytesReturned = value; } + inline Stats& WithBytesReturned(long long value) { SetBytesReturned(value); return *this;} + ///@} + private: + + long long m_bytesScanned; + bool m_bytesScannedHasBeenSet = false; + + long long m_bytesProcessed; + bool m_bytesProcessedHasBeenSet = false; + + long long m_bytesReturned; + bool m_bytesReturnedHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/StatsEvent.h b/include/aws/s3/model/StatsEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..ff22dc90886eb7622fbdda8d3e6d39bc9e489696 --- /dev/null +++ b/include/aws/s3/model/StatsEvent.h @@ -0,0 +1,59 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for the Stats Event.

See Also:

AWS API + * Reference

+ */ + class StatsEvent + { + public: + AWS_S3_API StatsEvent(); + AWS_S3_API StatsEvent(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API StatsEvent& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The Stats event details.

+ */ + inline const Stats& GetDetails() const{ return m_details; } + inline bool DetailsHasBeenSet() const { return m_detailsHasBeenSet; } + inline void SetDetails(const Stats& value) { m_detailsHasBeenSet = true; m_details = value; } + inline void SetDetails(Stats&& value) { m_detailsHasBeenSet = true; m_details = std::move(value); } + inline StatsEvent& WithDetails(const Stats& value) { SetDetails(value); return *this;} + inline StatsEvent& WithDetails(Stats&& value) { SetDetails(std::move(value)); return *this;} + ///@} + private: + + Stats m_details; + bool m_detailsHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/StorageClassAnalysisDataExport.h b/include/aws/s3/model/StorageClassAnalysisDataExport.h new file mode 100644 index 0000000000000000000000000000000000000000..c5d241bbd4882ef1eb2879f53111be16fc554757 --- /dev/null +++ b/include/aws/s3/model/StorageClassAnalysisDataExport.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for data related to the storage class analysis for an Amazon S3 + * bucket for export.

See Also:

AWS + * API Reference

+ */ + class StorageClassAnalysisDataExport + { + public: + AWS_S3_API StorageClassAnalysisDataExport(); + AWS_S3_API StorageClassAnalysisDataExport(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API StorageClassAnalysisDataExport& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The version of the output schema to use when exporting data. Must be + * V_1.

+ */ + inline const StorageClassAnalysisSchemaVersion& GetOutputSchemaVersion() const{ return m_outputSchemaVersion; } + inline bool OutputSchemaVersionHasBeenSet() const { return m_outputSchemaVersionHasBeenSet; } + inline void SetOutputSchemaVersion(const StorageClassAnalysisSchemaVersion& value) { m_outputSchemaVersionHasBeenSet = true; m_outputSchemaVersion = value; } + inline void SetOutputSchemaVersion(StorageClassAnalysisSchemaVersion&& value) { m_outputSchemaVersionHasBeenSet = true; m_outputSchemaVersion = std::move(value); } + inline StorageClassAnalysisDataExport& WithOutputSchemaVersion(const StorageClassAnalysisSchemaVersion& value) { SetOutputSchemaVersion(value); return *this;} + inline StorageClassAnalysisDataExport& WithOutputSchemaVersion(StorageClassAnalysisSchemaVersion&& value) { SetOutputSchemaVersion(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The place to store the data for an analysis.

+ */ + inline const AnalyticsExportDestination& GetDestination() const{ return m_destination; } + inline bool DestinationHasBeenSet() const { return m_destinationHasBeenSet; } + inline void SetDestination(const AnalyticsExportDestination& value) { m_destinationHasBeenSet = true; m_destination = value; } + inline void SetDestination(AnalyticsExportDestination&& value) { m_destinationHasBeenSet = true; m_destination = std::move(value); } + inline StorageClassAnalysisDataExport& WithDestination(const AnalyticsExportDestination& value) { SetDestination(value); return *this;} + inline StorageClassAnalysisDataExport& WithDestination(AnalyticsExportDestination&& value) { SetDestination(std::move(value)); return *this;} + ///@} + private: + + StorageClassAnalysisSchemaVersion m_outputSchemaVersion; + bool m_outputSchemaVersionHasBeenSet = false; + + AnalyticsExportDestination m_destination; + bool m_destinationHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Tagging.h b/include/aws/s3/model/Tagging.h new file mode 100644 index 0000000000000000000000000000000000000000..62ea85004f441bcbd78927d83d790369538b390b --- /dev/null +++ b/include/aws/s3/model/Tagging.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for TagSet elements.

See Also:

AWS API + * Reference

+ */ + class Tagging + { + public: + AWS_S3_API Tagging(); + AWS_S3_API Tagging(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Tagging& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

A collection for a set of tags

+ */ + inline const Aws::Vector& GetTagSet() const{ return m_tagSet; } + inline bool TagSetHasBeenSet() const { return m_tagSetHasBeenSet; } + inline void SetTagSet(const Aws::Vector& value) { m_tagSetHasBeenSet = true; m_tagSet = value; } + inline void SetTagSet(Aws::Vector&& value) { m_tagSetHasBeenSet = true; m_tagSet = std::move(value); } + inline Tagging& WithTagSet(const Aws::Vector& value) { SetTagSet(value); return *this;} + inline Tagging& WithTagSet(Aws::Vector&& value) { SetTagSet(std::move(value)); return *this;} + inline Tagging& AddTagSet(const Tag& value) { m_tagSetHasBeenSet = true; m_tagSet.push_back(value); return *this; } + inline Tagging& AddTagSet(Tag&& value) { m_tagSetHasBeenSet = true; m_tagSet.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Vector m_tagSet; + bool m_tagSetHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/TargetGrant.h b/include/aws/s3/model/TargetGrant.h new file mode 100644 index 0000000000000000000000000000000000000000..2ff0c9f72458c1090831355f4b5b14a6166d830f --- /dev/null +++ b/include/aws/s3/model/TargetGrant.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Container for granting information.

Buckets that use the bucket owner + * enforced setting for Object Ownership don't support target grants. For more + * information, see Permissions + * server access log delivery in the Amazon S3 User Guide.

See + * Also:

AWS API + * Reference

+ */ + class TargetGrant + { + public: + AWS_S3_API TargetGrant(); + AWS_S3_API TargetGrant(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API TargetGrant& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Container for the person being granted permissions.

+ */ + inline const Grantee& GetGrantee() const{ return m_grantee; } + inline bool GranteeHasBeenSet() const { return m_granteeHasBeenSet; } + inline void SetGrantee(const Grantee& value) { m_granteeHasBeenSet = true; m_grantee = value; } + inline void SetGrantee(Grantee&& value) { m_granteeHasBeenSet = true; m_grantee = std::move(value); } + inline TargetGrant& WithGrantee(const Grantee& value) { SetGrantee(value); return *this;} + inline TargetGrant& WithGrantee(Grantee&& value) { SetGrantee(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Logging permissions assigned to the grantee for the bucket.

+ */ + inline const BucketLogsPermission& GetPermission() const{ return m_permission; } + inline bool PermissionHasBeenSet() const { return m_permissionHasBeenSet; } + inline void SetPermission(const BucketLogsPermission& value) { m_permissionHasBeenSet = true; m_permission = value; } + inline void SetPermission(BucketLogsPermission&& value) { m_permissionHasBeenSet = true; m_permission = std::move(value); } + inline TargetGrant& WithPermission(const BucketLogsPermission& value) { SetPermission(value); return *this;} + inline TargetGrant& WithPermission(BucketLogsPermission&& value) { SetPermission(std::move(value)); return *this;} + ///@} + private: + + Grantee m_grantee; + bool m_granteeHasBeenSet = false; + + BucketLogsPermission m_permission; + bool m_permissionHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/TargetObjectKeyFormat.h b/include/aws/s3/model/TargetObjectKeyFormat.h new file mode 100644 index 0000000000000000000000000000000000000000..a7360a7b1bdc8d54abc39e2f2ec1d25a5eab1226 --- /dev/null +++ b/include/aws/s3/model/TargetObjectKeyFormat.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Amazon S3 key format for log objects. Only one format, PartitionedPrefix or + * SimplePrefix, is allowed.

See Also:

AWS + * API Reference

+ */ + class TargetObjectKeyFormat + { + public: + AWS_S3_API TargetObjectKeyFormat(); + AWS_S3_API TargetObjectKeyFormat(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API TargetObjectKeyFormat& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

To use the simple format for S3 keys for log objects. To specify SimplePrefix + * format, set SimplePrefix to {}.

+ */ + inline const SimplePrefix& GetSimplePrefix() const{ return m_simplePrefix; } + inline bool SimplePrefixHasBeenSet() const { return m_simplePrefixHasBeenSet; } + inline void SetSimplePrefix(const SimplePrefix& value) { m_simplePrefixHasBeenSet = true; m_simplePrefix = value; } + inline void SetSimplePrefix(SimplePrefix&& value) { m_simplePrefixHasBeenSet = true; m_simplePrefix = std::move(value); } + inline TargetObjectKeyFormat& WithSimplePrefix(const SimplePrefix& value) { SetSimplePrefix(value); return *this;} + inline TargetObjectKeyFormat& WithSimplePrefix(SimplePrefix&& value) { SetSimplePrefix(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Partitioned S3 key for log objects.

+ */ + inline const PartitionedPrefix& GetPartitionedPrefix() const{ return m_partitionedPrefix; } + inline bool PartitionedPrefixHasBeenSet() const { return m_partitionedPrefixHasBeenSet; } + inline void SetPartitionedPrefix(const PartitionedPrefix& value) { m_partitionedPrefixHasBeenSet = true; m_partitionedPrefix = value; } + inline void SetPartitionedPrefix(PartitionedPrefix&& value) { m_partitionedPrefixHasBeenSet = true; m_partitionedPrefix = std::move(value); } + inline TargetObjectKeyFormat& WithPartitionedPrefix(const PartitionedPrefix& value) { SetPartitionedPrefix(value); return *this;} + inline TargetObjectKeyFormat& WithPartitionedPrefix(PartitionedPrefix&& value) { SetPartitionedPrefix(std::move(value)); return *this;} + ///@} + private: + + SimplePrefix m_simplePrefix; + bool m_simplePrefixHasBeenSet = false; + + PartitionedPrefix m_partitionedPrefix; + bool m_partitionedPrefixHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Tier.h b/include/aws/s3/model/Tier.h new file mode 100644 index 0000000000000000000000000000000000000000..d30179b932aa440fd405f7094ca679ce2ccc0c4d --- /dev/null +++ b/include/aws/s3/model/Tier.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace S3 +{ +namespace Model +{ + enum class Tier + { + NOT_SET, + Standard, + Bulk, + Expedited + }; + +namespace TierMapper +{ +AWS_S3_API Tier GetTierForName(const Aws::String& name); + +AWS_S3_API Aws::String GetNameForTier(Tier value); +} // namespace TierMapper +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/Tiering.h b/include/aws/s3/model/Tiering.h new file mode 100644 index 0000000000000000000000000000000000000000..73cc560bac20b2ee6fe28f75e9e7126cff7c3540 --- /dev/null +++ b/include/aws/s3/model/Tiering.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

The S3 Intelligent-Tiering storage class is designed to optimize storage + * costs by automatically moving data to the most cost-effective storage access + * tier, without additional operational overhead.

See Also:

AWS API + * Reference

+ */ + class Tiering + { + public: + AWS_S3_API Tiering(); + AWS_S3_API Tiering(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API Tiering& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

The number of consecutive days of no access after which an object will be + * eligible to be transitioned to the corresponding tier. The minimum number of + * days specified for Archive Access tier must be at least 90 days and Deep Archive + * Access tier must be at least 180 days. The maximum can be up to 2 years (730 + * days).

+ */ + inline int GetDays() const{ return m_days; } + inline bool DaysHasBeenSet() const { return m_daysHasBeenSet; } + inline void SetDays(int value) { m_daysHasBeenSet = true; m_days = value; } + inline Tiering& WithDays(int value) { SetDays(value); return *this;} + ///@} + + ///@{ + /** + *

S3 Intelligent-Tiering access tier. See Storage + * class for automatically optimizing frequently and infrequently accessed + * objects for a list of access tiers in the S3 Intelligent-Tiering storage + * class.

+ */ + inline const IntelligentTieringAccessTier& GetAccessTier() const{ return m_accessTier; } + inline bool AccessTierHasBeenSet() const { return m_accessTierHasBeenSet; } + inline void SetAccessTier(const IntelligentTieringAccessTier& value) { m_accessTierHasBeenSet = true; m_accessTier = value; } + inline void SetAccessTier(IntelligentTieringAccessTier&& value) { m_accessTierHasBeenSet = true; m_accessTier = std::move(value); } + inline Tiering& WithAccessTier(const IntelligentTieringAccessTier& value) { SetAccessTier(value); return *this;} + inline Tiering& WithAccessTier(IntelligentTieringAccessTier&& value) { SetAccessTier(std::move(value)); return *this;} + ///@} + private: + + int m_days; + bool m_daysHasBeenSet = false; + + IntelligentTieringAccessTier m_accessTier; + bool m_accessTierHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/TopicConfiguration.h b/include/aws/s3/model/TopicConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..2ddb88fcd08a0ef5d8b76930dfe23b99a0127bed --- /dev/null +++ b/include/aws/s3/model/TopicConfiguration.h @@ -0,0 +1,115 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

A container for specifying the configuration for publication of messages to + * an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 detects + * specified events.

See Also:

AWS + * API Reference

+ */ + class TopicConfiguration + { + public: + AWS_S3_API TopicConfiguration(); + AWS_S3_API TopicConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API TopicConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline TopicConfiguration& WithId(const Aws::String& value) { SetId(value); return *this;} + inline TopicConfiguration& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline TopicConfiguration& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 + * publishes a message when it detects events of the specified type.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline TopicConfiguration& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline TopicConfiguration& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline TopicConfiguration& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon S3 bucket event about which to send notifications. For more + * information, see Supported + * Event Types in the Amazon S3 User Guide.

+ */ + inline const Aws::Vector& GetEvents() const{ return m_events; } + inline bool EventsHasBeenSet() const { return m_eventsHasBeenSet; } + inline void SetEvents(const Aws::Vector& value) { m_eventsHasBeenSet = true; m_events = value; } + inline void SetEvents(Aws::Vector&& value) { m_eventsHasBeenSet = true; m_events = std::move(value); } + inline TopicConfiguration& WithEvents(const Aws::Vector& value) { SetEvents(value); return *this;} + inline TopicConfiguration& WithEvents(Aws::Vector&& value) { SetEvents(std::move(value)); return *this;} + inline TopicConfiguration& AddEvents(const Event& value) { m_eventsHasBeenSet = true; m_events.push_back(value); return *this; } + inline TopicConfiguration& AddEvents(Event&& value) { m_eventsHasBeenSet = true; m_events.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const NotificationConfigurationFilter& GetFilter() const{ return m_filter; } + inline bool FilterHasBeenSet() const { return m_filterHasBeenSet; } + inline void SetFilter(const NotificationConfigurationFilter& value) { m_filterHasBeenSet = true; m_filter = value; } + inline void SetFilter(NotificationConfigurationFilter&& value) { m_filterHasBeenSet = true; m_filter = std::move(value); } + inline TopicConfiguration& WithFilter(const NotificationConfigurationFilter& value) { SetFilter(value); return *this;} + inline TopicConfiguration& WithFilter(NotificationConfigurationFilter&& value) { SetFilter(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::Vector m_events; + bool m_eventsHasBeenSet = false; + + NotificationConfigurationFilter m_filter; + bool m_filterHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/UploadPartCopyResult.h b/include/aws/s3/model/UploadPartCopyResult.h new file mode 100644 index 0000000000000000000000000000000000000000..1febf48a9667d9858c6b70b3b78af07c2f89fe67 --- /dev/null +++ b/include/aws/s3/model/UploadPartCopyResult.h @@ -0,0 +1,174 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + class UploadPartCopyResult + { + public: + AWS_S3_API UploadPartCopyResult(); + AWS_S3_API UploadPartCopyResult(const Aws::AmazonWebServiceResult& result); + AWS_S3_API UploadPartCopyResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The version of the source object that was copied, if you have enabled + * versioning on the source bucket.

This functionality is not + * supported when the source object is in a directory bucket.

+ */ + inline const Aws::String& GetCopySourceVersionId() const{ return m_copySourceVersionId; } + inline void SetCopySourceVersionId(const Aws::String& value) { m_copySourceVersionId = value; } + inline void SetCopySourceVersionId(Aws::String&& value) { m_copySourceVersionId = std::move(value); } + inline void SetCopySourceVersionId(const char* value) { m_copySourceVersionId.assign(value); } + inline UploadPartCopyResult& WithCopySourceVersionId(const Aws::String& value) { SetCopySourceVersionId(value); return *this;} + inline UploadPartCopyResult& WithCopySourceVersionId(Aws::String&& value) { SetCopySourceVersionId(std::move(value)); return *this;} + inline UploadPartCopyResult& WithCopySourceVersionId(const char* value) { SetCopySourceVersionId(value); return *this;} + ///@} + + ///@{ + /** + *

Container for all response elements.

+ */ + inline const CopyPartResult& GetCopyPartResult() const{ return m_copyPartResult; } + inline void SetCopyPartResult(const CopyPartResult& value) { m_copyPartResult = value; } + inline void SetCopyPartResult(CopyPartResult&& value) { m_copyPartResult = std::move(value); } + inline UploadPartCopyResult& WithCopyPartResult(const CopyPartResult& value) { SetCopyPartResult(value); return *this;} + inline UploadPartCopyResult& WithCopyPartResult(CopyPartResult&& value) { SetCopyPartResult(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The server-side encryption algorithm used when you store this object in + * Amazon S3 (for example, AES256, aws:kms).

+ */ + inline const ServerSideEncryption& GetServerSideEncryption() const{ return m_serverSideEncryption; } + inline void SetServerSideEncryption(const ServerSideEncryption& value) { m_serverSideEncryption = value; } + inline void SetServerSideEncryption(ServerSideEncryption&& value) { m_serverSideEncryption = std::move(value); } + inline UploadPartCopyResult& WithServerSideEncryption(const ServerSideEncryption& value) { SetServerSideEncryption(value); return *this;} + inline UploadPartCopyResult& WithServerSideEncryption(ServerSideEncryption&& value) { SetServerSideEncryption(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to confirm the encryption + * algorithm that's used.

This functionality is not supported for + * directory buckets.

+ */ + inline const Aws::String& GetSSECustomerAlgorithm() const{ return m_sSECustomerAlgorithm; } + inline void SetSSECustomerAlgorithm(const Aws::String& value) { m_sSECustomerAlgorithm = value; } + inline void SetSSECustomerAlgorithm(Aws::String&& value) { m_sSECustomerAlgorithm = std::move(value); } + inline void SetSSECustomerAlgorithm(const char* value) { m_sSECustomerAlgorithm.assign(value); } + inline UploadPartCopyResult& WithSSECustomerAlgorithm(const Aws::String& value) { SetSSECustomerAlgorithm(value); return *this;} + inline UploadPartCopyResult& WithSSECustomerAlgorithm(Aws::String&& value) { SetSSECustomerAlgorithm(std::move(value)); return *this;} + inline UploadPartCopyResult& WithSSECustomerAlgorithm(const char* value) { SetSSECustomerAlgorithm(value); return *this;} + ///@} + + ///@{ + /** + *

If server-side encryption with a customer-provided encryption key was + * requested, the response will include this header to provide the round-trip + * message integrity verification of the customer-provided encryption key.

+ *

This functionality is not supported for directory buckets.

+ */ + inline const Aws::String& GetSSECustomerKeyMD5() const{ return m_sSECustomerKeyMD5; } + inline void SetSSECustomerKeyMD5(const Aws::String& value) { m_sSECustomerKeyMD5 = value; } + inline void SetSSECustomerKeyMD5(Aws::String&& value) { m_sSECustomerKeyMD5 = std::move(value); } + inline void SetSSECustomerKeyMD5(const char* value) { m_sSECustomerKeyMD5.assign(value); } + inline UploadPartCopyResult& WithSSECustomerKeyMD5(const Aws::String& value) { SetSSECustomerKeyMD5(value); return *this;} + inline UploadPartCopyResult& WithSSECustomerKeyMD5(Aws::String&& value) { SetSSECustomerKeyMD5(std::move(value)); return *this;} + inline UploadPartCopyResult& WithSSECustomerKeyMD5(const char* value) { SetSSECustomerKeyMD5(value); return *this;} + ///@} + + ///@{ + /** + *

If present, indicates the ID of the KMS key that was used for object + * encryption.

+ */ + inline const Aws::String& GetSSEKMSKeyId() const{ return m_sSEKMSKeyId; } + inline void SetSSEKMSKeyId(const Aws::String& value) { m_sSEKMSKeyId = value; } + inline void SetSSEKMSKeyId(Aws::String&& value) { m_sSEKMSKeyId = std::move(value); } + inline void SetSSEKMSKeyId(const char* value) { m_sSEKMSKeyId.assign(value); } + inline UploadPartCopyResult& WithSSEKMSKeyId(const Aws::String& value) { SetSSEKMSKeyId(value); return *this;} + inline UploadPartCopyResult& WithSSEKMSKeyId(Aws::String&& value) { SetSSEKMSKeyId(std::move(value)); return *this;} + inline UploadPartCopyResult& WithSSEKMSKeyId(const char* value) { SetSSEKMSKeyId(value); return *this;} + ///@} + + ///@{ + /** + *

Indicates whether the multipart upload uses an S3 Bucket Key for server-side + * encryption with Key Management Service (KMS) keys (SSE-KMS).

+ */ + inline bool GetBucketKeyEnabled() const{ return m_bucketKeyEnabled; } + inline void SetBucketKeyEnabled(bool value) { m_bucketKeyEnabled = value; } + inline UploadPartCopyResult& WithBucketKeyEnabled(bool value) { SetBucketKeyEnabled(value); return *this;} + ///@} + + ///@{ + + inline const RequestCharged& GetRequestCharged() const{ return m_requestCharged; } + inline void SetRequestCharged(const RequestCharged& value) { m_requestCharged = value; } + inline void SetRequestCharged(RequestCharged&& value) { m_requestCharged = std::move(value); } + inline UploadPartCopyResult& WithRequestCharged(const RequestCharged& value) { SetRequestCharged(value); return *this;} + inline UploadPartCopyResult& WithRequestCharged(RequestCharged&& value) { SetRequestCharged(std::move(value)); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline UploadPartCopyResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline UploadPartCopyResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline UploadPartCopyResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_copySourceVersionId; + + CopyPartResult m_copyPartResult; + + ServerSideEncryption m_serverSideEncryption; + + Aws::String m_sSECustomerAlgorithm; + + Aws::String m_sSECustomerKeyMD5; + + Aws::String m_sSEKMSKeyId; + + bool m_bucketKeyEnabled; + + RequestCharged m_requestCharged; + + Aws::String m_requestId; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/s3/model/VersioningConfiguration.h b/include/aws/s3/model/VersioningConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..d7c4ebefdd2fcf9667f29e2fb49a42b87572bc06 --- /dev/null +++ b/include/aws/s3/model/VersioningConfiguration.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace S3 +{ +namespace Model +{ + + /** + *

Describes the versioning state of an Amazon S3 bucket. For more information, + * see PUT + * Bucket versioning in the Amazon S3 API Reference.

See + * Also:

AWS + * API Reference

+ */ + class VersioningConfiguration + { + public: + AWS_S3_API VersioningConfiguration(); + AWS_S3_API VersioningConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_S3_API VersioningConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_S3_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; + + + ///@{ + /** + *

Specifies whether MFA delete is enabled in the bucket versioning + * configuration. This element is only returned if the bucket has been configured + * with MFA delete. If the bucket has never been so configured, this element is not + * returned.

+ */ + inline const MFADelete& GetMFADelete() const{ return m_mFADelete; } + inline bool MFADeleteHasBeenSet() const { return m_mFADeleteHasBeenSet; } + inline void SetMFADelete(const MFADelete& value) { m_mFADeleteHasBeenSet = true; m_mFADelete = value; } + inline void SetMFADelete(MFADelete&& value) { m_mFADeleteHasBeenSet = true; m_mFADelete = std::move(value); } + inline VersioningConfiguration& WithMFADelete(const MFADelete& value) { SetMFADelete(value); return *this;} + inline VersioningConfiguration& WithMFADelete(MFADelete&& value) { SetMFADelete(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The versioning state of the bucket.

+ */ + inline const BucketVersioningStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const BucketVersioningStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(BucketVersioningStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline VersioningConfiguration& WithStatus(const BucketVersioningStatus& value) { SetStatus(value); return *this;} + inline VersioningConfiguration& WithStatus(BucketVersioningStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + MFADelete m_mFADelete; + bool m_mFADeleteHasBeenSet = false; + + BucketVersioningStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace S3 +} // namespace Aws diff --git a/include/aws/sns/SNSClient.h b/include/aws/sns/SNSClient.h new file mode 100644 index 0000000000000000000000000000000000000000..791d450fbef1747c2b1b3f5fa7dfdefa78dddefb --- /dev/null +++ b/include/aws/sns/SNSClient.h @@ -0,0 +1,1463 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ + /** + * Amazon Simple Notification Service

Amazon Simple + * Notification Service (Amazon SNS) is a web service that enables you to build + * distributed web-enabled applications. Applications can use Amazon SNS to easily + * push real-time notification messages to interested subscribers over multiple + * delivery protocols. For more information about this product see the Amazon SNS product page. For detailed + * information about Amazon SNS features and their associated API calls, see the Amazon SNS Developer + * Guide.

For information on the permissions you need to use this API, + * see Identity + * and access management in Amazon SNS in the Amazon SNS Developer + * Guide.

We also provide SDKs that enable you to access Amazon SNS + * from your preferred programming language. The SDKs contain functionality that + * automatically takes care of tasks such as: cryptographically signing your + * service requests, retrying requests, and handling error responses. For a list of + * available SDKs, go to Tools for Amazon + * Web Services.

+ */ + class AWS_SNS_API SNSClient : public Aws::Client::AWSXMLClient, public Aws::Client::ClientWithAsyncTemplateMethods + { + public: + typedef Aws::Client::AWSXMLClient BASECLASS; + static const char* GetServiceName(); + static const char* GetAllocationTag(); + + typedef SNSClientConfiguration ClientConfigurationType; + typedef SNSEndpointProvider EndpointProviderType; + + /** + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SNSClient(const Aws::SNS::SNSClientConfiguration& clientConfiguration = Aws::SNS::SNSClientConfiguration(), + std::shared_ptr endpointProvider = nullptr); + + /** + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SNSClient(const Aws::Auth::AWSCredentials& credentials, + std::shared_ptr endpointProvider = nullptr, + const Aws::SNS::SNSClientConfiguration& clientConfiguration = Aws::SNS::SNSClientConfiguration()); + + /** + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, + * the default http client factory will be used + */ + SNSClient(const std::shared_ptr& credentialsProvider, + std::shared_ptr endpointProvider = nullptr, + const Aws::SNS::SNSClientConfiguration& clientConfiguration = Aws::SNS::SNSClientConfiguration()); + + + /* Legacy constructors due deprecation */ + /** + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SNSClient(const Aws::Client::ClientConfiguration& clientConfiguration); + + /** + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SNSClient(const Aws::Auth::AWSCredentials& credentials, + const Aws::Client::ClientConfiguration& clientConfiguration); + + /** + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, + * the default http client factory will be used + */ + SNSClient(const std::shared_ptr& credentialsProvider, + const Aws::Client::ClientConfiguration& clientConfiguration); + + /* End of legacy constructors due deprecation */ + virtual ~SNSClient(); + + + /** + * Converts any request object to a presigned URL with the GET method, using region for the signer and a timeout of 15 minutes. + */ + Aws::String ConvertRequestToPresignedUrl(const Aws::AmazonSerializableWebServiceRequest& requestToConvert, const char* region) const; + + + /** + *

Adds a statement to a topic's access control policy, granting access for the + * specified Amazon Web Services accounts to the specified actions.

+ *

To remove the ability to change topic permissions, you must deny permissions + * to the AddPermission, RemovePermission, and + * SetTopicAttributes actions in your IAM policy.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::AddPermissionOutcome AddPermission(const Model::AddPermissionRequest& request) const; + + /** + * A Callable wrapper for AddPermission that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::AddPermissionOutcomeCallable AddPermissionCallable(const AddPermissionRequestT& request) const + { + return SubmitCallable(&SNSClient::AddPermission, request); + } + + /** + * An Async wrapper for AddPermission that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void AddPermissionAsync(const AddPermissionRequestT& request, const AddPermissionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::AddPermission, request, handler, context); + } + + /** + *

Accepts a phone number and indicates whether the phone holder has opted out + * of receiving SMS messages from your Amazon Web Services account. You cannot send + * SMS messages to a number that is opted out.

To resume sending messages, + * you can opt in the number by using the OptInPhoneNumber + * action.

See Also:

AWS + * API Reference

+ */ + virtual Model::CheckIfPhoneNumberIsOptedOutOutcome CheckIfPhoneNumberIsOptedOut(const Model::CheckIfPhoneNumberIsOptedOutRequest& request) const; + + /** + * A Callable wrapper for CheckIfPhoneNumberIsOptedOut that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::CheckIfPhoneNumberIsOptedOutOutcomeCallable CheckIfPhoneNumberIsOptedOutCallable(const CheckIfPhoneNumberIsOptedOutRequestT& request) const + { + return SubmitCallable(&SNSClient::CheckIfPhoneNumberIsOptedOut, request); + } + + /** + * An Async wrapper for CheckIfPhoneNumberIsOptedOut that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void CheckIfPhoneNumberIsOptedOutAsync(const CheckIfPhoneNumberIsOptedOutRequestT& request, const CheckIfPhoneNumberIsOptedOutResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::CheckIfPhoneNumberIsOptedOut, request, handler, context); + } + + /** + *

Verifies an endpoint owner's intent to receive messages by validating the + * token sent to the endpoint by an earlier Subscribe action. If the + * token is valid, the action creates a new subscription and returns its Amazon + * Resource Name (ARN). This call requires an AWS signature only when the + * AuthenticateOnUnsubscribe flag is set to "true".

See + * Also:

AWS + * API Reference

+ */ + virtual Model::ConfirmSubscriptionOutcome ConfirmSubscription(const Model::ConfirmSubscriptionRequest& request) const; + + /** + * A Callable wrapper for ConfirmSubscription that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ConfirmSubscriptionOutcomeCallable ConfirmSubscriptionCallable(const ConfirmSubscriptionRequestT& request) const + { + return SubmitCallable(&SNSClient::ConfirmSubscription, request); + } + + /** + * An Async wrapper for ConfirmSubscription that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ConfirmSubscriptionAsync(const ConfirmSubscriptionRequestT& request, const ConfirmSubscriptionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::ConfirmSubscription, request, handler, context); + } + + /** + *

Creates a platform application object for one of the supported push + * notification services, such as APNS and GCM (Firebase Cloud Messaging), to which + * devices and mobile apps may register. You must specify + * PlatformPrincipal and PlatformCredential attributes + * when using the CreatePlatformApplication action.

+ * PlatformPrincipal and PlatformCredential are received + * from the notification service.

  • For ADM, + * PlatformPrincipal is client id and + * PlatformCredential is client secret.

  • + *

    For APNS and APNS_SANDBOX using certificate credentials, + * PlatformPrincipal is SSL certificate and + * PlatformCredential is private key.

  • + *

    For APNS and APNS_SANDBOX using token credentials, + * PlatformPrincipal is signing key ID and + * PlatformCredential is signing key.

  • + *

    For Baidu, PlatformPrincipal is API key and + * PlatformCredential is secret key.

  • + *

    For GCM (Firebase Cloud Messaging) using key credentials, there is no + * PlatformPrincipal. The PlatformCredential is API + * key.

  • For GCM (Firebase Cloud Messaging) using token + * credentials, there is no PlatformPrincipal. The + * PlatformCredential is a JSON formatted private key file. When using + * the Amazon Web Services CLI, the file must be in string format and special + * characters must be ignored. To format the file correctly, Amazon SNS recommends + * using the following command: SERVICE_JSON=`jq @json <<< cat + * service.json`.

  • For MPNS, PlatformPrincipal + * is TLS certificate and PlatformCredential is + * private key.

  • For WNS, + * PlatformPrincipal is Package Security Identifier and + * PlatformCredential is secret key.

+ *

You can use the returned PlatformApplicationArn as an attribute + * for the CreatePlatformEndpoint action.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::CreatePlatformApplicationOutcome CreatePlatformApplication(const Model::CreatePlatformApplicationRequest& request) const; + + /** + * A Callable wrapper for CreatePlatformApplication that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::CreatePlatformApplicationOutcomeCallable CreatePlatformApplicationCallable(const CreatePlatformApplicationRequestT& request) const + { + return SubmitCallable(&SNSClient::CreatePlatformApplication, request); + } + + /** + * An Async wrapper for CreatePlatformApplication that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void CreatePlatformApplicationAsync(const CreatePlatformApplicationRequestT& request, const CreatePlatformApplicationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::CreatePlatformApplication, request, handler, context); + } + + /** + *

Creates an endpoint for a device and mobile app on one of the supported push + * notification services, such as GCM (Firebase Cloud Messaging) and APNS. + * CreatePlatformEndpoint requires the + * PlatformApplicationArn that is returned from + * CreatePlatformApplication. You can use the returned + * EndpointArn to send a message to a mobile app or by the + * Subscribe action for subscription to a topic. The + * CreatePlatformEndpoint action is idempotent, so if the requester + * already owns an endpoint with the same device token and attributes, that + * endpoint's ARN is returned without creating a new endpoint. For more + * information, see Using Amazon + * SNS Mobile Push Notifications.

When using + * CreatePlatformEndpoint with Baidu, two attributes must be provided: + * ChannelId and UserId. The token field must also contain the ChannelId. For more + * information, see Creating + * an Amazon SNS Endpoint for Baidu.

See Also:

AWS + * API Reference

+ */ + virtual Model::CreatePlatformEndpointOutcome CreatePlatformEndpoint(const Model::CreatePlatformEndpointRequest& request) const; + + /** + * A Callable wrapper for CreatePlatformEndpoint that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::CreatePlatformEndpointOutcomeCallable CreatePlatformEndpointCallable(const CreatePlatformEndpointRequestT& request) const + { + return SubmitCallable(&SNSClient::CreatePlatformEndpoint, request); + } + + /** + * An Async wrapper for CreatePlatformEndpoint that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void CreatePlatformEndpointAsync(const CreatePlatformEndpointRequestT& request, const CreatePlatformEndpointResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::CreatePlatformEndpoint, request, handler, context); + } + + /** + *

Adds a destination phone number to an Amazon Web Services account in the SMS + * sandbox and sends a one-time password (OTP) to that phone number.

When + * you start using Amazon SNS to send SMS messages, your Amazon Web Services + * account is in the SMS sandbox. The SMS sandbox provides a safe + * environment for you to try Amazon SNS features without risking your reputation + * as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, + * you can use all of the features of Amazon SNS. However, you can send SMS + * messages only to verified destination phone numbers. For more information, + * including how to move out of the sandbox to send messages without restrictions, + * see SMS + * sandbox in the Amazon SNS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::CreateSMSSandboxPhoneNumberOutcome CreateSMSSandboxPhoneNumber(const Model::CreateSMSSandboxPhoneNumberRequest& request) const; + + /** + * A Callable wrapper for CreateSMSSandboxPhoneNumber that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::CreateSMSSandboxPhoneNumberOutcomeCallable CreateSMSSandboxPhoneNumberCallable(const CreateSMSSandboxPhoneNumberRequestT& request) const + { + return SubmitCallable(&SNSClient::CreateSMSSandboxPhoneNumber, request); + } + + /** + * An Async wrapper for CreateSMSSandboxPhoneNumber that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void CreateSMSSandboxPhoneNumberAsync(const CreateSMSSandboxPhoneNumberRequestT& request, const CreateSMSSandboxPhoneNumberResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::CreateSMSSandboxPhoneNumber, request, handler, context); + } + + /** + *

Creates a topic to which notifications can be published. Users can create at + * most 100,000 standard topics (at most 1,000 FIFO topics). For more information, + * see Creating + * an Amazon SNS topic in the Amazon SNS Developer Guide. This action is + * idempotent, so if the requester already owns a topic with the specified name, + * that topic's ARN is returned without creating a new topic.

See + * Also:

AWS API + * Reference

+ */ + virtual Model::CreateTopicOutcome CreateTopic(const Model::CreateTopicRequest& request) const; + + /** + * A Callable wrapper for CreateTopic that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::CreateTopicOutcomeCallable CreateTopicCallable(const CreateTopicRequestT& request) const + { + return SubmitCallable(&SNSClient::CreateTopic, request); + } + + /** + * An Async wrapper for CreateTopic that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void CreateTopicAsync(const CreateTopicRequestT& request, const CreateTopicResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::CreateTopic, request, handler, context); + } + + /** + *

Deletes the endpoint for a device and mobile app from Amazon SNS. This action + * is idempotent. For more information, see Using Amazon + * SNS Mobile Push Notifications.

When you delete an endpoint that is + * also subscribed to a topic, then you must also unsubscribe the endpoint from the + * topic.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteEndpointOutcome DeleteEndpoint(const Model::DeleteEndpointRequest& request) const; + + /** + * A Callable wrapper for DeleteEndpoint that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteEndpointOutcomeCallable DeleteEndpointCallable(const DeleteEndpointRequestT& request) const + { + return SubmitCallable(&SNSClient::DeleteEndpoint, request); + } + + /** + * An Async wrapper for DeleteEndpoint that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteEndpointAsync(const DeleteEndpointRequestT& request, const DeleteEndpointResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::DeleteEndpoint, request, handler, context); + } + + /** + *

Deletes a platform application object for one of the supported push + * notification services, such as APNS and GCM (Firebase Cloud Messaging). For more + * information, see Using Amazon + * SNS Mobile Push Notifications.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeletePlatformApplicationOutcome DeletePlatformApplication(const Model::DeletePlatformApplicationRequest& request) const; + + /** + * A Callable wrapper for DeletePlatformApplication that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeletePlatformApplicationOutcomeCallable DeletePlatformApplicationCallable(const DeletePlatformApplicationRequestT& request) const + { + return SubmitCallable(&SNSClient::DeletePlatformApplication, request); + } + + /** + * An Async wrapper for DeletePlatformApplication that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeletePlatformApplicationAsync(const DeletePlatformApplicationRequestT& request, const DeletePlatformApplicationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::DeletePlatformApplication, request, handler, context); + } + + /** + *

Deletes an Amazon Web Services account's verified or pending phone number + * from the SMS sandbox.

When you start using Amazon SNS to send SMS + * messages, your Amazon Web Services account is in the SMS sandbox. The SMS + * sandbox provides a safe environment for you to try Amazon SNS features without + * risking your reputation as an SMS sender. While your Amazon Web Services account + * is in the SMS sandbox, you can use all of the features of Amazon SNS. However, + * you can send SMS messages only to verified destination phone numbers. For more + * information, including how to move out of the sandbox to send messages without + * restrictions, see SMS + * sandbox in the Amazon SNS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::DeleteSMSSandboxPhoneNumberOutcome DeleteSMSSandboxPhoneNumber(const Model::DeleteSMSSandboxPhoneNumberRequest& request) const; + + /** + * A Callable wrapper for DeleteSMSSandboxPhoneNumber that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteSMSSandboxPhoneNumberOutcomeCallable DeleteSMSSandboxPhoneNumberCallable(const DeleteSMSSandboxPhoneNumberRequestT& request) const + { + return SubmitCallable(&SNSClient::DeleteSMSSandboxPhoneNumber, request); + } + + /** + * An Async wrapper for DeleteSMSSandboxPhoneNumber that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteSMSSandboxPhoneNumberAsync(const DeleteSMSSandboxPhoneNumberRequestT& request, const DeleteSMSSandboxPhoneNumberResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::DeleteSMSSandboxPhoneNumber, request, handler, context); + } + + /** + *

Deletes a topic and all its subscriptions. Deleting a topic might prevent + * some messages previously sent to the topic from being delivered to subscribers. + * This action is idempotent, so deleting a topic that does not exist does not + * result in an error.

See Also:

AWS API + * Reference

+ */ + virtual Model::DeleteTopicOutcome DeleteTopic(const Model::DeleteTopicRequest& request) const; + + /** + * A Callable wrapper for DeleteTopic that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteTopicOutcomeCallable DeleteTopicCallable(const DeleteTopicRequestT& request) const + { + return SubmitCallable(&SNSClient::DeleteTopic, request); + } + + /** + * An Async wrapper for DeleteTopic that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteTopicAsync(const DeleteTopicRequestT& request, const DeleteTopicResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::DeleteTopic, request, handler, context); + } + + /** + *

Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetDataProtectionPolicyOutcome GetDataProtectionPolicy(const Model::GetDataProtectionPolicyRequest& request) const; + + /** + * A Callable wrapper for GetDataProtectionPolicy that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetDataProtectionPolicyOutcomeCallable GetDataProtectionPolicyCallable(const GetDataProtectionPolicyRequestT& request) const + { + return SubmitCallable(&SNSClient::GetDataProtectionPolicy, request); + } + + /** + * An Async wrapper for GetDataProtectionPolicy that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetDataProtectionPolicyAsync(const GetDataProtectionPolicyRequestT& request, const GetDataProtectionPolicyResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::GetDataProtectionPolicy, request, handler, context); + } + + /** + *

Retrieves the endpoint attributes for a device on one of the supported push + * notification services, such as GCM (Firebase Cloud Messaging) and APNS. For more + * information, see Using Amazon + * SNS Mobile Push Notifications.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetEndpointAttributesOutcome GetEndpointAttributes(const Model::GetEndpointAttributesRequest& request) const; + + /** + * A Callable wrapper for GetEndpointAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetEndpointAttributesOutcomeCallable GetEndpointAttributesCallable(const GetEndpointAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::GetEndpointAttributes, request); + } + + /** + * An Async wrapper for GetEndpointAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetEndpointAttributesAsync(const GetEndpointAttributesRequestT& request, const GetEndpointAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::GetEndpointAttributes, request, handler, context); + } + + /** + *

Retrieves the attributes of the platform application object for the supported + * push notification services, such as APNS and GCM (Firebase Cloud Messaging). For + * more information, see Using Amazon + * SNS Mobile Push Notifications.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetPlatformApplicationAttributesOutcome GetPlatformApplicationAttributes(const Model::GetPlatformApplicationAttributesRequest& request) const; + + /** + * A Callable wrapper for GetPlatformApplicationAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetPlatformApplicationAttributesOutcomeCallable GetPlatformApplicationAttributesCallable(const GetPlatformApplicationAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::GetPlatformApplicationAttributes, request); + } + + /** + * An Async wrapper for GetPlatformApplicationAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetPlatformApplicationAttributesAsync(const GetPlatformApplicationAttributesRequestT& request, const GetPlatformApplicationAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::GetPlatformApplicationAttributes, request, handler, context); + } + + /** + *

Returns the settings for sending SMS messages from your Amazon Web Services + * account.

These settings are set with the SetSMSAttributes + * action.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetSMSAttributesOutcome GetSMSAttributes(const Model::GetSMSAttributesRequest& request = {}) const; + + /** + * A Callable wrapper for GetSMSAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetSMSAttributesOutcomeCallable GetSMSAttributesCallable(const GetSMSAttributesRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::GetSMSAttributes, request); + } + + /** + * An Async wrapper for GetSMSAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetSMSAttributesAsync(const GetSMSAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const GetSMSAttributesRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::GetSMSAttributes, request, handler, context); + } + + /** + *

Retrieves the SMS sandbox status for the calling Amazon Web Services account + * in the target Amazon Web Services Region.

When you start using Amazon SNS + * to send SMS messages, your Amazon Web Services account is in the SMS + * sandbox. The SMS sandbox provides a safe environment for you to try Amazon + * SNS features without risking your reputation as an SMS sender. While your Amazon + * Web Services account is in the SMS sandbox, you can use all of the features of + * Amazon SNS. However, you can send SMS messages only to verified destination + * phone numbers. For more information, including how to move out of the sandbox to + * send messages without restrictions, see SMS + * sandbox in the Amazon SNS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::GetSMSSandboxAccountStatusOutcome GetSMSSandboxAccountStatus(const Model::GetSMSSandboxAccountStatusRequest& request = {}) const; + + /** + * A Callable wrapper for GetSMSSandboxAccountStatus that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetSMSSandboxAccountStatusOutcomeCallable GetSMSSandboxAccountStatusCallable(const GetSMSSandboxAccountStatusRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::GetSMSSandboxAccountStatus, request); + } + + /** + * An Async wrapper for GetSMSSandboxAccountStatus that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetSMSSandboxAccountStatusAsync(const GetSMSSandboxAccountStatusResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const GetSMSSandboxAccountStatusRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::GetSMSSandboxAccountStatus, request, handler, context); + } + + /** + *

Returns all of the properties of a subscription.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::GetSubscriptionAttributesOutcome GetSubscriptionAttributes(const Model::GetSubscriptionAttributesRequest& request) const; + + /** + * A Callable wrapper for GetSubscriptionAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetSubscriptionAttributesOutcomeCallable GetSubscriptionAttributesCallable(const GetSubscriptionAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::GetSubscriptionAttributes, request); + } + + /** + * An Async wrapper for GetSubscriptionAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetSubscriptionAttributesAsync(const GetSubscriptionAttributesRequestT& request, const GetSubscriptionAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::GetSubscriptionAttributes, request, handler, context); + } + + /** + *

Returns all of the properties of a topic. Topic properties returned might + * differ based on the authorization of the user.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetTopicAttributesOutcome GetTopicAttributes(const Model::GetTopicAttributesRequest& request) const; + + /** + * A Callable wrapper for GetTopicAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetTopicAttributesOutcomeCallable GetTopicAttributesCallable(const GetTopicAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::GetTopicAttributes, request); + } + + /** + * An Async wrapper for GetTopicAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetTopicAttributesAsync(const GetTopicAttributesRequestT& request, const GetTopicAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::GetTopicAttributes, request, handler, context); + } + + /** + *

Lists the endpoints and endpoint attributes for devices in a supported push + * notification service, such as GCM (Firebase Cloud Messaging) and APNS. The + * results for ListEndpointsByPlatformApplication are paginated and + * return a limited list of endpoints, up to 100. If additional records are + * available after the first page results, then a NextToken string will be + * returned. To receive the next page, you call + * ListEndpointsByPlatformApplication again using the NextToken string + * received from the previous call. When there are no more records to return, + * NextToken will be null. For more information, see Using Amazon + * SNS Mobile Push Notifications.

This action is throttled at 30 + * transactions per second (TPS).

See Also:

AWS + * API Reference

+ */ + virtual Model::ListEndpointsByPlatformApplicationOutcome ListEndpointsByPlatformApplication(const Model::ListEndpointsByPlatformApplicationRequest& request) const; + + /** + * A Callable wrapper for ListEndpointsByPlatformApplication that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListEndpointsByPlatformApplicationOutcomeCallable ListEndpointsByPlatformApplicationCallable(const ListEndpointsByPlatformApplicationRequestT& request) const + { + return SubmitCallable(&SNSClient::ListEndpointsByPlatformApplication, request); + } + + /** + * An Async wrapper for ListEndpointsByPlatformApplication that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListEndpointsByPlatformApplicationAsync(const ListEndpointsByPlatformApplicationRequestT& request, const ListEndpointsByPlatformApplicationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::ListEndpointsByPlatformApplication, request, handler, context); + } + + /** + *

Lists the calling Amazon Web Services account's dedicated origination numbers + * and their metadata. For more information about origination numbers, see Origination + * numbers in the Amazon SNS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::ListOriginationNumbersOutcome ListOriginationNumbers(const Model::ListOriginationNumbersRequest& request = {}) const; + + /** + * A Callable wrapper for ListOriginationNumbers that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListOriginationNumbersOutcomeCallable ListOriginationNumbersCallable(const ListOriginationNumbersRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::ListOriginationNumbers, request); + } + + /** + * An Async wrapper for ListOriginationNumbers that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListOriginationNumbersAsync(const ListOriginationNumbersResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListOriginationNumbersRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::ListOriginationNumbers, request, handler, context); + } + + /** + *

Returns a list of phone numbers that are opted out, meaning you cannot send + * SMS messages to them.

The results for + * ListPhoneNumbersOptedOut are paginated, and each page returns up to + * 100 phone numbers. If additional phone numbers are available after the first + * page of results, then a NextToken string will be returned. To + * receive the next page, you call ListPhoneNumbersOptedOut again + * using the NextToken string received from the previous call. When + * there are no more records to return, NextToken will be + * null.

See Also:

AWS + * API Reference

+ */ + virtual Model::ListPhoneNumbersOptedOutOutcome ListPhoneNumbersOptedOut(const Model::ListPhoneNumbersOptedOutRequest& request = {}) const; + + /** + * A Callable wrapper for ListPhoneNumbersOptedOut that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListPhoneNumbersOptedOutOutcomeCallable ListPhoneNumbersOptedOutCallable(const ListPhoneNumbersOptedOutRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::ListPhoneNumbersOptedOut, request); + } + + /** + * An Async wrapper for ListPhoneNumbersOptedOut that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListPhoneNumbersOptedOutAsync(const ListPhoneNumbersOptedOutResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListPhoneNumbersOptedOutRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::ListPhoneNumbersOptedOut, request, handler, context); + } + + /** + *

Lists the platform application objects for the supported push notification + * services, such as APNS and GCM (Firebase Cloud Messaging). The results for + * ListPlatformApplications are paginated and return a limited list of + * applications, up to 100. If additional records are available after the first + * page results, then a NextToken string will be returned. To receive the next + * page, you call ListPlatformApplications using the NextToken string + * received from the previous call. When there are no more records to return, + * NextToken will be null. For more information, see Using Amazon + * SNS Mobile Push Notifications.

This action is throttled at 15 + * transactions per second (TPS).

See Also:

AWS + * API Reference

+ */ + virtual Model::ListPlatformApplicationsOutcome ListPlatformApplications(const Model::ListPlatformApplicationsRequest& request = {}) const; + + /** + * A Callable wrapper for ListPlatformApplications that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListPlatformApplicationsOutcomeCallable ListPlatformApplicationsCallable(const ListPlatformApplicationsRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::ListPlatformApplications, request); + } + + /** + * An Async wrapper for ListPlatformApplications that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListPlatformApplicationsAsync(const ListPlatformApplicationsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListPlatformApplicationsRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::ListPlatformApplications, request, handler, context); + } + + /** + *

Lists the calling Amazon Web Services account's current verified and pending + * destination phone numbers in the SMS sandbox.

When you start using Amazon + * SNS to send SMS messages, your Amazon Web Services account is in the SMS + * sandbox. The SMS sandbox provides a safe environment for you to try Amazon + * SNS features without risking your reputation as an SMS sender. While your Amazon + * Web Services account is in the SMS sandbox, you can use all of the features of + * Amazon SNS. However, you can send SMS messages only to verified destination + * phone numbers. For more information, including how to move out of the sandbox to + * send messages without restrictions, see SMS + * sandbox in the Amazon SNS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::ListSMSSandboxPhoneNumbersOutcome ListSMSSandboxPhoneNumbers(const Model::ListSMSSandboxPhoneNumbersRequest& request = {}) const; + + /** + * A Callable wrapper for ListSMSSandboxPhoneNumbers that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListSMSSandboxPhoneNumbersOutcomeCallable ListSMSSandboxPhoneNumbersCallable(const ListSMSSandboxPhoneNumbersRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::ListSMSSandboxPhoneNumbers, request); + } + + /** + * An Async wrapper for ListSMSSandboxPhoneNumbers that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListSMSSandboxPhoneNumbersAsync(const ListSMSSandboxPhoneNumbersResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListSMSSandboxPhoneNumbersRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::ListSMSSandboxPhoneNumbers, request, handler, context); + } + + /** + *

Returns a list of the requester's subscriptions. Each call returns a limited + * list of subscriptions, up to 100. If there are more subscriptions, a + * NextToken is also returned. Use the NextToken + * parameter in a new ListSubscriptions call to get further + * results.

This action is throttled at 30 transactions per second + * (TPS).

See Also:

AWS + * API Reference

+ */ + virtual Model::ListSubscriptionsOutcome ListSubscriptions(const Model::ListSubscriptionsRequest& request = {}) const; + + /** + * A Callable wrapper for ListSubscriptions that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListSubscriptionsOutcomeCallable ListSubscriptionsCallable(const ListSubscriptionsRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::ListSubscriptions, request); + } + + /** + * An Async wrapper for ListSubscriptions that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListSubscriptionsAsync(const ListSubscriptionsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListSubscriptionsRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::ListSubscriptions, request, handler, context); + } + + /** + *

Returns a list of the subscriptions to a specific topic. Each call returns a + * limited list of subscriptions, up to 100. If there are more subscriptions, a + * NextToken is also returned. Use the NextToken + * parameter in a new ListSubscriptionsByTopic call to get further + * results.

This action is throttled at 30 transactions per second + * (TPS).

See Also:

AWS + * API Reference

+ */ + virtual Model::ListSubscriptionsByTopicOutcome ListSubscriptionsByTopic(const Model::ListSubscriptionsByTopicRequest& request) const; + + /** + * A Callable wrapper for ListSubscriptionsByTopic that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListSubscriptionsByTopicOutcomeCallable ListSubscriptionsByTopicCallable(const ListSubscriptionsByTopicRequestT& request) const + { + return SubmitCallable(&SNSClient::ListSubscriptionsByTopic, request); + } + + /** + * An Async wrapper for ListSubscriptionsByTopic that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListSubscriptionsByTopicAsync(const ListSubscriptionsByTopicRequestT& request, const ListSubscriptionsByTopicResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::ListSubscriptionsByTopic, request, handler, context); + } + + /** + *

List all tags added to the specified Amazon SNS topic. For an overview, see + * Amazon SNS + * Tags in the Amazon Simple Notification Service Developer + * Guide.

See Also:

AWS + * API Reference

+ */ + virtual Model::ListTagsForResourceOutcome ListTagsForResource(const Model::ListTagsForResourceRequest& request) const; + + /** + * A Callable wrapper for ListTagsForResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListTagsForResourceOutcomeCallable ListTagsForResourceCallable(const ListTagsForResourceRequestT& request) const + { + return SubmitCallable(&SNSClient::ListTagsForResource, request); + } + + /** + * An Async wrapper for ListTagsForResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListTagsForResourceAsync(const ListTagsForResourceRequestT& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::ListTagsForResource, request, handler, context); + } + + /** + *

Returns a list of the requester's topics. Each call returns a limited list of + * topics, up to 100. If there are more topics, a NextToken is also + * returned. Use the NextToken parameter in a new + * ListTopics call to get further results.

This action is + * throttled at 30 transactions per second (TPS).

See Also:

AWS API + * Reference

+ */ + virtual Model::ListTopicsOutcome ListTopics(const Model::ListTopicsRequest& request = {}) const; + + /** + * A Callable wrapper for ListTopics that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListTopicsOutcomeCallable ListTopicsCallable(const ListTopicsRequestT& request = {}) const + { + return SubmitCallable(&SNSClient::ListTopics, request); + } + + /** + * An Async wrapper for ListTopics that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListTopicsAsync(const ListTopicsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListTopicsRequestT& request = {}) const + { + return SubmitAsync(&SNSClient::ListTopics, request, handler, context); + } + + /** + *

Use this request to opt in a phone number that is opted out, which enables + * you to resume sending SMS messages to the number.

You can opt in a phone + * number only once every 30 days.

See Also:

AWS + * API Reference

+ */ + virtual Model::OptInPhoneNumberOutcome OptInPhoneNumber(const Model::OptInPhoneNumberRequest& request) const; + + /** + * A Callable wrapper for OptInPhoneNumber that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::OptInPhoneNumberOutcomeCallable OptInPhoneNumberCallable(const OptInPhoneNumberRequestT& request) const + { + return SubmitCallable(&SNSClient::OptInPhoneNumber, request); + } + + /** + * An Async wrapper for OptInPhoneNumber that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void OptInPhoneNumberAsync(const OptInPhoneNumberRequestT& request, const OptInPhoneNumberResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::OptInPhoneNumber, request, handler, context); + } + + /** + *

Sends a message to an Amazon SNS topic, a text message (SMS message) directly + * to a phone number, or a message to a mobile platform endpoint (when you specify + * the TargetArn).

If you send a message to a topic, Amazon SNS + * delivers the message to each endpoint that is subscribed to the topic. The + * format of the message depends on the notification protocol for each subscribed + * endpoint.

When a messageId is returned, the message is saved + * and Amazon SNS immediately delivers it to subscribers.

To use the + * Publish action for publishing a message to a mobile endpoint, such + * as an app on a Kindle device or mobile phone, you must specify the EndpointArn + * for the TargetArn parameter. The EndpointArn is returned when making a call with + * the CreatePlatformEndpoint action.

For more information + * about formatting messages, see Send + * Custom Platform-Specific Payloads in Messages to Mobile Devices.

+ *

You can publish messages only to topics and endpoints in the same + * Amazon Web Services Region.

See Also:

AWS API + * Reference

+ */ + virtual Model::PublishOutcome Publish(const Model::PublishRequest& request) const; + + /** + * A Callable wrapper for Publish that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PublishOutcomeCallable PublishCallable(const PublishRequestT& request) const + { + return SubmitCallable(&SNSClient::Publish, request); + } + + /** + * An Async wrapper for Publish that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PublishAsync(const PublishRequestT& request, const PublishResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::Publish, request, handler, context); + } + + /** + *

Publishes up to ten messages to the specified topic. This is a batch version + * of Publish. For FIFO topics, multiple messages within a single + * batch are published in the order they are sent, and messages are deduplicated + * within the batch and across batches for 5 minutes.

The result of + * publishing each message is reported individually in the response. Because the + * batch request can result in a combination of successful and unsuccessful + * actions, you should check for batch errors even when the call returns an HTTP + * status code of 200.

The maximum allowed individual message + * size and the maximum total payload size (the sum of the individual lengths of + * all of the batched messages) are both 256 KB (262,144 bytes).

Some + * actions take lists of parameters. These lists are specified using the + * param.n notation. Values of n are integers starting + * from 1. For example, a parameter list with two elements looks like this:

+ *

&AttributeName.1=first

&AttributeName.2=second

If you + * send a batch message to a topic, Amazon SNS publishes the batch message to each + * endpoint that is subscribed to the topic. The format of the batch message + * depends on the notification protocol for each subscribed endpoint.

When a + * messageId is returned, the batch message is saved and Amazon SNS + * immediately delivers the message to subscribers.

See Also:

AWS + * API Reference

+ */ + virtual Model::PublishBatchOutcome PublishBatch(const Model::PublishBatchRequest& request) const; + + /** + * A Callable wrapper for PublishBatch that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PublishBatchOutcomeCallable PublishBatchCallable(const PublishBatchRequestT& request) const + { + return SubmitCallable(&SNSClient::PublishBatch, request); + } + + /** + * An Async wrapper for PublishBatch that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PublishBatchAsync(const PublishBatchRequestT& request, const PublishBatchResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::PublishBatch, request, handler, context); + } + + /** + *

Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic.

See Also:

AWS + * API Reference

+ */ + virtual Model::PutDataProtectionPolicyOutcome PutDataProtectionPolicy(const Model::PutDataProtectionPolicyRequest& request) const; + + /** + * A Callable wrapper for PutDataProtectionPolicy that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PutDataProtectionPolicyOutcomeCallable PutDataProtectionPolicyCallable(const PutDataProtectionPolicyRequestT& request) const + { + return SubmitCallable(&SNSClient::PutDataProtectionPolicy, request); + } + + /** + * An Async wrapper for PutDataProtectionPolicy that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PutDataProtectionPolicyAsync(const PutDataProtectionPolicyRequestT& request, const PutDataProtectionPolicyResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::PutDataProtectionPolicy, request, handler, context); + } + + /** + *

Removes a statement from a topic's access control policy.

To + * remove the ability to change topic permissions, you must deny permissions to the + * AddPermission, RemovePermission, and + * SetTopicAttributes actions in your IAM policy.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::RemovePermissionOutcome RemovePermission(const Model::RemovePermissionRequest& request) const; + + /** + * A Callable wrapper for RemovePermission that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::RemovePermissionOutcomeCallable RemovePermissionCallable(const RemovePermissionRequestT& request) const + { + return SubmitCallable(&SNSClient::RemovePermission, request); + } + + /** + * An Async wrapper for RemovePermission that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void RemovePermissionAsync(const RemovePermissionRequestT& request, const RemovePermissionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::RemovePermission, request, handler, context); + } + + /** + *

Sets the attributes for an endpoint for a device on one of the supported push + * notification services, such as GCM (Firebase Cloud Messaging) and APNS. For more + * information, see Using Amazon + * SNS Mobile Push Notifications.

See Also:

AWS + * API Reference

+ */ + virtual Model::SetEndpointAttributesOutcome SetEndpointAttributes(const Model::SetEndpointAttributesRequest& request) const; + + /** + * A Callable wrapper for SetEndpointAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SetEndpointAttributesOutcomeCallable SetEndpointAttributesCallable(const SetEndpointAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::SetEndpointAttributes, request); + } + + /** + * An Async wrapper for SetEndpointAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SetEndpointAttributesAsync(const SetEndpointAttributesRequestT& request, const SetEndpointAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::SetEndpointAttributes, request, handler, context); + } + + /** + *

Sets the attributes of the platform application object for the supported push + * notification services, such as APNS and GCM (Firebase Cloud Messaging). For more + * information, see Using Amazon + * SNS Mobile Push Notifications. For information on configuring attributes for + * message delivery status, see Using + * Amazon SNS Application Attributes for Message Delivery Status. + *

See Also:

AWS + * API Reference

+ */ + virtual Model::SetPlatformApplicationAttributesOutcome SetPlatformApplicationAttributes(const Model::SetPlatformApplicationAttributesRequest& request) const; + + /** + * A Callable wrapper for SetPlatformApplicationAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SetPlatformApplicationAttributesOutcomeCallable SetPlatformApplicationAttributesCallable(const SetPlatformApplicationAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::SetPlatformApplicationAttributes, request); + } + + /** + * An Async wrapper for SetPlatformApplicationAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SetPlatformApplicationAttributesAsync(const SetPlatformApplicationAttributesRequestT& request, const SetPlatformApplicationAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::SetPlatformApplicationAttributes, request, handler, context); + } + + /** + *

Use this request to set the default settings for sending SMS messages and + * receiving daily SMS usage reports.

You can override some of these + * settings for a single message when you use the Publish action with + * the MessageAttributes.entry.N parameter. For more information, see + * Publishing + * to a mobile phone in the Amazon SNS Developer Guide.

To + * use this operation, you must grant the Amazon SNS service principal + * (sns.amazonaws.com) permission to perform the + * s3:ListBucket action.

See Also:

AWS + * API Reference

+ */ + virtual Model::SetSMSAttributesOutcome SetSMSAttributes(const Model::SetSMSAttributesRequest& request) const; + + /** + * A Callable wrapper for SetSMSAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SetSMSAttributesOutcomeCallable SetSMSAttributesCallable(const SetSMSAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::SetSMSAttributes, request); + } + + /** + * An Async wrapper for SetSMSAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SetSMSAttributesAsync(const SetSMSAttributesRequestT& request, const SetSMSAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::SetSMSAttributes, request, handler, context); + } + + /** + *

Allows a subscription owner to set an attribute of the subscription to a new + * value.

See Also:

AWS + * API Reference

+ */ + virtual Model::SetSubscriptionAttributesOutcome SetSubscriptionAttributes(const Model::SetSubscriptionAttributesRequest& request) const; + + /** + * A Callable wrapper for SetSubscriptionAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SetSubscriptionAttributesOutcomeCallable SetSubscriptionAttributesCallable(const SetSubscriptionAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::SetSubscriptionAttributes, request); + } + + /** + * An Async wrapper for SetSubscriptionAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SetSubscriptionAttributesAsync(const SetSubscriptionAttributesRequestT& request, const SetSubscriptionAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::SetSubscriptionAttributes, request, handler, context); + } + + /** + *

Allows a topic owner to set an attribute of the topic to a new value.

+ *

To remove the ability to change topic permissions, you must deny + * permissions to the AddPermission, RemovePermission, + * and SetTopicAttributes actions in your IAM policy.

+ *

See Also:

AWS + * API Reference

+ */ + virtual Model::SetTopicAttributesOutcome SetTopicAttributes(const Model::SetTopicAttributesRequest& request) const; + + /** + * A Callable wrapper for SetTopicAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SetTopicAttributesOutcomeCallable SetTopicAttributesCallable(const SetTopicAttributesRequestT& request) const + { + return SubmitCallable(&SNSClient::SetTopicAttributes, request); + } + + /** + * An Async wrapper for SetTopicAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SetTopicAttributesAsync(const SetTopicAttributesRequestT& request, const SetTopicAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::SetTopicAttributes, request, handler, context); + } + + /** + *

Subscribes an endpoint to an Amazon SNS topic. If the endpoint type is HTTP/S + * or email, or if the endpoint and the topic are not in the same Amazon Web + * Services account, the endpoint owner must run the + * ConfirmSubscription action to confirm the subscription.

You + * call the ConfirmSubscription action with the token from the + * subscription response. Confirmation tokens are valid for two days.

This + * action is throttled at 100 transactions per second (TPS).

See + * Also:

AWS API + * Reference

+ */ + virtual Model::SubscribeOutcome Subscribe(const Model::SubscribeRequest& request) const; + + /** + * A Callable wrapper for Subscribe that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SubscribeOutcomeCallable SubscribeCallable(const SubscribeRequestT& request) const + { + return SubmitCallable(&SNSClient::Subscribe, request); + } + + /** + * An Async wrapper for Subscribe that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SubscribeAsync(const SubscribeRequestT& request, const SubscribeResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::Subscribe, request, handler, context); + } + + /** + *

Add tags to the specified Amazon SNS topic. For an overview, see Amazon SNS + * Tags in the Amazon SNS Developer Guide.

When you use topic + * tags, keep the following guidelines in mind:

  • Adding more than + * 50 tags to a topic isn't recommended.

  • Tags don't have any + * semantic meaning. Amazon SNS interprets tags as character strings.

  • + *
  • Tags are case-sensitive.

  • A new tag with a key + * identical to that of an existing tag overwrites the existing tag.

  • + *

    Tagging actions are limited to 10 TPS per Amazon Web Services account, per + * Amazon Web Services Region. If your application requires a higher throughput, + * file a technical + * support request.

See Also:

AWS API + * Reference

+ */ + virtual Model::TagResourceOutcome TagResource(const Model::TagResourceRequest& request) const; + + /** + * A Callable wrapper for TagResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::TagResourceOutcomeCallable TagResourceCallable(const TagResourceRequestT& request) const + { + return SubmitCallable(&SNSClient::TagResource, request); + } + + /** + * An Async wrapper for TagResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void TagResourceAsync(const TagResourceRequestT& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::TagResource, request, handler, context); + } + + /** + *

Deletes a subscription. If the subscription requires authentication for + * deletion, only the owner of the subscription or the topic's owner can + * unsubscribe, and an Amazon Web Services signature is required. If the + * Unsubscribe call does not require authentication and the requester + * is not the subscription owner, a final cancellation message is delivered to the + * endpoint, so that the endpoint owner can easily resubscribe to the topic if the + * Unsubscribe request was unintended.

Amazon SQS queue + * subscriptions require authentication for deletion. Only the owner of the + * subscription, or the owner of the topic can unsubscribe using the required + * Amazon Web Services signature.

This action is throttled at 100 + * transactions per second (TPS).

See Also:

AWS API + * Reference

+ */ + virtual Model::UnsubscribeOutcome Unsubscribe(const Model::UnsubscribeRequest& request) const; + + /** + * A Callable wrapper for Unsubscribe that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::UnsubscribeOutcomeCallable UnsubscribeCallable(const UnsubscribeRequestT& request) const + { + return SubmitCallable(&SNSClient::Unsubscribe, request); + } + + /** + * An Async wrapper for Unsubscribe that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void UnsubscribeAsync(const UnsubscribeRequestT& request, const UnsubscribeResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::Unsubscribe, request, handler, context); + } + + /** + *

Remove tags from the specified Amazon SNS topic. For an overview, see Amazon SNS + * Tags in the Amazon SNS Developer Guide.

See Also:

AWS + * API Reference

+ */ + virtual Model::UntagResourceOutcome UntagResource(const Model::UntagResourceRequest& request) const; + + /** + * A Callable wrapper for UntagResource that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::UntagResourceOutcomeCallable UntagResourceCallable(const UntagResourceRequestT& request) const + { + return SubmitCallable(&SNSClient::UntagResource, request); + } + + /** + * An Async wrapper for UntagResource that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void UntagResourceAsync(const UntagResourceRequestT& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::UntagResource, request, handler, context); + } + + /** + *

Verifies a destination phone number with a one-time password (OTP) for the + * calling Amazon Web Services account.

When you start using Amazon SNS to + * send SMS messages, your Amazon Web Services account is in the SMS + * sandbox. The SMS sandbox provides a safe environment for you to try Amazon + * SNS features without risking your reputation as an SMS sender. While your Amazon + * Web Services account is in the SMS sandbox, you can use all of the features of + * Amazon SNS. However, you can send SMS messages only to verified destination + * phone numbers. For more information, including how to move out of the sandbox to + * send messages without restrictions, see SMS + * sandbox in the Amazon SNS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::VerifySMSSandboxPhoneNumberOutcome VerifySMSSandboxPhoneNumber(const Model::VerifySMSSandboxPhoneNumberRequest& request) const; + + /** + * A Callable wrapper for VerifySMSSandboxPhoneNumber that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::VerifySMSSandboxPhoneNumberOutcomeCallable VerifySMSSandboxPhoneNumberCallable(const VerifySMSSandboxPhoneNumberRequestT& request) const + { + return SubmitCallable(&SNSClient::VerifySMSSandboxPhoneNumber, request); + } + + /** + * An Async wrapper for VerifySMSSandboxPhoneNumber that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void VerifySMSSandboxPhoneNumberAsync(const VerifySMSSandboxPhoneNumberRequestT& request, const VerifySMSSandboxPhoneNumberResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SNSClient::VerifySMSSandboxPhoneNumber, request, handler, context); + } + + + void OverrideEndpoint(const Aws::String& endpoint); + std::shared_ptr& accessEndpointProvider(); + private: + friend class Aws::Client::ClientWithAsyncTemplateMethods; + void init(const SNSClientConfiguration& clientConfiguration); + + SNSClientConfiguration m_clientConfiguration; + std::shared_ptr m_endpointProvider; + }; + +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/SNSEndpointProvider.h b/include/aws/sns/SNSEndpointProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..01877cecdb25421b70296ccfb4c08773f8e45879 --- /dev/null +++ b/include/aws/sns/SNSEndpointProvider.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +#include + + +namespace Aws +{ +namespace SNS +{ +namespace Endpoint +{ +using EndpointParameters = Aws::Endpoint::EndpointParameters; +using Aws::Endpoint::EndpointProviderBase; +using Aws::Endpoint::DefaultEndpointProvider; + +using SNSClientContextParameters = Aws::Endpoint::ClientContextParameters; + +using SNSClientConfiguration = Aws::Client::GenericClientConfiguration; +using SNSBuiltInParameters = Aws::Endpoint::BuiltInParameters; + +/** + * The type for the SNS Client Endpoint Provider. + * Inherit from this Base class / "Interface" should you want to provide a custom endpoint provider. + * The SDK must use service-specific type for each service per specification. + */ +using SNSEndpointProviderBase = + EndpointProviderBase; + +using SNSDefaultEpProviderBase = + DefaultEndpointProvider; + +/** + * Default endpoint provider used for this service + */ +class AWS_SNS_API SNSEndpointProvider : public SNSDefaultEpProviderBase +{ +public: + using SNSResolveEndpointOutcome = Aws::Endpoint::ResolveEndpointOutcome; + + SNSEndpointProvider() + : SNSDefaultEpProviderBase(Aws::SNS::SNSEndpointRules::GetRulesBlob(), Aws::SNS::SNSEndpointRules::RulesBlobSize) + {} + + ~SNSEndpointProvider() + { + } +}; +} // namespace Endpoint +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/SNSEndpointRules.h b/include/aws/sns/SNSEndpointRules.h new file mode 100644 index 0000000000000000000000000000000000000000..c155a078ec1543e593fb2a4fd738c35d8623728e --- /dev/null +++ b/include/aws/sns/SNSEndpointRules.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SNS +{ +class SNSEndpointRules +{ +public: + static const size_t RulesBlobStrLen; + static const size_t RulesBlobSize; + + static const char* GetRulesBlob(); +}; +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/SNSErrorMarshaller.h b/include/aws/sns/SNSErrorMarshaller.h new file mode 100644 index 0000000000000000000000000000000000000000..aaa2e8eceb1dec63cb4fdfa55ea743830c21b56b --- /dev/null +++ b/include/aws/sns/SNSErrorMarshaller.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ +namespace Client +{ + +class AWS_SNS_API SNSErrorMarshaller : public Aws::Client::XmlErrorMarshaller +{ +public: + Aws::Client::AWSError FindErrorByName(const char* exceptionName) const override; +}; + +} // namespace Client +} // namespace Aws diff --git a/include/aws/sns/SNSErrors.h b/include/aws/sns/SNSErrors.h new file mode 100644 index 0000000000000000000000000000000000000000..f312fa07d6a77d2edb42b47e667b07449f371d97 --- /dev/null +++ b/include/aws/sns/SNSErrors.h @@ -0,0 +1,101 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +enum class SNSErrors +{ + //From Core// + ////////////////////////////////////////////////////////////////////////////////////////// + INCOMPLETE_SIGNATURE = 0, + INTERNAL_FAILURE = 1, + INVALID_ACTION = 2, + INVALID_CLIENT_TOKEN_ID = 3, + INVALID_PARAMETER_COMBINATION = 4, + INVALID_QUERY_PARAMETER = 5, + INVALID_PARAMETER_VALUE = 6, + MISSING_ACTION = 7, // SDK should never allow + MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow + MISSING_PARAMETER = 9, // SDK should never allow + OPT_IN_REQUIRED = 10, + REQUEST_EXPIRED = 11, + SERVICE_UNAVAILABLE = 12, + THROTTLING = 13, + VALIDATION = 14, + ACCESS_DENIED = 15, + RESOURCE_NOT_FOUND = 16, + UNRECOGNIZED_CLIENT = 17, + MALFORMED_QUERY_STRING = 18, + SLOW_DOWN = 19, + REQUEST_TIME_TOO_SKEWED = 20, + INVALID_SIGNATURE = 21, + SIGNATURE_DOES_NOT_MATCH = 22, + INVALID_ACCESS_KEY_ID = 23, + REQUEST_TIMEOUT = 24, + NETWORK_CONNECTION = 99, + + UNKNOWN = 100, + /////////////////////////////////////////////////////////////////////////////////////////// + + AUTHORIZATION_ERROR= static_cast(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1, + BATCH_ENTRY_IDS_NOT_DISTINCT, + BATCH_REQUEST_TOO_LONG, + CONCURRENT_ACCESS, + EMPTY_BATCH_REQUEST, + ENDPOINT_DISABLED, + FILTER_POLICY_LIMIT_EXCEEDED, + INTERNAL_ERROR, + INVALID_BATCH_ENTRY_ID, + INVALID_PARAMETER, + INVALID_SECURITY, + INVALID_STATE, + K_M_S_ACCESS_DENIED, + K_M_S_DISABLED, + K_M_S_INVALID_STATE, + K_M_S_NOT_FOUND, + K_M_S_OPT_IN_REQUIRED, + K_M_S_THROTTLING, + NOT_FOUND, + OPTED_OUT, + PLATFORM_APPLICATION_DISABLED, + REPLAY_LIMIT_EXCEEDED, + STALE_TAG, + SUBSCRIPTION_LIMIT_EXCEEDED, + TAG_LIMIT_EXCEEDED, + TAG_POLICY, + TOO_MANY_ENTRIES_IN_BATCH_REQUEST, + TOPIC_LIMIT_EXCEEDED, + USER_ERROR, + VERIFICATION +}; + +class AWS_SNS_API SNSError : public Aws::Client::AWSError +{ +public: + SNSError() {} + SNSError(const Aws::Client::AWSError& rhs) : Aws::Client::AWSError(rhs) {} + SNSError(Aws::Client::AWSError&& rhs) : Aws::Client::AWSError(rhs) {} + SNSError(const Aws::Client::AWSError& rhs) : Aws::Client::AWSError(rhs) {} + SNSError(Aws::Client::AWSError&& rhs) : Aws::Client::AWSError(rhs) {} + + template + T GetModeledError(); +}; + +namespace SNSErrorMapper +{ + AWS_SNS_API Aws::Client::AWSError GetErrorForName(const char* errorName); +} + +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/SNSRequest.h b/include/aws/sns/SNSRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1bd4b17311e52fa5af8ecad79db10c9af3bc7284 --- /dev/null +++ b/include/aws/sns/SNSRequest.h @@ -0,0 +1,46 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ + class AWS_SNS_API SNSRequest : public Aws::AmazonSerializableWebServiceRequest + { + public: + using EndpointParameter = Aws::Endpoint::EndpointParameter; + using EndpointParameters = Aws::Endpoint::EndpointParameters; + + virtual ~SNSRequest () {} + + void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); } + + inline Aws::Http::HeaderValueCollection GetHeaders() const override + { + auto headers = GetRequestSpecificHeaders(); + + if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0)) + { + headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::FORM_CONTENT_TYPE )); + } + headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2010-03-31")); + return headers; + } + + protected: + virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); } + + }; + + +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/SNSServiceClientModel.h b/include/aws/sns/SNSServiceClientModel.h new file mode 100644 index 0000000000000000000000000000000000000000..24793d92b1d0c6ed26f69da60e03ea8fe1e8d8f1 --- /dev/null +++ b/include/aws/sns/SNSServiceClientModel.h @@ -0,0 +1,283 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +/* Generic header includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* End of generic header includes */ + +/* Service model headers required in SNSClient header */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* End of service model headers required in SNSClient header */ + +namespace Aws +{ + namespace Http + { + class HttpClient; + class HttpClientFactory; + } // namespace Http + + namespace Utils + { + template< typename R, typename E> class Outcome; + + namespace Threading + { + class Executor; + } // namespace Threading + } // namespace Utils + + namespace Auth + { + class AWSCredentials; + class AWSCredentialsProvider; + } // namespace Auth + + namespace Client + { + class RetryStrategy; + } // namespace Client + + namespace SNS + { + using SNSClientConfiguration = Aws::Client::GenericClientConfiguration; + using SNSEndpointProviderBase = Aws::SNS::Endpoint::SNSEndpointProviderBase; + using SNSEndpointProvider = Aws::SNS::Endpoint::SNSEndpointProvider; + + namespace Model + { + /* Service model forward declarations required in SNSClient header */ + class AddPermissionRequest; + class CheckIfPhoneNumberIsOptedOutRequest; + class ConfirmSubscriptionRequest; + class CreatePlatformApplicationRequest; + class CreatePlatformEndpointRequest; + class CreateSMSSandboxPhoneNumberRequest; + class CreateTopicRequest; + class DeleteEndpointRequest; + class DeletePlatformApplicationRequest; + class DeleteSMSSandboxPhoneNumberRequest; + class DeleteTopicRequest; + class GetDataProtectionPolicyRequest; + class GetEndpointAttributesRequest; + class GetPlatformApplicationAttributesRequest; + class GetSMSAttributesRequest; + class GetSMSSandboxAccountStatusRequest; + class GetSubscriptionAttributesRequest; + class GetTopicAttributesRequest; + class ListEndpointsByPlatformApplicationRequest; + class ListOriginationNumbersRequest; + class ListPhoneNumbersOptedOutRequest; + class ListPlatformApplicationsRequest; + class ListSMSSandboxPhoneNumbersRequest; + class ListSubscriptionsRequest; + class ListSubscriptionsByTopicRequest; + class ListTagsForResourceRequest; + class ListTopicsRequest; + class OptInPhoneNumberRequest; + class PublishRequest; + class PublishBatchRequest; + class PutDataProtectionPolicyRequest; + class RemovePermissionRequest; + class SetEndpointAttributesRequest; + class SetPlatformApplicationAttributesRequest; + class SetSMSAttributesRequest; + class SetSubscriptionAttributesRequest; + class SetTopicAttributesRequest; + class SubscribeRequest; + class TagResourceRequest; + class UnsubscribeRequest; + class UntagResourceRequest; + class VerifySMSSandboxPhoneNumberRequest; + /* End of service model forward declarations required in SNSClient header */ + + /* Service model Outcome class definitions */ + typedef Aws::Utils::Outcome AddPermissionOutcome; + typedef Aws::Utils::Outcome CheckIfPhoneNumberIsOptedOutOutcome; + typedef Aws::Utils::Outcome ConfirmSubscriptionOutcome; + typedef Aws::Utils::Outcome CreatePlatformApplicationOutcome; + typedef Aws::Utils::Outcome CreatePlatformEndpointOutcome; + typedef Aws::Utils::Outcome CreateSMSSandboxPhoneNumberOutcome; + typedef Aws::Utils::Outcome CreateTopicOutcome; + typedef Aws::Utils::Outcome DeleteEndpointOutcome; + typedef Aws::Utils::Outcome DeletePlatformApplicationOutcome; + typedef Aws::Utils::Outcome DeleteSMSSandboxPhoneNumberOutcome; + typedef Aws::Utils::Outcome DeleteTopicOutcome; + typedef Aws::Utils::Outcome GetDataProtectionPolicyOutcome; + typedef Aws::Utils::Outcome GetEndpointAttributesOutcome; + typedef Aws::Utils::Outcome GetPlatformApplicationAttributesOutcome; + typedef Aws::Utils::Outcome GetSMSAttributesOutcome; + typedef Aws::Utils::Outcome GetSMSSandboxAccountStatusOutcome; + typedef Aws::Utils::Outcome GetSubscriptionAttributesOutcome; + typedef Aws::Utils::Outcome GetTopicAttributesOutcome; + typedef Aws::Utils::Outcome ListEndpointsByPlatformApplicationOutcome; + typedef Aws::Utils::Outcome ListOriginationNumbersOutcome; + typedef Aws::Utils::Outcome ListPhoneNumbersOptedOutOutcome; + typedef Aws::Utils::Outcome ListPlatformApplicationsOutcome; + typedef Aws::Utils::Outcome ListSMSSandboxPhoneNumbersOutcome; + typedef Aws::Utils::Outcome ListSubscriptionsOutcome; + typedef Aws::Utils::Outcome ListSubscriptionsByTopicOutcome; + typedef Aws::Utils::Outcome ListTagsForResourceOutcome; + typedef Aws::Utils::Outcome ListTopicsOutcome; + typedef Aws::Utils::Outcome OptInPhoneNumberOutcome; + typedef Aws::Utils::Outcome PublishOutcome; + typedef Aws::Utils::Outcome PublishBatchOutcome; + typedef Aws::Utils::Outcome PutDataProtectionPolicyOutcome; + typedef Aws::Utils::Outcome RemovePermissionOutcome; + typedef Aws::Utils::Outcome SetEndpointAttributesOutcome; + typedef Aws::Utils::Outcome SetPlatformApplicationAttributesOutcome; + typedef Aws::Utils::Outcome SetSMSAttributesOutcome; + typedef Aws::Utils::Outcome SetSubscriptionAttributesOutcome; + typedef Aws::Utils::Outcome SetTopicAttributesOutcome; + typedef Aws::Utils::Outcome SubscribeOutcome; + typedef Aws::Utils::Outcome TagResourceOutcome; + typedef Aws::Utils::Outcome UnsubscribeOutcome; + typedef Aws::Utils::Outcome UntagResourceOutcome; + typedef Aws::Utils::Outcome VerifySMSSandboxPhoneNumberOutcome; + /* End of service model Outcome class definitions */ + + /* Service model Outcome callable definitions */ + typedef std::future AddPermissionOutcomeCallable; + typedef std::future CheckIfPhoneNumberIsOptedOutOutcomeCallable; + typedef std::future ConfirmSubscriptionOutcomeCallable; + typedef std::future CreatePlatformApplicationOutcomeCallable; + typedef std::future CreatePlatformEndpointOutcomeCallable; + typedef std::future CreateSMSSandboxPhoneNumberOutcomeCallable; + typedef std::future CreateTopicOutcomeCallable; + typedef std::future DeleteEndpointOutcomeCallable; + typedef std::future DeletePlatformApplicationOutcomeCallable; + typedef std::future DeleteSMSSandboxPhoneNumberOutcomeCallable; + typedef std::future DeleteTopicOutcomeCallable; + typedef std::future GetDataProtectionPolicyOutcomeCallable; + typedef std::future GetEndpointAttributesOutcomeCallable; + typedef std::future GetPlatformApplicationAttributesOutcomeCallable; + typedef std::future GetSMSAttributesOutcomeCallable; + typedef std::future GetSMSSandboxAccountStatusOutcomeCallable; + typedef std::future GetSubscriptionAttributesOutcomeCallable; + typedef std::future GetTopicAttributesOutcomeCallable; + typedef std::future ListEndpointsByPlatformApplicationOutcomeCallable; + typedef std::future ListOriginationNumbersOutcomeCallable; + typedef std::future ListPhoneNumbersOptedOutOutcomeCallable; + typedef std::future ListPlatformApplicationsOutcomeCallable; + typedef std::future ListSMSSandboxPhoneNumbersOutcomeCallable; + typedef std::future ListSubscriptionsOutcomeCallable; + typedef std::future ListSubscriptionsByTopicOutcomeCallable; + typedef std::future ListTagsForResourceOutcomeCallable; + typedef std::future ListTopicsOutcomeCallable; + typedef std::future OptInPhoneNumberOutcomeCallable; + typedef std::future PublishOutcomeCallable; + typedef std::future PublishBatchOutcomeCallable; + typedef std::future PutDataProtectionPolicyOutcomeCallable; + typedef std::future RemovePermissionOutcomeCallable; + typedef std::future SetEndpointAttributesOutcomeCallable; + typedef std::future SetPlatformApplicationAttributesOutcomeCallable; + typedef std::future SetSMSAttributesOutcomeCallable; + typedef std::future SetSubscriptionAttributesOutcomeCallable; + typedef std::future SetTopicAttributesOutcomeCallable; + typedef std::future SubscribeOutcomeCallable; + typedef std::future TagResourceOutcomeCallable; + typedef std::future UnsubscribeOutcomeCallable; + typedef std::future UntagResourceOutcomeCallable; + typedef std::future VerifySMSSandboxPhoneNumberOutcomeCallable; + /* End of service model Outcome callable definitions */ + } // namespace Model + + class SNSClient; + + /* Service model async handlers definitions */ + typedef std::function&) > AddPermissionResponseReceivedHandler; + typedef std::function&) > CheckIfPhoneNumberIsOptedOutResponseReceivedHandler; + typedef std::function&) > ConfirmSubscriptionResponseReceivedHandler; + typedef std::function&) > CreatePlatformApplicationResponseReceivedHandler; + typedef std::function&) > CreatePlatformEndpointResponseReceivedHandler; + typedef std::function&) > CreateSMSSandboxPhoneNumberResponseReceivedHandler; + typedef std::function&) > CreateTopicResponseReceivedHandler; + typedef std::function&) > DeleteEndpointResponseReceivedHandler; + typedef std::function&) > DeletePlatformApplicationResponseReceivedHandler; + typedef std::function&) > DeleteSMSSandboxPhoneNumberResponseReceivedHandler; + typedef std::function&) > DeleteTopicResponseReceivedHandler; + typedef std::function&) > GetDataProtectionPolicyResponseReceivedHandler; + typedef std::function&) > GetEndpointAttributesResponseReceivedHandler; + typedef std::function&) > GetPlatformApplicationAttributesResponseReceivedHandler; + typedef std::function&) > GetSMSAttributesResponseReceivedHandler; + typedef std::function&) > GetSMSSandboxAccountStatusResponseReceivedHandler; + typedef std::function&) > GetSubscriptionAttributesResponseReceivedHandler; + typedef std::function&) > GetTopicAttributesResponseReceivedHandler; + typedef std::function&) > ListEndpointsByPlatformApplicationResponseReceivedHandler; + typedef std::function&) > ListOriginationNumbersResponseReceivedHandler; + typedef std::function&) > ListPhoneNumbersOptedOutResponseReceivedHandler; + typedef std::function&) > ListPlatformApplicationsResponseReceivedHandler; + typedef std::function&) > ListSMSSandboxPhoneNumbersResponseReceivedHandler; + typedef std::function&) > ListSubscriptionsResponseReceivedHandler; + typedef std::function&) > ListSubscriptionsByTopicResponseReceivedHandler; + typedef std::function&) > ListTagsForResourceResponseReceivedHandler; + typedef std::function&) > ListTopicsResponseReceivedHandler; + typedef std::function&) > OptInPhoneNumberResponseReceivedHandler; + typedef std::function&) > PublishResponseReceivedHandler; + typedef std::function&) > PublishBatchResponseReceivedHandler; + typedef std::function&) > PutDataProtectionPolicyResponseReceivedHandler; + typedef std::function&) > RemovePermissionResponseReceivedHandler; + typedef std::function&) > SetEndpointAttributesResponseReceivedHandler; + typedef std::function&) > SetPlatformApplicationAttributesResponseReceivedHandler; + typedef std::function&) > SetSMSAttributesResponseReceivedHandler; + typedef std::function&) > SetSubscriptionAttributesResponseReceivedHandler; + typedef std::function&) > SetTopicAttributesResponseReceivedHandler; + typedef std::function&) > SubscribeResponseReceivedHandler; + typedef std::function&) > TagResourceResponseReceivedHandler; + typedef std::function&) > UnsubscribeResponseReceivedHandler; + typedef std::function&) > UntagResourceResponseReceivedHandler; + typedef std::function&) > VerifySMSSandboxPhoneNumberResponseReceivedHandler; + /* End of service model async handlers definitions */ + } // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/SNS_EXPORTS.h b/include/aws/sns/SNS_EXPORTS.h new file mode 100644 index 0000000000000000000000000000000000000000..0cee339f155c4962e5e8ca36d1a87c390c240558 --- /dev/null +++ b/include/aws/sns/SNS_EXPORTS.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#ifdef _MSC_VER + //disable windows complaining about max template size. + #pragma warning (disable : 4503) +#endif // _MSC_VER + +#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #ifdef _MSC_VER + #pragma warning(disable : 4251) + #endif // _MSC_VER + + #ifdef USE_IMPORT_EXPORT + #ifdef AWS_SNS_EXPORTS + #define AWS_SNS_API __declspec(dllexport) + #else + #define AWS_SNS_API __declspec(dllimport) + #endif /* AWS_SNS_EXPORTS */ + #define AWS_SNS_EXTERN + #else + #define AWS_SNS_API + #define AWS_SNS_EXTERN extern + #endif // USE_IMPORT_EXPORT +#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) + #define AWS_SNS_API + #define AWS_SNS_EXTERN extern +#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) diff --git a/include/aws/sns/model/AddPermissionRequest.h b/include/aws/sns/model/AddPermissionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..835d61a059e369885be73b5a0c0b4363ef9ed3f2 --- /dev/null +++ b/include/aws/sns/model/AddPermissionRequest.h @@ -0,0 +1,117 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class AddPermissionRequest : public SNSRequest + { + public: + AWS_SNS_API AddPermissionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "AddPermission"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic whose access control policy you wish to modify.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline AddPermissionRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline AddPermissionRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline AddPermissionRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

A unique identifier for the new policy statement.

+ */ + inline const Aws::String& GetLabel() const{ return m_label; } + inline bool LabelHasBeenSet() const { return m_labelHasBeenSet; } + inline void SetLabel(const Aws::String& value) { m_labelHasBeenSet = true; m_label = value; } + inline void SetLabel(Aws::String&& value) { m_labelHasBeenSet = true; m_label = std::move(value); } + inline void SetLabel(const char* value) { m_labelHasBeenSet = true; m_label.assign(value); } + inline AddPermissionRequest& WithLabel(const Aws::String& value) { SetLabel(value); return *this;} + inline AddPermissionRequest& WithLabel(Aws::String&& value) { SetLabel(std::move(value)); return *this;} + inline AddPermissionRequest& WithLabel(const char* value) { SetLabel(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Web Services account IDs of the users (principals) who will be + * given access to the specified actions. The users must have Amazon Web Services + * account, but do not need to be signed up for this service.

+ */ + inline const Aws::Vector& GetAWSAccountId() const{ return m_aWSAccountId; } + inline bool AWSAccountIdHasBeenSet() const { return m_aWSAccountIdHasBeenSet; } + inline void SetAWSAccountId(const Aws::Vector& value) { m_aWSAccountIdHasBeenSet = true; m_aWSAccountId = value; } + inline void SetAWSAccountId(Aws::Vector&& value) { m_aWSAccountIdHasBeenSet = true; m_aWSAccountId = std::move(value); } + inline AddPermissionRequest& WithAWSAccountId(const Aws::Vector& value) { SetAWSAccountId(value); return *this;} + inline AddPermissionRequest& WithAWSAccountId(Aws::Vector&& value) { SetAWSAccountId(std::move(value)); return *this;} + inline AddPermissionRequest& AddAWSAccountId(const Aws::String& value) { m_aWSAccountIdHasBeenSet = true; m_aWSAccountId.push_back(value); return *this; } + inline AddPermissionRequest& AddAWSAccountId(Aws::String&& value) { m_aWSAccountIdHasBeenSet = true; m_aWSAccountId.push_back(std::move(value)); return *this; } + inline AddPermissionRequest& AddAWSAccountId(const char* value) { m_aWSAccountIdHasBeenSet = true; m_aWSAccountId.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The action you want to allow for the specified principal(s).

Valid + * values: Any Amazon SNS action name, for example Publish.

+ */ + inline const Aws::Vector& GetActionName() const{ return m_actionName; } + inline bool ActionNameHasBeenSet() const { return m_actionNameHasBeenSet; } + inline void SetActionName(const Aws::Vector& value) { m_actionNameHasBeenSet = true; m_actionName = value; } + inline void SetActionName(Aws::Vector&& value) { m_actionNameHasBeenSet = true; m_actionName = std::move(value); } + inline AddPermissionRequest& WithActionName(const Aws::Vector& value) { SetActionName(value); return *this;} + inline AddPermissionRequest& WithActionName(Aws::Vector&& value) { SetActionName(std::move(value)); return *this;} + inline AddPermissionRequest& AddActionName(const Aws::String& value) { m_actionNameHasBeenSet = true; m_actionName.push_back(value); return *this; } + inline AddPermissionRequest& AddActionName(Aws::String&& value) { m_actionNameHasBeenSet = true; m_actionName.push_back(std::move(value)); return *this; } + inline AddPermissionRequest& AddActionName(const char* value) { m_actionNameHasBeenSet = true; m_actionName.push_back(value); return *this; } + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::String m_label; + bool m_labelHasBeenSet = false; + + Aws::Vector m_aWSAccountId; + bool m_aWSAccountIdHasBeenSet = false; + + Aws::Vector m_actionName; + bool m_actionNameHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/BatchResultErrorEntry.h b/include/aws/sns/model/BatchResultErrorEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..2e621e2cb72f2cbb0d2e94867c744672d88be16b --- /dev/null +++ b/include/aws/sns/model/BatchResultErrorEntry.h @@ -0,0 +1,112 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

Gives a detailed description of failed messages in the batch.

See + * Also:

AWS + * API Reference

+ */ + class BatchResultErrorEntry + { + public: + AWS_SNS_API BatchResultErrorEntry(); + AWS_SNS_API BatchResultErrorEntry(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API BatchResultErrorEntry& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

The Id of an entry in a batch request

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline BatchResultErrorEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline BatchResultErrorEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline BatchResultErrorEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

An error code representing why the action failed on this entry.

+ */ + inline const Aws::String& GetCode() const{ return m_code; } + inline bool CodeHasBeenSet() const { return m_codeHasBeenSet; } + inline void SetCode(const Aws::String& value) { m_codeHasBeenSet = true; m_code = value; } + inline void SetCode(Aws::String&& value) { m_codeHasBeenSet = true; m_code = std::move(value); } + inline void SetCode(const char* value) { m_codeHasBeenSet = true; m_code.assign(value); } + inline BatchResultErrorEntry& WithCode(const Aws::String& value) { SetCode(value); return *this;} + inline BatchResultErrorEntry& WithCode(Aws::String&& value) { SetCode(std::move(value)); return *this;} + inline BatchResultErrorEntry& WithCode(const char* value) { SetCode(value); return *this;} + ///@} + + ///@{ + /** + *

A message explaining why the action failed on this entry.

+ */ + inline const Aws::String& GetMessage() const{ return m_message; } + inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } + inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } + inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } + inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } + inline BatchResultErrorEntry& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} + inline BatchResultErrorEntry& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} + inline BatchResultErrorEntry& WithMessage(const char* value) { SetMessage(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether the error happened due to the caller of the batch API + * action.

+ */ + inline bool GetSenderFault() const{ return m_senderFault; } + inline bool SenderFaultHasBeenSet() const { return m_senderFaultHasBeenSet; } + inline void SetSenderFault(bool value) { m_senderFaultHasBeenSet = true; m_senderFault = value; } + inline BatchResultErrorEntry& WithSenderFault(bool value) { SetSenderFault(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_code; + bool m_codeHasBeenSet = false; + + Aws::String m_message; + bool m_messageHasBeenSet = false; + + bool m_senderFault; + bool m_senderFaultHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CheckIfPhoneNumberIsOptedOutRequest.h b/include/aws/sns/model/CheckIfPhoneNumberIsOptedOutRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..be35143bc947cc65995155b568666a16664238c7 --- /dev/null +++ b/include/aws/sns/model/CheckIfPhoneNumberIsOptedOutRequest.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

The input for the CheckIfPhoneNumberIsOptedOut + * action.

See Also:

AWS + * API Reference

+ */ + class CheckIfPhoneNumberIsOptedOutRequest : public SNSRequest + { + public: + AWS_SNS_API CheckIfPhoneNumberIsOptedOutRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CheckIfPhoneNumberIsOptedOut"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The phone number for which you want to check the opt out status.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline CheckIfPhoneNumberIsOptedOutRequest& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline CheckIfPhoneNumberIsOptedOutRequest& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline CheckIfPhoneNumberIsOptedOutRequest& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + private: + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CheckIfPhoneNumberIsOptedOutResult.h b/include/aws/sns/model/CheckIfPhoneNumberIsOptedOutResult.h new file mode 100644 index 0000000000000000000000000000000000000000..9065323cec3de9a059e24c8aee7331cc69771d72 --- /dev/null +++ b/include/aws/sns/model/CheckIfPhoneNumberIsOptedOutResult.h @@ -0,0 +1,70 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

The response from the CheckIfPhoneNumberIsOptedOut + * action.

See Also:

AWS + * API Reference

+ */ + class CheckIfPhoneNumberIsOptedOutResult + { + public: + AWS_SNS_API CheckIfPhoneNumberIsOptedOutResult(); + AWS_SNS_API CheckIfPhoneNumberIsOptedOutResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API CheckIfPhoneNumberIsOptedOutResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether the phone number is opted out:

  • + * true – The phone number is opted out, meaning you cannot publish + * SMS messages to it.

  • false – The phone number is + * opted in, meaning you can publish SMS messages to it.

+ */ + inline bool GetIsOptedOut() const{ return m_isOptedOut; } + inline void SetIsOptedOut(bool value) { m_isOptedOut = value; } + inline CheckIfPhoneNumberIsOptedOutResult& WithIsOptedOut(bool value) { SetIsOptedOut(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline CheckIfPhoneNumberIsOptedOutResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline CheckIfPhoneNumberIsOptedOutResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + bool m_isOptedOut; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ConfirmSubscriptionRequest.h b/include/aws/sns/model/ConfirmSubscriptionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1f3de4909837e0bed2b33ede5957a3e99cffdf01 --- /dev/null +++ b/include/aws/sns/model/ConfirmSubscriptionRequest.h @@ -0,0 +1,102 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for ConfirmSubscription action.

See Also:

AWS + * API Reference

+ */ + class ConfirmSubscriptionRequest : public SNSRequest + { + public: + AWS_SNS_API ConfirmSubscriptionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ConfirmSubscription"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic for which you wish to confirm a subscription.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline ConfirmSubscriptionRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline ConfirmSubscriptionRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline ConfirmSubscriptionRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

Short-lived token sent to an endpoint during the Subscribe + * action.

+ */ + inline const Aws::String& GetToken() const{ return m_token; } + inline bool TokenHasBeenSet() const { return m_tokenHasBeenSet; } + inline void SetToken(const Aws::String& value) { m_tokenHasBeenSet = true; m_token = value; } + inline void SetToken(Aws::String&& value) { m_tokenHasBeenSet = true; m_token = std::move(value); } + inline void SetToken(const char* value) { m_tokenHasBeenSet = true; m_token.assign(value); } + inline ConfirmSubscriptionRequest& WithToken(const Aws::String& value) { SetToken(value); return *this;} + inline ConfirmSubscriptionRequest& WithToken(Aws::String&& value) { SetToken(std::move(value)); return *this;} + inline ConfirmSubscriptionRequest& WithToken(const char* value) { SetToken(value); return *this;} + ///@} + + ///@{ + /** + *

Disallows unauthenticated unsubscribes of the subscription. If the value of + * this parameter is true and the request has an Amazon Web Services + * signature, then only the topic owner and the subscription owner can unsubscribe + * the endpoint. The unsubscribe action requires Amazon Web Services + * authentication.

+ */ + inline const Aws::String& GetAuthenticateOnUnsubscribe() const{ return m_authenticateOnUnsubscribe; } + inline bool AuthenticateOnUnsubscribeHasBeenSet() const { return m_authenticateOnUnsubscribeHasBeenSet; } + inline void SetAuthenticateOnUnsubscribe(const Aws::String& value) { m_authenticateOnUnsubscribeHasBeenSet = true; m_authenticateOnUnsubscribe = value; } + inline void SetAuthenticateOnUnsubscribe(Aws::String&& value) { m_authenticateOnUnsubscribeHasBeenSet = true; m_authenticateOnUnsubscribe = std::move(value); } + inline void SetAuthenticateOnUnsubscribe(const char* value) { m_authenticateOnUnsubscribeHasBeenSet = true; m_authenticateOnUnsubscribe.assign(value); } + inline ConfirmSubscriptionRequest& WithAuthenticateOnUnsubscribe(const Aws::String& value) { SetAuthenticateOnUnsubscribe(value); return *this;} + inline ConfirmSubscriptionRequest& WithAuthenticateOnUnsubscribe(Aws::String&& value) { SetAuthenticateOnUnsubscribe(std::move(value)); return *this;} + inline ConfirmSubscriptionRequest& WithAuthenticateOnUnsubscribe(const char* value) { SetAuthenticateOnUnsubscribe(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::String m_token; + bool m_tokenHasBeenSet = false; + + Aws::String m_authenticateOnUnsubscribe; + bool m_authenticateOnUnsubscribeHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ConfirmSubscriptionResult.h b/include/aws/sns/model/ConfirmSubscriptionResult.h new file mode 100644 index 0000000000000000000000000000000000000000..27325d53fb6158106e8231864437feb50d4f39d5 --- /dev/null +++ b/include/aws/sns/model/ConfirmSubscriptionResult.h @@ -0,0 +1,71 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for ConfirmSubscriptions action.

See Also:

AWS + * API Reference

+ */ + class ConfirmSubscriptionResult + { + public: + AWS_SNS_API ConfirmSubscriptionResult(); + AWS_SNS_API ConfirmSubscriptionResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ConfirmSubscriptionResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The ARN of the created subscription.

+ */ + inline const Aws::String& GetSubscriptionArn() const{ return m_subscriptionArn; } + inline void SetSubscriptionArn(const Aws::String& value) { m_subscriptionArn = value; } + inline void SetSubscriptionArn(Aws::String&& value) { m_subscriptionArn = std::move(value); } + inline void SetSubscriptionArn(const char* value) { m_subscriptionArn.assign(value); } + inline ConfirmSubscriptionResult& WithSubscriptionArn(const Aws::String& value) { SetSubscriptionArn(value); return *this;} + inline ConfirmSubscriptionResult& WithSubscriptionArn(Aws::String&& value) { SetSubscriptionArn(std::move(value)); return *this;} + inline ConfirmSubscriptionResult& WithSubscriptionArn(const char* value) { SetSubscriptionArn(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ConfirmSubscriptionResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ConfirmSubscriptionResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_subscriptionArn; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreatePlatformApplicationRequest.h b/include/aws/sns/model/CreatePlatformApplicationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..957699c2acda40032b2811d4e346be5d61199587 --- /dev/null +++ b/include/aws/sns/model/CreatePlatformApplicationRequest.h @@ -0,0 +1,109 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for CreatePlatformApplication action.

See Also:

AWS + * API Reference

+ */ + class CreatePlatformApplicationRequest : public SNSRequest + { + public: + AWS_SNS_API CreatePlatformApplicationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CreatePlatformApplication"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

Application names must be made up of only uppercase and lowercase ASCII + * letters, numbers, underscores, hyphens, and periods, and must be between 1 and + * 256 characters long.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline CreatePlatformApplicationRequest& WithName(const Aws::String& value) { SetName(value); return *this;} + inline CreatePlatformApplicationRequest& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline CreatePlatformApplicationRequest& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

The following platforms are supported: ADM (Amazon Device Messaging), APNS + * (Apple Push Notification Service), APNS_SANDBOX, and GCM (Firebase Cloud + * Messaging).

+ */ + inline const Aws::String& GetPlatform() const{ return m_platform; } + inline bool PlatformHasBeenSet() const { return m_platformHasBeenSet; } + inline void SetPlatform(const Aws::String& value) { m_platformHasBeenSet = true; m_platform = value; } + inline void SetPlatform(Aws::String&& value) { m_platformHasBeenSet = true; m_platform = std::move(value); } + inline void SetPlatform(const char* value) { m_platformHasBeenSet = true; m_platform.assign(value); } + inline CreatePlatformApplicationRequest& WithPlatform(const Aws::String& value) { SetPlatform(value); return *this;} + inline CreatePlatformApplicationRequest& WithPlatform(Aws::String&& value) { SetPlatform(std::move(value)); return *this;} + inline CreatePlatformApplicationRequest& WithPlatform(const char* value) { SetPlatform(value); return *this;} + ///@} + + ///@{ + /** + *

For a list of attributes, see + * SetPlatformApplicationAttributes .

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline CreatePlatformApplicationRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline CreatePlatformApplicationRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline CreatePlatformApplicationRequest& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline CreatePlatformApplicationRequest& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreatePlatformApplicationRequest& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline CreatePlatformApplicationRequest& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline CreatePlatformApplicationRequest& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline CreatePlatformApplicationRequest& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreatePlatformApplicationRequest& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + Aws::String m_platform; + bool m_platformHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreatePlatformApplicationResult.h b/include/aws/sns/model/CreatePlatformApplicationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c59db752fa33cd61aa82932ae3c2b16e5aa21570 --- /dev/null +++ b/include/aws/sns/model/CreatePlatformApplicationResult.h @@ -0,0 +1,71 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response from CreatePlatformApplication action.

See Also:

AWS + * API Reference

+ */ + class CreatePlatformApplicationResult + { + public: + AWS_SNS_API CreatePlatformApplicationResult(); + AWS_SNS_API CreatePlatformApplicationResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API CreatePlatformApplicationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

PlatformApplicationArn is returned.

+ */ + inline const Aws::String& GetPlatformApplicationArn() const{ return m_platformApplicationArn; } + inline void SetPlatformApplicationArn(const Aws::String& value) { m_platformApplicationArn = value; } + inline void SetPlatformApplicationArn(Aws::String&& value) { m_platformApplicationArn = std::move(value); } + inline void SetPlatformApplicationArn(const char* value) { m_platformApplicationArn.assign(value); } + inline CreatePlatformApplicationResult& WithPlatformApplicationArn(const Aws::String& value) { SetPlatformApplicationArn(value); return *this;} + inline CreatePlatformApplicationResult& WithPlatformApplicationArn(Aws::String&& value) { SetPlatformApplicationArn(std::move(value)); return *this;} + inline CreatePlatformApplicationResult& WithPlatformApplicationArn(const char* value) { SetPlatformApplicationArn(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline CreatePlatformApplicationResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline CreatePlatformApplicationResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_platformApplicationArn; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreatePlatformEndpointRequest.h b/include/aws/sns/model/CreatePlatformEndpointRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5aaf4db30a3bdb03d2b4011ed9ebd82061a7189e --- /dev/null +++ b/include/aws/sns/model/CreatePlatformEndpointRequest.h @@ -0,0 +1,128 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for CreatePlatformEndpoint action.

See Also:

AWS + * API Reference

+ */ + class CreatePlatformEndpointRequest : public SNSRequest + { + public: + AWS_SNS_API CreatePlatformEndpointRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CreatePlatformEndpoint"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

PlatformApplicationArn returned from CreatePlatformApplication + * is used to create a an endpoint.

+ */ + inline const Aws::String& GetPlatformApplicationArn() const{ return m_platformApplicationArn; } + inline bool PlatformApplicationArnHasBeenSet() const { return m_platformApplicationArnHasBeenSet; } + inline void SetPlatformApplicationArn(const Aws::String& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = value; } + inline void SetPlatformApplicationArn(Aws::String&& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = std::move(value); } + inline void SetPlatformApplicationArn(const char* value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn.assign(value); } + inline CreatePlatformEndpointRequest& WithPlatformApplicationArn(const Aws::String& value) { SetPlatformApplicationArn(value); return *this;} + inline CreatePlatformEndpointRequest& WithPlatformApplicationArn(Aws::String&& value) { SetPlatformApplicationArn(std::move(value)); return *this;} + inline CreatePlatformEndpointRequest& WithPlatformApplicationArn(const char* value) { SetPlatformApplicationArn(value); return *this;} + ///@} + + ///@{ + /** + *

Unique identifier created by the notification service for an app on a device. + * The specific name for Token will vary, depending on which notification service + * is being used. For example, when using APNS as the notification service, you + * need the device token. Alternatively, when using GCM (Firebase Cloud Messaging) + * or ADM, the device token equivalent is called the registration ID.

+ */ + inline const Aws::String& GetToken() const{ return m_token; } + inline bool TokenHasBeenSet() const { return m_tokenHasBeenSet; } + inline void SetToken(const Aws::String& value) { m_tokenHasBeenSet = true; m_token = value; } + inline void SetToken(Aws::String&& value) { m_tokenHasBeenSet = true; m_token = std::move(value); } + inline void SetToken(const char* value) { m_tokenHasBeenSet = true; m_token.assign(value); } + inline CreatePlatformEndpointRequest& WithToken(const Aws::String& value) { SetToken(value); return *this;} + inline CreatePlatformEndpointRequest& WithToken(Aws::String&& value) { SetToken(std::move(value)); return *this;} + inline CreatePlatformEndpointRequest& WithToken(const char* value) { SetToken(value); return *this;} + ///@} + + ///@{ + /** + *

Arbitrary user data to associate with the endpoint. Amazon SNS does not use + * this data. The data must be in UTF-8 format and less than 2KB.

+ */ + inline const Aws::String& GetCustomUserData() const{ return m_customUserData; } + inline bool CustomUserDataHasBeenSet() const { return m_customUserDataHasBeenSet; } + inline void SetCustomUserData(const Aws::String& value) { m_customUserDataHasBeenSet = true; m_customUserData = value; } + inline void SetCustomUserData(Aws::String&& value) { m_customUserDataHasBeenSet = true; m_customUserData = std::move(value); } + inline void SetCustomUserData(const char* value) { m_customUserDataHasBeenSet = true; m_customUserData.assign(value); } + inline CreatePlatformEndpointRequest& WithCustomUserData(const Aws::String& value) { SetCustomUserData(value); return *this;} + inline CreatePlatformEndpointRequest& WithCustomUserData(Aws::String&& value) { SetCustomUserData(std::move(value)); return *this;} + inline CreatePlatformEndpointRequest& WithCustomUserData(const char* value) { SetCustomUserData(value); return *this;} + ///@} + + ///@{ + /** + *

For a list of attributes, see + * SetEndpointAttributes .

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline CreatePlatformEndpointRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline CreatePlatformEndpointRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline CreatePlatformEndpointRequest& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline CreatePlatformEndpointRequest& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreatePlatformEndpointRequest& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline CreatePlatformEndpointRequest& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline CreatePlatformEndpointRequest& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline CreatePlatformEndpointRequest& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreatePlatformEndpointRequest& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_platformApplicationArn; + bool m_platformApplicationArnHasBeenSet = false; + + Aws::String m_token; + bool m_tokenHasBeenSet = false; + + Aws::String m_customUserData; + bool m_customUserDataHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreatePlatformEndpointResult.h b/include/aws/sns/model/CreatePlatformEndpointResult.h new file mode 100644 index 0000000000000000000000000000000000000000..20b7411f4348d1fb01dfb26f35589bd21f718577 --- /dev/null +++ b/include/aws/sns/model/CreatePlatformEndpointResult.h @@ -0,0 +1,71 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response from CreateEndpoint action.

See Also:

AWS + * API Reference

+ */ + class CreatePlatformEndpointResult + { + public: + AWS_SNS_API CreatePlatformEndpointResult(); + AWS_SNS_API CreatePlatformEndpointResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API CreatePlatformEndpointResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

EndpointArn returned from CreateEndpoint action.

+ */ + inline const Aws::String& GetEndpointArn() const{ return m_endpointArn; } + inline void SetEndpointArn(const Aws::String& value) { m_endpointArn = value; } + inline void SetEndpointArn(Aws::String&& value) { m_endpointArn = std::move(value); } + inline void SetEndpointArn(const char* value) { m_endpointArn.assign(value); } + inline CreatePlatformEndpointResult& WithEndpointArn(const Aws::String& value) { SetEndpointArn(value); return *this;} + inline CreatePlatformEndpointResult& WithEndpointArn(Aws::String&& value) { SetEndpointArn(std::move(value)); return *this;} + inline CreatePlatformEndpointResult& WithEndpointArn(const char* value) { SetEndpointArn(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline CreatePlatformEndpointResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline CreatePlatformEndpointResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_endpointArn; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreateSMSSandboxPhoneNumberRequest.h b/include/aws/sns/model/CreateSMSSandboxPhoneNumberRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a72fe9513fb452f712b13fcc0e751b4e9f3b8ba2 --- /dev/null +++ b/include/aws/sns/model/CreateSMSSandboxPhoneNumberRequest.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class CreateSMSSandboxPhoneNumberRequest : public SNSRequest + { + public: + AWS_SNS_API CreateSMSSandboxPhoneNumberRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CreateSMSSandboxPhoneNumber"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The destination phone number to verify. On verification, Amazon SNS adds this + * phone number to the list of verified phone numbers that you can send SMS + * messages to.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline CreateSMSSandboxPhoneNumberRequest& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline CreateSMSSandboxPhoneNumberRequest& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline CreateSMSSandboxPhoneNumberRequest& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + + ///@{ + /** + *

The language to use for sending the OTP. The default value is + * en-US.

+ */ + inline const LanguageCodeString& GetLanguageCode() const{ return m_languageCode; } + inline bool LanguageCodeHasBeenSet() const { return m_languageCodeHasBeenSet; } + inline void SetLanguageCode(const LanguageCodeString& value) { m_languageCodeHasBeenSet = true; m_languageCode = value; } + inline void SetLanguageCode(LanguageCodeString&& value) { m_languageCodeHasBeenSet = true; m_languageCode = std::move(value); } + inline CreateSMSSandboxPhoneNumberRequest& WithLanguageCode(const LanguageCodeString& value) { SetLanguageCode(value); return *this;} + inline CreateSMSSandboxPhoneNumberRequest& WithLanguageCode(LanguageCodeString&& value) { SetLanguageCode(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + + LanguageCodeString m_languageCode; + bool m_languageCodeHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreateSMSSandboxPhoneNumberResult.h b/include/aws/sns/model/CreateSMSSandboxPhoneNumberResult.h new file mode 100644 index 0000000000000000000000000000000000000000..853aefc15c0836c95e335174b2b991716bf36b52 --- /dev/null +++ b/include/aws/sns/model/CreateSMSSandboxPhoneNumberResult.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class CreateSMSSandboxPhoneNumberResult + { + public: + AWS_SNS_API CreateSMSSandboxPhoneNumberResult(); + AWS_SNS_API CreateSMSSandboxPhoneNumberResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API CreateSMSSandboxPhoneNumberResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline CreateSMSSandboxPhoneNumberResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline CreateSMSSandboxPhoneNumberResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreateTopicRequest.h b/include/aws/sns/model/CreateTopicRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..9d1dd5a70af7b72b89938fb4ee9d729026b99b3a --- /dev/null +++ b/include/aws/sns/model/CreateTopicRequest.h @@ -0,0 +1,186 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for CreateTopic action.

See Also:

AWS + * API Reference

+ */ + class CreateTopicRequest : public SNSRequest + { + public: + AWS_SNS_API CreateTopicRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CreateTopic"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The name of the topic you want to create.

Constraints: Topic names + * must be made up of only uppercase and lowercase ASCII letters, numbers, + * underscores, and hyphens, and must be between 1 and 256 characters long.

+ *

For a FIFO (first-in-first-out) topic, the name must end with the + * .fifo suffix.

+ */ + inline const Aws::String& GetName() const{ return m_name; } + inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } + inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } + inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } + inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } + inline CreateTopicRequest& WithName(const Aws::String& value) { SetName(value); return *this;} + inline CreateTopicRequest& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} + inline CreateTopicRequest& WithName(const char* value) { SetName(value); return *this;} + ///@} + + ///@{ + /** + *

A map of attributes with their corresponding values.

The following + * lists names, descriptions, and values of the special request parameters that the + * CreateTopic action uses:

  • + * DeliveryPolicy – The policy that defines how Amazon SNS retries + * failed deliveries to HTTP/S endpoints.

  • + * DisplayName – The display name to use for a topic with SMS + * subscriptions.

  • FifoTopic – Set to true to create + * a FIFO topic.

  • Policy – The policy that defines + * who can access your topic. By default, only the topic owner can publish or + * subscribe to the topic.

  • SignatureVersion – The + * signature version corresponds to the hashing algorithm used while creating the + * signature of the notifications, subscription confirmations, or unsubscribe + * confirmation messages sent by Amazon SNS. By default, + * SignatureVersion is set to 1.

  • + * TracingConfig – Tracing mode of an Amazon SNS topic. By default + * TracingConfig is set to PassThrough, and the topic + * passes through the tracing header it receives from an Amazon SNS publisher to + * its subscriptions. If set to Active, Amazon SNS will vend X-Ray + * segment data to topic owner account if the sampled flag in the tracing header is + * true. This is only supported on standard topics.

The + * following attribute applies only to server-side + * encryption:

  • KmsMasterKeyId – The ID of an + * Amazon Web Services managed customer master key (CMK) for Amazon SNS or a custom + * CMK. For more information, see Key + * Terms. For more examples, see KeyId + * in the Key Management Service API Reference.

The + * following attributes apply only to FIFO + * topics:

  • ArchivePolicy – The policy that sets + * the retention period for messages stored in the message archive of an Amazon SNS + * FIFO topic.

  • ContentBasedDeduplication – Enables + * content-based deduplication for FIFO topics.

    • By default, + * ContentBasedDeduplication is set to false. If you + * create a FIFO topic and this attribute is false, you must specify a + * value for the MessageDeduplicationId parameter for the Publish + * action.

    • When you set ContentBasedDeduplication + * to true, Amazon SNS uses a SHA-256 hash to generate the + * MessageDeduplicationId using the body of the message (but not the + * attributes of the message).

      (Optional) To override the generated value, + * you can specify a value for the MessageDeduplicationId parameter + * for the Publish action.

  • + * FifoThroughputScope – Enables higher throughput for your FIFO topic + * by adjusting the scope of deduplication. This attribute has two possible + * values:

    • Topic – The scope of message + * deduplication is across the entire topic. This is the default value and + * maintains existing behavior, with a maximum throughput of 3000 messages per + * second or 20MB per second, whichever comes first.

    • + * MessageGroup – The scope of deduplication is within each individual + * message group, which enables higher throughput per topic subject to regional + * quotas. For more information on quotas or to request an increase, see Amazon SNS service + * quotas in the Amazon Web Services General Reference.

  • + *
+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline CreateTopicRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline CreateTopicRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline CreateTopicRequest& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline CreateTopicRequest& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreateTopicRequest& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline CreateTopicRequest& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline CreateTopicRequest& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline CreateTopicRequest& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreateTopicRequest& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

The list of tags to add to a new topic.

To be able to tag a + * topic on creation, you must have the sns:CreateTopic and + * sns:TagResource permissions.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline CreateTopicRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline CreateTopicRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline CreateTopicRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline CreateTopicRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The body of the policy document you want to use for this topic.

You + * can only add one policy per topic.

The policy must be in JSON string + * format.

Length Constraints: Maximum length of 30,720.

+ */ + inline const Aws::String& GetDataProtectionPolicy() const{ return m_dataProtectionPolicy; } + inline bool DataProtectionPolicyHasBeenSet() const { return m_dataProtectionPolicyHasBeenSet; } + inline void SetDataProtectionPolicy(const Aws::String& value) { m_dataProtectionPolicyHasBeenSet = true; m_dataProtectionPolicy = value; } + inline void SetDataProtectionPolicy(Aws::String&& value) { m_dataProtectionPolicyHasBeenSet = true; m_dataProtectionPolicy = std::move(value); } + inline void SetDataProtectionPolicy(const char* value) { m_dataProtectionPolicyHasBeenSet = true; m_dataProtectionPolicy.assign(value); } + inline CreateTopicRequest& WithDataProtectionPolicy(const Aws::String& value) { SetDataProtectionPolicy(value); return *this;} + inline CreateTopicRequest& WithDataProtectionPolicy(Aws::String&& value) { SetDataProtectionPolicy(std::move(value)); return *this;} + inline CreateTopicRequest& WithDataProtectionPolicy(const char* value) { SetDataProtectionPolicy(value); return *this;} + ///@} + private: + + Aws::String m_name; + bool m_nameHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + + Aws::String m_dataProtectionPolicy; + bool m_dataProtectionPolicyHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/CreateTopicResult.h b/include/aws/sns/model/CreateTopicResult.h new file mode 100644 index 0000000000000000000000000000000000000000..80d0e887b2b0c7b0fc9d6b57c319a4bfdb41b88c --- /dev/null +++ b/include/aws/sns/model/CreateTopicResult.h @@ -0,0 +1,71 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response from CreateTopic action.

See Also:

AWS + * API Reference

+ */ + class CreateTopicResult + { + public: + AWS_SNS_API CreateTopicResult(); + AWS_SNS_API CreateTopicResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API CreateTopicResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The Amazon Resource Name (ARN) assigned to the created topic.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline void SetTopicArn(const Aws::String& value) { m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArn.assign(value); } + inline CreateTopicResult& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline CreateTopicResult& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline CreateTopicResult& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline CreateTopicResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline CreateTopicResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_topicArn; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/DeleteEndpointRequest.h b/include/aws/sns/model/DeleteEndpointRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d878bce738893e1381afb0054182d74cc554b0b7 --- /dev/null +++ b/include/aws/sns/model/DeleteEndpointRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for DeleteEndpoint action.

See Also:

AWS + * API Reference

+ */ + class DeleteEndpointRequest : public SNSRequest + { + public: + AWS_SNS_API DeleteEndpointRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteEndpoint"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

EndpointArn of endpoint to delete.

+ */ + inline const Aws::String& GetEndpointArn() const{ return m_endpointArn; } + inline bool EndpointArnHasBeenSet() const { return m_endpointArnHasBeenSet; } + inline void SetEndpointArn(const Aws::String& value) { m_endpointArnHasBeenSet = true; m_endpointArn = value; } + inline void SetEndpointArn(Aws::String&& value) { m_endpointArnHasBeenSet = true; m_endpointArn = std::move(value); } + inline void SetEndpointArn(const char* value) { m_endpointArnHasBeenSet = true; m_endpointArn.assign(value); } + inline DeleteEndpointRequest& WithEndpointArn(const Aws::String& value) { SetEndpointArn(value); return *this;} + inline DeleteEndpointRequest& WithEndpointArn(Aws::String&& value) { SetEndpointArn(std::move(value)); return *this;} + inline DeleteEndpointRequest& WithEndpointArn(const char* value) { SetEndpointArn(value); return *this;} + ///@} + private: + + Aws::String m_endpointArn; + bool m_endpointArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/DeletePlatformApplicationRequest.h b/include/aws/sns/model/DeletePlatformApplicationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..56ea02b28e7d1452c36effe48dfcf783040e36a2 --- /dev/null +++ b/include/aws/sns/model/DeletePlatformApplicationRequest.h @@ -0,0 +1,65 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for DeletePlatformApplication action.

See + * Also:

AWS + * API Reference

+ */ + class DeletePlatformApplicationRequest : public SNSRequest + { + public: + AWS_SNS_API DeletePlatformApplicationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeletePlatformApplication"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

PlatformApplicationArn of platform application object to + * delete.

+ */ + inline const Aws::String& GetPlatformApplicationArn() const{ return m_platformApplicationArn; } + inline bool PlatformApplicationArnHasBeenSet() const { return m_platformApplicationArnHasBeenSet; } + inline void SetPlatformApplicationArn(const Aws::String& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = value; } + inline void SetPlatformApplicationArn(Aws::String&& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = std::move(value); } + inline void SetPlatformApplicationArn(const char* value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn.assign(value); } + inline DeletePlatformApplicationRequest& WithPlatformApplicationArn(const Aws::String& value) { SetPlatformApplicationArn(value); return *this;} + inline DeletePlatformApplicationRequest& WithPlatformApplicationArn(Aws::String&& value) { SetPlatformApplicationArn(std::move(value)); return *this;} + inline DeletePlatformApplicationRequest& WithPlatformApplicationArn(const char* value) { SetPlatformApplicationArn(value); return *this;} + ///@} + private: + + Aws::String m_platformApplicationArn; + bool m_platformApplicationArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/DeleteSMSSandboxPhoneNumberRequest.h b/include/aws/sns/model/DeleteSMSSandboxPhoneNumberRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..4e2104aa54b82153a25151cc69c3d6dad1f71f88 --- /dev/null +++ b/include/aws/sns/model/DeleteSMSSandboxPhoneNumberRequest.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class DeleteSMSSandboxPhoneNumberRequest : public SNSRequest + { + public: + AWS_SNS_API DeleteSMSSandboxPhoneNumberRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteSMSSandboxPhoneNumber"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The destination phone number to delete.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline DeleteSMSSandboxPhoneNumberRequest& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline DeleteSMSSandboxPhoneNumberRequest& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline DeleteSMSSandboxPhoneNumberRequest& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + private: + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/DeleteSMSSandboxPhoneNumberResult.h b/include/aws/sns/model/DeleteSMSSandboxPhoneNumberResult.h new file mode 100644 index 0000000000000000000000000000000000000000..052abd3c033a66b165ebd6ee9e58bd3ff91ba78f --- /dev/null +++ b/include/aws/sns/model/DeleteSMSSandboxPhoneNumberResult.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class DeleteSMSSandboxPhoneNumberResult + { + public: + AWS_SNS_API DeleteSMSSandboxPhoneNumberResult(); + AWS_SNS_API DeleteSMSSandboxPhoneNumberResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API DeleteSMSSandboxPhoneNumberResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline DeleteSMSSandboxPhoneNumberResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline DeleteSMSSandboxPhoneNumberResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/DeleteTopicRequest.h b/include/aws/sns/model/DeleteTopicRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..050b7d31667681ec55b8deaf0f6a1780379b6525 --- /dev/null +++ b/include/aws/sns/model/DeleteTopicRequest.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class DeleteTopicRequest : public SNSRequest + { + public: + AWS_SNS_API DeleteTopicRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteTopic"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic you want to delete.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline DeleteTopicRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline DeleteTopicRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline DeleteTopicRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetDataProtectionPolicyRequest.h b/include/aws/sns/model/GetDataProtectionPolicyRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5f802a0fd3165f34405d2dfb6b613bf986abff00 --- /dev/null +++ b/include/aws/sns/model/GetDataProtectionPolicyRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class GetDataProtectionPolicyRequest : public SNSRequest + { + public: + AWS_SNS_API GetDataProtectionPolicyRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetDataProtectionPolicy"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic whose DataProtectionPolicy you want to + * get.

For more information about ARNs, see Amazon + * Resource Names (ARNs) in the Amazon Web Services General Reference.

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline GetDataProtectionPolicyRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline GetDataProtectionPolicyRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline GetDataProtectionPolicyRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetDataProtectionPolicyResult.h b/include/aws/sns/model/GetDataProtectionPolicyResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f14786809287b4f56c76bc62a8b430b249c83a52 --- /dev/null +++ b/include/aws/sns/model/GetDataProtectionPolicyResult.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class GetDataProtectionPolicyResult + { + public: + AWS_SNS_API GetDataProtectionPolicyResult(); + AWS_SNS_API GetDataProtectionPolicyResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API GetDataProtectionPolicyResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Retrieves the DataProtectionPolicy in JSON string format.

+ */ + inline const Aws::String& GetDataProtectionPolicy() const{ return m_dataProtectionPolicy; } + inline void SetDataProtectionPolicy(const Aws::String& value) { m_dataProtectionPolicy = value; } + inline void SetDataProtectionPolicy(Aws::String&& value) { m_dataProtectionPolicy = std::move(value); } + inline void SetDataProtectionPolicy(const char* value) { m_dataProtectionPolicy.assign(value); } + inline GetDataProtectionPolicyResult& WithDataProtectionPolicy(const Aws::String& value) { SetDataProtectionPolicy(value); return *this;} + inline GetDataProtectionPolicyResult& WithDataProtectionPolicy(Aws::String&& value) { SetDataProtectionPolicy(std::move(value)); return *this;} + inline GetDataProtectionPolicyResult& WithDataProtectionPolicy(const char* value) { SetDataProtectionPolicy(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetDataProtectionPolicyResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetDataProtectionPolicyResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_dataProtectionPolicy; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetEndpointAttributesRequest.h b/include/aws/sns/model/GetEndpointAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e1c8c4415fb0e61e19d0b3e84812aa398e8746f5 --- /dev/null +++ b/include/aws/sns/model/GetEndpointAttributesRequest.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for GetEndpointAttributes action.

See Also:

+ * AWS + * API Reference

+ */ + class GetEndpointAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API GetEndpointAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetEndpointAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

EndpointArn for GetEndpointAttributes input.

+ */ + inline const Aws::String& GetEndpointArn() const{ return m_endpointArn; } + inline bool EndpointArnHasBeenSet() const { return m_endpointArnHasBeenSet; } + inline void SetEndpointArn(const Aws::String& value) { m_endpointArnHasBeenSet = true; m_endpointArn = value; } + inline void SetEndpointArn(Aws::String&& value) { m_endpointArnHasBeenSet = true; m_endpointArn = std::move(value); } + inline void SetEndpointArn(const char* value) { m_endpointArnHasBeenSet = true; m_endpointArn.assign(value); } + inline GetEndpointAttributesRequest& WithEndpointArn(const Aws::String& value) { SetEndpointArn(value); return *this;} + inline GetEndpointAttributesRequest& WithEndpointArn(Aws::String&& value) { SetEndpointArn(std::move(value)); return *this;} + inline GetEndpointAttributesRequest& WithEndpointArn(const char* value) { SetEndpointArn(value); return *this;} + ///@} + private: + + Aws::String m_endpointArn; + bool m_endpointArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetEndpointAttributesResult.h b/include/aws/sns/model/GetEndpointAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f21970937cc54d1209e301ab37dce28407058445 --- /dev/null +++ b/include/aws/sns/model/GetEndpointAttributesResult.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response from GetEndpointAttributes of the + * EndpointArn.

See Also:

AWS + * API Reference

+ */ + class GetEndpointAttributesResult + { + public: + AWS_SNS_API GetEndpointAttributesResult(); + AWS_SNS_API GetEndpointAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API GetEndpointAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Attributes include the following:

  • + * CustomUserData – arbitrary user data to associate with the + * endpoint. Amazon SNS does not use this data. The data must be in UTF-8 format + * and less than 2KB.

  • Enabled – flag that + * enables/disables delivery to the endpoint. Amazon SNS will set this to false + * when a notification service indicates to Amazon SNS that the endpoint is + * invalid. Users can set it back to true, typically after updating Token.

    + *
  • Token – device token, also referred to as a + * registration id, for an app and mobile device. This is returned from the + * notification service when an app and mobile device are registered with the + * notification service.

    The device token for the iOS platform is + * returned in lowercase.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline void SetAttributes(const Aws::Map& value) { m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributes = std::move(value); } + inline GetEndpointAttributesResult& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline GetEndpointAttributesResult& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline GetEndpointAttributesResult& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributes.emplace(key, value); return *this; } + inline GetEndpointAttributesResult& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetEndpointAttributesResult& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetEndpointAttributesResult& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline GetEndpointAttributesResult& AddAttributes(const char* key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetEndpointAttributesResult& AddAttributes(Aws::String&& key, const char* value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetEndpointAttributesResult& AddAttributes(const char* key, const char* value) { m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetEndpointAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetEndpointAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Map m_attributes; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetPlatformApplicationAttributesRequest.h b/include/aws/sns/model/GetPlatformApplicationAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a55cdf48ed695c91d4bb786442c23bcb14fc58c2 --- /dev/null +++ b/include/aws/sns/model/GetPlatformApplicationAttributesRequest.h @@ -0,0 +1,65 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for GetPlatformApplicationAttributes action.

See + * Also:

AWS + * API Reference

+ */ + class GetPlatformApplicationAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API GetPlatformApplicationAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetPlatformApplicationAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

PlatformApplicationArn for + * GetPlatformApplicationAttributesInput.

+ */ + inline const Aws::String& GetPlatformApplicationArn() const{ return m_platformApplicationArn; } + inline bool PlatformApplicationArnHasBeenSet() const { return m_platformApplicationArnHasBeenSet; } + inline void SetPlatformApplicationArn(const Aws::String& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = value; } + inline void SetPlatformApplicationArn(Aws::String&& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = std::move(value); } + inline void SetPlatformApplicationArn(const char* value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn.assign(value); } + inline GetPlatformApplicationAttributesRequest& WithPlatformApplicationArn(const Aws::String& value) { SetPlatformApplicationArn(value); return *this;} + inline GetPlatformApplicationAttributesRequest& WithPlatformApplicationArn(Aws::String&& value) { SetPlatformApplicationArn(std::move(value)); return *this;} + inline GetPlatformApplicationAttributesRequest& WithPlatformApplicationArn(const char* value) { SetPlatformApplicationArn(value); return *this;} + ///@} + private: + + Aws::String m_platformApplicationArn; + bool m_platformApplicationArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetPlatformApplicationAttributesResult.h b/include/aws/sns/model/GetPlatformApplicationAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..add07fe80e3a6372008492884bc2ede79144df48 --- /dev/null +++ b/include/aws/sns/model/GetPlatformApplicationAttributesResult.h @@ -0,0 +1,96 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for GetPlatformApplicationAttributes + * action.

See Also:

AWS + * API Reference

+ */ + class GetPlatformApplicationAttributesResult + { + public: + AWS_SNS_API GetPlatformApplicationAttributesResult(); + AWS_SNS_API GetPlatformApplicationAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API GetPlatformApplicationAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Attributes include the following:

  • + * AppleCertificateExpiryDate – The expiry date of the SSL certificate + * used to configure certificate-based authentication.

  • + * ApplePlatformTeamID – The Apple developer account ID used to + * configure token-based authentication.

  • + * ApplePlatformBundleID – The app identifier used to configure + * token-based authentication.

  • AuthenticationMethod + * – Returns the credential type used when sending push notifications from + * application to APNS/APNS_Sandbox, or application to GCM.

    • APNS – + * Returns the token or certificate.

    • GCM – Returns the token or + * key.

  • EventEndpointCreated – Topic + * ARN to which EndpointCreated event notifications should be sent.

  • + *

    EventEndpointDeleted – Topic ARN to which EndpointDeleted event + * notifications should be sent.

  • + * EventEndpointUpdated – Topic ARN to which EndpointUpdate event + * notifications should be sent.

  • + * EventDeliveryFailure – Topic ARN to which DeliveryFailure event + * notifications should be sent upon Direct Publish delivery failure (permanent) to + * one of the application's endpoints.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline void SetAttributes(const Aws::Map& value) { m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributes = std::move(value); } + inline GetPlatformApplicationAttributesResult& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline GetPlatformApplicationAttributesResult& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline GetPlatformApplicationAttributesResult& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributes.emplace(key, value); return *this; } + inline GetPlatformApplicationAttributesResult& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetPlatformApplicationAttributesResult& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetPlatformApplicationAttributesResult& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline GetPlatformApplicationAttributesResult& AddAttributes(const char* key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetPlatformApplicationAttributesResult& AddAttributes(Aws::String&& key, const char* value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetPlatformApplicationAttributesResult& AddAttributes(const char* key, const char* value) { m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetPlatformApplicationAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetPlatformApplicationAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Map m_attributes; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetSMSAttributesRequest.h b/include/aws/sns/model/GetSMSAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2469e2e0bc864fc447ee40dcb1cc940d4f0a4df5 --- /dev/null +++ b/include/aws/sns/model/GetSMSAttributesRequest.h @@ -0,0 +1,70 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

The input for the GetSMSAttributes request.

See + * Also:

AWS + * API Reference

+ */ + class GetSMSAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API GetSMSAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetSMSAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

A list of the individual attribute names, such as + * MonthlySpendLimit, for which you want values.

For all + * attribute names, see SetSMSAttributes.

+ *

If you don't use this parameter, Amazon SNS returns all SMS attributes.

+ */ + inline const Aws::Vector& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Vector& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Vector&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline GetSMSAttributesRequest& WithAttributes(const Aws::Vector& value) { SetAttributes(value); return *this;} + inline GetSMSAttributesRequest& WithAttributes(Aws::Vector&& value) { SetAttributes(std::move(value)); return *this;} + inline GetSMSAttributesRequest& AddAttributes(const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.push_back(value); return *this; } + inline GetSMSAttributesRequest& AddAttributes(Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.push_back(std::move(value)); return *this; } + inline GetSMSAttributesRequest& AddAttributes(const char* value) { m_attributesHasBeenSet = true; m_attributes.push_back(value); return *this; } + ///@} + private: + + Aws::Vector m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetSMSAttributesResult.h b/include/aws/sns/model/GetSMSAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..73c6a6690d49358954e84e4905ed3a80ad452467 --- /dev/null +++ b/include/aws/sns/model/GetSMSAttributesResult.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

The response from the GetSMSAttributes request.

See + * Also:

AWS + * API Reference

+ */ + class GetSMSAttributesResult + { + public: + AWS_SNS_API GetSMSAttributesResult(); + AWS_SNS_API GetSMSAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API GetSMSAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The SMS attribute names and their values.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline void SetAttributes(const Aws::Map& value) { m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributes = std::move(value); } + inline GetSMSAttributesResult& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline GetSMSAttributesResult& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline GetSMSAttributesResult& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributes.emplace(key, value); return *this; } + inline GetSMSAttributesResult& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetSMSAttributesResult& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetSMSAttributesResult& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline GetSMSAttributesResult& AddAttributes(const char* key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetSMSAttributesResult& AddAttributes(Aws::String&& key, const char* value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetSMSAttributesResult& AddAttributes(const char* key, const char* value) { m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetSMSAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetSMSAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Map m_attributes; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetSMSSandboxAccountStatusRequest.h b/include/aws/sns/model/GetSMSSandboxAccountStatusRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..326c294fb6bd9b09386b6a9f0713b147d3762218 --- /dev/null +++ b/include/aws/sns/model/GetSMSSandboxAccountStatusRequest.h @@ -0,0 +1,40 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class GetSMSSandboxAccountStatusRequest : public SNSRequest + { + public: + AWS_SNS_API GetSMSSandboxAccountStatusRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetSMSSandboxAccountStatus"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetSMSSandboxAccountStatusResult.h b/include/aws/sns/model/GetSMSSandboxAccountStatusResult.h new file mode 100644 index 0000000000000000000000000000000000000000..29aa829cc210d1d7a1503453e392f53889bbadaf --- /dev/null +++ b/include/aws/sns/model/GetSMSSandboxAccountStatusResult.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class GetSMSSandboxAccountStatusResult + { + public: + AWS_SNS_API GetSMSSandboxAccountStatusResult(); + AWS_SNS_API GetSMSSandboxAccountStatusResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API GetSMSSandboxAccountStatusResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Indicates whether the calling Amazon Web Services account is in the SMS + * sandbox.

+ */ + inline bool GetIsInSandbox() const{ return m_isInSandbox; } + inline void SetIsInSandbox(bool value) { m_isInSandbox = value; } + inline GetSMSSandboxAccountStatusResult& WithIsInSandbox(bool value) { SetIsInSandbox(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetSMSSandboxAccountStatusResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetSMSSandboxAccountStatusResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + bool m_isInSandbox; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetSubscriptionAttributesRequest.h b/include/aws/sns/model/GetSubscriptionAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..b9b6a859dcfd31c41292925430278a0d6346e5d9 --- /dev/null +++ b/include/aws/sns/model/GetSubscriptionAttributesRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for GetSubscriptionAttributes.

See Also:

AWS + * API Reference

+ */ + class GetSubscriptionAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API GetSubscriptionAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetSubscriptionAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the subscription whose properties you want to get.

+ */ + inline const Aws::String& GetSubscriptionArn() const{ return m_subscriptionArn; } + inline bool SubscriptionArnHasBeenSet() const { return m_subscriptionArnHasBeenSet; } + inline void SetSubscriptionArn(const Aws::String& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = value; } + inline void SetSubscriptionArn(Aws::String&& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = std::move(value); } + inline void SetSubscriptionArn(const char* value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn.assign(value); } + inline GetSubscriptionAttributesRequest& WithSubscriptionArn(const Aws::String& value) { SetSubscriptionArn(value); return *this;} + inline GetSubscriptionAttributesRequest& WithSubscriptionArn(Aws::String&& value) { SetSubscriptionArn(std::move(value)); return *this;} + inline GetSubscriptionAttributesRequest& WithSubscriptionArn(const char* value) { SetSubscriptionArn(value); return *this;} + ///@} + private: + + Aws::String m_subscriptionArn; + bool m_subscriptionArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetSubscriptionAttributesResult.h b/include/aws/sns/model/GetSubscriptionAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..f1e32cd2f2d0967a9a0606680f533ee1e008ae09 --- /dev/null +++ b/include/aws/sns/model/GetSubscriptionAttributesResult.h @@ -0,0 +1,116 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for GetSubscriptionAttributes action.

See Also:

AWS + * API Reference

+ */ + class GetSubscriptionAttributesResult + { + public: + AWS_SNS_API GetSubscriptionAttributesResult(); + AWS_SNS_API GetSubscriptionAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API GetSubscriptionAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A map of the subscription's attributes. Attributes in this map include the + * following:

  • ConfirmationWasAuthenticated – + * true if the subscription confirmation request was + * authenticated.

  • DeliveryPolicy – The JSON + * serialization of the subscription's delivery policy.

  • + * EffectiveDeliveryPolicy – The JSON serialization of the effective + * delivery policy that takes into account the topic delivery policy and account + * system defaults.

  • FilterPolicy – The filter + * policy JSON that is assigned to the subscription. For more information, see Amazon + * SNS Message Filtering in the Amazon SNS Developer Guide.

  • + *
  • FilterPolicyScope – This attribute lets you choose the + * filtering scope by using one of the following string value types:

    • + *

      MessageAttributes (default) – The filter is applied on the + * message attributes.

    • MessageBody – The filter is + * applied on the message body.

  • Owner – + * The Amazon Web Services account ID of the subscription's owner.

  • + *

    PendingConfirmation – true if the subscription + * hasn't been confirmed. To confirm a pending subscription, call the + * ConfirmSubscription action with a confirmation token.

  • + *
  • RawMessageDelivery – true if raw message + * delivery is enabled for the subscription. Raw messages are free of JSON + * formatting and can be sent to HTTP/S and Amazon SQS endpoints.

  • + *

    RedrivePolicy – When specified, sends undeliverable messages to + * the specified Amazon SQS dead-letter queue. Messages that can't be delivered due + * to client errors (for example, when the subscribed endpoint is unreachable) or + * server errors (for example, when the service that powers the subscribed endpoint + * becomes unavailable) are held in the dead-letter queue for further analysis or + * reprocessing.

  • SubscriptionArn – The + * subscription's ARN.

  • TopicArn – The topic ARN + * that the subscription is associated with.

The following + * attribute applies only to Amazon Data Firehose delivery stream + * subscriptions:

  • SubscriptionRoleArn – The ARN of + * the IAM role that has the following:

    • Permission to write to the + * Firehose delivery stream

    • Amazon SNS listed as a trusted + * entity

    Specifying a valid ARN for this attribute is required + * for Firehose delivery stream subscriptions. For more information, see Fanout + * to Firehose delivery streams in the Amazon SNS Developer Guide.

    + *
+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline void SetAttributes(const Aws::Map& value) { m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributes = std::move(value); } + inline GetSubscriptionAttributesResult& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline GetSubscriptionAttributesResult& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline GetSubscriptionAttributesResult& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributes.emplace(key, value); return *this; } + inline GetSubscriptionAttributesResult& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetSubscriptionAttributesResult& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetSubscriptionAttributesResult& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline GetSubscriptionAttributesResult& AddAttributes(const char* key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetSubscriptionAttributesResult& AddAttributes(Aws::String&& key, const char* value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetSubscriptionAttributesResult& AddAttributes(const char* key, const char* value) { m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetSubscriptionAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetSubscriptionAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Map m_attributes; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetTopicAttributesRequest.h b/include/aws/sns/model/GetTopicAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c230ad1ac1332087777b27b61cf18ab88bd8544c --- /dev/null +++ b/include/aws/sns/model/GetTopicAttributesRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for GetTopicAttributes action.

See Also:

AWS + * API Reference

+ */ + class GetTopicAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API GetTopicAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetTopicAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic whose properties you want to get.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline GetTopicAttributesRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline GetTopicAttributesRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline GetTopicAttributesRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/GetTopicAttributesResult.h b/include/aws/sns/model/GetTopicAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c7aafa45f96408ce90899705a91a716f2b9196e8 --- /dev/null +++ b/include/aws/sns/model/GetTopicAttributesResult.h @@ -0,0 +1,138 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for GetTopicAttributes action.

See Also:

AWS + * API Reference

+ */ + class GetTopicAttributesResult + { + public: + AWS_SNS_API GetTopicAttributesResult(); + AWS_SNS_API GetTopicAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API GetTopicAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A map of the topic's attributes. Attributes in this map include the + * following:

  • DeliveryPolicy – The JSON + * serialization of the topic's delivery policy.

  • + * DisplayName – The human-readable name used in the From + * field for notifications to email and email-json + * endpoints.

  • EffectiveDeliveryPolicy – The JSON + * serialization of the effective delivery policy, taking system defaults into + * account.

  • Owner – The Amazon Web Services account + * ID of the topic's owner.

  • Policy – The JSON + * serialization of the topic's access control policy.

  • + * SignatureVersion – The signature version corresponds to the hashing + * algorithm used while creating the signature of the notifications, subscription + * confirmations, or unsubscribe confirmation messages sent by Amazon SNS.

      + *
    • By default, SignatureVersion is set to 1. The + * signature is a Base64-encoded SHA1withRSA signature.

    • + *

      When you set SignatureVersion to 2. Amazon SNS uses a + * Base64-encoded SHA256withRSA signature.

      If the API + * response does not include the SignatureVersion attribute, it means + * that the SignatureVersion for the topic has value 1.

      + *
  • SubscriptionsConfirmed – The + * number of confirmed subscriptions for the topic.

  • + * SubscriptionsDeleted – The number of deleted subscriptions for the + * topic.

  • SubscriptionsPending – The number of + * subscriptions pending confirmation for the topic.

  • + * TopicArn – The topic's ARN.

  • + * TracingConfig – Tracing mode of an Amazon SNS topic. By default + * TracingConfig is set to PassThrough, and the topic + * passes through the tracing header it receives from an Amazon SNS publisher to + * its subscriptions. If set to Active, Amazon SNS will vend X-Ray + * segment data to topic owner account if the sampled flag in the tracing header is + * true. This is only supported on standard topics.

The + * following attribute applies only to server-side-encryption:

+ *
  • KmsMasterKeyId - The ID of an Amazon Web Services + * managed customer master key (CMK) for Amazon SNS or a custom CMK. For more + * information, see Key + * Terms. For more examples, see KeyId + * in the Key Management Service API Reference.

The + * following attributes apply only to FIFO + * topics:

  • ArchivePolicy – The policy that sets + * the retention period for messages stored in the message archive of an Amazon SNS + * FIFO topic.

  • BeginningArchiveTime – The earliest + * starting point at which a message in the topic’s archive can be replayed from. + * This point in time is based on the configured message retention period set by + * the topic’s message archiving policy.

  • + * ContentBasedDeduplication – Enables content-based deduplication for + * FIFO topics.

    • By default, ContentBasedDeduplication + * is set to false. If you create a FIFO topic and this attribute is + * false, you must specify a value for the + * MessageDeduplicationId parameter for the Publish + * action.

    • When you set ContentBasedDeduplication + * to true, Amazon SNS uses a SHA-256 hash to generate the + * MessageDeduplicationId using the body of the message (but not the + * attributes of the message).

      (Optional) To override the generated value, + * you can specify a value for the MessageDeduplicationId parameter + * for the Publish action.

  • + * FifoTopic – When this is set to true, a FIFO topic is + * created.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline void SetAttributes(const Aws::Map& value) { m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributes = std::move(value); } + inline GetTopicAttributesResult& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline GetTopicAttributesResult& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline GetTopicAttributesResult& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributes.emplace(key, value); return *this; } + inline GetTopicAttributesResult& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetTopicAttributesResult& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetTopicAttributesResult& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline GetTopicAttributesResult& AddAttributes(const char* key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetTopicAttributesResult& AddAttributes(Aws::String&& key, const char* value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetTopicAttributesResult& AddAttributes(const char* key, const char* value) { m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetTopicAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetTopicAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Map m_attributes; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/LanguageCodeString.h b/include/aws/sns/model/LanguageCodeString.h new file mode 100644 index 0000000000000000000000000000000000000000..dfa7e169123dcbf913c8a3e9a9e55c6a5051cbbc --- /dev/null +++ b/include/aws/sns/model/LanguageCodeString.h @@ -0,0 +1,42 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + enum class LanguageCodeString + { + NOT_SET, + en_US, + en_GB, + es_419, + es_ES, + de_DE, + fr_CA, + fr_FR, + it_IT, + ja_JP, + pt_BR, + kr_KR, + zh_CN, + zh_TW + }; + +namespace LanguageCodeStringMapper +{ +AWS_SNS_API LanguageCodeString GetLanguageCodeStringForName(const Aws::String& name); + +AWS_SNS_API Aws::String GetNameForLanguageCodeString(LanguageCodeString value); +} // namespace LanguageCodeStringMapper +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListEndpointsByPlatformApplicationRequest.h b/include/aws/sns/model/ListEndpointsByPlatformApplicationRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..44199bb8700d26a6e1cfbbf6f9ff85e40470a809 --- /dev/null +++ b/include/aws/sns/model/ListEndpointsByPlatformApplicationRequest.h @@ -0,0 +1,84 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for ListEndpointsByPlatformApplication + * action.

See Also:

AWS + * API Reference

+ */ + class ListEndpointsByPlatformApplicationRequest : public SNSRequest + { + public: + AWS_SNS_API ListEndpointsByPlatformApplicationRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListEndpointsByPlatformApplication"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

PlatformApplicationArn for + * ListEndpointsByPlatformApplicationInput action.

+ */ + inline const Aws::String& GetPlatformApplicationArn() const{ return m_platformApplicationArn; } + inline bool PlatformApplicationArnHasBeenSet() const { return m_platformApplicationArnHasBeenSet; } + inline void SetPlatformApplicationArn(const Aws::String& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = value; } + inline void SetPlatformApplicationArn(Aws::String&& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = std::move(value); } + inline void SetPlatformApplicationArn(const char* value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn.assign(value); } + inline ListEndpointsByPlatformApplicationRequest& WithPlatformApplicationArn(const Aws::String& value) { SetPlatformApplicationArn(value); return *this;} + inline ListEndpointsByPlatformApplicationRequest& WithPlatformApplicationArn(Aws::String&& value) { SetPlatformApplicationArn(std::move(value)); return *this;} + inline ListEndpointsByPlatformApplicationRequest& WithPlatformApplicationArn(const char* value) { SetPlatformApplicationArn(value); return *this;} + ///@} + + ///@{ + /** + *

NextToken string is used when calling + * ListEndpointsByPlatformApplication action to retrieve additional + * records that are available after the first page results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListEndpointsByPlatformApplicationRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListEndpointsByPlatformApplicationRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListEndpointsByPlatformApplicationRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_platformApplicationArn; + bool m_platformApplicationArnHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListEndpointsByPlatformApplicationResult.h b/include/aws/sns/model/ListEndpointsByPlatformApplicationResult.h new file mode 100644 index 0000000000000000000000000000000000000000..3888b11c74082bf067f55440a93817dda6fa97b4 --- /dev/null +++ b/include/aws/sns/model/ListEndpointsByPlatformApplicationResult.h @@ -0,0 +1,92 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for ListEndpointsByPlatformApplication + * action.

See Also:

AWS + * API Reference

+ */ + class ListEndpointsByPlatformApplicationResult + { + public: + AWS_SNS_API ListEndpointsByPlatformApplicationResult(); + AWS_SNS_API ListEndpointsByPlatformApplicationResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListEndpointsByPlatformApplicationResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Endpoints returned for ListEndpointsByPlatformApplication + * action.

+ */ + inline const Aws::Vector& GetEndpoints() const{ return m_endpoints; } + inline void SetEndpoints(const Aws::Vector& value) { m_endpoints = value; } + inline void SetEndpoints(Aws::Vector&& value) { m_endpoints = std::move(value); } + inline ListEndpointsByPlatformApplicationResult& WithEndpoints(const Aws::Vector& value) { SetEndpoints(value); return *this;} + inline ListEndpointsByPlatformApplicationResult& WithEndpoints(Aws::Vector&& value) { SetEndpoints(std::move(value)); return *this;} + inline ListEndpointsByPlatformApplicationResult& AddEndpoints(const Aws::String& value) { m_endpoints.push_back(value); return *this; } + inline ListEndpointsByPlatformApplicationResult& AddEndpoints(Aws::String&& value) { m_endpoints.push_back(std::move(value)); return *this; } + inline ListEndpointsByPlatformApplicationResult& AddEndpoints(const char* value) { m_endpoints.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

NextToken string is returned when calling + * ListEndpointsByPlatformApplication action if additional records are + * available after the first page results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListEndpointsByPlatformApplicationResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListEndpointsByPlatformApplicationResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListEndpointsByPlatformApplicationResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListEndpointsByPlatformApplicationResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListEndpointsByPlatformApplicationResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_endpoints; + + Aws::String m_nextToken; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListOriginationNumbersRequest.h b/include/aws/sns/model/ListOriginationNumbersRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..fd651c683e274c07a6b35b6f5d289bd36633d3b7 --- /dev/null +++ b/include/aws/sns/model/ListOriginationNumbersRequest.h @@ -0,0 +1,74 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class ListOriginationNumbersRequest : public SNSRequest + { + public: + AWS_SNS_API ListOriginationNumbersRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListOriginationNumbers"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

Token that the previous ListOriginationNumbers request + * returns.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListOriginationNumbersRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListOriginationNumbersRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListOriginationNumbersRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of origination numbers to return.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline ListOriginationNumbersRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListOriginationNumbersResult.h b/include/aws/sns/model/ListOriginationNumbersResult.h new file mode 100644 index 0000000000000000000000000000000000000000..75a37e82d71a7eadb7f1c4516801997dd8c5fe5c --- /dev/null +++ b/include/aws/sns/model/ListOriginationNumbersResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class ListOriginationNumbersResult + { + public: + AWS_SNS_API ListOriginationNumbersResult(); + AWS_SNS_API ListOriginationNumbersResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListOriginationNumbersResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A NextToken string is returned when you call the + * ListOriginationNumbers operation if additional pages of records are + * available.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListOriginationNumbersResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListOriginationNumbersResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListOriginationNumbersResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

A list of the calling account's verified and pending origination numbers.

+ */ + inline const Aws::Vector& GetPhoneNumbers() const{ return m_phoneNumbers; } + inline void SetPhoneNumbers(const Aws::Vector& value) { m_phoneNumbers = value; } + inline void SetPhoneNumbers(Aws::Vector&& value) { m_phoneNumbers = std::move(value); } + inline ListOriginationNumbersResult& WithPhoneNumbers(const Aws::Vector& value) { SetPhoneNumbers(value); return *this;} + inline ListOriginationNumbersResult& WithPhoneNumbers(Aws::Vector&& value) { SetPhoneNumbers(std::move(value)); return *this;} + inline ListOriginationNumbersResult& AddPhoneNumbers(const PhoneNumberInformation& value) { m_phoneNumbers.push_back(value); return *this; } + inline ListOriginationNumbersResult& AddPhoneNumbers(PhoneNumberInformation&& value) { m_phoneNumbers.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListOriginationNumbersResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListOriginationNumbersResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_nextToken; + + Aws::Vector m_phoneNumbers; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListPhoneNumbersOptedOutRequest.h b/include/aws/sns/model/ListPhoneNumbersOptedOutRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..19d6ae55debcfe0e1a334dafa34bb4c7f9a19366 --- /dev/null +++ b/include/aws/sns/model/ListPhoneNumbersOptedOutRequest.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

The input for the ListPhoneNumbersOptedOut action.

See + * Also:

AWS + * API Reference

+ */ + class ListPhoneNumbersOptedOutRequest : public SNSRequest + { + public: + AWS_SNS_API ListPhoneNumbersOptedOutRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListPhoneNumbersOptedOut"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

A NextToken string is used when you call the + * ListPhoneNumbersOptedOut action to retrieve additional records that + * are available after the first page of results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListPhoneNumbersOptedOutRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListPhoneNumbersOptedOutRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListPhoneNumbersOptedOutRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListPhoneNumbersOptedOutResult.h b/include/aws/sns/model/ListPhoneNumbersOptedOutResult.h new file mode 100644 index 0000000000000000000000000000000000000000..91d41e95eea17e925aa864c903746d8a2bc448c1 --- /dev/null +++ b/include/aws/sns/model/ListPhoneNumbersOptedOutResult.h @@ -0,0 +1,92 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

The response from the ListPhoneNumbersOptedOut + * action.

See Also:

AWS + * API Reference

+ */ + class ListPhoneNumbersOptedOutResult + { + public: + AWS_SNS_API ListPhoneNumbersOptedOutResult(); + AWS_SNS_API ListPhoneNumbersOptedOutResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListPhoneNumbersOptedOutResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of phone numbers that are opted out of receiving SMS messages. The + * list is paginated, and each page can contain up to 100 phone numbers.

+ */ + inline const Aws::Vector& GetPhoneNumbers() const{ return m_phoneNumbers; } + inline void SetPhoneNumbers(const Aws::Vector& value) { m_phoneNumbers = value; } + inline void SetPhoneNumbers(Aws::Vector&& value) { m_phoneNumbers = std::move(value); } + inline ListPhoneNumbersOptedOutResult& WithPhoneNumbers(const Aws::Vector& value) { SetPhoneNumbers(value); return *this;} + inline ListPhoneNumbersOptedOutResult& WithPhoneNumbers(Aws::Vector&& value) { SetPhoneNumbers(std::move(value)); return *this;} + inline ListPhoneNumbersOptedOutResult& AddPhoneNumbers(const Aws::String& value) { m_phoneNumbers.push_back(value); return *this; } + inline ListPhoneNumbersOptedOutResult& AddPhoneNumbers(Aws::String&& value) { m_phoneNumbers.push_back(std::move(value)); return *this; } + inline ListPhoneNumbersOptedOutResult& AddPhoneNumbers(const char* value) { m_phoneNumbers.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

A NextToken string is returned when you call the + * ListPhoneNumbersOptedOut action if additional records are available + * after the first page of results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListPhoneNumbersOptedOutResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListPhoneNumbersOptedOutResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListPhoneNumbersOptedOutResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListPhoneNumbersOptedOutResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListPhoneNumbersOptedOutResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_phoneNumbers; + + Aws::String m_nextToken; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListPlatformApplicationsRequest.h b/include/aws/sns/model/ListPlatformApplicationsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..9be172828d663252fb065612c28f3910fc481b45 --- /dev/null +++ b/include/aws/sns/model/ListPlatformApplicationsRequest.h @@ -0,0 +1,66 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for ListPlatformApplications action.

See + * Also:

AWS + * API Reference

+ */ + class ListPlatformApplicationsRequest : public SNSRequest + { + public: + AWS_SNS_API ListPlatformApplicationsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListPlatformApplications"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

NextToken string is used when calling + * ListPlatformApplications action to retrieve additional records that + * are available after the first page results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListPlatformApplicationsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListPlatformApplicationsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListPlatformApplicationsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListPlatformApplicationsResult.h b/include/aws/sns/model/ListPlatformApplicationsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..8d0895d6cc218fd98e192a81204a7faee9045f14 --- /dev/null +++ b/include/aws/sns/model/ListPlatformApplicationsResult.h @@ -0,0 +1,92 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for ListPlatformApplications action.

See + * Also:

AWS + * API Reference

+ */ + class ListPlatformApplicationsResult + { + public: + AWS_SNS_API ListPlatformApplicationsResult(); + AWS_SNS_API ListPlatformApplicationsResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListPlatformApplicationsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Platform applications returned when calling + * ListPlatformApplications action.

+ */ + inline const Aws::Vector& GetPlatformApplications() const{ return m_platformApplications; } + inline void SetPlatformApplications(const Aws::Vector& value) { m_platformApplications = value; } + inline void SetPlatformApplications(Aws::Vector&& value) { m_platformApplications = std::move(value); } + inline ListPlatformApplicationsResult& WithPlatformApplications(const Aws::Vector& value) { SetPlatformApplications(value); return *this;} + inline ListPlatformApplicationsResult& WithPlatformApplications(Aws::Vector&& value) { SetPlatformApplications(std::move(value)); return *this;} + inline ListPlatformApplicationsResult& AddPlatformApplications(const PlatformApplication& value) { m_platformApplications.push_back(value); return *this; } + inline ListPlatformApplicationsResult& AddPlatformApplications(PlatformApplication&& value) { m_platformApplications.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

NextToken string is returned when calling + * ListPlatformApplications action if additional records are available + * after the first page results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListPlatformApplicationsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListPlatformApplicationsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListPlatformApplicationsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListPlatformApplicationsResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListPlatformApplicationsResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_platformApplications; + + Aws::String m_nextToken; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListSMSSandboxPhoneNumbersRequest.h b/include/aws/sns/model/ListSMSSandboxPhoneNumbersRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..28384022ec0aceafface0d5178ce1f338a31da32 --- /dev/null +++ b/include/aws/sns/model/ListSMSSandboxPhoneNumbersRequest.h @@ -0,0 +1,74 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class ListSMSSandboxPhoneNumbersRequest : public SNSRequest + { + public: + AWS_SNS_API ListSMSSandboxPhoneNumbersRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListSMSSandboxPhoneNumbers"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

Token that the previous ListSMSSandboxPhoneNumbersInput request + * returns.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListSMSSandboxPhoneNumbersRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListSMSSandboxPhoneNumbersRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListSMSSandboxPhoneNumbersRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of phone numbers to return.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline ListSMSSandboxPhoneNumbersRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListSMSSandboxPhoneNumbersResult.h b/include/aws/sns/model/ListSMSSandboxPhoneNumbersResult.h new file mode 100644 index 0000000000000000000000000000000000000000..bde665ccafc02155765ac4b2f9937414b9835e6b --- /dev/null +++ b/include/aws/sns/model/ListSMSSandboxPhoneNumbersResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class ListSMSSandboxPhoneNumbersResult + { + public: + AWS_SNS_API ListSMSSandboxPhoneNumbersResult(); + AWS_SNS_API ListSMSSandboxPhoneNumbersResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListSMSSandboxPhoneNumbersResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of the calling account's pending and verified phone numbers.

+ */ + inline const Aws::Vector& GetPhoneNumbers() const{ return m_phoneNumbers; } + inline void SetPhoneNumbers(const Aws::Vector& value) { m_phoneNumbers = value; } + inline void SetPhoneNumbers(Aws::Vector&& value) { m_phoneNumbers = std::move(value); } + inline ListSMSSandboxPhoneNumbersResult& WithPhoneNumbers(const Aws::Vector& value) { SetPhoneNumbers(value); return *this;} + inline ListSMSSandboxPhoneNumbersResult& WithPhoneNumbers(Aws::Vector&& value) { SetPhoneNumbers(std::move(value)); return *this;} + inline ListSMSSandboxPhoneNumbersResult& AddPhoneNumbers(const SMSSandboxPhoneNumber& value) { m_phoneNumbers.push_back(value); return *this; } + inline ListSMSSandboxPhoneNumbersResult& AddPhoneNumbers(SMSSandboxPhoneNumber&& value) { m_phoneNumbers.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A NextToken string is returned when you call the + * ListSMSSandboxPhoneNumbersInput operation if additional pages of + * records are available.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListSMSSandboxPhoneNumbersResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListSMSSandboxPhoneNumbersResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListSMSSandboxPhoneNumbersResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListSMSSandboxPhoneNumbersResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListSMSSandboxPhoneNumbersResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_phoneNumbers; + + Aws::String m_nextToken; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListSubscriptionsByTopicRequest.h b/include/aws/sns/model/ListSubscriptionsByTopicRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..77d921e17035fad906dcc13c43c57e3124a7c9a3 --- /dev/null +++ b/include/aws/sns/model/ListSubscriptionsByTopicRequest.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for ListSubscriptionsByTopic action.

See Also:

AWS + * API Reference

+ */ + class ListSubscriptionsByTopicRequest : public SNSRequest + { + public: + AWS_SNS_API ListSubscriptionsByTopicRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListSubscriptionsByTopic"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic for which you wish to find subscriptions.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline ListSubscriptionsByTopicRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline ListSubscriptionsByTopicRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline ListSubscriptionsByTopicRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

Token returned by the previous ListSubscriptionsByTopic + * request.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListSubscriptionsByTopicRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListSubscriptionsByTopicRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListSubscriptionsByTopicRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListSubscriptionsByTopicResult.h b/include/aws/sns/model/ListSubscriptionsByTopicResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c53f8aec89f88aea430aa141c8e05072f108a728 --- /dev/null +++ b/include/aws/sns/model/ListSubscriptionsByTopicResult.h @@ -0,0 +1,90 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for ListSubscriptionsByTopic action.

See Also:

AWS + * API Reference

+ */ + class ListSubscriptionsByTopicResult + { + public: + AWS_SNS_API ListSubscriptionsByTopicResult(); + AWS_SNS_API ListSubscriptionsByTopicResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListSubscriptionsByTopicResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of subscriptions.

+ */ + inline const Aws::Vector& GetSubscriptions() const{ return m_subscriptions; } + inline void SetSubscriptions(const Aws::Vector& value) { m_subscriptions = value; } + inline void SetSubscriptions(Aws::Vector&& value) { m_subscriptions = std::move(value); } + inline ListSubscriptionsByTopicResult& WithSubscriptions(const Aws::Vector& value) { SetSubscriptions(value); return *this;} + inline ListSubscriptionsByTopicResult& WithSubscriptions(Aws::Vector&& value) { SetSubscriptions(std::move(value)); return *this;} + inline ListSubscriptionsByTopicResult& AddSubscriptions(const Subscription& value) { m_subscriptions.push_back(value); return *this; } + inline ListSubscriptionsByTopicResult& AddSubscriptions(Subscription&& value) { m_subscriptions.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Token to pass along to the next ListSubscriptionsByTopic + * request. This element is returned if there are more subscriptions to + * retrieve.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListSubscriptionsByTopicResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListSubscriptionsByTopicResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListSubscriptionsByTopicResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListSubscriptionsByTopicResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListSubscriptionsByTopicResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_subscriptions; + + Aws::String m_nextToken; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListSubscriptionsRequest.h b/include/aws/sns/model/ListSubscriptionsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c09901196d7570c605c2b90eec38aef509dc0b60 --- /dev/null +++ b/include/aws/sns/model/ListSubscriptionsRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for ListSubscriptions action.

See Also:

AWS + * API Reference

+ */ + class ListSubscriptionsRequest : public SNSRequest + { + public: + AWS_SNS_API ListSubscriptionsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListSubscriptions"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

Token returned by the previous ListSubscriptions request.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListSubscriptionsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListSubscriptionsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListSubscriptionsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListSubscriptionsResult.h b/include/aws/sns/model/ListSubscriptionsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..9bc05013866520a573463ab9bfa031739c1c162e --- /dev/null +++ b/include/aws/sns/model/ListSubscriptionsResult.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for ListSubscriptions action

See Also:

AWS + * API Reference

+ */ + class ListSubscriptionsResult + { + public: + AWS_SNS_API ListSubscriptionsResult(); + AWS_SNS_API ListSubscriptionsResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListSubscriptionsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of subscriptions.

+ */ + inline const Aws::Vector& GetSubscriptions() const{ return m_subscriptions; } + inline void SetSubscriptions(const Aws::Vector& value) { m_subscriptions = value; } + inline void SetSubscriptions(Aws::Vector&& value) { m_subscriptions = std::move(value); } + inline ListSubscriptionsResult& WithSubscriptions(const Aws::Vector& value) { SetSubscriptions(value); return *this;} + inline ListSubscriptionsResult& WithSubscriptions(Aws::Vector&& value) { SetSubscriptions(std::move(value)); return *this;} + inline ListSubscriptionsResult& AddSubscriptions(const Subscription& value) { m_subscriptions.push_back(value); return *this; } + inline ListSubscriptionsResult& AddSubscriptions(Subscription&& value) { m_subscriptions.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Token to pass along to the next ListSubscriptions request. This + * element is returned if there are more subscriptions to retrieve.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListSubscriptionsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListSubscriptionsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListSubscriptionsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListSubscriptionsResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListSubscriptionsResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_subscriptions; + + Aws::String m_nextToken; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListTagsForResourceRequest.h b/include/aws/sns/model/ListTagsForResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..10bf9ad891c73e7c6303083541e78a6b097e1893 --- /dev/null +++ b/include/aws/sns/model/ListTagsForResourceRequest.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class ListTagsForResourceRequest : public SNSRequest + { + public: + AWS_SNS_API ListTagsForResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListTagsForResource"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic for which to list tags.

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline ListTagsForResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline ListTagsForResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline ListTagsForResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListTagsForResourceResult.h b/include/aws/sns/model/ListTagsForResourceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..749f8bdfe83d904661df5f3b4ba88c98a12b624c --- /dev/null +++ b/include/aws/sns/model/ListTagsForResourceResult.h @@ -0,0 +1,67 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class ListTagsForResourceResult + { + public: + AWS_SNS_API ListTagsForResourceResult(); + AWS_SNS_API ListTagsForResourceResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListTagsForResourceResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The tags associated with the specified topic.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline void SetTags(const Aws::Vector& value) { m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tags = std::move(value); } + inline ListTagsForResourceResult& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline ListTagsForResourceResult& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline ListTagsForResourceResult& AddTags(const Tag& value) { m_tags.push_back(value); return *this; } + inline ListTagsForResourceResult& AddTags(Tag&& value) { m_tags.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListTagsForResourceResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListTagsForResourceResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_tags; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListTopicsRequest.h b/include/aws/sns/model/ListTopicsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..57b34b46b4345931e8458097ce72cd7cd66c8703 --- /dev/null +++ b/include/aws/sns/model/ListTopicsRequest.h @@ -0,0 +1,60 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class ListTopicsRequest : public SNSRequest + { + public: + AWS_SNS_API ListTopicsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListTopics"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

Token returned by the previous ListTopics request.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListTopicsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListTopicsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListTopicsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + private: + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ListTopicsResult.h b/include/aws/sns/model/ListTopicsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..825539c498c0305b25d0f7905c1d1e4142fb3322 --- /dev/null +++ b/include/aws/sns/model/ListTopicsResult.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for ListTopics action.

See Also:

AWS + * API Reference

+ */ + class ListTopicsResult + { + public: + AWS_SNS_API ListTopicsResult(); + AWS_SNS_API ListTopicsResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API ListTopicsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of topic ARNs.

+ */ + inline const Aws::Vector& GetTopics() const{ return m_topics; } + inline void SetTopics(const Aws::Vector& value) { m_topics = value; } + inline void SetTopics(Aws::Vector&& value) { m_topics = std::move(value); } + inline ListTopicsResult& WithTopics(const Aws::Vector& value) { SetTopics(value); return *this;} + inline ListTopicsResult& WithTopics(Aws::Vector&& value) { SetTopics(std::move(value)); return *this;} + inline ListTopicsResult& AddTopics(const Topic& value) { m_topics.push_back(value); return *this; } + inline ListTopicsResult& AddTopics(Topic&& value) { m_topics.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Token to pass along to the next ListTopics request. This element + * is returned if there are additional topics to retrieve.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListTopicsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListTopicsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListTopicsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListTopicsResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListTopicsResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_topics; + + Aws::String m_nextToken; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/MessageAttributeValue.h b/include/aws/sns/model/MessageAttributeValue.h new file mode 100644 index 0000000000000000000000000000000000000000..0214fa503a744d7a20418c4b619f23d3af2bac44 --- /dev/null +++ b/include/aws/sns/model/MessageAttributeValue.h @@ -0,0 +1,114 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

The user-specified message attribute value. For string data types, the value + * attribute has the same restrictions on the content as the message body. For more + * information, see Publish.

+ *

Name, type, and value must not be empty or null. In addition, the message + * body should not be empty or null. All parts of the message attribute, including + * name, type, and value, are included in the message size restriction, which is + * currently 256 KB (262,144 bytes). For more information, see Amazon + * SNS message attributes and Publishing + * to a mobile phone in the Amazon SNS Developer Guide.

See + * Also:

AWS + * API Reference

+ */ + class MessageAttributeValue + { + public: + AWS_SNS_API MessageAttributeValue(); + AWS_SNS_API MessageAttributeValue(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API MessageAttributeValue& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

Amazon SNS supports the following logical data types: String, String.Array, + * Number, and Binary. For more information, see Message + * Attribute Data Types.

+ */ + inline const Aws::String& GetDataType() const{ return m_dataType; } + inline bool DataTypeHasBeenSet() const { return m_dataTypeHasBeenSet; } + inline void SetDataType(const Aws::String& value) { m_dataTypeHasBeenSet = true; m_dataType = value; } + inline void SetDataType(Aws::String&& value) { m_dataTypeHasBeenSet = true; m_dataType = std::move(value); } + inline void SetDataType(const char* value) { m_dataTypeHasBeenSet = true; m_dataType.assign(value); } + inline MessageAttributeValue& WithDataType(const Aws::String& value) { SetDataType(value); return *this;} + inline MessageAttributeValue& WithDataType(Aws::String&& value) { SetDataType(std::move(value)); return *this;} + inline MessageAttributeValue& WithDataType(const char* value) { SetDataType(value); return *this;} + ///@} + + ///@{ + /** + *

Strings are Unicode with UTF8 binary encoding. For a list of code values, see + * ASCII + * Printable Characters.

+ */ + inline const Aws::String& GetStringValue() const{ return m_stringValue; } + inline bool StringValueHasBeenSet() const { return m_stringValueHasBeenSet; } + inline void SetStringValue(const Aws::String& value) { m_stringValueHasBeenSet = true; m_stringValue = value; } + inline void SetStringValue(Aws::String&& value) { m_stringValueHasBeenSet = true; m_stringValue = std::move(value); } + inline void SetStringValue(const char* value) { m_stringValueHasBeenSet = true; m_stringValue.assign(value); } + inline MessageAttributeValue& WithStringValue(const Aws::String& value) { SetStringValue(value); return *this;} + inline MessageAttributeValue& WithStringValue(Aws::String&& value) { SetStringValue(std::move(value)); return *this;} + inline MessageAttributeValue& WithStringValue(const char* value) { SetStringValue(value); return *this;} + ///@} + + ///@{ + /** + *

Binary type attributes can store any binary data, for example, compressed + * data, encrypted data, or images.

+ */ + inline const Aws::Utils::ByteBuffer& GetBinaryValue() const{ return m_binaryValue; } + inline bool BinaryValueHasBeenSet() const { return m_binaryValueHasBeenSet; } + inline void SetBinaryValue(const Aws::Utils::ByteBuffer& value) { m_binaryValueHasBeenSet = true; m_binaryValue = value; } + inline void SetBinaryValue(Aws::Utils::ByteBuffer&& value) { m_binaryValueHasBeenSet = true; m_binaryValue = std::move(value); } + inline MessageAttributeValue& WithBinaryValue(const Aws::Utils::ByteBuffer& value) { SetBinaryValue(value); return *this;} + inline MessageAttributeValue& WithBinaryValue(Aws::Utils::ByteBuffer&& value) { SetBinaryValue(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_dataType; + bool m_dataTypeHasBeenSet = false; + + Aws::String m_stringValue; + bool m_stringValueHasBeenSet = false; + + Aws::Utils::ByteBuffer m_binaryValue; + bool m_binaryValueHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/NumberCapability.h b/include/aws/sns/model/NumberCapability.h new file mode 100644 index 0000000000000000000000000000000000000000..d1406e269a2bdb786bf096877cbaef4b193cc649 --- /dev/null +++ b/include/aws/sns/model/NumberCapability.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + enum class NumberCapability + { + NOT_SET, + SMS, + MMS, + VOICE + }; + +namespace NumberCapabilityMapper +{ +AWS_SNS_API NumberCapability GetNumberCapabilityForName(const Aws::String& name); + +AWS_SNS_API Aws::String GetNameForNumberCapability(NumberCapability value); +} // namespace NumberCapabilityMapper +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/OptInPhoneNumberRequest.h b/include/aws/sns/model/OptInPhoneNumberRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a58f19ae3e12920a4f187bfdd6e61fe52adf6fbd --- /dev/null +++ b/include/aws/sns/model/OptInPhoneNumberRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for the OptInPhoneNumber action.

See Also:

AWS + * API Reference

+ */ + class OptInPhoneNumberRequest : public SNSRequest + { + public: + AWS_SNS_API OptInPhoneNumberRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "OptInPhoneNumber"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The phone number to opt in. Use E.164 format.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline OptInPhoneNumberRequest& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline OptInPhoneNumberRequest& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline OptInPhoneNumberRequest& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + private: + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/OptInPhoneNumberResult.h b/include/aws/sns/model/OptInPhoneNumberResult.h new file mode 100644 index 0000000000000000000000000000000000000000..062f9631f4541f89d5e1d0e60e24d8b8e75bc225 --- /dev/null +++ b/include/aws/sns/model/OptInPhoneNumberResult.h @@ -0,0 +1,55 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

The response for the OptInPhoneNumber action.

See Also:

AWS + * API Reference

+ */ + class OptInPhoneNumberResult + { + public: + AWS_SNS_API OptInPhoneNumberResult(); + AWS_SNS_API OptInPhoneNumberResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API OptInPhoneNumberResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline OptInPhoneNumberResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline OptInPhoneNumberResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PhoneNumberInformation.h b/include/aws/sns/model/PhoneNumberInformation.h new file mode 100644 index 0000000000000000000000000000000000000000..b1947c8301f6c40f0ec99905158fac8cfbb3c917 --- /dev/null +++ b/include/aws/sns/model/PhoneNumberInformation.h @@ -0,0 +1,149 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

A list of phone numbers and their metadata.

See Also:

AWS + * API Reference

+ */ + class PhoneNumberInformation + { + public: + AWS_SNS_API PhoneNumberInformation(); + AWS_SNS_API PhoneNumberInformation(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API PhoneNumberInformation& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

The date and time when the phone number was created.

+ */ + inline const Aws::Utils::DateTime& GetCreatedAt() const{ return m_createdAt; } + inline bool CreatedAtHasBeenSet() const { return m_createdAtHasBeenSet; } + inline void SetCreatedAt(const Aws::Utils::DateTime& value) { m_createdAtHasBeenSet = true; m_createdAt = value; } + inline void SetCreatedAt(Aws::Utils::DateTime&& value) { m_createdAtHasBeenSet = true; m_createdAt = std::move(value); } + inline PhoneNumberInformation& WithCreatedAt(const Aws::Utils::DateTime& value) { SetCreatedAt(value); return *this;} + inline PhoneNumberInformation& WithCreatedAt(Aws::Utils::DateTime&& value) { SetCreatedAt(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The phone number.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline PhoneNumberInformation& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline PhoneNumberInformation& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline PhoneNumberInformation& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + + ///@{ + /** + *

The status of the phone number.

+ */ + inline const Aws::String& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const Aws::String& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(Aws::String&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline void SetStatus(const char* value) { m_statusHasBeenSet = true; m_status.assign(value); } + inline PhoneNumberInformation& WithStatus(const Aws::String& value) { SetStatus(value); return *this;} + inline PhoneNumberInformation& WithStatus(Aws::String&& value) { SetStatus(std::move(value)); return *this;} + inline PhoneNumberInformation& WithStatus(const char* value) { SetStatus(value); return *this;} + ///@} + + ///@{ + /** + *

The two-character code for the country or region, in ISO 3166-1 alpha-2 + * format.

+ */ + inline const Aws::String& GetIso2CountryCode() const{ return m_iso2CountryCode; } + inline bool Iso2CountryCodeHasBeenSet() const { return m_iso2CountryCodeHasBeenSet; } + inline void SetIso2CountryCode(const Aws::String& value) { m_iso2CountryCodeHasBeenSet = true; m_iso2CountryCode = value; } + inline void SetIso2CountryCode(Aws::String&& value) { m_iso2CountryCodeHasBeenSet = true; m_iso2CountryCode = std::move(value); } + inline void SetIso2CountryCode(const char* value) { m_iso2CountryCodeHasBeenSet = true; m_iso2CountryCode.assign(value); } + inline PhoneNumberInformation& WithIso2CountryCode(const Aws::String& value) { SetIso2CountryCode(value); return *this;} + inline PhoneNumberInformation& WithIso2CountryCode(Aws::String&& value) { SetIso2CountryCode(std::move(value)); return *this;} + inline PhoneNumberInformation& WithIso2CountryCode(const char* value) { SetIso2CountryCode(value); return *this;} + ///@} + + ///@{ + /** + *

The list of supported routes.

+ */ + inline const RouteType& GetRouteType() const{ return m_routeType; } + inline bool RouteTypeHasBeenSet() const { return m_routeTypeHasBeenSet; } + inline void SetRouteType(const RouteType& value) { m_routeTypeHasBeenSet = true; m_routeType = value; } + inline void SetRouteType(RouteType&& value) { m_routeTypeHasBeenSet = true; m_routeType = std::move(value); } + inline PhoneNumberInformation& WithRouteType(const RouteType& value) { SetRouteType(value); return *this;} + inline PhoneNumberInformation& WithRouteType(RouteType&& value) { SetRouteType(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

The capabilities of each phone number.

+ */ + inline const Aws::Vector& GetNumberCapabilities() const{ return m_numberCapabilities; } + inline bool NumberCapabilitiesHasBeenSet() const { return m_numberCapabilitiesHasBeenSet; } + inline void SetNumberCapabilities(const Aws::Vector& value) { m_numberCapabilitiesHasBeenSet = true; m_numberCapabilities = value; } + inline void SetNumberCapabilities(Aws::Vector&& value) { m_numberCapabilitiesHasBeenSet = true; m_numberCapabilities = std::move(value); } + inline PhoneNumberInformation& WithNumberCapabilities(const Aws::Vector& value) { SetNumberCapabilities(value); return *this;} + inline PhoneNumberInformation& WithNumberCapabilities(Aws::Vector&& value) { SetNumberCapabilities(std::move(value)); return *this;} + inline PhoneNumberInformation& AddNumberCapabilities(const NumberCapability& value) { m_numberCapabilitiesHasBeenSet = true; m_numberCapabilities.push_back(value); return *this; } + inline PhoneNumberInformation& AddNumberCapabilities(NumberCapability&& value) { m_numberCapabilitiesHasBeenSet = true; m_numberCapabilities.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::Utils::DateTime m_createdAt; + bool m_createdAtHasBeenSet = false; + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + + Aws::String m_status; + bool m_statusHasBeenSet = false; + + Aws::String m_iso2CountryCode; + bool m_iso2CountryCodeHasBeenSet = false; + + RouteType m_routeType; + bool m_routeTypeHasBeenSet = false; + + Aws::Vector m_numberCapabilities; + bool m_numberCapabilitiesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PlatformApplication.h b/include/aws/sns/model/PlatformApplication.h new file mode 100644 index 0000000000000000000000000000000000000000..d8e73b7d346b5b164e7cec325c54a0b26e63cf66 --- /dev/null +++ b/include/aws/sns/model/PlatformApplication.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

Platform application object.

See Also:

AWS + * API Reference

+ */ + class PlatformApplication + { + public: + AWS_SNS_API PlatformApplication(); + AWS_SNS_API PlatformApplication(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API PlatformApplication& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

PlatformApplicationArn for platform application object.

+ */ + inline const Aws::String& GetPlatformApplicationArn() const{ return m_platformApplicationArn; } + inline bool PlatformApplicationArnHasBeenSet() const { return m_platformApplicationArnHasBeenSet; } + inline void SetPlatformApplicationArn(const Aws::String& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = value; } + inline void SetPlatformApplicationArn(Aws::String&& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = std::move(value); } + inline void SetPlatformApplicationArn(const char* value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn.assign(value); } + inline PlatformApplication& WithPlatformApplicationArn(const Aws::String& value) { SetPlatformApplicationArn(value); return *this;} + inline PlatformApplication& WithPlatformApplicationArn(Aws::String&& value) { SetPlatformApplicationArn(std::move(value)); return *this;} + inline PlatformApplication& WithPlatformApplicationArn(const char* value) { SetPlatformApplicationArn(value); return *this;} + ///@} + + ///@{ + /** + *

Attributes for platform application object.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline PlatformApplication& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline PlatformApplication& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline PlatformApplication& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline PlatformApplication& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline PlatformApplication& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline PlatformApplication& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline PlatformApplication& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline PlatformApplication& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline PlatformApplication& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_platformApplicationArn; + bool m_platformApplicationArnHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PublishBatchRequest.h b/include/aws/sns/model/PublishBatchRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..649a4cd54d669474f3b747d367a00bdececf731f --- /dev/null +++ b/include/aws/sns/model/PublishBatchRequest.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class PublishBatchRequest : public SNSRequest + { + public: + AWS_SNS_API PublishBatchRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PublishBatch"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The Amazon resource name (ARN) of the topic you want to batch publish to.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline PublishBatchRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline PublishBatchRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline PublishBatchRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

A list of PublishBatch request entries to be sent to the SNS + * topic.

+ */ + inline const Aws::Vector& GetPublishBatchRequestEntries() const{ return m_publishBatchRequestEntries; } + inline bool PublishBatchRequestEntriesHasBeenSet() const { return m_publishBatchRequestEntriesHasBeenSet; } + inline void SetPublishBatchRequestEntries(const Aws::Vector& value) { m_publishBatchRequestEntriesHasBeenSet = true; m_publishBatchRequestEntries = value; } + inline void SetPublishBatchRequestEntries(Aws::Vector&& value) { m_publishBatchRequestEntriesHasBeenSet = true; m_publishBatchRequestEntries = std::move(value); } + inline PublishBatchRequest& WithPublishBatchRequestEntries(const Aws::Vector& value) { SetPublishBatchRequestEntries(value); return *this;} + inline PublishBatchRequest& WithPublishBatchRequestEntries(Aws::Vector&& value) { SetPublishBatchRequestEntries(std::move(value)); return *this;} + inline PublishBatchRequest& AddPublishBatchRequestEntries(const PublishBatchRequestEntry& value) { m_publishBatchRequestEntriesHasBeenSet = true; m_publishBatchRequestEntries.push_back(value); return *this; } + inline PublishBatchRequest& AddPublishBatchRequestEntries(PublishBatchRequestEntry&& value) { m_publishBatchRequestEntriesHasBeenSet = true; m_publishBatchRequestEntries.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::Vector m_publishBatchRequestEntries; + bool m_publishBatchRequestEntriesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PublishBatchRequestEntry.h b/include/aws/sns/model/PublishBatchRequestEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..eb7faf603a703722c31858f047e1e55712574ffa --- /dev/null +++ b/include/aws/sns/model/PublishBatchRequestEntry.h @@ -0,0 +1,243 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

Contains the details of a single Amazon SNS message along with an + * Id that identifies a message within the batch.

See + * Also:

AWS + * API Reference

+ */ + class PublishBatchRequestEntry + { + public: + AWS_SNS_API PublishBatchRequestEntry(); + AWS_SNS_API PublishBatchRequestEntry(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API PublishBatchRequestEntry& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

An identifier for the message in this batch.

The + * Ids of a batch request must be unique within a request.

+ *

This identifier can have up to 80 characters. The following characters are + * accepted: alphanumeric characters, hyphens(-), and underscores (_).

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline PublishBatchRequestEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline PublishBatchRequestEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline PublishBatchRequestEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The body of the message.

+ */ + inline const Aws::String& GetMessage() const{ return m_message; } + inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } + inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } + inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } + inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } + inline PublishBatchRequestEntry& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} + inline PublishBatchRequestEntry& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} + inline PublishBatchRequestEntry& WithMessage(const char* value) { SetMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The subject of the batch message.

+ */ + inline const Aws::String& GetSubject() const{ return m_subject; } + inline bool SubjectHasBeenSet() const { return m_subjectHasBeenSet; } + inline void SetSubject(const Aws::String& value) { m_subjectHasBeenSet = true; m_subject = value; } + inline void SetSubject(Aws::String&& value) { m_subjectHasBeenSet = true; m_subject = std::move(value); } + inline void SetSubject(const char* value) { m_subjectHasBeenSet = true; m_subject.assign(value); } + inline PublishBatchRequestEntry& WithSubject(const Aws::String& value) { SetSubject(value); return *this;} + inline PublishBatchRequestEntry& WithSubject(Aws::String&& value) { SetSubject(std::move(value)); return *this;} + inline PublishBatchRequestEntry& WithSubject(const char* value) { SetSubject(value); return *this;} + ///@} + + ///@{ + /** + *

Set MessageStructure to json if you want to send a + * different message for each protocol. For example, using one publish action, you + * can send a short message to your SMS subscribers and a longer message to your + * email subscribers. If you set MessageStructure to + * json, the value of the Message parameter must:

+ *
  • be a syntactically valid JSON object; and

  • contain + * at least a top-level JSON key of "default" with a value that is a string.

    + *

You can define other top-level keys that define the message you + * want to send to a specific transport protocol (e.g. http).

+ */ + inline const Aws::String& GetMessageStructure() const{ return m_messageStructure; } + inline bool MessageStructureHasBeenSet() const { return m_messageStructureHasBeenSet; } + inline void SetMessageStructure(const Aws::String& value) { m_messageStructureHasBeenSet = true; m_messageStructure = value; } + inline void SetMessageStructure(Aws::String&& value) { m_messageStructureHasBeenSet = true; m_messageStructure = std::move(value); } + inline void SetMessageStructure(const char* value) { m_messageStructureHasBeenSet = true; m_messageStructure.assign(value); } + inline PublishBatchRequestEntry& WithMessageStructure(const Aws::String& value) { SetMessageStructure(value); return *this;} + inline PublishBatchRequestEntry& WithMessageStructure(Aws::String&& value) { SetMessageStructure(std::move(value)); return *this;} + inline PublishBatchRequestEntry& WithMessageStructure(const char* value) { SetMessageStructure(value); return *this;} + ///@} + + ///@{ + /** + *

Each message attribute consists of a Name, Type, + * and Value. For more information, see Amazon + * SNS message attributes in the Amazon SNS Developer Guide.

+ */ + inline const Aws::Map& GetMessageAttributes() const{ return m_messageAttributes; } + inline bool MessageAttributesHasBeenSet() const { return m_messageAttributesHasBeenSet; } + inline void SetMessageAttributes(const Aws::Map& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = value; } + inline void SetMessageAttributes(Aws::Map&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = std::move(value); } + inline PublishBatchRequestEntry& WithMessageAttributes(const Aws::Map& value) { SetMessageAttributes(value); return *this;} + inline PublishBatchRequestEntry& WithMessageAttributes(Aws::Map&& value) { SetMessageAttributes(std::move(value)); return *this;} + inline PublishBatchRequestEntry& AddMessageAttributes(const Aws::String& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + inline PublishBatchRequestEntry& AddMessageAttributes(Aws::String&& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), value); return *this; } + inline PublishBatchRequestEntry& AddMessageAttributes(const Aws::String& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline PublishBatchRequestEntry& AddMessageAttributes(Aws::String&& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), std::move(value)); return *this; } + inline PublishBatchRequestEntry& AddMessageAttributes(const char* key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline PublishBatchRequestEntry& AddMessageAttributes(const char* key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) topics.

    + *
  • This parameter applies only to FIFO (first-in-first-out) topics. The + * MessageDeduplicationId can contain up to 128 alphanumeric + * characters (a-z, A-Z, 0-9) and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

  • + *

    Every message must have a unique MessageDeduplicationId, which + * is a token used for deduplication of sent messages within the 5 minute minimum + * deduplication interval.

  • The scope of deduplication depends on + * the FifoThroughputScope attribute, when set to Topic + * the message deduplication scope is across the entire topic, when set to + * MessageGroup the message deduplication scope is within each + * individual message group.

  • If a message with a particular + * MessageDeduplicationId is sent successfully, subsequent messages + * within the deduplication scope and interval, with the same + * MessageDeduplicationId, are accepted successfully but aren't + * delivered.

  • Every message must have a unique + * MessageDeduplicationId.

    • You may provide a + * MessageDeduplicationId explicitly.

    • If you aren't + * able to provide a MessageDeduplicationId and you enable + * ContentBasedDeduplication for your topic, Amazon SNS uses a SHA-256 + * hash to generate the MessageDeduplicationId using the body of the + * message (but not the attributes of the message).

    • If you don't + * provide a MessageDeduplicationId and the topic doesn't have + * ContentBasedDeduplication set, the action fails with an error.

      + *
    • If the topic has a ContentBasedDeduplication set, + * your MessageDeduplicationId overrides the generated one.

    • + *
  • When ContentBasedDeduplication is in effect, + * messages with identical content sent within the deduplication scope and interval + * are treated as duplicates and only one copy of the message is delivered.

    + *
  • If you send one message with + * ContentBasedDeduplication enabled, and then another message with a + * MessageDeduplicationId that is the same as the one generated for + * the first MessageDeduplicationId, the two messages are treated as + * duplicates, within the deduplication scope and interval, and only one copy of + * the message is delivered.

The + * MessageDeduplicationId is available to the consumer of the message + * (this can be useful for troubleshooting delivery issues).

If a message is + * sent successfully but the acknowledgement is lost and the message is resent with + * the same MessageDeduplicationId after the deduplication interval, + * Amazon SNS can't detect duplicate messages.

Amazon SNS continues to keep + * track of the message deduplication ID even after the message is received and + * deleted.

+ */ + inline const Aws::String& GetMessageDeduplicationId() const{ return m_messageDeduplicationId; } + inline bool MessageDeduplicationIdHasBeenSet() const { return m_messageDeduplicationIdHasBeenSet; } + inline void SetMessageDeduplicationId(const Aws::String& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = value; } + inline void SetMessageDeduplicationId(Aws::String&& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = std::move(value); } + inline void SetMessageDeduplicationId(const char* value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId.assign(value); } + inline PublishBatchRequestEntry& WithMessageDeduplicationId(const Aws::String& value) { SetMessageDeduplicationId(value); return *this;} + inline PublishBatchRequestEntry& WithMessageDeduplicationId(Aws::String&& value) { SetMessageDeduplicationId(std::move(value)); return *this;} + inline PublishBatchRequestEntry& WithMessageDeduplicationId(const char* value) { SetMessageDeduplicationId(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) topics.

The + * tag that specifies that a message belongs to a specific message group. Messages + * that belong to the same message group are processed in a FIFO manner (however, + * messages in different message groups might be processed out of order). To + * interleave multiple ordered streams within a single topic, use + * MessageGroupId values (for example, session data for multiple + * users). In this scenario, multiple consumers can process the topic, but the + * session data of each user is processed in a FIFO fashion.

You must + * associate a non-empty MessageGroupId with a message. If you don't + * provide a MessageGroupId, the action fails.

The length of + * MessageGroupId is 128 characters.

+ * MessageGroupId can contain alphanumeric characters (a-z, A-Z, + * 0-9) and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

+ * MessageGroupId is required for FIFO topics. You can't use it for + * standard topics.

+ */ + inline const Aws::String& GetMessageGroupId() const{ return m_messageGroupId; } + inline bool MessageGroupIdHasBeenSet() const { return m_messageGroupIdHasBeenSet; } + inline void SetMessageGroupId(const Aws::String& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = value; } + inline void SetMessageGroupId(Aws::String&& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = std::move(value); } + inline void SetMessageGroupId(const char* value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId.assign(value); } + inline PublishBatchRequestEntry& WithMessageGroupId(const Aws::String& value) { SetMessageGroupId(value); return *this;} + inline PublishBatchRequestEntry& WithMessageGroupId(Aws::String&& value) { SetMessageGroupId(std::move(value)); return *this;} + inline PublishBatchRequestEntry& WithMessageGroupId(const char* value) { SetMessageGroupId(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_message; + bool m_messageHasBeenSet = false; + + Aws::String m_subject; + bool m_subjectHasBeenSet = false; + + Aws::String m_messageStructure; + bool m_messageStructureHasBeenSet = false; + + Aws::Map m_messageAttributes; + bool m_messageAttributesHasBeenSet = false; + + Aws::String m_messageDeduplicationId; + bool m_messageDeduplicationIdHasBeenSet = false; + + Aws::String m_messageGroupId; + bool m_messageGroupIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PublishBatchResult.h b/include/aws/sns/model/PublishBatchResult.h new file mode 100644 index 0000000000000000000000000000000000000000..3db4b7b33bf54fa66b7e425a83dcca99dde9226d --- /dev/null +++ b/include/aws/sns/model/PublishBatchResult.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class PublishBatchResult + { + public: + AWS_SNS_API PublishBatchResult(); + AWS_SNS_API PublishBatchResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API PublishBatchResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of successful PublishBatch responses.

+ */ + inline const Aws::Vector& GetSuccessful() const{ return m_successful; } + inline void SetSuccessful(const Aws::Vector& value) { m_successful = value; } + inline void SetSuccessful(Aws::Vector&& value) { m_successful = std::move(value); } + inline PublishBatchResult& WithSuccessful(const Aws::Vector& value) { SetSuccessful(value); return *this;} + inline PublishBatchResult& WithSuccessful(Aws::Vector&& value) { SetSuccessful(std::move(value)); return *this;} + inline PublishBatchResult& AddSuccessful(const PublishBatchResultEntry& value) { m_successful.push_back(value); return *this; } + inline PublishBatchResult& AddSuccessful(PublishBatchResultEntry&& value) { m_successful.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A list of failed PublishBatch responses.

+ */ + inline const Aws::Vector& GetFailed() const{ return m_failed; } + inline void SetFailed(const Aws::Vector& value) { m_failed = value; } + inline void SetFailed(Aws::Vector&& value) { m_failed = std::move(value); } + inline PublishBatchResult& WithFailed(const Aws::Vector& value) { SetFailed(value); return *this;} + inline PublishBatchResult& WithFailed(Aws::Vector&& value) { SetFailed(std::move(value)); return *this;} + inline PublishBatchResult& AddFailed(const BatchResultErrorEntry& value) { m_failed.push_back(value); return *this; } + inline PublishBatchResult& AddFailed(BatchResultErrorEntry&& value) { m_failed.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline PublishBatchResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline PublishBatchResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_successful; + + Aws::Vector m_failed; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PublishBatchResultEntry.h b/include/aws/sns/model/PublishBatchResultEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..bc5fae43bbd8b7546c2b41bf381bb8d7d9edca1c --- /dev/null +++ b/include/aws/sns/model/PublishBatchResultEntry.h @@ -0,0 +1,102 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

Encloses data related to a successful message in a batch request for + * topic.

See Also:

AWS + * API Reference

+ */ + class PublishBatchResultEntry + { + public: + AWS_SNS_API PublishBatchResultEntry(); + AWS_SNS_API PublishBatchResultEntry(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API PublishBatchResultEntry& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

The Id of an entry in a batch request.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline PublishBatchResultEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline PublishBatchResultEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline PublishBatchResultEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

An identifier for the message.

+ */ + inline const Aws::String& GetMessageId() const{ return m_messageId; } + inline bool MessageIdHasBeenSet() const { return m_messageIdHasBeenSet; } + inline void SetMessageId(const Aws::String& value) { m_messageIdHasBeenSet = true; m_messageId = value; } + inline void SetMessageId(Aws::String&& value) { m_messageIdHasBeenSet = true; m_messageId = std::move(value); } + inline void SetMessageId(const char* value) { m_messageIdHasBeenSet = true; m_messageId.assign(value); } + inline PublishBatchResultEntry& WithMessageId(const Aws::String& value) { SetMessageId(value); return *this;} + inline PublishBatchResultEntry& WithMessageId(Aws::String&& value) { SetMessageId(std::move(value)); return *this;} + inline PublishBatchResultEntry& WithMessageId(const char* value) { SetMessageId(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) topics.

The + * large, non-consecutive number that Amazon SNS assigns to each message.

+ *

The length of SequenceNumber is 128 bits. + * SequenceNumber continues to increase for a particular + * MessageGroupId.

+ */ + inline const Aws::String& GetSequenceNumber() const{ return m_sequenceNumber; } + inline bool SequenceNumberHasBeenSet() const { return m_sequenceNumberHasBeenSet; } + inline void SetSequenceNumber(const Aws::String& value) { m_sequenceNumberHasBeenSet = true; m_sequenceNumber = value; } + inline void SetSequenceNumber(Aws::String&& value) { m_sequenceNumberHasBeenSet = true; m_sequenceNumber = std::move(value); } + inline void SetSequenceNumber(const char* value) { m_sequenceNumberHasBeenSet = true; m_sequenceNumber.assign(value); } + inline PublishBatchResultEntry& WithSequenceNumber(const Aws::String& value) { SetSequenceNumber(value); return *this;} + inline PublishBatchResultEntry& WithSequenceNumber(Aws::String&& value) { SetSequenceNumber(std::move(value)); return *this;} + inline PublishBatchResultEntry& WithSequenceNumber(const char* value) { SetSequenceNumber(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_messageId; + bool m_messageIdHasBeenSet = false; + + Aws::String m_sequenceNumber; + bool m_sequenceNumberHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PublishRequest.h b/include/aws/sns/model/PublishRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2fdccc840d2ae42f98ce1b74d97c9db70ba83f5d --- /dev/null +++ b/include/aws/sns/model/PublishRequest.h @@ -0,0 +1,293 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for Publish action.

See Also:

AWS + * API Reference

+ */ + class PublishRequest : public SNSRequest + { + public: + AWS_SNS_API PublishRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "Publish"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The topic you want to publish to.

If you don't specify a value for the + * TopicArn parameter, you must specify a value for the + * PhoneNumber or TargetArn parameters.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline PublishRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline PublishRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline PublishRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

If you don't specify a value for the TargetArn parameter, you + * must specify a value for the PhoneNumber or TopicArn + * parameters.

+ */ + inline const Aws::String& GetTargetArn() const{ return m_targetArn; } + inline bool TargetArnHasBeenSet() const { return m_targetArnHasBeenSet; } + inline void SetTargetArn(const Aws::String& value) { m_targetArnHasBeenSet = true; m_targetArn = value; } + inline void SetTargetArn(Aws::String&& value) { m_targetArnHasBeenSet = true; m_targetArn = std::move(value); } + inline void SetTargetArn(const char* value) { m_targetArnHasBeenSet = true; m_targetArn.assign(value); } + inline PublishRequest& WithTargetArn(const Aws::String& value) { SetTargetArn(value); return *this;} + inline PublishRequest& WithTargetArn(Aws::String&& value) { SetTargetArn(std::move(value)); return *this;} + inline PublishRequest& WithTargetArn(const char* value) { SetTargetArn(value); return *this;} + ///@} + + ///@{ + /** + *

The phone number to which you want to deliver an SMS message. Use E.164 + * format.

If you don't specify a value for the PhoneNumber + * parameter, you must specify a value for the TargetArn or + * TopicArn parameters.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline PublishRequest& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline PublishRequest& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline PublishRequest& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + + ///@{ + /** + *

The message you want to send.

If you are publishing to a topic and you + * want to send the same message to all transport protocols, include the text of + * the message as a String value. If you want to send different messages for each + * transport protocol, set the value of the MessageStructure parameter + * to json and use a JSON object for the Message + * parameter.

Constraints:

  • With the exception of SMS, + * messages must be UTF-8 encoded strings and at most 256 KB in size (262,144 + * bytes, not 262,144 characters).

  • For SMS, each message can + * contain up to 140 characters. This character limit depends on the encoding + * schema. For example, an SMS message can contain 160 GSM characters, 140 ASCII + * characters, or 70 UCS-2 characters.

    If you publish a message that exceeds + * this size limit, Amazon SNS sends the message as multiple messages, each fitting + * within the size limit. Messages aren't truncated mid-word but are cut off at + * whole-word boundaries.

    The total size limit for a single SMS + * Publish action is 1,600 characters.

+ *

JSON-specific constraints:

  • Keys in the JSON object that + * correspond to supported transport protocols must have simple JSON string + * values.

  • The values will be parsed (unescaped) before they are + * used in outgoing messages.

  • Outbound notifications are JSON + * encoded (meaning that the characters will be reescaped for sending).

  • + *
  • Values have a minimum length of 0 (the empty string, "", is + * allowed).

  • Values have a maximum length bounded by the overall + * message size (so, including multiple protocols may limit message sizes).

    + *
  • Non-string values will cause the key to be ignored.

  • + *

    Keys that do not correspond to supported transport protocols are ignored.

    + *
  • Duplicate keys are not allowed.

  • Failure to parse + * or validate any key or value in the message will cause the Publish + * call to return an error (no partial delivery).

+ */ + inline const Aws::String& GetMessage() const{ return m_message; } + inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } + inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } + inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } + inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } + inline PublishRequest& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} + inline PublishRequest& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} + inline PublishRequest& WithMessage(const char* value) { SetMessage(value); return *this;} + ///@} + + ///@{ + /** + *

Optional parameter to be used as the "Subject" line when the message is + * delivered to email endpoints. This field will also be included, if present, in + * the standard JSON messages delivered to other endpoints.

Constraints: + * Subjects must be UTF-8 text with no line breaks or control characters, and less + * than 100 characters long.

+ */ + inline const Aws::String& GetSubject() const{ return m_subject; } + inline bool SubjectHasBeenSet() const { return m_subjectHasBeenSet; } + inline void SetSubject(const Aws::String& value) { m_subjectHasBeenSet = true; m_subject = value; } + inline void SetSubject(Aws::String&& value) { m_subjectHasBeenSet = true; m_subject = std::move(value); } + inline void SetSubject(const char* value) { m_subjectHasBeenSet = true; m_subject.assign(value); } + inline PublishRequest& WithSubject(const Aws::String& value) { SetSubject(value); return *this;} + inline PublishRequest& WithSubject(Aws::String&& value) { SetSubject(std::move(value)); return *this;} + inline PublishRequest& WithSubject(const char* value) { SetSubject(value); return *this;} + ///@} + + ///@{ + /** + *

Set MessageStructure to json if you want to send a + * different message for each protocol. For example, using one publish action, you + * can send a short message to your SMS subscribers and a longer message to your + * email subscribers. If you set MessageStructure to + * json, the value of the Message parameter must:

+ *
  • be a syntactically valid JSON object; and

  • contain + * at least a top-level JSON key of "default" with a value that is a string.

    + *

You can define other top-level keys that define the message you + * want to send to a specific transport protocol (e.g., "http").

Valid + * value: json

+ */ + inline const Aws::String& GetMessageStructure() const{ return m_messageStructure; } + inline bool MessageStructureHasBeenSet() const { return m_messageStructureHasBeenSet; } + inline void SetMessageStructure(const Aws::String& value) { m_messageStructureHasBeenSet = true; m_messageStructure = value; } + inline void SetMessageStructure(Aws::String&& value) { m_messageStructureHasBeenSet = true; m_messageStructure = std::move(value); } + inline void SetMessageStructure(const char* value) { m_messageStructureHasBeenSet = true; m_messageStructure.assign(value); } + inline PublishRequest& WithMessageStructure(const Aws::String& value) { SetMessageStructure(value); return *this;} + inline PublishRequest& WithMessageStructure(Aws::String&& value) { SetMessageStructure(std::move(value)); return *this;} + inline PublishRequest& WithMessageStructure(const char* value) { SetMessageStructure(value); return *this;} + ///@} + + ///@{ + /** + *

Message attributes for Publish action.

+ */ + inline const Aws::Map& GetMessageAttributes() const{ return m_messageAttributes; } + inline bool MessageAttributesHasBeenSet() const { return m_messageAttributesHasBeenSet; } + inline void SetMessageAttributes(const Aws::Map& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = value; } + inline void SetMessageAttributes(Aws::Map&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = std::move(value); } + inline PublishRequest& WithMessageAttributes(const Aws::Map& value) { SetMessageAttributes(value); return *this;} + inline PublishRequest& WithMessageAttributes(Aws::Map&& value) { SetMessageAttributes(std::move(value)); return *this;} + inline PublishRequest& AddMessageAttributes(const Aws::String& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + inline PublishRequest& AddMessageAttributes(Aws::String&& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), value); return *this; } + inline PublishRequest& AddMessageAttributes(const Aws::String& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline PublishRequest& AddMessageAttributes(Aws::String&& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), std::move(value)); return *this; } + inline PublishRequest& AddMessageAttributes(const char* key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline PublishRequest& AddMessageAttributes(const char* key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *
  • This parameter applies only to FIFO (first-in-first-out) topics. + * The MessageDeduplicationId can contain up to 128 alphanumeric + * characters (a-z, A-Z, 0-9) and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

  • + *

    Every message must have a unique MessageDeduplicationId, which + * is a token used for deduplication of sent messages within the 5 minute minimum + * deduplication interval.

  • The scope of deduplication depends on + * the FifoThroughputScope attribute, when set to Topic + * the message deduplication scope is across the entire topic, when set to + * MessageGroup the message deduplication scope is within each + * individual message group.

  • If a message with a particular + * MessageDeduplicationId is sent successfully, subsequent messages + * within the deduplication scope and interval, with the same + * MessageDeduplicationId, are accepted successfully but aren't + * delivered.

  • Every message must have a unique + * MessageDeduplicationId:

    • You may provide a + * MessageDeduplicationId explicitly.

    • If you aren't + * able to provide a MessageDeduplicationId and you enable + * ContentBasedDeduplication for your topic, Amazon SNS uses a SHA-256 + * hash to generate the MessageDeduplicationId using the body of the + * message (but not the attributes of the message).

    • If you don't + * provide a MessageDeduplicationId and the topic doesn't have + * ContentBasedDeduplication set, the action fails with an error.

      + *
    • If the topic has a ContentBasedDeduplication set, + * your MessageDeduplicationId overrides the generated one.

    • + *
  • When ContentBasedDeduplication is in effect, + * messages with identical content sent within the deduplication scope and interval + * are treated as duplicates and only one copy of the message is delivered.

    + *
  • If you send one message with + * ContentBasedDeduplication enabled, and then another message with a + * MessageDeduplicationId that is the same as the one generated for + * the first MessageDeduplicationId, the two messages are treated as + * duplicates, within the deduplication scope and interval, and only one copy of + * the message is delivered.

+ */ + inline const Aws::String& GetMessageDeduplicationId() const{ return m_messageDeduplicationId; } + inline bool MessageDeduplicationIdHasBeenSet() const { return m_messageDeduplicationIdHasBeenSet; } + inline void SetMessageDeduplicationId(const Aws::String& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = value; } + inline void SetMessageDeduplicationId(Aws::String&& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = std::move(value); } + inline void SetMessageDeduplicationId(const char* value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId.assign(value); } + inline PublishRequest& WithMessageDeduplicationId(const Aws::String& value) { SetMessageDeduplicationId(value); return *this;} + inline PublishRequest& WithMessageDeduplicationId(Aws::String&& value) { SetMessageDeduplicationId(std::move(value)); return *this;} + inline PublishRequest& WithMessageDeduplicationId(const char* value) { SetMessageDeduplicationId(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) topics. The + * MessageGroupId can contain up to 128 alphanumeric characters + * (a-z, A-Z, 0-9) and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

The + * MessageGroupId is a tag that specifies that a message belongs to a + * specific message group. Messages that belong to the same message group are + * processed in a FIFO manner (however, messages in different message groups might + * be processed out of order). Every message must include a + * MessageGroupId.

+ */ + inline const Aws::String& GetMessageGroupId() const{ return m_messageGroupId; } + inline bool MessageGroupIdHasBeenSet() const { return m_messageGroupIdHasBeenSet; } + inline void SetMessageGroupId(const Aws::String& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = value; } + inline void SetMessageGroupId(Aws::String&& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = std::move(value); } + inline void SetMessageGroupId(const char* value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId.assign(value); } + inline PublishRequest& WithMessageGroupId(const Aws::String& value) { SetMessageGroupId(value); return *this;} + inline PublishRequest& WithMessageGroupId(Aws::String&& value) { SetMessageGroupId(std::move(value)); return *this;} + inline PublishRequest& WithMessageGroupId(const char* value) { SetMessageGroupId(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::String m_targetArn; + bool m_targetArnHasBeenSet = false; + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + + Aws::String m_message; + bool m_messageHasBeenSet = false; + + Aws::String m_subject; + bool m_subjectHasBeenSet = false; + + Aws::String m_messageStructure; + bool m_messageStructureHasBeenSet = false; + + Aws::Map m_messageAttributes; + bool m_messageAttributesHasBeenSet = false; + + Aws::String m_messageDeduplicationId; + bool m_messageDeduplicationIdHasBeenSet = false; + + Aws::String m_messageGroupId; + bool m_messageGroupIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PublishResult.h b/include/aws/sns/model/PublishResult.h new file mode 100644 index 0000000000000000000000000000000000000000..c33d01d6940e245c056acb34a2d3de1a5a2964ec --- /dev/null +++ b/include/aws/sns/model/PublishResult.h @@ -0,0 +1,91 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for Publish action.

See Also:

AWS + * API Reference

+ */ + class PublishResult + { + public: + AWS_SNS_API PublishResult(); + AWS_SNS_API PublishResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API PublishResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

Unique identifier assigned to the published message.

Length + * Constraint: Maximum 100 characters

+ */ + inline const Aws::String& GetMessageId() const{ return m_messageId; } + inline void SetMessageId(const Aws::String& value) { m_messageId = value; } + inline void SetMessageId(Aws::String&& value) { m_messageId = std::move(value); } + inline void SetMessageId(const char* value) { m_messageId.assign(value); } + inline PublishResult& WithMessageId(const Aws::String& value) { SetMessageId(value); return *this;} + inline PublishResult& WithMessageId(Aws::String&& value) { SetMessageId(std::move(value)); return *this;} + inline PublishResult& WithMessageId(const char* value) { SetMessageId(value); return *this;} + ///@} + + ///@{ + /** + *

This response element applies only to FIFO (first-in-first-out) topics.

+ *

The sequence number is a large, non-consecutive number that Amazon SNS + * assigns to each message. The length of SequenceNumber is 128 bits. + * SequenceNumber continues to increase for each + * MessageGroupId.

+ */ + inline const Aws::String& GetSequenceNumber() const{ return m_sequenceNumber; } + inline void SetSequenceNumber(const Aws::String& value) { m_sequenceNumber = value; } + inline void SetSequenceNumber(Aws::String&& value) { m_sequenceNumber = std::move(value); } + inline void SetSequenceNumber(const char* value) { m_sequenceNumber.assign(value); } + inline PublishResult& WithSequenceNumber(const Aws::String& value) { SetSequenceNumber(value); return *this;} + inline PublishResult& WithSequenceNumber(Aws::String&& value) { SetSequenceNumber(std::move(value)); return *this;} + inline PublishResult& WithSequenceNumber(const char* value) { SetSequenceNumber(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline PublishResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline PublishResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_messageId; + + Aws::String m_sequenceNumber; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/PutDataProtectionPolicyRequest.h b/include/aws/sns/model/PutDataProtectionPolicyRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a4ca9c247258ae829af8b3175d949ab6355a86cc --- /dev/null +++ b/include/aws/sns/model/PutDataProtectionPolicyRequest.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class PutDataProtectionPolicyRequest : public SNSRequest + { + public: + AWS_SNS_API PutDataProtectionPolicyRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PutDataProtectionPolicy"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic whose DataProtectionPolicy you want to add + * or update.

For more information about ARNs, see Amazon + * Resource Names (ARNs) in the Amazon Web Services General Reference.

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline PutDataProtectionPolicyRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline PutDataProtectionPolicyRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline PutDataProtectionPolicyRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The JSON serialization of the topic's DataProtectionPolicy.

+ *

The DataProtectionPolicy must be in JSON string format.

+ *

Length Constraints: Maximum length of 30,720.

+ */ + inline const Aws::String& GetDataProtectionPolicy() const{ return m_dataProtectionPolicy; } + inline bool DataProtectionPolicyHasBeenSet() const { return m_dataProtectionPolicyHasBeenSet; } + inline void SetDataProtectionPolicy(const Aws::String& value) { m_dataProtectionPolicyHasBeenSet = true; m_dataProtectionPolicy = value; } + inline void SetDataProtectionPolicy(Aws::String&& value) { m_dataProtectionPolicyHasBeenSet = true; m_dataProtectionPolicy = std::move(value); } + inline void SetDataProtectionPolicy(const char* value) { m_dataProtectionPolicyHasBeenSet = true; m_dataProtectionPolicy.assign(value); } + inline PutDataProtectionPolicyRequest& WithDataProtectionPolicy(const Aws::String& value) { SetDataProtectionPolicy(value); return *this;} + inline PutDataProtectionPolicyRequest& WithDataProtectionPolicy(Aws::String&& value) { SetDataProtectionPolicy(std::move(value)); return *this;} + inline PutDataProtectionPolicyRequest& WithDataProtectionPolicy(const char* value) { SetDataProtectionPolicy(value); return *this;} + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + + Aws::String m_dataProtectionPolicy; + bool m_dataProtectionPolicyHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/RemovePermissionRequest.h b/include/aws/sns/model/RemovePermissionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f619bd648a1767ed072517c6bdd1920619327323 --- /dev/null +++ b/include/aws/sns/model/RemovePermissionRequest.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for RemovePermission action.

See Also:

AWS + * API Reference

+ */ + class RemovePermissionRequest : public SNSRequest + { + public: + AWS_SNS_API RemovePermissionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "RemovePermission"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic whose access control policy you wish to modify.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline RemovePermissionRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline RemovePermissionRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline RemovePermissionRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

The unique label of the statement you want to remove.

+ */ + inline const Aws::String& GetLabel() const{ return m_label; } + inline bool LabelHasBeenSet() const { return m_labelHasBeenSet; } + inline void SetLabel(const Aws::String& value) { m_labelHasBeenSet = true; m_label = value; } + inline void SetLabel(Aws::String&& value) { m_labelHasBeenSet = true; m_label = std::move(value); } + inline void SetLabel(const char* value) { m_labelHasBeenSet = true; m_label.assign(value); } + inline RemovePermissionRequest& WithLabel(const Aws::String& value) { SetLabel(value); return *this;} + inline RemovePermissionRequest& WithLabel(Aws::String&& value) { SetLabel(std::move(value)); return *this;} + inline RemovePermissionRequest& WithLabel(const char* value) { SetLabel(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::String m_label; + bool m_labelHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/ResponseMetadata.h b/include/aws/sns/model/ResponseMetadata.h new file mode 100644 index 0000000000000000000000000000000000000000..a595db9653f1b395a153d46900d8e8419070a78e --- /dev/null +++ b/include/aws/sns/model/ResponseMetadata.h @@ -0,0 +1,56 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + class ResponseMetadata + { + public: + AWS_SNS_API ResponseMetadata(); + AWS_SNS_API ResponseMetadata(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API ResponseMetadata& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline bool RequestIdHasBeenSet() const { return m_requestIdHasBeenSet; } + inline void SetRequestId(const Aws::String& value) { m_requestIdHasBeenSet = true; m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestIdHasBeenSet = true; m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestIdHasBeenSet = true; m_requestId.assign(value); } + inline ResponseMetadata& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ResponseMetadata& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ResponseMetadata& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_requestId; + bool m_requestIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/RouteType.h b/include/aws/sns/model/RouteType.h new file mode 100644 index 0000000000000000000000000000000000000000..82f43a5b2cdcdfc7f9768e7ccae8b3c709a590ab --- /dev/null +++ b/include/aws/sns/model/RouteType.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + enum class RouteType + { + NOT_SET, + Transactional, + Promotional, + Premium + }; + +namespace RouteTypeMapper +{ +AWS_SNS_API RouteType GetRouteTypeForName(const Aws::String& name); + +AWS_SNS_API Aws::String GetNameForRouteType(RouteType value); +} // namespace RouteTypeMapper +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SMSSandboxPhoneNumber.h b/include/aws/sns/model/SMSSandboxPhoneNumber.h new file mode 100644 index 0000000000000000000000000000000000000000..5c75e33e6636aea8ad7679a9b2f9b39cdb8781cd --- /dev/null +++ b/include/aws/sns/model/SMSSandboxPhoneNumber.h @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

A verified or pending destination phone number in the SMS sandbox.

+ *

When you start using Amazon SNS to send SMS messages, your Amazon Web + * Services account is in the SMS sandbox. The SMS sandbox provides a safe + * environment for you to try Amazon SNS features without risking your reputation + * as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, + * you can use all of the features of Amazon SNS. However, you can send SMS + * messages only to verified destination phone numbers. For more information, + * including how to move out of the sandbox to send messages without restrictions, + * see SMS + * sandbox in the Amazon SNS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + class SMSSandboxPhoneNumber + { + public: + AWS_SNS_API SMSSandboxPhoneNumber(); + AWS_SNS_API SMSSandboxPhoneNumber(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API SMSSandboxPhoneNumber& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

The destination phone number.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline SMSSandboxPhoneNumber& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline SMSSandboxPhoneNumber& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline SMSSandboxPhoneNumber& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + + ///@{ + /** + *

The destination phone number's verification status.

+ */ + inline const SMSSandboxPhoneNumberVerificationStatus& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const SMSSandboxPhoneNumberVerificationStatus& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(SMSSandboxPhoneNumberVerificationStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline SMSSandboxPhoneNumber& WithStatus(const SMSSandboxPhoneNumberVerificationStatus& value) { SetStatus(value); return *this;} + inline SMSSandboxPhoneNumber& WithStatus(SMSSandboxPhoneNumberVerificationStatus&& value) { SetStatus(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + + SMSSandboxPhoneNumberVerificationStatus m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SMSSandboxPhoneNumberVerificationStatus.h b/include/aws/sns/model/SMSSandboxPhoneNumberVerificationStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..883553b2e6f4065dbce001acfb2edf42d782ee60 --- /dev/null +++ b/include/aws/sns/model/SMSSandboxPhoneNumberVerificationStatus.h @@ -0,0 +1,31 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + enum class SMSSandboxPhoneNumberVerificationStatus + { + NOT_SET, + Pending, + Verified + }; + +namespace SMSSandboxPhoneNumberVerificationStatusMapper +{ +AWS_SNS_API SMSSandboxPhoneNumberVerificationStatus GetSMSSandboxPhoneNumberVerificationStatusForName(const Aws::String& name); + +AWS_SNS_API Aws::String GetNameForSMSSandboxPhoneNumberVerificationStatus(SMSSandboxPhoneNumberVerificationStatus value); +} // namespace SMSSandboxPhoneNumberVerificationStatusMapper +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SetEndpointAttributesRequest.h b/include/aws/sns/model/SetEndpointAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..8023bbedc85023da58447604849a97605105a5ba --- /dev/null +++ b/include/aws/sns/model/SetEndpointAttributesRequest.h @@ -0,0 +1,97 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for SetEndpointAttributes action.

See Also:

+ * AWS + * API Reference

+ */ + class SetEndpointAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API SetEndpointAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SetEndpointAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

EndpointArn used for SetEndpointAttributes action.

+ */ + inline const Aws::String& GetEndpointArn() const{ return m_endpointArn; } + inline bool EndpointArnHasBeenSet() const { return m_endpointArnHasBeenSet; } + inline void SetEndpointArn(const Aws::String& value) { m_endpointArnHasBeenSet = true; m_endpointArn = value; } + inline void SetEndpointArn(Aws::String&& value) { m_endpointArnHasBeenSet = true; m_endpointArn = std::move(value); } + inline void SetEndpointArn(const char* value) { m_endpointArnHasBeenSet = true; m_endpointArn.assign(value); } + inline SetEndpointAttributesRequest& WithEndpointArn(const Aws::String& value) { SetEndpointArn(value); return *this;} + inline SetEndpointAttributesRequest& WithEndpointArn(Aws::String&& value) { SetEndpointArn(std::move(value)); return *this;} + inline SetEndpointAttributesRequest& WithEndpointArn(const char* value) { SetEndpointArn(value); return *this;} + ///@} + + ///@{ + /** + *

A map of the endpoint attributes. Attributes in this map include the + * following:

  • CustomUserData – arbitrary user data + * to associate with the endpoint. Amazon SNS does not use this data. The data must + * be in UTF-8 format and less than 2KB.

  • Enabled – + * flag that enables/disables delivery to the endpoint. Amazon SNS will set this to + * false when a notification service indicates to Amazon SNS that the endpoint is + * invalid. Users can set it back to true, typically after updating Token.

    + *
  • Token – device token, also referred to as a + * registration id, for an app and mobile device. This is returned from the + * notification service when an app and mobile device are registered with the + * notification service.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline SetEndpointAttributesRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline SetEndpointAttributesRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline SetEndpointAttributesRequest& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline SetEndpointAttributesRequest& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetEndpointAttributesRequest& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SetEndpointAttributesRequest& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline SetEndpointAttributesRequest& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SetEndpointAttributesRequest& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetEndpointAttributesRequest& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_endpointArn; + bool m_endpointArnHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SetPlatformApplicationAttributesRequest.h b/include/aws/sns/model/SetPlatformApplicationAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a178e939a4cfa846adfb92ee3f9d2f816f4ada88 --- /dev/null +++ b/include/aws/sns/model/SetPlatformApplicationAttributesRequest.h @@ -0,0 +1,129 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for SetPlatformApplicationAttributes action.

See + * Also:

AWS + * API Reference

+ */ + class SetPlatformApplicationAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API SetPlatformApplicationAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SetPlatformApplicationAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

PlatformApplicationArn for + * SetPlatformApplicationAttributes action.

+ */ + inline const Aws::String& GetPlatformApplicationArn() const{ return m_platformApplicationArn; } + inline bool PlatformApplicationArnHasBeenSet() const { return m_platformApplicationArnHasBeenSet; } + inline void SetPlatformApplicationArn(const Aws::String& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = value; } + inline void SetPlatformApplicationArn(Aws::String&& value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn = std::move(value); } + inline void SetPlatformApplicationArn(const char* value) { m_platformApplicationArnHasBeenSet = true; m_platformApplicationArn.assign(value); } + inline SetPlatformApplicationAttributesRequest& WithPlatformApplicationArn(const Aws::String& value) { SetPlatformApplicationArn(value); return *this;} + inline SetPlatformApplicationAttributesRequest& WithPlatformApplicationArn(Aws::String&& value) { SetPlatformApplicationArn(std::move(value)); return *this;} + inline SetPlatformApplicationAttributesRequest& WithPlatformApplicationArn(const char* value) { SetPlatformApplicationArn(value); return *this;} + ///@} + + ///@{ + /** + *

A map of the platform application attributes. Attributes in this map include + * the following:

  • PlatformCredential – The + * credential received from the notification service.

    • For ADM, + * PlatformCredentialis client secret.

    • For Apple + * Services using certificate credentials, PlatformCredential is + * private key.

    • For Apple Services using token credentials, + * PlatformCredential is signing key.

    • For GCM + * (Firebase Cloud Messaging) using key credentials, there is no + * PlatformPrincipal. The PlatformCredential is API + * key.

    • For GCM (Firebase Cloud Messaging) using token + * credentials, there is no PlatformPrincipal. The + * PlatformCredential is a JSON formatted private key file. When using + * the Amazon Web Services CLI, the file must be in string format and special + * characters must be ignored. To format the file correctly, Amazon SNS recommends + * using the following command: SERVICE_JSON=`jq @json <<< cat + * service.json`.

  • + * PlatformPrincipal – The principal received from the notification + * service.

    • For ADM, PlatformPrincipalis client + * id.

    • For Apple Services using certificate credentials, + * PlatformPrincipal is SSL certificate.

    • For Apple + * Services using token credentials, PlatformPrincipal is signing key + * ID.

    • For GCM (Firebase Cloud Messaging), there is no + * PlatformPrincipal.

  • + * EventEndpointCreated – Topic ARN to which + * EndpointCreated event notifications are sent.

  • + * EventEndpointDeleted – Topic ARN to which + * EndpointDeleted event notifications are sent.

  • + * EventEndpointUpdated – Topic ARN to which + * EndpointUpdate event notifications are sent.

  • + * EventDeliveryFailure – Topic ARN to which + * DeliveryFailure event notifications are sent upon Direct Publish + * delivery failure (permanent) to one of the application's endpoints.

  • + *
  • SuccessFeedbackRoleArn – IAM role ARN used to give Amazon + * SNS write access to use CloudWatch Logs on your behalf.

  • + * FailureFeedbackRoleArn – IAM role ARN used to give Amazon SNS write + * access to use CloudWatch Logs on your behalf.

  • + * SuccessFeedbackSampleRate – Sample rate percentage (0-100) of + * successfully delivered messages.

The following attributes + * only apply to APNs token-based authentication:

  • + * ApplePlatformTeamID – The identifier that's assigned to your Apple + * developer account team.

  • ApplePlatformBundleID – + * The bundle identifier that's assigned to your iOS app.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline SetPlatformApplicationAttributesRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline SetPlatformApplicationAttributesRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline SetPlatformApplicationAttributesRequest& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline SetPlatformApplicationAttributesRequest& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetPlatformApplicationAttributesRequest& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SetPlatformApplicationAttributesRequest& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline SetPlatformApplicationAttributesRequest& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SetPlatformApplicationAttributesRequest& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetPlatformApplicationAttributesRequest& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_platformApplicationArn; + bool m_platformApplicationArnHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SetSMSAttributesRequest.h b/include/aws/sns/model/SetSMSAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e99787038b518d0989676cd0c686d5ea7b39988a --- /dev/null +++ b/include/aws/sns/model/SetSMSAttributesRequest.h @@ -0,0 +1,118 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

The input for the SetSMSAttributes action.

See Also:

AWS + * API Reference

+ */ + class SetSMSAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API SetSMSAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SetSMSAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The default settings for sending SMS messages from your Amazon Web Services + * account. You can set values for the following attribute names:

+ * MonthlySpendLimit – The maximum amount in USD that you are willing + * to spend each month to send SMS messages. When Amazon SNS determines that + * sending an SMS message would incur a cost that exceeds this limit, it stops + * sending SMS messages within minutes.

Amazon SNS stops sending + * SMS messages within minutes of the limit being crossed. During that interval, if + * you continue to send SMS messages, you will incur costs that exceed your + * limit.

By default, the spend limit is set to the maximum + * allowed by Amazon SNS. If you want to raise the limit, submit an SNS + * Limit Increase case. For New limit value, enter your desired monthly + * spend limit. In the Use Case Description field, explain that you are + * requesting an SMS monthly spend limit increase.

+ * DeliveryStatusIAMRole – The ARN of the IAM role that allows Amazon + * SNS to write logs about SMS deliveries in CloudWatch Logs. For each SMS message + * that you send, Amazon SNS writes a log that includes the message price, the + * success or failure status, the reason for failure (if the message failed), the + * message dwell time, and other information.

+ * DeliveryStatusSuccessSamplingRate – The percentage of successful + * SMS deliveries for which Amazon SNS will write logs in CloudWatch Logs. The + * value can be an integer from 0 - 100. For example, to write logs only for failed + * deliveries, set this value to 0. To write logs for 10% of your + * successful deliveries, set it to 10.

+ * DefaultSenderID – A string, such as your business brand, that is + * displayed as the sender on the receiving device. Support for sender IDs varies + * by country. The sender ID can be 1 - 11 alphanumeric characters, and it must + * contain at least one letter.

DefaultSMSType – The type of + * SMS message that you will send by default. You can assign the following + * values:

  • Promotional – (Default) Noncritical + * messages, such as marketing messages. Amazon SNS optimizes the message delivery + * to incur the lowest cost.

  • Transactional – + * Critical messages that support customer transactions, such as one-time passcodes + * for multi-factor authentication. Amazon SNS optimizes the message delivery to + * achieve the highest reliability.

+ * UsageReportS3Bucket – The name of the Amazon S3 bucket to receive + * daily SMS usage reports from Amazon SNS. Each day, Amazon SNS will deliver a + * usage report as a CSV file to the bucket. The report includes the following + * information for each SMS message that was successfully delivered by your Amazon + * Web Services account:

  • Time that the message was published (in + * UTC)

  • Message ID

  • Destination phone number

    + *
  • Message type

  • Delivery status

  • + *

    Message price (in USD)

  • Part number (a message is split into + * multiple parts if it is too long for a single message)

  • Total + * number of parts

To receive the report, the bucket must have a + * policy that allows the Amazon SNS service principal to perform the + * s3:PutObject and s3:GetBucketLocation actions.

+ *

For an example bucket policy and usage report, see Monitoring SMS + * Activity in the Amazon SNS Developer Guide.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline SetSMSAttributesRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline SetSMSAttributesRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline SetSMSAttributesRequest& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline SetSMSAttributesRequest& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetSMSAttributesRequest& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SetSMSAttributesRequest& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline SetSMSAttributesRequest& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SetSMSAttributesRequest& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetSMSAttributesRequest& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SetSMSAttributesResult.h b/include/aws/sns/model/SetSMSAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..b5f23735fd324620fac311d73bc51a31c333c492 --- /dev/null +++ b/include/aws/sns/model/SetSMSAttributesResult.h @@ -0,0 +1,55 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

The response for the SetSMSAttributes action.

See Also:

AWS + * API Reference

+ */ + class SetSMSAttributesResult + { + public: + AWS_SNS_API SetSMSAttributesResult(); + AWS_SNS_API SetSMSAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API SetSMSAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline SetSMSAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline SetSMSAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SetSubscriptionAttributesRequest.h b/include/aws/sns/model/SetSubscriptionAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..7f07fde4dc40678bd78a6ed224a587b8fa5ddff6 --- /dev/null +++ b/include/aws/sns/model/SetSubscriptionAttributesRequest.h @@ -0,0 +1,126 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for SetSubscriptionAttributes action.

See Also:

AWS + * API Reference

+ */ + class SetSubscriptionAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API SetSubscriptionAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SetSubscriptionAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the subscription to modify.

+ */ + inline const Aws::String& GetSubscriptionArn() const{ return m_subscriptionArn; } + inline bool SubscriptionArnHasBeenSet() const { return m_subscriptionArnHasBeenSet; } + inline void SetSubscriptionArn(const Aws::String& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = value; } + inline void SetSubscriptionArn(Aws::String&& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = std::move(value); } + inline void SetSubscriptionArn(const char* value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn.assign(value); } + inline SetSubscriptionAttributesRequest& WithSubscriptionArn(const Aws::String& value) { SetSubscriptionArn(value); return *this;} + inline SetSubscriptionAttributesRequest& WithSubscriptionArn(Aws::String&& value) { SetSubscriptionArn(std::move(value)); return *this;} + inline SetSubscriptionAttributesRequest& WithSubscriptionArn(const char* value) { SetSubscriptionArn(value); return *this;} + ///@} + + ///@{ + /** + *

A map of attributes with their corresponding values.

The following + * lists the names, descriptions, and values of the special request parameters that + * this action uses:

  • DeliveryPolicy – The policy + * that defines how Amazon SNS retries failed deliveries to HTTP/S endpoints.

    + *
  • FilterPolicy – The simple JSON object that lets your + * subscriber receive only a subset of messages, rather than receiving every + * message published to the topic.

  • + * FilterPolicyScope – This attribute lets you choose the filtering + * scope by using one of the following string value types:

    • + * MessageAttributes (default) – The filter is applied on the message + * attributes.

    • MessageBody – The filter is applied + * on the message body.

  • + * RawMessageDelivery – When set to true, enables raw + * message delivery to Amazon SQS or HTTP/S endpoints. This eliminates the need for + * the endpoints to process JSON formatting, which is otherwise created for Amazon + * SNS metadata.

  • RedrivePolicy – When specified, + * sends undeliverable messages to the specified Amazon SQS dead-letter queue. + * Messages that can't be delivered due to client errors (for example, when the + * subscribed endpoint is unreachable) or server errors (for example, when the + * service that powers the subscribed endpoint becomes unavailable) are held in the + * dead-letter queue for further analysis or reprocessing.

The + * following attribute applies only to Amazon Data Firehose delivery stream + * subscriptions:

  • SubscriptionRoleArn – The ARN of + * the IAM role that has the following:

    • Permission to write to the + * Firehose delivery stream

    • Amazon SNS listed as a trusted + * entity

    Specifying a valid ARN for this attribute is required + * for Firehose delivery stream subscriptions. For more information, see Fanout + * to Firehose delivery streams in the Amazon SNS Developer Guide.

    + *
+ */ + inline const Aws::String& GetAttributeName() const{ return m_attributeName; } + inline bool AttributeNameHasBeenSet() const { return m_attributeNameHasBeenSet; } + inline void SetAttributeName(const Aws::String& value) { m_attributeNameHasBeenSet = true; m_attributeName = value; } + inline void SetAttributeName(Aws::String&& value) { m_attributeNameHasBeenSet = true; m_attributeName = std::move(value); } + inline void SetAttributeName(const char* value) { m_attributeNameHasBeenSet = true; m_attributeName.assign(value); } + inline SetSubscriptionAttributesRequest& WithAttributeName(const Aws::String& value) { SetAttributeName(value); return *this;} + inline SetSubscriptionAttributesRequest& WithAttributeName(Aws::String&& value) { SetAttributeName(std::move(value)); return *this;} + inline SetSubscriptionAttributesRequest& WithAttributeName(const char* value) { SetAttributeName(value); return *this;} + ///@} + + ///@{ + /** + *

The new value for the attribute in JSON format.

+ */ + inline const Aws::String& GetAttributeValue() const{ return m_attributeValue; } + inline bool AttributeValueHasBeenSet() const { return m_attributeValueHasBeenSet; } + inline void SetAttributeValue(const Aws::String& value) { m_attributeValueHasBeenSet = true; m_attributeValue = value; } + inline void SetAttributeValue(Aws::String&& value) { m_attributeValueHasBeenSet = true; m_attributeValue = std::move(value); } + inline void SetAttributeValue(const char* value) { m_attributeValueHasBeenSet = true; m_attributeValue.assign(value); } + inline SetSubscriptionAttributesRequest& WithAttributeValue(const Aws::String& value) { SetAttributeValue(value); return *this;} + inline SetSubscriptionAttributesRequest& WithAttributeValue(Aws::String&& value) { SetAttributeValue(std::move(value)); return *this;} + inline SetSubscriptionAttributesRequest& WithAttributeValue(const char* value) { SetAttributeValue(value); return *this;} + ///@} + private: + + Aws::String m_subscriptionArn; + bool m_subscriptionArnHasBeenSet = false; + + Aws::String m_attributeName; + bool m_attributeNameHasBeenSet = false; + + Aws::String m_attributeValue; + bool m_attributeValueHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SetTopicAttributesRequest.h b/include/aws/sns/model/SetTopicAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f809c6dca1f4fae8fc8b034c291dc9df4d6c738c --- /dev/null +++ b/include/aws/sns/model/SetTopicAttributesRequest.h @@ -0,0 +1,211 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for SetTopicAttributes action.

See Also:

AWS + * API Reference

+ */ + class SetTopicAttributesRequest : public SNSRequest + { + public: + AWS_SNS_API SetTopicAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SetTopicAttributes"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic to modify.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline SetTopicAttributesRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline SetTopicAttributesRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline SetTopicAttributesRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

A map of attributes with their corresponding values.

The following + * lists the names, descriptions, and values of the special request parameters that + * the SetTopicAttributes action uses:

  • + * ApplicationSuccessFeedbackRoleArn – Indicates failed message + * delivery status for an Amazon SNS topic that is subscribed to a platform + * application endpoint.

  • DeliveryPolicy – The + * policy that defines how Amazon SNS retries failed deliveries to HTTP/S + * endpoints.

  • DisplayName – The display name to use + * for a topic with SMS subscriptions.

  • Policy – The + * policy that defines who can access your topic. By default, only the topic owner + * can publish or subscribe to the topic.

  • + * TracingConfig – Tracing mode of an Amazon SNS topic. By default + * TracingConfig is set to PassThrough, and the topic + * passes through the tracing header it receives from an Amazon SNS publisher to + * its subscriptions. If set to Active, Amazon SNS will vend X-Ray + * segment data to topic owner account if the sampled flag in the tracing header is + * true. This is only supported on standard topics.

  • HTTP

      + *
    • HTTPSuccessFeedbackRoleArn – Indicates successful message + * delivery status for an Amazon SNS topic that is subscribed to an HTTP endpoint. + *

    • HTTPSuccessFeedbackSampleRate – Indicates + * percentage of successful messages to sample for an Amazon SNS topic that is + * subscribed to an HTTP endpoint.

    • + * HTTPFailureFeedbackRoleArn – Indicates failed message delivery + * status for an Amazon SNS topic that is subscribed to an HTTP endpoint.

    • + *
  • Amazon Kinesis Data Firehose

    • + * FirehoseSuccessFeedbackRoleArn – Indicates successful message + * delivery status for an Amazon SNS topic that is subscribed to an Amazon Kinesis + * Data Firehose endpoint.

    • + * FirehoseSuccessFeedbackSampleRate – Indicates percentage of + * successful messages to sample for an Amazon SNS topic that is subscribed to an + * Amazon Kinesis Data Firehose endpoint.

    • + * FirehoseFailureFeedbackRoleArn – Indicates failed message delivery + * status for an Amazon SNS topic that is subscribed to an Amazon Kinesis Data + * Firehose endpoint.

  • Lambda

    • + * LambdaSuccessFeedbackRoleArn – Indicates successful message + * delivery status for an Amazon SNS topic that is subscribed to an Lambda + * endpoint.

    • LambdaSuccessFeedbackSampleRate – + * Indicates percentage of successful messages to sample for an Amazon SNS topic + * that is subscribed to an Lambda endpoint.

    • + * LambdaFailureFeedbackRoleArn – Indicates failed message delivery + * status for an Amazon SNS topic that is subscribed to an Lambda endpoint.

      + *
  • Platform application endpoint

    • + * ApplicationSuccessFeedbackRoleArn – Indicates successful message + * delivery status for an Amazon SNS topic that is subscribed to an Amazon Web + * Services application endpoint.

    • + * ApplicationSuccessFeedbackSampleRate – Indicates percentage of + * successful messages to sample for an Amazon SNS topic that is subscribed to an + * Amazon Web Services application endpoint.

    • + * ApplicationFailureFeedbackRoleArn – Indicates failed message + * delivery status for an Amazon SNS topic that is subscribed to an Amazon Web + * Services application endpoint.

    In addition to being + * able to configure topic attributes for message delivery status of notification + * messages sent to Amazon SNS application endpoints, you can also configure + * application attributes for the delivery status of push notification messages + * sent to push notification services.

    For example, For more information, + * see Using + * Amazon SNS Application Attributes for Message Delivery Status.

    + *
  • Amazon SQS

    • + * SQSSuccessFeedbackRoleArn – Indicates successful message delivery + * status for an Amazon SNS topic that is subscribed to an Amazon SQS endpoint. + *

    • SQSSuccessFeedbackSampleRate – Indicates + * percentage of successful messages to sample for an Amazon SNS topic that is + * subscribed to an Amazon SQS endpoint.

    • + * SQSFailureFeedbackRoleArn – Indicates failed message delivery + * status for an Amazon SNS topic that is subscribed to an Amazon SQS endpoint. + *

The + * <ENDPOINT>SuccessFeedbackRoleArn and + * <ENDPOINT>FailureFeedbackRoleArn attributes are used to give Amazon SNS + * write access to use CloudWatch Logs on your behalf. The + * <ENDPOINT>SuccessFeedbackSampleRate attribute is for specifying the sample + * rate percentage (0-100) of successfully delivered messages. After you configure + * the <ENDPOINT>FailureFeedbackRoleArn attribute, then all failed message + * deliveries generate CloudWatch Logs.

The following attribute + * applies only to server-side-encryption:

+ *
  • KmsMasterKeyId – The ID of an Amazon Web Services + * managed customer master key (CMK) for Amazon SNS or a custom CMK. For more + * information, see Key + * Terms. For more examples, see KeyId + * in the Key Management Service API Reference.

  • + * SignatureVersion – The signature version corresponds to the hashing + * algorithm used while creating the signature of the notifications, subscription + * confirmations, or unsubscribe confirmation messages sent by Amazon SNS. By + * default, SignatureVersion is set to 1.

+ *

The following attribute applies only to FIFO + * topics:

  • ArchivePolicy – The policy that sets + * the retention period for messages stored in the message archive of an Amazon SNS + * FIFO topic.

  • ContentBasedDeduplication – Enables + * content-based deduplication for FIFO topics.

    • By default, + * ContentBasedDeduplication is set to false. If you + * create a FIFO topic and this attribute is false, you must specify a + * value for the MessageDeduplicationId parameter for the Publish + * action.

    • When you set ContentBasedDeduplication + * to true, Amazon SNS uses a SHA-256 hash to generate the + * MessageDeduplicationId using the body of the message (but not the + * attributes of the message).

      (Optional) To override the generated value, + * you can specify a value for the MessageDeduplicationId parameter + * for the Publish action.

  • + * FifoThroughputScope – Enables higher throughput for your FIFO topic + * by adjusting the scope of deduplication. This attribute has two possible + * values:

    • Topic – The scope of message + * deduplication is across the entire topic. This is the default value and + * maintains existing behavior, with a maximum throughput of 3000 messages per + * second or 20MB per second, whichever comes first.

    • + * MessageGroup – The scope of deduplication is within each individual + * message group, which enables higher throughput per topic subject to regional + * quotas. For more information on quotas or to request an increase, see Amazon SNS service + * quotas in the Amazon Web Services General Reference.

  • + *
+ */ + inline const Aws::String& GetAttributeName() const{ return m_attributeName; } + inline bool AttributeNameHasBeenSet() const { return m_attributeNameHasBeenSet; } + inline void SetAttributeName(const Aws::String& value) { m_attributeNameHasBeenSet = true; m_attributeName = value; } + inline void SetAttributeName(Aws::String&& value) { m_attributeNameHasBeenSet = true; m_attributeName = std::move(value); } + inline void SetAttributeName(const char* value) { m_attributeNameHasBeenSet = true; m_attributeName.assign(value); } + inline SetTopicAttributesRequest& WithAttributeName(const Aws::String& value) { SetAttributeName(value); return *this;} + inline SetTopicAttributesRequest& WithAttributeName(Aws::String&& value) { SetAttributeName(std::move(value)); return *this;} + inline SetTopicAttributesRequest& WithAttributeName(const char* value) { SetAttributeName(value); return *this;} + ///@} + + ///@{ + /** + *

The new value for the attribute.

+ */ + inline const Aws::String& GetAttributeValue() const{ return m_attributeValue; } + inline bool AttributeValueHasBeenSet() const { return m_attributeValueHasBeenSet; } + inline void SetAttributeValue(const Aws::String& value) { m_attributeValueHasBeenSet = true; m_attributeValue = value; } + inline void SetAttributeValue(Aws::String&& value) { m_attributeValueHasBeenSet = true; m_attributeValue = std::move(value); } + inline void SetAttributeValue(const char* value) { m_attributeValueHasBeenSet = true; m_attributeValue.assign(value); } + inline SetTopicAttributesRequest& WithAttributeValue(const Aws::String& value) { SetAttributeValue(value); return *this;} + inline SetTopicAttributesRequest& WithAttributeValue(Aws::String&& value) { SetAttributeValue(std::move(value)); return *this;} + inline SetTopicAttributesRequest& WithAttributeValue(const char* value) { SetAttributeValue(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::String m_attributeName; + bool m_attributeNameHasBeenSet = false; + + Aws::String m_attributeValue; + bool m_attributeValueHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SubscribeRequest.h b/include/aws/sns/model/SubscribeRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..0c7e3fcc7c6898fac908170bef5caaa661a4e312 --- /dev/null +++ b/include/aws/sns/model/SubscribeRequest.h @@ -0,0 +1,209 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for Subscribe action.

See Also:

AWS + * API Reference

+ */ + class SubscribeRequest : public SNSRequest + { + public: + AWS_SNS_API SubscribeRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "Subscribe"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic you want to subscribe to.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline SubscribeRequest& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline SubscribeRequest& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline SubscribeRequest& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + + ///@{ + /** + *

The protocol that you want to use. Supported protocols include:

  • + *

    http – delivery of JSON-encoded message via HTTP POST

  • + *
  • https – delivery of JSON-encoded message via HTTPS + * POST

  • email – delivery of message via SMTP

    + *
  • email-json – delivery of JSON-encoded message via + * SMTP

  • sms – delivery of message via SMS

  • + *
  • sqs – delivery of JSON-encoded message to an Amazon SQS + * queue

  • application – delivery of JSON-encoded + * message to an EndpointArn for a mobile app and device

  • + * lambda – delivery of JSON-encoded message to an Lambda function

    + *
  • firehose – delivery of JSON-encoded message to an + * Amazon Kinesis Data Firehose delivery stream.

+ */ + inline const Aws::String& GetProtocol() const{ return m_protocol; } + inline bool ProtocolHasBeenSet() const { return m_protocolHasBeenSet; } + inline void SetProtocol(const Aws::String& value) { m_protocolHasBeenSet = true; m_protocol = value; } + inline void SetProtocol(Aws::String&& value) { m_protocolHasBeenSet = true; m_protocol = std::move(value); } + inline void SetProtocol(const char* value) { m_protocolHasBeenSet = true; m_protocol.assign(value); } + inline SubscribeRequest& WithProtocol(const Aws::String& value) { SetProtocol(value); return *this;} + inline SubscribeRequest& WithProtocol(Aws::String&& value) { SetProtocol(std::move(value)); return *this;} + inline SubscribeRequest& WithProtocol(const char* value) { SetProtocol(value); return *this;} + ///@} + + ///@{ + /** + *

The endpoint that you want to receive notifications. Endpoints vary by + * protocol:

  • For the http protocol, the (public) + * endpoint is a URL beginning with http://.

  • For the + * https protocol, the (public) endpoint is a URL beginning with + * https://.

  • For the email protocol, + * the endpoint is an email address.

  • For the + * email-json protocol, the endpoint is an email address.

  • + *
  • For the sms protocol, the endpoint is a phone number of an + * SMS-enabled device.

  • For the sqs protocol, the + * endpoint is the ARN of an Amazon SQS queue.

  • For the + * application protocol, the endpoint is the EndpointArn of a mobile + * app and device.

  • For the lambda protocol, the + * endpoint is the ARN of an Lambda function.

  • For the + * firehose protocol, the endpoint is the ARN of an Amazon Kinesis + * Data Firehose delivery stream.

+ */ + inline const Aws::String& GetEndpoint() const{ return m_endpoint; } + inline bool EndpointHasBeenSet() const { return m_endpointHasBeenSet; } + inline void SetEndpoint(const Aws::String& value) { m_endpointHasBeenSet = true; m_endpoint = value; } + inline void SetEndpoint(Aws::String&& value) { m_endpointHasBeenSet = true; m_endpoint = std::move(value); } + inline void SetEndpoint(const char* value) { m_endpointHasBeenSet = true; m_endpoint.assign(value); } + inline SubscribeRequest& WithEndpoint(const Aws::String& value) { SetEndpoint(value); return *this;} + inline SubscribeRequest& WithEndpoint(Aws::String&& value) { SetEndpoint(std::move(value)); return *this;} + inline SubscribeRequest& WithEndpoint(const char* value) { SetEndpoint(value); return *this;} + ///@} + + ///@{ + /** + *

A map of attributes with their corresponding values.

The following + * lists the names, descriptions, and values of the special request parameters that + * the Subscribe action uses:

  • + * DeliveryPolicy – The policy that defines how Amazon SNS retries + * failed deliveries to HTTP/S endpoints.

  • + * FilterPolicy – The simple JSON object that lets your subscriber + * receive only a subset of messages, rather than receiving every message published + * to the topic.

  • FilterPolicyScope – This attribute + * lets you choose the filtering scope by using one of the following string value + * types:

    • MessageAttributes (default) – The filter + * is applied on the message attributes.

    • + * MessageBody – The filter is applied on the message body.

    • + *
  • RawMessageDelivery – When set to + * true, enables raw message delivery to Amazon SQS or HTTP/S + * endpoints. This eliminates the need for the endpoints to process JSON + * formatting, which is otherwise created for Amazon SNS metadata.

  • + *

    RedrivePolicy – When specified, sends undeliverable messages to + * the specified Amazon SQS dead-letter queue. Messages that can't be delivered due + * to client errors (for example, when the subscribed endpoint is unreachable) or + * server errors (for example, when the service that powers the subscribed endpoint + * becomes unavailable) are held in the dead-letter queue for further analysis or + * reprocessing.

The following attribute applies only to Amazon + * Data Firehose delivery stream subscriptions:

  • + * SubscriptionRoleArn – The ARN of the IAM role that has the + * following:

    • Permission to write to the Firehose delivery + * stream

    • Amazon SNS listed as a trusted entity

    + *

    Specifying a valid ARN for this attribute is required for Firehose delivery + * stream subscriptions. For more information, see Fanout + * to Firehose delivery streams in the Amazon SNS Developer Guide.

    + *

The following attributes apply only to FIFO + * topics:

  • ReplayPolicy – Adds or updates an + * inline policy document for a subscription to replay messages stored in the + * specified Amazon SNS topic.

  • ReplayStatus – + * Retrieves the status of the subscription message replay, which can be one of the + * following:

    • Completed – The replay has + * successfully redelivered all messages, and is now delivering newly published + * messages. If an ending point was specified in the ReplayPolicy then + * the subscription will no longer receive newly published messages.

    • + *

      In progress – The replay is currently replaying the selected + * messages.

    • Failed – The replay was unable to + * complete.

    • Pending – The default state while the + * replay initiates.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline SubscribeRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline SubscribeRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline SubscribeRequest& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline SubscribeRequest& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SubscribeRequest& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SubscribeRequest& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline SubscribeRequest& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SubscribeRequest& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SubscribeRequest& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

Sets whether the response from the Subscribe request includes + * the subscription ARN, even if the subscription is not yet confirmed.

If + * you set this parameter to true, the response includes the ARN in + * all cases, even if the subscription is not yet confirmed. In addition to the ARN + * for confirmed subscriptions, the response also includes the pending + * subscription ARN value for subscriptions that aren't yet confirmed. A + * subscription becomes confirmed when the subscriber calls the + * ConfirmSubscription action with a confirmation token.

+ *

The default value is false.

+ */ + inline bool GetReturnSubscriptionArn() const{ return m_returnSubscriptionArn; } + inline bool ReturnSubscriptionArnHasBeenSet() const { return m_returnSubscriptionArnHasBeenSet; } + inline void SetReturnSubscriptionArn(bool value) { m_returnSubscriptionArnHasBeenSet = true; m_returnSubscriptionArn = value; } + inline SubscribeRequest& WithReturnSubscriptionArn(bool value) { SetReturnSubscriptionArn(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + + Aws::String m_protocol; + bool m_protocolHasBeenSet = false; + + Aws::String m_endpoint; + bool m_endpointHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + + bool m_returnSubscriptionArn; + bool m_returnSubscriptionArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/SubscribeResult.h b/include/aws/sns/model/SubscribeResult.h new file mode 100644 index 0000000000000000000000000000000000000000..d07943e44ff1d5bef4aeef53114162b1d66ad794 --- /dev/null +++ b/include/aws/sns/model/SubscribeResult.h @@ -0,0 +1,74 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

Response for Subscribe action.

See Also:

AWS + * API Reference

+ */ + class SubscribeResult + { + public: + AWS_SNS_API SubscribeResult(); + AWS_SNS_API SubscribeResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API SubscribeResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The ARN of the subscription if it is confirmed, or the string "pending + * confirmation" if the subscription requires confirmation. However, if the API + * request parameter ReturnSubscriptionArn is true, then the value is + * always the subscription ARN, even if the subscription requires confirmation.

+ */ + inline const Aws::String& GetSubscriptionArn() const{ return m_subscriptionArn; } + inline void SetSubscriptionArn(const Aws::String& value) { m_subscriptionArn = value; } + inline void SetSubscriptionArn(Aws::String&& value) { m_subscriptionArn = std::move(value); } + inline void SetSubscriptionArn(const char* value) { m_subscriptionArn.assign(value); } + inline SubscribeResult& WithSubscriptionArn(const Aws::String& value) { SetSubscriptionArn(value); return *this;} + inline SubscribeResult& WithSubscriptionArn(Aws::String&& value) { SetSubscriptionArn(std::move(value)); return *this;} + inline SubscribeResult& WithSubscriptionArn(const char* value) { SetSubscriptionArn(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline SubscribeResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline SubscribeResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_subscriptionArn; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/Subscription.h b/include/aws/sns/model/Subscription.h new file mode 100644 index 0000000000000000000000000000000000000000..d66d53be7ec7ee6fb18703ec26c3b44c34bf4fb6 --- /dev/null +++ b/include/aws/sns/model/Subscription.h @@ -0,0 +1,132 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

A wrapper type for the attributes of an Amazon SNS + * subscription.

See Also:

AWS + * API Reference

+ */ + class Subscription + { + public: + AWS_SNS_API Subscription(); + AWS_SNS_API Subscription(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API Subscription& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

The subscription's ARN.

+ */ + inline const Aws::String& GetSubscriptionArn() const{ return m_subscriptionArn; } + inline bool SubscriptionArnHasBeenSet() const { return m_subscriptionArnHasBeenSet; } + inline void SetSubscriptionArn(const Aws::String& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = value; } + inline void SetSubscriptionArn(Aws::String&& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = std::move(value); } + inline void SetSubscriptionArn(const char* value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn.assign(value); } + inline Subscription& WithSubscriptionArn(const Aws::String& value) { SetSubscriptionArn(value); return *this;} + inline Subscription& WithSubscriptionArn(Aws::String&& value) { SetSubscriptionArn(std::move(value)); return *this;} + inline Subscription& WithSubscriptionArn(const char* value) { SetSubscriptionArn(value); return *this;} + ///@} + + ///@{ + /** + *

The subscription's owner.

+ */ + inline const Aws::String& GetOwner() const{ return m_owner; } + inline bool OwnerHasBeenSet() const { return m_ownerHasBeenSet; } + inline void SetOwner(const Aws::String& value) { m_ownerHasBeenSet = true; m_owner = value; } + inline void SetOwner(Aws::String&& value) { m_ownerHasBeenSet = true; m_owner = std::move(value); } + inline void SetOwner(const char* value) { m_ownerHasBeenSet = true; m_owner.assign(value); } + inline Subscription& WithOwner(const Aws::String& value) { SetOwner(value); return *this;} + inline Subscription& WithOwner(Aws::String&& value) { SetOwner(std::move(value)); return *this;} + inline Subscription& WithOwner(const char* value) { SetOwner(value); return *this;} + ///@} + + ///@{ + /** + *

The subscription's protocol.

+ */ + inline const Aws::String& GetProtocol() const{ return m_protocol; } + inline bool ProtocolHasBeenSet() const { return m_protocolHasBeenSet; } + inline void SetProtocol(const Aws::String& value) { m_protocolHasBeenSet = true; m_protocol = value; } + inline void SetProtocol(Aws::String&& value) { m_protocolHasBeenSet = true; m_protocol = std::move(value); } + inline void SetProtocol(const char* value) { m_protocolHasBeenSet = true; m_protocol.assign(value); } + inline Subscription& WithProtocol(const Aws::String& value) { SetProtocol(value); return *this;} + inline Subscription& WithProtocol(Aws::String&& value) { SetProtocol(std::move(value)); return *this;} + inline Subscription& WithProtocol(const char* value) { SetProtocol(value); return *this;} + ///@} + + ///@{ + /** + *

The subscription's endpoint (format depends on the protocol).

+ */ + inline const Aws::String& GetEndpoint() const{ return m_endpoint; } + inline bool EndpointHasBeenSet() const { return m_endpointHasBeenSet; } + inline void SetEndpoint(const Aws::String& value) { m_endpointHasBeenSet = true; m_endpoint = value; } + inline void SetEndpoint(Aws::String&& value) { m_endpointHasBeenSet = true; m_endpoint = std::move(value); } + inline void SetEndpoint(const char* value) { m_endpointHasBeenSet = true; m_endpoint.assign(value); } + inline Subscription& WithEndpoint(const Aws::String& value) { SetEndpoint(value); return *this;} + inline Subscription& WithEndpoint(Aws::String&& value) { SetEndpoint(std::move(value)); return *this;} + inline Subscription& WithEndpoint(const char* value) { SetEndpoint(value); return *this;} + ///@} + + ///@{ + /** + *

The ARN of the subscription's topic.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline Subscription& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline Subscription& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline Subscription& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + private: + + Aws::String m_subscriptionArn; + bool m_subscriptionArnHasBeenSet = false; + + Aws::String m_owner; + bool m_ownerHasBeenSet = false; + + Aws::String m_protocol; + bool m_protocolHasBeenSet = false; + + Aws::String m_endpoint; + bool m_endpointHasBeenSet = false; + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/Tag.h b/include/aws/sns/model/Tag.h new file mode 100644 index 0000000000000000000000000000000000000000..06c650ed68ba940c3b7ade6f530c51465dd94343 --- /dev/null +++ b/include/aws/sns/model/Tag.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

The list of tags to be added to the specified topic.

See Also:

+ * AWS API + * Reference

+ */ + class Tag + { + public: + AWS_SNS_API Tag(); + AWS_SNS_API Tag(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API Tag& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

The required key portion of the tag.

+ */ + inline const Aws::String& GetKey() const{ return m_key; } + inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; } + inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; } + inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); } + inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); } + inline Tag& WithKey(const Aws::String& value) { SetKey(value); return *this;} + inline Tag& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;} + inline Tag& WithKey(const char* value) { SetKey(value); return *this;} + ///@} + + ///@{ + /** + *

The optional value portion of the tag.

+ */ + inline const Aws::String& GetValue() const{ return m_value; } + inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; } + inline void SetValue(const Aws::String& value) { m_valueHasBeenSet = true; m_value = value; } + inline void SetValue(Aws::String&& value) { m_valueHasBeenSet = true; m_value = std::move(value); } + inline void SetValue(const char* value) { m_valueHasBeenSet = true; m_value.assign(value); } + inline Tag& WithValue(const Aws::String& value) { SetValue(value); return *this;} + inline Tag& WithValue(Aws::String&& value) { SetValue(std::move(value)); return *this;} + inline Tag& WithValue(const char* value) { SetValue(value); return *this;} + ///@} + private: + + Aws::String m_key; + bool m_keyHasBeenSet = false; + + Aws::String m_value; + bool m_valueHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/TagResourceRequest.h b/include/aws/sns/model/TagResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d21486d6deeac0c713c6c31009a2c5dff713b619 --- /dev/null +++ b/include/aws/sns/model/TagResourceRequest.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class TagResourceRequest : public SNSRequest + { + public: + AWS_SNS_API TagResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "TagResource"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic to which to add tags.

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline TagResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline TagResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline TagResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The tags to be added to the specified topic. A tag consists of a required key + * and an optional value.

+ */ + inline const Aws::Vector& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Vector& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Vector&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline TagResourceRequest& WithTags(const Aws::Vector& value) { SetTags(value); return *this;} + inline TagResourceRequest& WithTags(Aws::Vector&& value) { SetTags(std::move(value)); return *this;} + inline TagResourceRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } + inline TagResourceRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + + Aws::Vector m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/TagResourceResult.h b/include/aws/sns/model/TagResourceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a7f6f18ce6742c5b73d899899d3df28258642603 --- /dev/null +++ b/include/aws/sns/model/TagResourceResult.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class TagResourceResult + { + public: + AWS_SNS_API TagResourceResult(); + AWS_SNS_API TagResourceResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API TagResourceResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline TagResourceResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline TagResourceResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/Topic.h b/include/aws/sns/model/Topic.h new file mode 100644 index 0000000000000000000000000000000000000000..c7fe6cd5256d1d5de96257bc45cd85ead800f5f8 --- /dev/null +++ b/include/aws/sns/model/Topic.h @@ -0,0 +1,65 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

A wrapper type for the topic's Amazon Resource Name (ARN). To retrieve a + * topic's attributes, use GetTopicAttributes.

See + * Also:

AWS API + * Reference

+ */ + class Topic + { + public: + AWS_SNS_API Topic(); + AWS_SNS_API Topic(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API Topic& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + /** + *

The topic's ARN.

+ */ + inline const Aws::String& GetTopicArn() const{ return m_topicArn; } + inline bool TopicArnHasBeenSet() const { return m_topicArnHasBeenSet; } + inline void SetTopicArn(const Aws::String& value) { m_topicArnHasBeenSet = true; m_topicArn = value; } + inline void SetTopicArn(Aws::String&& value) { m_topicArnHasBeenSet = true; m_topicArn = std::move(value); } + inline void SetTopicArn(const char* value) { m_topicArnHasBeenSet = true; m_topicArn.assign(value); } + inline Topic& WithTopicArn(const Aws::String& value) { SetTopicArn(value); return *this;} + inline Topic& WithTopicArn(Aws::String&& value) { SetTopicArn(std::move(value)); return *this;} + inline Topic& WithTopicArn(const char* value) { SetTopicArn(value); return *this;} + ///@} + private: + + Aws::String m_topicArn; + bool m_topicArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/UnsubscribeRequest.h b/include/aws/sns/model/UnsubscribeRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..72572c76e2adc2ed4efe6c0b0dc385a082d899de --- /dev/null +++ b/include/aws/sns/model/UnsubscribeRequest.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + *

Input for Unsubscribe action.

See Also:

AWS + * API Reference

+ */ + class UnsubscribeRequest : public SNSRequest + { + public: + AWS_SNS_API UnsubscribeRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "Unsubscribe"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the subscription to be deleted.

+ */ + inline const Aws::String& GetSubscriptionArn() const{ return m_subscriptionArn; } + inline bool SubscriptionArnHasBeenSet() const { return m_subscriptionArnHasBeenSet; } + inline void SetSubscriptionArn(const Aws::String& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = value; } + inline void SetSubscriptionArn(Aws::String&& value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn = std::move(value); } + inline void SetSubscriptionArn(const char* value) { m_subscriptionArnHasBeenSet = true; m_subscriptionArn.assign(value); } + inline UnsubscribeRequest& WithSubscriptionArn(const Aws::String& value) { SetSubscriptionArn(value); return *this;} + inline UnsubscribeRequest& WithSubscriptionArn(Aws::String&& value) { SetSubscriptionArn(std::move(value)); return *this;} + inline UnsubscribeRequest& WithSubscriptionArn(const char* value) { SetSubscriptionArn(value); return *this;} + ///@} + private: + + Aws::String m_subscriptionArn; + bool m_subscriptionArnHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/UntagResourceRequest.h b/include/aws/sns/model/UntagResourceRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..e649488d781b694e9e37fd63d0edd2fb1a21f425 --- /dev/null +++ b/include/aws/sns/model/UntagResourceRequest.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class UntagResourceRequest : public SNSRequest + { + public: + AWS_SNS_API UntagResourceRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "UntagResource"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The ARN of the topic from which to remove tags.

+ */ + inline const Aws::String& GetResourceArn() const{ return m_resourceArn; } + inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; } + inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; } + inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); } + inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); } + inline UntagResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;} + inline UntagResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;} + inline UntagResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The list of tag keys to remove from the specified topic.

+ */ + inline const Aws::Vector& GetTagKeys() const{ return m_tagKeys; } + inline bool TagKeysHasBeenSet() const { return m_tagKeysHasBeenSet; } + inline void SetTagKeys(const Aws::Vector& value) { m_tagKeysHasBeenSet = true; m_tagKeys = value; } + inline void SetTagKeys(Aws::Vector&& value) { m_tagKeysHasBeenSet = true; m_tagKeys = std::move(value); } + inline UntagResourceRequest& WithTagKeys(const Aws::Vector& value) { SetTagKeys(value); return *this;} + inline UntagResourceRequest& WithTagKeys(Aws::Vector&& value) { SetTagKeys(std::move(value)); return *this;} + inline UntagResourceRequest& AddTagKeys(const Aws::String& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; } + inline UntagResourceRequest& AddTagKeys(Aws::String&& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(std::move(value)); return *this; } + inline UntagResourceRequest& AddTagKeys(const char* value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; } + ///@} + private: + + Aws::String m_resourceArn; + bool m_resourceArnHasBeenSet = false; + + Aws::Vector m_tagKeys; + bool m_tagKeysHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/UntagResourceResult.h b/include/aws/sns/model/UntagResourceResult.h new file mode 100644 index 0000000000000000000000000000000000000000..66328f45f12eceff5ea0e964e9137665cb068669 --- /dev/null +++ b/include/aws/sns/model/UntagResourceResult.h @@ -0,0 +1,50 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + class UntagResourceResult + { + public: + AWS_SNS_API UntagResourceResult(); + AWS_SNS_API UntagResourceResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API UntagResourceResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline UntagResourceResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline UntagResourceResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/VerificationException.h b/include/aws/sns/model/VerificationException.h new file mode 100644 index 0000000000000000000000000000000000000000..e4fc0f35d141bfa5d0fb771cb168badf01a3b3fb --- /dev/null +++ b/include/aws/sns/model/VerificationException.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Xml +{ + class XmlNode; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + + /** + *

Indicates that the one-time password (OTP) used for verification is + * invalid.

See Also:

AWS + * API Reference

+ */ + class VerificationException + { + public: + AWS_SNS_API VerificationException(); + AWS_SNS_API VerificationException(const Aws::Utils::Xml::XmlNode& xmlNode); + AWS_SNS_API VerificationException& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); + + AWS_SNS_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; + AWS_SNS_API void OutputToStream(Aws::OStream& oStream, const char* location) const; + + + ///@{ + + inline const Aws::String& GetMessage() const{ return m_message; } + inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } + inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } + inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } + inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } + inline VerificationException& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} + inline VerificationException& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} + inline VerificationException& WithMessage(const char* value) { SetMessage(value); return *this;} + ///@} + + ///@{ + /** + *

The status of the verification error.

+ */ + inline const Aws::String& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const Aws::String& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(Aws::String&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline void SetStatus(const char* value) { m_statusHasBeenSet = true; m_status.assign(value); } + inline VerificationException& WithStatus(const Aws::String& value) { SetStatus(value); return *this;} + inline VerificationException& WithStatus(Aws::String&& value) { SetStatus(std::move(value)); return *this;} + inline VerificationException& WithStatus(const char* value) { SetStatus(value); return *this;} + ///@} + private: + + Aws::String m_message; + bool m_messageHasBeenSet = false; + + Aws::String m_status; + bool m_statusHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/VerifySMSSandboxPhoneNumberRequest.h b/include/aws/sns/model/VerifySMSSandboxPhoneNumberRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f71810980c8fc5ccec3d2d90a359937348acba3f --- /dev/null +++ b/include/aws/sns/model/VerifySMSSandboxPhoneNumberRequest.h @@ -0,0 +1,78 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SNS +{ +namespace Model +{ + + /** + */ + class VerifySMSSandboxPhoneNumberRequest : public SNSRequest + { + public: + AWS_SNS_API VerifySMSSandboxPhoneNumberRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "VerifySMSSandboxPhoneNumber"; } + + AWS_SNS_API Aws::String SerializePayload() const override; + + protected: + AWS_SNS_API void DumpBodyToUrl(Aws::Http::URI& uri ) const override; + + public: + + ///@{ + /** + *

The destination phone number to verify.

+ */ + inline const Aws::String& GetPhoneNumber() const{ return m_phoneNumber; } + inline bool PhoneNumberHasBeenSet() const { return m_phoneNumberHasBeenSet; } + inline void SetPhoneNumber(const Aws::String& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = value; } + inline void SetPhoneNumber(Aws::String&& value) { m_phoneNumberHasBeenSet = true; m_phoneNumber = std::move(value); } + inline void SetPhoneNumber(const char* value) { m_phoneNumberHasBeenSet = true; m_phoneNumber.assign(value); } + inline VerifySMSSandboxPhoneNumberRequest& WithPhoneNumber(const Aws::String& value) { SetPhoneNumber(value); return *this;} + inline VerifySMSSandboxPhoneNumberRequest& WithPhoneNumber(Aws::String&& value) { SetPhoneNumber(std::move(value)); return *this;} + inline VerifySMSSandboxPhoneNumberRequest& WithPhoneNumber(const char* value) { SetPhoneNumber(value); return *this;} + ///@} + + ///@{ + /** + *

The OTP sent to the destination number from the + * CreateSMSSandBoxPhoneNumber call.

+ */ + inline const Aws::String& GetOneTimePassword() const{ return m_oneTimePassword; } + inline bool OneTimePasswordHasBeenSet() const { return m_oneTimePasswordHasBeenSet; } + inline void SetOneTimePassword(const Aws::String& value) { m_oneTimePasswordHasBeenSet = true; m_oneTimePassword = value; } + inline void SetOneTimePassword(Aws::String&& value) { m_oneTimePasswordHasBeenSet = true; m_oneTimePassword = std::move(value); } + inline void SetOneTimePassword(const char* value) { m_oneTimePasswordHasBeenSet = true; m_oneTimePassword.assign(value); } + inline VerifySMSSandboxPhoneNumberRequest& WithOneTimePassword(const Aws::String& value) { SetOneTimePassword(value); return *this;} + inline VerifySMSSandboxPhoneNumberRequest& WithOneTimePassword(Aws::String&& value) { SetOneTimePassword(std::move(value)); return *this;} + inline VerifySMSSandboxPhoneNumberRequest& WithOneTimePassword(const char* value) { SetOneTimePassword(value); return *this;} + ///@} + private: + + Aws::String m_phoneNumber; + bool m_phoneNumberHasBeenSet = false; + + Aws::String m_oneTimePassword; + bool m_oneTimePasswordHasBeenSet = false; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sns/model/VerifySMSSandboxPhoneNumberResult.h b/include/aws/sns/model/VerifySMSSandboxPhoneNumberResult.h new file mode 100644 index 0000000000000000000000000000000000000000..1b0e641194e5eb1957c11a05283b6358d4bcad8c --- /dev/null +++ b/include/aws/sns/model/VerifySMSSandboxPhoneNumberResult.h @@ -0,0 +1,56 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Xml +{ + class XmlDocument; +} // namespace Xml +} // namespace Utils +namespace SNS +{ +namespace Model +{ + /** + *

The destination phone number's verification status.

See Also:

+ * AWS + * API Reference

+ */ + class VerifySMSSandboxPhoneNumberResult + { + public: + AWS_SNS_API VerifySMSSandboxPhoneNumberResult(); + AWS_SNS_API VerifySMSSandboxPhoneNumberResult(const Aws::AmazonWebServiceResult& result); + AWS_SNS_API VerifySMSSandboxPhoneNumberResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline VerifySMSSandboxPhoneNumberResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline VerifySMSSandboxPhoneNumberResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SNS +} // namespace Aws diff --git a/include/aws/sqs/SQSClient.h b/include/aws/sqs/SQSClient.h new file mode 100644 index 0000000000000000000000000000000000000000..c9f25ad65e66eba284be880270948c46fb470033 --- /dev/null +++ b/include/aws/sqs/SQSClient.h @@ -0,0 +1,1038 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ + /** + *

Welcome to the Amazon SQS API Reference.

Amazon SQS is a + * reliable, highly-scalable hosted queue for storing messages as they travel + * between applications or microservices. Amazon SQS moves data between distributed + * application components and helps you decouple these components.

For + * information on the permissions you need to use this API, see Identity + * and access management in the Amazon SQS Developer Guide.

You + * can use Amazon Web Services SDKs + * to access Amazon SQS using your favorite programming language. The SDKs perform + * tasks such as the following automatically:

  • Cryptographically + * sign your service requests

  • Retry requests

  • + *

    Handle error responses

Additional information

+ * + */ + class AWS_SQS_API SQSClient : public Aws::Client::AWSJsonClient, public Aws::Client::ClientWithAsyncTemplateMethods + { + public: + typedef Aws::Client::AWSJsonClient BASECLASS; + static const char* GetServiceName(); + static const char* GetAllocationTag(); + + typedef SQSClientConfiguration ClientConfigurationType; + typedef SQSEndpointProvider EndpointProviderType; + + /** + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SQSClient(const Aws::SQS::SQSClientConfiguration& clientConfiguration = Aws::SQS::SQSClientConfiguration(), + std::shared_ptr endpointProvider = nullptr); + + /** + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SQSClient(const Aws::Auth::AWSCredentials& credentials, + std::shared_ptr endpointProvider = nullptr, + const Aws::SQS::SQSClientConfiguration& clientConfiguration = Aws::SQS::SQSClientConfiguration()); + + /** + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, + * the default http client factory will be used + */ + SQSClient(const std::shared_ptr& credentialsProvider, + std::shared_ptr endpointProvider = nullptr, + const Aws::SQS::SQSClientConfiguration& clientConfiguration = Aws::SQS::SQSClientConfiguration()); + + + /* Legacy constructors due deprecation */ + /** + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SQSClient(const Aws::Client::ClientConfiguration& clientConfiguration); + + /** + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config + * is not specified, it will be initialized to default values. + */ + SQSClient(const Aws::Auth::AWSCredentials& credentials, + const Aws::Client::ClientConfiguration& clientConfiguration); + + /** + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, + * the default http client factory will be used + */ + SQSClient(const std::shared_ptr& credentialsProvider, + const Aws::Client::ClientConfiguration& clientConfiguration); + + /* End of legacy constructors due deprecation */ + virtual ~SQSClient(); + + /** + *

Adds a permission to a queue for a specific principal. + * This allows sharing access to the queue.

When you create a queue, you + * have full control access rights for the queue. Only you, the owner of the queue, + * can grant or deny permissions to the queue. For more information about these + * permissions, see Allow + * Developers to Write Messages to a Shared Queue in the Amazon SQS + * Developer Guide.

  • AddPermission + * generates a policy for you. You can use SetQueueAttributes + * to upload your policy. For more information, see Using + * Custom Policies with the Amazon SQS Access Policy Language in the Amazon + * SQS Developer Guide.

  • An Amazon SQS policy can have a + * maximum of seven actions per statement.

  • To remove the ability + * to change queue permissions, you must deny permission to the + * AddPermission, RemovePermission, and + * SetQueueAttributes actions in your IAM policy.

  • + *

    Amazon SQS AddPermission does not support adding a non-account + * principal.

Cross-account permissions don't + * apply to this action. For more information, see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

See Also:

AWS + * API Reference

+ */ + virtual Model::AddPermissionOutcome AddPermission(const Model::AddPermissionRequest& request) const; + + /** + * A Callable wrapper for AddPermission that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::AddPermissionOutcomeCallable AddPermissionCallable(const AddPermissionRequestT& request) const + { + return SubmitCallable(&SQSClient::AddPermission, request); + } + + /** + * An Async wrapper for AddPermission that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void AddPermissionAsync(const AddPermissionRequestT& request, const AddPermissionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::AddPermission, request, handler, context); + } + + /** + *

Cancels a specified message movement task. A message movement can only be + * cancelled when the current status is RUNNING. Cancelling a message movement task + * does not revert the messages that have already been moved. It can only stop the + * messages that have not been moved yet.

  • This action is + * currently limited to supporting message redrive from dead-letter + * queues (DLQs) only. In this context, the source queue is the dead-letter + * queue (DLQ), while the destination queue can be the original source queue (from + * which the messages were driven to the dead-letter-queue), or a custom + * destination queue.

  • Only one active message movement task is + * supported per queue at any given time.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::CancelMessageMoveTaskOutcome CancelMessageMoveTask(const Model::CancelMessageMoveTaskRequest& request) const; + + /** + * A Callable wrapper for CancelMessageMoveTask that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::CancelMessageMoveTaskOutcomeCallable CancelMessageMoveTaskCallable(const CancelMessageMoveTaskRequestT& request) const + { + return SubmitCallable(&SQSClient::CancelMessageMoveTask, request); + } + + /** + * An Async wrapper for CancelMessageMoveTask that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void CancelMessageMoveTaskAsync(const CancelMessageMoveTaskRequestT& request, const CancelMessageMoveTaskResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::CancelMessageMoveTask, request, handler, context); + } + + /** + *

Changes the visibility timeout of a specified message in a queue to a new + * value. The default visibility timeout for a message is 30 seconds. The minimum + * is 0 seconds. The maximum is 12 hours. For more information, see Visibility + * Timeout in the Amazon SQS Developer Guide.

For example, if the + * default timeout for a queue is 60 seconds, 15 seconds have elapsed since you + * received the message, and you send a ChangeMessageVisibility call with + * VisibilityTimeout set to 10 seconds, the 10 seconds begin to count + * from the time that you make the ChangeMessageVisibility call. Thus, + * any attempt to change the visibility timeout or to delete that message 10 + * seconds after you initially change the visibility timeout (a total of 25 + * seconds) might result in an error.

An Amazon SQS message has three basic + * states:

  1. Sent to a queue by a producer.

  2. + *

    Received from the queue by a consumer.

  3. Deleted from the + * queue.

A message is considered to be stored after it + * is sent to a queue by a producer, but not yet received from the queue by a + * consumer (that is, between states 1 and 2). There is no limit to the number of + * stored messages. A message is considered to be in flight after it is + * received from a queue by a consumer, but not yet deleted from the queue (that + * is, between states 2 and 3). There is a limit to the number of in flight + * messages.

Limits that apply to in flight messages are unrelated to the + * unlimited number of stored messages.

For most standard queues + * (depending on queue traffic and message backlog), there can be a maximum of + * approximately 120,000 in flight messages (received from a queue by a consumer, + * but not yet deleted from the queue). If you reach this limit, Amazon SQS returns + * the OverLimit error message. To avoid reaching the limit, you + * should delete messages from the queue after they're processed. You can also + * increase the number of queues you use to process your messages. To request a + * limit increase, file + * a support request.

For FIFO queues, there can be a maximum of 120,000 + * in flight messages (received from a queue by a consumer, but not yet deleted + * from the queue). If you reach this limit, Amazon SQS returns no error + * messages.

If you attempt to set the + * VisibilityTimeout to a value greater than the maximum time left, + * Amazon SQS returns an error. Amazon SQS doesn't automatically recalculate and + * increase the timeout to the maximum remaining time.

Unlike with a queue, + * when you change the visibility timeout for a specific message the timeout value + * is applied immediately but isn't saved in memory for that message. If you don't + * delete a message after it is received, the visibility timeout for the message + * reverts to the original timeout value (not to the value you set using the + * ChangeMessageVisibility action) the next time the message is + * received.

See Also:

AWS + * API Reference

+ */ + virtual Model::ChangeMessageVisibilityOutcome ChangeMessageVisibility(const Model::ChangeMessageVisibilityRequest& request) const; + + /** + * A Callable wrapper for ChangeMessageVisibility that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ChangeMessageVisibilityOutcomeCallable ChangeMessageVisibilityCallable(const ChangeMessageVisibilityRequestT& request) const + { + return SubmitCallable(&SQSClient::ChangeMessageVisibility, request); + } + + /** + * An Async wrapper for ChangeMessageVisibility that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ChangeMessageVisibilityAsync(const ChangeMessageVisibilityRequestT& request, const ChangeMessageVisibilityResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::ChangeMessageVisibility, request, handler, context); + } + + /** + *

Changes the visibility timeout of multiple messages. This is a batch version + * of ChangeMessageVisibility. The result of the action on + * each message is reported individually in the response. You can send up to 10 + * ChangeMessageVisibility requests with each + * ChangeMessageVisibilityBatch action.

Because the + * batch request can result in a combination of successful and unsuccessful + * actions, you should check for batch errors even when the call returns an HTTP + * status code of 200.

See Also:

AWS + * API Reference

+ */ + virtual Model::ChangeMessageVisibilityBatchOutcome ChangeMessageVisibilityBatch(const Model::ChangeMessageVisibilityBatchRequest& request) const; + + /** + * A Callable wrapper for ChangeMessageVisibilityBatch that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ChangeMessageVisibilityBatchOutcomeCallable ChangeMessageVisibilityBatchCallable(const ChangeMessageVisibilityBatchRequestT& request) const + { + return SubmitCallable(&SQSClient::ChangeMessageVisibilityBatch, request); + } + + /** + * An Async wrapper for ChangeMessageVisibilityBatch that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ChangeMessageVisibilityBatchAsync(const ChangeMessageVisibilityBatchRequestT& request, const ChangeMessageVisibilityBatchResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::ChangeMessageVisibilityBatch, request, handler, context); + } + + /** + *

Creates a new standard or FIFO queue. You can pass one or more attributes in + * the request. Keep the following in mind:

  • If you don't specify + * the FifoQueue attribute, Amazon SQS creates a standard queue.

    + *

    You can't change the queue type after you create it and you can't + * convert an existing standard queue into a FIFO queue. You must either create a + * new FIFO queue for your application or delete your existing standard queue and + * recreate it as a FIFO queue. For more information, see Moving + * From a Standard Queue to a FIFO Queue in the Amazon SQS Developer + * Guide.

  • If you don't provide a value for an + * attribute, the queue is created with the default value for the attribute.

    + *
  • If you delete a queue, you must wait at least 60 seconds before + * creating a queue with the same name.

To successfully create a + * new queue, you must provide a queue name that adheres to the limits + * related to queues and is unique within the scope of your queues.

+ *

After you create a queue, you must wait at least one second after the queue + * is created to be able to use the queue.

To retrieve the URL of a + * queue, use the + * GetQueueUrl action. This action only requires the + * QueueName parameter.

When creating queues, keep the + * following points in mind:

  • If you specify the name of an + * existing queue and provide the exact same names and values for all its + * attributes, the + * CreateQueue action will return the URL of the existing queue + * instead of creating a new one.

  • If you attempt to create a + * queue with a name that already exists but with different attribute names or + * values, the CreateQueue action will return an error. This ensures + * that existing queues are not inadvertently altered.

+ *

Cross-account permissions don't apply to this action. For more information, + * see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

See Also:

AWS API + * Reference

+ */ + virtual Model::CreateQueueOutcome CreateQueue(const Model::CreateQueueRequest& request) const; + + /** + * A Callable wrapper for CreateQueue that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::CreateQueueOutcomeCallable CreateQueueCallable(const CreateQueueRequestT& request) const + { + return SubmitCallable(&SQSClient::CreateQueue, request); + } + + /** + * An Async wrapper for CreateQueue that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void CreateQueueAsync(const CreateQueueRequestT& request, const CreateQueueResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::CreateQueue, request, handler, context); + } + + /** + *

Deletes the specified message from the specified queue. To select the message + * to delete, use the ReceiptHandle of the message (not the + * MessageId which you receive when you send the message). Amazon SQS + * can delete a message from a queue even if a visibility timeout setting causes + * the message to be locked by another consumer. Amazon SQS automatically deletes + * messages left in a queue longer than the retention period configured for the + * queue.

Each time you receive a message, meaning when a consumer + * retrieves a message from the queue, it comes with a unique + * ReceiptHandle. If you receive the same message more than once, you + * will get a different ReceiptHandle each time. When you want to + * delete a message using the DeleteMessage action, you must use the + * ReceiptHandle from the most recent time you received the message. + * If you use an old ReceiptHandle, the request will succeed, but the + * message might not be deleted.

For standard queues, it is possible to + * receive a message even after you delete it. This might happen on rare occasions + * if one of the servers which stores a copy of the message is unavailable when you + * send the request to delete the message. The copy remains on the server and might + * be returned to you during a subsequent receive request. You should ensure that + * your application is idempotent, so that receiving a message more than once does + * not cause issues.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteMessageOutcome DeleteMessage(const Model::DeleteMessageRequest& request) const; + + /** + * A Callable wrapper for DeleteMessage that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteMessageOutcomeCallable DeleteMessageCallable(const DeleteMessageRequestT& request) const + { + return SubmitCallable(&SQSClient::DeleteMessage, request); + } + + /** + * An Async wrapper for DeleteMessage that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteMessageAsync(const DeleteMessageRequestT& request, const DeleteMessageResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::DeleteMessage, request, handler, context); + } + + /** + *

Deletes up to ten messages from the specified queue. This is a batch version + * of DeleteMessage. The result of the action on each message + * is reported individually in the response.

Because the batch + * request can result in a combination of successful and unsuccessful actions, you + * should check for batch errors even when the call returns an HTTP status code of + * 200.

See Also:

AWS + * API Reference

+ */ + virtual Model::DeleteMessageBatchOutcome DeleteMessageBatch(const Model::DeleteMessageBatchRequest& request) const; + + /** + * A Callable wrapper for DeleteMessageBatch that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteMessageBatchOutcomeCallable DeleteMessageBatchCallable(const DeleteMessageBatchRequestT& request) const + { + return SubmitCallable(&SQSClient::DeleteMessageBatch, request); + } + + /** + * An Async wrapper for DeleteMessageBatch that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteMessageBatchAsync(const DeleteMessageBatchRequestT& request, const DeleteMessageBatchResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::DeleteMessageBatch, request, handler, context); + } + + /** + *

Deletes the queue specified by the QueueUrl, regardless of the + * queue's contents.

Be careful with the + * DeleteQueue action: When you delete a queue, any messages in the + * queue are no longer available.

When you delete a queue, the + * deletion process takes up to 60 seconds. Requests you send involving that queue + * during the 60 seconds might succeed. For example, a SendMessage + * request might succeed, but after 60 seconds the queue and the message + * you sent no longer exist.

When you delete a queue, you must wait at least + * 60 seconds before creating a queue with the same name.

+ *

Cross-account permissions don't apply to this action. For more information, + * see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

The delete operation uses the HTTP GET + * verb.

See Also:

AWS API + * Reference

+ */ + virtual Model::DeleteQueueOutcome DeleteQueue(const Model::DeleteQueueRequest& request) const; + + /** + * A Callable wrapper for DeleteQueue that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::DeleteQueueOutcomeCallable DeleteQueueCallable(const DeleteQueueRequestT& request) const + { + return SubmitCallable(&SQSClient::DeleteQueue, request); + } + + /** + * An Async wrapper for DeleteQueue that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void DeleteQueueAsync(const DeleteQueueRequestT& request, const DeleteQueueResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::DeleteQueue, request, handler, context); + } + + /** + *

Gets attributes for the specified queue.

To determine whether a + * queue is FIFO, + * you can check whether QueueName ends with the .fifo + * suffix.

See Also:

AWS + * API Reference

+ */ + virtual Model::GetQueueAttributesOutcome GetQueueAttributes(const Model::GetQueueAttributesRequest& request) const; + + /** + * A Callable wrapper for GetQueueAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetQueueAttributesOutcomeCallable GetQueueAttributesCallable(const GetQueueAttributesRequestT& request) const + { + return SubmitCallable(&SQSClient::GetQueueAttributes, request); + } + + /** + * An Async wrapper for GetQueueAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetQueueAttributesAsync(const GetQueueAttributesRequestT& request, const GetQueueAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::GetQueueAttributes, request, handler, context); + } + + /** + *

The GetQueueUrl API returns the URL of an existing Amazon SQS + * queue. This is useful when you know the queue's name but need to retrieve its + * URL for further operations.

To access a queue owned by another Amazon Web + * Services account, use the QueueOwnerAWSAccountId parameter to + * specify the account ID of the queue's owner. Note that the queue owner must + * grant you the necessary permissions to access the queue. For more information + * about accessing shared queues, see the AddPermission API + * or Allow + * developers to write messages to a shared queue in the Amazon SQS + * Developer Guide.

See Also:

AWS API + * Reference

+ */ + virtual Model::GetQueueUrlOutcome GetQueueUrl(const Model::GetQueueUrlRequest& request) const; + + /** + * A Callable wrapper for GetQueueUrl that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::GetQueueUrlOutcomeCallable GetQueueUrlCallable(const GetQueueUrlRequestT& request) const + { + return SubmitCallable(&SQSClient::GetQueueUrl, request); + } + + /** + * An Async wrapper for GetQueueUrl that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void GetQueueUrlAsync(const GetQueueUrlRequestT& request, const GetQueueUrlResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::GetQueueUrl, request, handler, context); + } + + /** + *

Returns a list of your queues that have the RedrivePolicy queue + * attribute configured with a dead-letter queue.

The + * ListDeadLetterSourceQueues methods supports pagination. Set + * parameter MaxResults in the request to specify the maximum number + * of results to be returned in the response. If you do not set + * MaxResults, the response includes a maximum of 1,000 results. If + * you set MaxResults and there are additional results to display, the + * response includes a value for NextToken. Use NextToken + * as a parameter in your next request to ListDeadLetterSourceQueues + * to receive the next page of results.

For more information about using + * dead-letter queues, see Using + * Amazon SQS Dead-Letter Queues in the Amazon SQS Developer + * Guide.

See Also:

AWS + * API Reference

+ */ + virtual Model::ListDeadLetterSourceQueuesOutcome ListDeadLetterSourceQueues(const Model::ListDeadLetterSourceQueuesRequest& request) const; + + /** + * A Callable wrapper for ListDeadLetterSourceQueues that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListDeadLetterSourceQueuesOutcomeCallable ListDeadLetterSourceQueuesCallable(const ListDeadLetterSourceQueuesRequestT& request) const + { + return SubmitCallable(&SQSClient::ListDeadLetterSourceQueues, request); + } + + /** + * An Async wrapper for ListDeadLetterSourceQueues that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListDeadLetterSourceQueuesAsync(const ListDeadLetterSourceQueuesRequestT& request, const ListDeadLetterSourceQueuesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::ListDeadLetterSourceQueues, request, handler, context); + } + + /** + *

Gets the most recent message movement tasks (up to 10) under a specific + * source queue.

  • This action is currently limited to + * supporting message redrive from dead-letter + * queues (DLQs) only. In this context, the source queue is the dead-letter + * queue (DLQ), while the destination queue can be the original source queue (from + * which the messages were driven to the dead-letter-queue), or a custom + * destination queue.

  • Only one active message movement task is + * supported per queue at any given time.

See + * Also:

AWS + * API Reference

+ */ + virtual Model::ListMessageMoveTasksOutcome ListMessageMoveTasks(const Model::ListMessageMoveTasksRequest& request) const; + + /** + * A Callable wrapper for ListMessageMoveTasks that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListMessageMoveTasksOutcomeCallable ListMessageMoveTasksCallable(const ListMessageMoveTasksRequestT& request) const + { + return SubmitCallable(&SQSClient::ListMessageMoveTasks, request); + } + + /** + * An Async wrapper for ListMessageMoveTasks that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListMessageMoveTasksAsync(const ListMessageMoveTasksRequestT& request, const ListMessageMoveTasksResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::ListMessageMoveTasks, request, handler, context); + } + + /** + *

List all cost allocation tags added to the specified Amazon SQS queue. For an + * overview, see Tagging + * Your Amazon SQS Queues in the Amazon SQS Developer Guide.

+ *

Cross-account permissions don't apply to this action. For more information, + * see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

See Also:

AWS + * API Reference

+ */ + virtual Model::ListQueueTagsOutcome ListQueueTags(const Model::ListQueueTagsRequest& request) const; + + /** + * A Callable wrapper for ListQueueTags that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListQueueTagsOutcomeCallable ListQueueTagsCallable(const ListQueueTagsRequestT& request) const + { + return SubmitCallable(&SQSClient::ListQueueTags, request); + } + + /** + * An Async wrapper for ListQueueTags that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListQueueTagsAsync(const ListQueueTagsRequestT& request, const ListQueueTagsResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::ListQueueTags, request, handler, context); + } + + /** + *

Returns a list of your queues in the current region. The response includes a + * maximum of 1,000 results. If you specify a value for the optional + * QueueNamePrefix parameter, only queues with a name that begins with + * the specified value are returned.

The listQueues methods + * supports pagination. Set parameter MaxResults in the request to + * specify the maximum number of results to be returned in the response. If you do + * not set MaxResults, the response includes a maximum of 1,000 + * results. If you set MaxResults and there are additional results to + * display, the response includes a value for NextToken. Use + * NextToken as a parameter in your next request to + * listQueues to receive the next page of results.

+ *

Cross-account permissions don't apply to this action. For more information, + * see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

See Also:

AWS API + * Reference

+ */ + virtual Model::ListQueuesOutcome ListQueues(const Model::ListQueuesRequest& request = {}) const; + + /** + * A Callable wrapper for ListQueues that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ListQueuesOutcomeCallable ListQueuesCallable(const ListQueuesRequestT& request = {}) const + { + return SubmitCallable(&SQSClient::ListQueues, request); + } + + /** + * An Async wrapper for ListQueues that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ListQueuesAsync(const ListQueuesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr, const ListQueuesRequestT& request = {}) const + { + return SubmitAsync(&SQSClient::ListQueues, request, handler, context); + } + + /** + *

Deletes available messages in a queue (including in-flight messages) + * specified by the QueueURL parameter.

When you + * use the PurgeQueue action, you can't retrieve any messages deleted + * from a queue.

The message deletion process takes up to 60 seconds. We + * recommend waiting for 60 seconds regardless of your queue's size.

+ *

Messages sent to the queue before you call + * PurgeQueue might be received but are deleted within the next + * minute.

Messages sent to the queue after you call + * PurgeQueue might be deleted while the queue is being + * purged.

See Also:

AWS API + * Reference

+ */ + virtual Model::PurgeQueueOutcome PurgeQueue(const Model::PurgeQueueRequest& request) const; + + /** + * A Callable wrapper for PurgeQueue that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::PurgeQueueOutcomeCallable PurgeQueueCallable(const PurgeQueueRequestT& request) const + { + return SubmitCallable(&SQSClient::PurgeQueue, request); + } + + /** + * An Async wrapper for PurgeQueue that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void PurgeQueueAsync(const PurgeQueueRequestT& request, const PurgeQueueResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::PurgeQueue, request, handler, context); + } + + /** + *

Retrieves one or more messages (up to 10), from the specified queue. Using + * the WaitTimeSeconds parameter enables long-poll support. For more + * information, see Amazon + * SQS Long Polling in the Amazon SQS Developer Guide.

Short + * poll is the default behavior where a weighted random set of machines is sampled + * on a ReceiveMessage call. Therefore, only the messages on the + * sampled machines are returned. If the number of messages in the queue is small + * (fewer than 1,000), you most likely get fewer messages than you requested per + * ReceiveMessage call. If the number of messages in the queue is + * extremely small, you might not receive any messages in a particular + * ReceiveMessage response. If this happens, repeat the request.

+ *

For each message returned, the response includes the following:

  • + *

    The message body.

  • An MD5 digest of the message body. For + * information about MD5, see RFC1321.

  • The + * MessageId you received when you sent the message to the queue.

    + *
  • The receipt handle.

  • The message attributes.

    + *
  • An MD5 digest of the message attributes.

The + * receipt handle is the identifier you must provide when deleting the message. For + * more information, see Queue + * and Message Identifiers in the Amazon SQS Developer Guide.

You + * can provide the VisibilityTimeout parameter in your request. The + * parameter is applied to the messages that Amazon SQS returns in the response. If + * you don't include the parameter, the overall visibility timeout for the queue is + * used for the returned messages. The default visibility timeout for a queue is 30 + * seconds.

In the future, new attributes might be added. If you + * write code that calls this action, we recommend that you structure your code so + * that it can handle new attributes gracefully.

See Also:

+ * AWS + * API Reference

+ */ + virtual Model::ReceiveMessageOutcome ReceiveMessage(const Model::ReceiveMessageRequest& request) const; + + /** + * A Callable wrapper for ReceiveMessage that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::ReceiveMessageOutcomeCallable ReceiveMessageCallable(const ReceiveMessageRequestT& request) const + { + return SubmitCallable(&SQSClient::ReceiveMessage, request); + } + + /** + * An Async wrapper for ReceiveMessage that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void ReceiveMessageAsync(const ReceiveMessageRequestT& request, const ReceiveMessageResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::ReceiveMessage, request, handler, context); + } + + /** + *

Revokes any permissions in the queue policy that matches the specified + * Label parameter.

  • Only the owner of a queue + * can remove permissions from it.

  • Cross-account permissions + * don't apply to this action. For more information, see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

  • To remove the ability to change queue + * permissions, you must deny permission to the AddPermission, + * RemovePermission, and SetQueueAttributes actions in + * your IAM policy.

See Also:

AWS + * API Reference

+ */ + virtual Model::RemovePermissionOutcome RemovePermission(const Model::RemovePermissionRequest& request) const; + + /** + * A Callable wrapper for RemovePermission that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::RemovePermissionOutcomeCallable RemovePermissionCallable(const RemovePermissionRequestT& request) const + { + return SubmitCallable(&SQSClient::RemovePermission, request); + } + + /** + * An Async wrapper for RemovePermission that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void RemovePermissionAsync(const RemovePermissionRequestT& request, const RemovePermissionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::RemovePermission, request, handler, context); + } + + /** + *

Delivers a message to the specified queue.

A message can + * include only XML, JSON, and unformatted text. The following Unicode characters + * are allowed. For more information, see the W3C specification for + * characters.

#x9 | #xA | #xD | + * #x20 to #xD7FF | #xE000 to + * #xFFFD | #x10000 to #x10FFFF

+ *

Amazon SQS does not throw an exception or completely reject the message if it + * contains invalid characters. Instead, it replaces those invalid characters with + * U+FFFD before storing the message in the queue, as long as the + * message body contains at least one valid character.

See + * Also:

AWS API + * Reference

+ */ + virtual Model::SendMessageOutcome SendMessage(const Model::SendMessageRequest& request) const; + + /** + * A Callable wrapper for SendMessage that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SendMessageOutcomeCallable SendMessageCallable(const SendMessageRequestT& request) const + { + return SubmitCallable(&SQSClient::SendMessage, request); + } + + /** + * An Async wrapper for SendMessage that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SendMessageAsync(const SendMessageRequestT& request, const SendMessageResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::SendMessage, request, handler, context); + } + + /** + *

You can use SendMessageBatch to send up to 10 messages to the + * specified queue by assigning either identical or different values to each + * message (or by not assigning values at all). This is a batch version of + * SendMessage. For a FIFO queue, multiple messages within a single + * batch are enqueued in the order they are sent.

The result of sending each + * message is reported individually in the response. Because the batch request can + * result in a combination of successful and unsuccessful actions, you should check + * for batch errors even when the call returns an HTTP status code of + * 200.

The maximum allowed individual message size and the + * maximum total payload size (the sum of the individual lengths of all of the + * batched messages) are both 256 KiB (262,144 bytes).

A message + * can include only XML, JSON, and unformatted text. The following Unicode + * characters are allowed. For more information, see the W3C specification for + * characters.

#x9 | #xA | #xD | + * #x20 to #xD7FF | #xE000 to + * #xFFFD | #x10000 to #x10FFFF

+ *

Amazon SQS does not throw an exception or completely reject the message if it + * contains invalid characters. Instead, it replaces those invalid characters with + * U+FFFD before storing the message in the queue, as long as the + * message body contains at least one valid character.

If you + * don't specify the DelaySeconds parameter for an entry, Amazon SQS + * uses the default value for the queue.

See Also:

AWS + * API Reference

+ */ + virtual Model::SendMessageBatchOutcome SendMessageBatch(const Model::SendMessageBatchRequest& request) const; + + /** + * A Callable wrapper for SendMessageBatch that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SendMessageBatchOutcomeCallable SendMessageBatchCallable(const SendMessageBatchRequestT& request) const + { + return SubmitCallable(&SQSClient::SendMessageBatch, request); + } + + /** + * An Async wrapper for SendMessageBatch that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SendMessageBatchAsync(const SendMessageBatchRequestT& request, const SendMessageBatchResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::SendMessageBatch, request, handler, context); + } + + /** + *

Sets the value of one or more queue attributes, like a policy. When you + * change a queue's attributes, the change can take up to 60 seconds for most of + * the attributes to propagate throughout the Amazon SQS system. Changes made to + * the MessageRetentionPeriod attribute can take up to 15 minutes and + * will impact existing messages in the queue potentially causing them to be + * expired and deleted if the MessageRetentionPeriod is reduced below + * the age of existing messages.

  • In the future, new + * attributes might be added. If you write code that calls this action, we + * recommend that you structure your code so that it can handle new attributes + * gracefully.

  • Cross-account permissions don't apply to this + * action. For more information, see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

  • To remove the ability to change queue + * permissions, you must deny permission to the AddPermission, + * RemovePermission, and SetQueueAttributes actions in + * your IAM policy.

See Also:

AWS + * API Reference

+ */ + virtual Model::SetQueueAttributesOutcome SetQueueAttributes(const Model::SetQueueAttributesRequest& request) const; + + /** + * A Callable wrapper for SetQueueAttributes that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::SetQueueAttributesOutcomeCallable SetQueueAttributesCallable(const SetQueueAttributesRequestT& request) const + { + return SubmitCallable(&SQSClient::SetQueueAttributes, request); + } + + /** + * An Async wrapper for SetQueueAttributes that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void SetQueueAttributesAsync(const SetQueueAttributesRequestT& request, const SetQueueAttributesResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::SetQueueAttributes, request, handler, context); + } + + /** + *

Starts an asynchronous task to move messages from a specified source queue to + * a specified destination queue.

  • This action is currently + * limited to supporting message redrive from queues that are configured as dead-letter + * queues (DLQs) of other Amazon SQS queues only. Non-SQS queue sources of + * dead-letter queues, such as Lambda or Amazon SNS topics, are currently not + * supported.

  • In dead-letter queues redrive context, the + * StartMessageMoveTask the source queue is the DLQ, while the + * destination queue can be the original source queue (from which the messages were + * driven to the dead-letter-queue), or a custom destination queue.

  • + *

    Only one active message movement task is supported per queue at any given + * time.

See Also:

AWS + * API Reference

+ */ + virtual Model::StartMessageMoveTaskOutcome StartMessageMoveTask(const Model::StartMessageMoveTaskRequest& request) const; + + /** + * A Callable wrapper for StartMessageMoveTask that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::StartMessageMoveTaskOutcomeCallable StartMessageMoveTaskCallable(const StartMessageMoveTaskRequestT& request) const + { + return SubmitCallable(&SQSClient::StartMessageMoveTask, request); + } + + /** + * An Async wrapper for StartMessageMoveTask that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void StartMessageMoveTaskAsync(const StartMessageMoveTaskRequestT& request, const StartMessageMoveTaskResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::StartMessageMoveTask, request, handler, context); + } + + /** + *

Add cost allocation tags to the specified Amazon SQS queue. For an overview, + * see Tagging + * Your Amazon SQS Queues in the Amazon SQS Developer Guide.

When + * you use queue tags, keep the following guidelines in mind:

  • + *

    Adding more than 50 tags to a queue isn't recommended.

  • Tags + * don't have any semantic meaning. Amazon SQS interprets tags as character + * strings.

  • Tags are case-sensitive.

  • A new tag + * with a key identical to that of an existing tag overwrites the existing tag.

    + *

For a full list of tag restrictions, see Quotas + * related to queues in the Amazon SQS Developer Guide.

+ *

Cross-account permissions don't apply to this action. For more information, + * see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

See Also:

AWS API + * Reference

+ */ + virtual Model::TagQueueOutcome TagQueue(const Model::TagQueueRequest& request) const; + + /** + * A Callable wrapper for TagQueue that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::TagQueueOutcomeCallable TagQueueCallable(const TagQueueRequestT& request) const + { + return SubmitCallable(&SQSClient::TagQueue, request); + } + + /** + * An Async wrapper for TagQueue that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void TagQueueAsync(const TagQueueRequestT& request, const TagQueueResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::TagQueue, request, handler, context); + } + + /** + *

Remove cost allocation tags from the specified Amazon SQS queue. For an + * overview, see Tagging + * Your Amazon SQS Queues in the Amazon SQS Developer Guide.

+ *

Cross-account permissions don't apply to this action. For more information, + * see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

See Also:

AWS API + * Reference

+ */ + virtual Model::UntagQueueOutcome UntagQueue(const Model::UntagQueueRequest& request) const; + + /** + * A Callable wrapper for UntagQueue that returns a future to the operation so that it can be executed in parallel to other requests. + */ + template + Model::UntagQueueOutcomeCallable UntagQueueCallable(const UntagQueueRequestT& request) const + { + return SubmitCallable(&SQSClient::UntagQueue, request); + } + + /** + * An Async wrapper for UntagQueue that queues the request into a thread executor and triggers associated callback when operation has finished. + */ + template + void UntagQueueAsync(const UntagQueueRequestT& request, const UntagQueueResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const + { + return SubmitAsync(&SQSClient::UntagQueue, request, handler, context); + } + + + void OverrideEndpoint(const Aws::String& endpoint); + std::shared_ptr& accessEndpointProvider(); + private: + friend class Aws::Client::ClientWithAsyncTemplateMethods; + void init(const SQSClientConfiguration& clientConfiguration); + + SQSClientConfiguration m_clientConfiguration; + std::shared_ptr m_endpointProvider; + }; + +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/SQSEndpointProvider.h b/include/aws/sqs/SQSEndpointProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..1e9d86687af8fc22128198b9124257e15303dcc9 --- /dev/null +++ b/include/aws/sqs/SQSEndpointProvider.h @@ -0,0 +1,61 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +#include + + +namespace Aws +{ +namespace SQS +{ +namespace Endpoint +{ +using EndpointParameters = Aws::Endpoint::EndpointParameters; +using Aws::Endpoint::EndpointProviderBase; +using Aws::Endpoint::DefaultEndpointProvider; + +using SQSClientContextParameters = Aws::Endpoint::ClientContextParameters; + +using SQSClientConfiguration = Aws::Client::GenericClientConfiguration; +using SQSBuiltInParameters = Aws::Endpoint::BuiltInParameters; + +/** + * The type for the SQS Client Endpoint Provider. + * Inherit from this Base class / "Interface" should you want to provide a custom endpoint provider. + * The SDK must use service-specific type for each service per specification. + */ +using SQSEndpointProviderBase = + EndpointProviderBase; + +using SQSDefaultEpProviderBase = + DefaultEndpointProvider; + +/** + * Default endpoint provider used for this service + */ +class AWS_SQS_API SQSEndpointProvider : public SQSDefaultEpProviderBase +{ +public: + using SQSResolveEndpointOutcome = Aws::Endpoint::ResolveEndpointOutcome; + + SQSEndpointProvider() + : SQSDefaultEpProviderBase(Aws::SQS::SQSEndpointRules::GetRulesBlob(), Aws::SQS::SQSEndpointRules::RulesBlobSize) + {} + + ~SQSEndpointProvider() + { + } +}; +} // namespace Endpoint +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/SQSEndpointRules.h b/include/aws/sqs/SQSEndpointRules.h new file mode 100644 index 0000000000000000000000000000000000000000..b57a82a11263a1321685beeed9f82554a8a9c2a6 --- /dev/null +++ b/include/aws/sqs/SQSEndpointRules.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SQS +{ +class SQSEndpointRules +{ +public: + static const size_t RulesBlobStrLen; + static const size_t RulesBlobSize; + + static const char* GetRulesBlob(); +}; +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/SQSErrorMarshaller.h b/include/aws/sqs/SQSErrorMarshaller.h new file mode 100644 index 0000000000000000000000000000000000000000..b6900b900c254e6cb4a7761acddaca3573d060c6 --- /dev/null +++ b/include/aws/sqs/SQSErrorMarshaller.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws +{ +namespace Client +{ + +class AWS_SQS_API SQSErrorMarshaller : public Aws::Client::JsonErrorMarshallerQueryCompatible +{ +public: + Aws::Client::AWSError FindErrorByName(const char* exceptionName) const override; +}; + +} // namespace Client +} // namespace Aws diff --git a/include/aws/sqs/SQSErrors.h b/include/aws/sqs/SQSErrors.h new file mode 100644 index 0000000000000000000000000000000000000000..37c465afe6600063f481fd4e4b8f7f03412b22c2 --- /dev/null +++ b/include/aws/sqs/SQSErrors.h @@ -0,0 +1,97 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +enum class SQSErrors +{ + //From Core// + ////////////////////////////////////////////////////////////////////////////////////////// + INCOMPLETE_SIGNATURE = 0, + INTERNAL_FAILURE = 1, + INVALID_ACTION = 2, + INVALID_CLIENT_TOKEN_ID = 3, + INVALID_PARAMETER_COMBINATION = 4, + INVALID_QUERY_PARAMETER = 5, + INVALID_PARAMETER_VALUE = 6, + MISSING_ACTION = 7, // SDK should never allow + MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow + MISSING_PARAMETER = 9, // SDK should never allow + OPT_IN_REQUIRED = 10, + REQUEST_EXPIRED = 11, + SERVICE_UNAVAILABLE = 12, + THROTTLING = 13, + VALIDATION = 14, + ACCESS_DENIED = 15, + RESOURCE_NOT_FOUND = 16, + UNRECOGNIZED_CLIENT = 17, + MALFORMED_QUERY_STRING = 18, + SLOW_DOWN = 19, + REQUEST_TIME_TOO_SKEWED = 20, + INVALID_SIGNATURE = 21, + SIGNATURE_DOES_NOT_MATCH = 22, + INVALID_ACCESS_KEY_ID = 23, + REQUEST_TIMEOUT = 24, + NETWORK_CONNECTION = 99, + + UNKNOWN = 100, + /////////////////////////////////////////////////////////////////////////////////////////// + + BATCH_ENTRY_IDS_NOT_DISTINCT= static_cast(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1, + BATCH_REQUEST_TOO_LONG, + EMPTY_BATCH_REQUEST, + INVALID_ADDRESS, + INVALID_ATTRIBUTE_NAME, + INVALID_ATTRIBUTE_VALUE, + INVALID_BATCH_ENTRY_ID, + INVALID_ID_FORMAT, + INVALID_MESSAGE_CONTENTS, + INVALID_SECURITY, + KMS_ACCESS_DENIED, + KMS_DISABLED, + KMS_INVALID_KEY_USAGE, + KMS_INVALID_STATE, + KMS_NOT_FOUND, + KMS_OPT_IN_REQUIRED, + KMS_THROTTLED, + MESSAGE_NOT_INFLIGHT, + OVER_LIMIT, + PURGE_QUEUE_IN_PROGRESS, + QUEUE_DELETED_RECENTLY, + QUEUE_DOES_NOT_EXIST, + QUEUE_NAME_EXISTS, + RECEIPT_HANDLE_IS_INVALID, + TOO_MANY_ENTRIES_IN_BATCH_REQUEST, + UNSUPPORTED_OPERATION +}; + +class AWS_SQS_API SQSError : public Aws::Client::AWSError +{ +public: + SQSError() {} + SQSError(const Aws::Client::AWSError& rhs) : Aws::Client::AWSError(rhs) {} + SQSError(Aws::Client::AWSError&& rhs) : Aws::Client::AWSError(rhs) {} + SQSError(const Aws::Client::AWSError& rhs) : Aws::Client::AWSError(rhs) {} + SQSError(Aws::Client::AWSError&& rhs) : Aws::Client::AWSError(rhs) {} + + template + T GetModeledError(); +}; + +namespace SQSErrorMapper +{ + AWS_SQS_API Aws::Client::AWSError GetErrorForName(const char* errorName); +} + +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/SQSRequest.h b/include/aws/sqs/SQSRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..5c275e56f8517952fdc85e2e8763cdb39d999a4d --- /dev/null +++ b/include/aws/sqs/SQSRequest.h @@ -0,0 +1,47 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ + class AWS_SQS_API SQSRequest : public Aws::AmazonSerializableWebServiceRequest + { + public: + using EndpointParameter = Aws::Endpoint::EndpointParameter; + using EndpointParameters = Aws::Endpoint::EndpointParameters; + + virtual ~SQSRequest () {} + + void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); } + + inline Aws::Http::HeaderValueCollection GetHeaders() const override + { + auto headers = GetRequestSpecificHeaders(); + + if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0)) + { + headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::AMZN_JSON_CONTENT_TYPE_1_0 )); + headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::X_AMZN_QUERY_MODE,"true")); + } + headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2012-11-05")); + return headers; + } + + protected: + virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); } + + }; + + +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/SQSServiceClientModel.h b/include/aws/sqs/SQSServiceClientModel.h new file mode 100644 index 0000000000000000000000000000000000000000..d43f49f902154efbf8dce3c9b909af52bd91c92c --- /dev/null +++ b/include/aws/sqs/SQSServiceClientModel.h @@ -0,0 +1,183 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +/* Generic header includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* End of generic header includes */ + +/* Service model headers required in SQSClient header */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* End of service model headers required in SQSClient header */ + +namespace Aws +{ + namespace Http + { + class HttpClient; + class HttpClientFactory; + } // namespace Http + + namespace Utils + { + template< typename R, typename E> class Outcome; + + namespace Threading + { + class Executor; + } // namespace Threading + } // namespace Utils + + namespace Auth + { + class AWSCredentials; + class AWSCredentialsProvider; + } // namespace Auth + + namespace Client + { + class RetryStrategy; + } // namespace Client + + namespace SQS + { + using SQSClientConfiguration = Aws::Client::GenericClientConfiguration; + using SQSEndpointProviderBase = Aws::SQS::Endpoint::SQSEndpointProviderBase; + using SQSEndpointProvider = Aws::SQS::Endpoint::SQSEndpointProvider; + + namespace Model + { + /* Service model forward declarations required in SQSClient header */ + class AddPermissionRequest; + class CancelMessageMoveTaskRequest; + class ChangeMessageVisibilityRequest; + class ChangeMessageVisibilityBatchRequest; + class CreateQueueRequest; + class DeleteMessageRequest; + class DeleteMessageBatchRequest; + class DeleteQueueRequest; + class GetQueueAttributesRequest; + class GetQueueUrlRequest; + class ListDeadLetterSourceQueuesRequest; + class ListMessageMoveTasksRequest; + class ListQueueTagsRequest; + class ListQueuesRequest; + class PurgeQueueRequest; + class ReceiveMessageRequest; + class RemovePermissionRequest; + class SendMessageRequest; + class SendMessageBatchRequest; + class SetQueueAttributesRequest; + class StartMessageMoveTaskRequest; + class TagQueueRequest; + class UntagQueueRequest; + /* End of service model forward declarations required in SQSClient header */ + + /* Service model Outcome class definitions */ + typedef Aws::Utils::Outcome AddPermissionOutcome; + typedef Aws::Utils::Outcome CancelMessageMoveTaskOutcome; + typedef Aws::Utils::Outcome ChangeMessageVisibilityOutcome; + typedef Aws::Utils::Outcome ChangeMessageVisibilityBatchOutcome; + typedef Aws::Utils::Outcome CreateQueueOutcome; + typedef Aws::Utils::Outcome DeleteMessageOutcome; + typedef Aws::Utils::Outcome DeleteMessageBatchOutcome; + typedef Aws::Utils::Outcome DeleteQueueOutcome; + typedef Aws::Utils::Outcome GetQueueAttributesOutcome; + typedef Aws::Utils::Outcome GetQueueUrlOutcome; + typedef Aws::Utils::Outcome ListDeadLetterSourceQueuesOutcome; + typedef Aws::Utils::Outcome ListMessageMoveTasksOutcome; + typedef Aws::Utils::Outcome ListQueueTagsOutcome; + typedef Aws::Utils::Outcome ListQueuesOutcome; + typedef Aws::Utils::Outcome PurgeQueueOutcome; + typedef Aws::Utils::Outcome ReceiveMessageOutcome; + typedef Aws::Utils::Outcome RemovePermissionOutcome; + typedef Aws::Utils::Outcome SendMessageOutcome; + typedef Aws::Utils::Outcome SendMessageBatchOutcome; + typedef Aws::Utils::Outcome SetQueueAttributesOutcome; + typedef Aws::Utils::Outcome StartMessageMoveTaskOutcome; + typedef Aws::Utils::Outcome TagQueueOutcome; + typedef Aws::Utils::Outcome UntagQueueOutcome; + /* End of service model Outcome class definitions */ + + /* Service model Outcome callable definitions */ + typedef std::future AddPermissionOutcomeCallable; + typedef std::future CancelMessageMoveTaskOutcomeCallable; + typedef std::future ChangeMessageVisibilityOutcomeCallable; + typedef std::future ChangeMessageVisibilityBatchOutcomeCallable; + typedef std::future CreateQueueOutcomeCallable; + typedef std::future DeleteMessageOutcomeCallable; + typedef std::future DeleteMessageBatchOutcomeCallable; + typedef std::future DeleteQueueOutcomeCallable; + typedef std::future GetQueueAttributesOutcomeCallable; + typedef std::future GetQueueUrlOutcomeCallable; + typedef std::future ListDeadLetterSourceQueuesOutcomeCallable; + typedef std::future ListMessageMoveTasksOutcomeCallable; + typedef std::future ListQueueTagsOutcomeCallable; + typedef std::future ListQueuesOutcomeCallable; + typedef std::future PurgeQueueOutcomeCallable; + typedef std::future ReceiveMessageOutcomeCallable; + typedef std::future RemovePermissionOutcomeCallable; + typedef std::future SendMessageOutcomeCallable; + typedef std::future SendMessageBatchOutcomeCallable; + typedef std::future SetQueueAttributesOutcomeCallable; + typedef std::future StartMessageMoveTaskOutcomeCallable; + typedef std::future TagQueueOutcomeCallable; + typedef std::future UntagQueueOutcomeCallable; + /* End of service model Outcome callable definitions */ + } // namespace Model + + class SQSClient; + + /* Service model async handlers definitions */ + typedef std::function&) > AddPermissionResponseReceivedHandler; + typedef std::function&) > CancelMessageMoveTaskResponseReceivedHandler; + typedef std::function&) > ChangeMessageVisibilityResponseReceivedHandler; + typedef std::function&) > ChangeMessageVisibilityBatchResponseReceivedHandler; + typedef std::function&) > CreateQueueResponseReceivedHandler; + typedef std::function&) > DeleteMessageResponseReceivedHandler; + typedef std::function&) > DeleteMessageBatchResponseReceivedHandler; + typedef std::function&) > DeleteQueueResponseReceivedHandler; + typedef std::function&) > GetQueueAttributesResponseReceivedHandler; + typedef std::function&) > GetQueueUrlResponseReceivedHandler; + typedef std::function&) > ListDeadLetterSourceQueuesResponseReceivedHandler; + typedef std::function&) > ListMessageMoveTasksResponseReceivedHandler; + typedef std::function&) > ListQueueTagsResponseReceivedHandler; + typedef std::function&) > ListQueuesResponseReceivedHandler; + typedef std::function&) > PurgeQueueResponseReceivedHandler; + typedef std::function&) > ReceiveMessageResponseReceivedHandler; + typedef std::function&) > RemovePermissionResponseReceivedHandler; + typedef std::function&) > SendMessageResponseReceivedHandler; + typedef std::function&) > SendMessageBatchResponseReceivedHandler; + typedef std::function&) > SetQueueAttributesResponseReceivedHandler; + typedef std::function&) > StartMessageMoveTaskResponseReceivedHandler; + typedef std::function&) > TagQueueResponseReceivedHandler; + typedef std::function&) > UntagQueueResponseReceivedHandler; + /* End of service model async handlers definitions */ + } // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/SQS_EXPORTS.h b/include/aws/sqs/SQS_EXPORTS.h new file mode 100644 index 0000000000000000000000000000000000000000..a1f33c934c6c35d8846a4199ebfaf6cb95a1efac --- /dev/null +++ b/include/aws/sqs/SQS_EXPORTS.h @@ -0,0 +1,32 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#ifdef _MSC_VER + //disable windows complaining about max template size. + #pragma warning (disable : 4503) +#endif // _MSC_VER + +#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #ifdef _MSC_VER + #pragma warning(disable : 4251) + #endif // _MSC_VER + + #ifdef USE_IMPORT_EXPORT + #ifdef AWS_SQS_EXPORTS + #define AWS_SQS_API __declspec(dllexport) + #else + #define AWS_SQS_API __declspec(dllimport) + #endif /* AWS_SQS_EXPORTS */ + #define AWS_SQS_EXTERN + #else + #define AWS_SQS_API + #define AWS_SQS_EXTERN extern + #endif // USE_IMPORT_EXPORT +#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) + #define AWS_SQS_API + #define AWS_SQS_EXTERN extern +#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) diff --git a/include/aws/sqs/model/AddPermissionRequest.h b/include/aws/sqs/model/AddPermissionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..98f6ddae8a04750e7ffeaf744cd4ae3636020062 --- /dev/null +++ b/include/aws/sqs/model/AddPermissionRequest.h @@ -0,0 +1,135 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class AddPermissionRequest : public SQSRequest + { + public: + AWS_SQS_API AddPermissionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "AddPermission"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue to which permissions are added.

Queue + * URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline AddPermissionRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline AddPermissionRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline AddPermissionRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

The unique identification of the permission you're setting (for example, + * AliceSendMessage). Maximum 80 characters. Allowed characters + * include alphanumeric characters, hyphens (-), and underscores + * (_).

+ */ + inline const Aws::String& GetLabel() const{ return m_label; } + inline bool LabelHasBeenSet() const { return m_labelHasBeenSet; } + inline void SetLabel(const Aws::String& value) { m_labelHasBeenSet = true; m_label = value; } + inline void SetLabel(Aws::String&& value) { m_labelHasBeenSet = true; m_label = std::move(value); } + inline void SetLabel(const char* value) { m_labelHasBeenSet = true; m_label.assign(value); } + inline AddPermissionRequest& WithLabel(const Aws::String& value) { SetLabel(value); return *this;} + inline AddPermissionRequest& WithLabel(Aws::String&& value) { SetLabel(std::move(value)); return *this;} + inline AddPermissionRequest& WithLabel(const char* value) { SetLabel(value); return *this;} + ///@} + + ///@{ + /** + *

The Amazon Web Services account numbers of the principals + * who are to receive permission. For information about locating the Amazon Web + * Services account identification, see Your + * Amazon Web Services Identifiers in the Amazon SQS Developer + * Guide.

+ */ + inline const Aws::Vector& GetAWSAccountIds() const{ return m_aWSAccountIds; } + inline bool AWSAccountIdsHasBeenSet() const { return m_aWSAccountIdsHasBeenSet; } + inline void SetAWSAccountIds(const Aws::Vector& value) { m_aWSAccountIdsHasBeenSet = true; m_aWSAccountIds = value; } + inline void SetAWSAccountIds(Aws::Vector&& value) { m_aWSAccountIdsHasBeenSet = true; m_aWSAccountIds = std::move(value); } + inline AddPermissionRequest& WithAWSAccountIds(const Aws::Vector& value) { SetAWSAccountIds(value); return *this;} + inline AddPermissionRequest& WithAWSAccountIds(Aws::Vector&& value) { SetAWSAccountIds(std::move(value)); return *this;} + inline AddPermissionRequest& AddAWSAccountIds(const Aws::String& value) { m_aWSAccountIdsHasBeenSet = true; m_aWSAccountIds.push_back(value); return *this; } + inline AddPermissionRequest& AddAWSAccountIds(Aws::String&& value) { m_aWSAccountIdsHasBeenSet = true; m_aWSAccountIds.push_back(std::move(value)); return *this; } + inline AddPermissionRequest& AddAWSAccountIds(const char* value) { m_aWSAccountIdsHasBeenSet = true; m_aWSAccountIds.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The action the client wants to allow for the specified principal. Valid + * values: the name of any action or *.

For more information + * about these actions, see Overview + * of Managing Access Permissions to Your Amazon Simple Queue Service Resource + * in the Amazon SQS Developer Guide.

Specifying + * SendMessage, DeleteMessage, or + * ChangeMessageVisibility for ActionName.n also grants + * permissions for the corresponding batch versions of those actions: + * SendMessageBatch, DeleteMessageBatch, and + * ChangeMessageVisibilityBatch.

+ */ + inline const Aws::Vector& GetActions() const{ return m_actions; } + inline bool ActionsHasBeenSet() const { return m_actionsHasBeenSet; } + inline void SetActions(const Aws::Vector& value) { m_actionsHasBeenSet = true; m_actions = value; } + inline void SetActions(Aws::Vector&& value) { m_actionsHasBeenSet = true; m_actions = std::move(value); } + inline AddPermissionRequest& WithActions(const Aws::Vector& value) { SetActions(value); return *this;} + inline AddPermissionRequest& WithActions(Aws::Vector&& value) { SetActions(std::move(value)); return *this;} + inline AddPermissionRequest& AddActions(const Aws::String& value) { m_actionsHasBeenSet = true; m_actions.push_back(value); return *this; } + inline AddPermissionRequest& AddActions(Aws::String&& value) { m_actionsHasBeenSet = true; m_actions.push_back(std::move(value)); return *this; } + inline AddPermissionRequest& AddActions(const char* value) { m_actionsHasBeenSet = true; m_actions.push_back(value); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::String m_label; + bool m_labelHasBeenSet = false; + + Aws::Vector m_aWSAccountIds; + bool m_aWSAccountIdsHasBeenSet = false; + + Aws::Vector m_actions; + bool m_actionsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/BatchResultErrorEntry.h b/include/aws/sqs/model/BatchResultErrorEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..f003b60017201ccb07d0f2514fdc66f622d889fd --- /dev/null +++ b/include/aws/sqs/model/BatchResultErrorEntry.h @@ -0,0 +1,110 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Gives a detailed description of the result of an action on each entry in the + * request.

See Also:

AWS + * API Reference

+ */ + class BatchResultErrorEntry + { + public: + AWS_SQS_API BatchResultErrorEntry(); + AWS_SQS_API BatchResultErrorEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API BatchResultErrorEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The Id of an entry in a batch request.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline BatchResultErrorEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline BatchResultErrorEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline BatchResultErrorEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

Specifies whether the error happened due to the caller of the batch API + * action.

+ */ + inline bool GetSenderFault() const{ return m_senderFault; } + inline bool SenderFaultHasBeenSet() const { return m_senderFaultHasBeenSet; } + inline void SetSenderFault(bool value) { m_senderFaultHasBeenSet = true; m_senderFault = value; } + inline BatchResultErrorEntry& WithSenderFault(bool value) { SetSenderFault(value); return *this;} + ///@} + + ///@{ + /** + *

An error code representing why the action failed on this entry.

+ */ + inline const Aws::String& GetCode() const{ return m_code; } + inline bool CodeHasBeenSet() const { return m_codeHasBeenSet; } + inline void SetCode(const Aws::String& value) { m_codeHasBeenSet = true; m_code = value; } + inline void SetCode(Aws::String&& value) { m_codeHasBeenSet = true; m_code = std::move(value); } + inline void SetCode(const char* value) { m_codeHasBeenSet = true; m_code.assign(value); } + inline BatchResultErrorEntry& WithCode(const Aws::String& value) { SetCode(value); return *this;} + inline BatchResultErrorEntry& WithCode(Aws::String&& value) { SetCode(std::move(value)); return *this;} + inline BatchResultErrorEntry& WithCode(const char* value) { SetCode(value); return *this;} + ///@} + + ///@{ + /** + *

A message explaining why the action failed on this entry.

+ */ + inline const Aws::String& GetMessage() const{ return m_message; } + inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } + inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } + inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } + inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } + inline BatchResultErrorEntry& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} + inline BatchResultErrorEntry& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} + inline BatchResultErrorEntry& WithMessage(const char* value) { SetMessage(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + bool m_senderFault; + bool m_senderFaultHasBeenSet = false; + + Aws::String m_code; + bool m_codeHasBeenSet = false; + + Aws::String m_message; + bool m_messageHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/CancelMessageMoveTaskRequest.h b/include/aws/sqs/model/CancelMessageMoveTaskRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..2964357f24547e97f213571df83389b4215f8511 --- /dev/null +++ b/include/aws/sqs/model/CancelMessageMoveTaskRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + */ + class CancelMessageMoveTaskRequest : public SQSRequest + { + public: + AWS_SQS_API CancelMessageMoveTaskRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CancelMessageMoveTask"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

An identifier associated with a message movement task.

+ */ + inline const Aws::String& GetTaskHandle() const{ return m_taskHandle; } + inline bool TaskHandleHasBeenSet() const { return m_taskHandleHasBeenSet; } + inline void SetTaskHandle(const Aws::String& value) { m_taskHandleHasBeenSet = true; m_taskHandle = value; } + inline void SetTaskHandle(Aws::String&& value) { m_taskHandleHasBeenSet = true; m_taskHandle = std::move(value); } + inline void SetTaskHandle(const char* value) { m_taskHandleHasBeenSet = true; m_taskHandle.assign(value); } + inline CancelMessageMoveTaskRequest& WithTaskHandle(const Aws::String& value) { SetTaskHandle(value); return *this;} + inline CancelMessageMoveTaskRequest& WithTaskHandle(Aws::String&& value) { SetTaskHandle(std::move(value)); return *this;} + inline CancelMessageMoveTaskRequest& WithTaskHandle(const char* value) { SetTaskHandle(value); return *this;} + ///@} + private: + + Aws::String m_taskHandle; + bool m_taskHandleHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/CancelMessageMoveTaskResult.h b/include/aws/sqs/model/CancelMessageMoveTaskResult.h new file mode 100644 index 0000000000000000000000000000000000000000..68991a691d257faacdc17dfed6486443f2162fbc --- /dev/null +++ b/include/aws/sqs/model/CancelMessageMoveTaskResult.h @@ -0,0 +1,76 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + class CancelMessageMoveTaskResult + { + public: + AWS_SQS_API CancelMessageMoveTaskResult(); + AWS_SQS_API CancelMessageMoveTaskResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API CancelMessageMoveTaskResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The approximate number of messages already moved to the destination + * queue.

+ */ + inline long long GetApproximateNumberOfMessagesMoved() const{ return m_approximateNumberOfMessagesMoved; } + inline void SetApproximateNumberOfMessagesMoved(long long value) { m_approximateNumberOfMessagesMoved = value; } + inline CancelMessageMoveTaskResult& WithApproximateNumberOfMessagesMoved(long long value) { SetApproximateNumberOfMessagesMoved(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline CancelMessageMoveTaskResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline CancelMessageMoveTaskResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline CancelMessageMoveTaskResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline CancelMessageMoveTaskResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline CancelMessageMoveTaskResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + long long m_approximateNumberOfMessagesMoved; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ChangeMessageVisibilityBatchRequest.h b/include/aws/sqs/model/ChangeMessageVisibilityBatchRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..696eeaa73a5d23370b479beec938369fbda4edc6 --- /dev/null +++ b/include/aws/sqs/model/ChangeMessageVisibilityBatchRequest.h @@ -0,0 +1,82 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class ChangeMessageVisibilityBatchRequest : public SQSRequest + { + public: + AWS_SQS_API ChangeMessageVisibilityBatchRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ChangeMessageVisibilityBatch"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue whose messages' visibility is changed.

+ *

Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline ChangeMessageVisibilityBatchRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline ChangeMessageVisibilityBatchRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

Lists the receipt handles of the messages for which the visibility timeout + * must be changed.

+ */ + inline const Aws::Vector& GetEntries() const{ return m_entries; } + inline bool EntriesHasBeenSet() const { return m_entriesHasBeenSet; } + inline void SetEntries(const Aws::Vector& value) { m_entriesHasBeenSet = true; m_entries = value; } + inline void SetEntries(Aws::Vector&& value) { m_entriesHasBeenSet = true; m_entries = std::move(value); } + inline ChangeMessageVisibilityBatchRequest& WithEntries(const Aws::Vector& value) { SetEntries(value); return *this;} + inline ChangeMessageVisibilityBatchRequest& WithEntries(Aws::Vector&& value) { SetEntries(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchRequest& AddEntries(const ChangeMessageVisibilityBatchRequestEntry& value) { m_entriesHasBeenSet = true; m_entries.push_back(value); return *this; } + inline ChangeMessageVisibilityBatchRequest& AddEntries(ChangeMessageVisibilityBatchRequestEntry&& value) { m_entriesHasBeenSet = true; m_entries.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Vector m_entries; + bool m_entriesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ChangeMessageVisibilityBatchRequestEntry.h b/include/aws/sqs/model/ChangeMessageVisibilityBatchRequestEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..60aa1390b8348d49525135241f7e0699ab87c344 --- /dev/null +++ b/include/aws/sqs/model/ChangeMessageVisibilityBatchRequestEntry.h @@ -0,0 +1,96 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Encloses a receipt handle and an entry ID for each message in + * ChangeMessageVisibilityBatch.

See Also:

AWS + * API Reference

+ */ + class ChangeMessageVisibilityBatchRequestEntry + { + public: + AWS_SQS_API ChangeMessageVisibilityBatchRequestEntry(); + AWS_SQS_API ChangeMessageVisibilityBatchRequestEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API ChangeMessageVisibilityBatchRequestEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

An identifier for this particular receipt handle used to communicate the + * result.

The Ids of a batch request need to be unique + * within a request.

This identifier can have up to 80 characters. The + * following characters are accepted: alphanumeric characters, hyphens(-), and + * underscores (_).

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline ChangeMessageVisibilityBatchRequestEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline ChangeMessageVisibilityBatchRequestEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchRequestEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

A receipt handle.

+ */ + inline const Aws::String& GetReceiptHandle() const{ return m_receiptHandle; } + inline bool ReceiptHandleHasBeenSet() const { return m_receiptHandleHasBeenSet; } + inline void SetReceiptHandle(const Aws::String& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = value; } + inline void SetReceiptHandle(Aws::String&& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = std::move(value); } + inline void SetReceiptHandle(const char* value) { m_receiptHandleHasBeenSet = true; m_receiptHandle.assign(value); } + inline ChangeMessageVisibilityBatchRequestEntry& WithReceiptHandle(const Aws::String& value) { SetReceiptHandle(value); return *this;} + inline ChangeMessageVisibilityBatchRequestEntry& WithReceiptHandle(Aws::String&& value) { SetReceiptHandle(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchRequestEntry& WithReceiptHandle(const char* value) { SetReceiptHandle(value); return *this;} + ///@} + + ///@{ + /** + *

The new value (in seconds) for the message's visibility timeout.

+ */ + inline int GetVisibilityTimeout() const{ return m_visibilityTimeout; } + inline bool VisibilityTimeoutHasBeenSet() const { return m_visibilityTimeoutHasBeenSet; } + inline void SetVisibilityTimeout(int value) { m_visibilityTimeoutHasBeenSet = true; m_visibilityTimeout = value; } + inline ChangeMessageVisibilityBatchRequestEntry& WithVisibilityTimeout(int value) { SetVisibilityTimeout(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_receiptHandle; + bool m_receiptHandleHasBeenSet = false; + + int m_visibilityTimeout; + bool m_visibilityTimeoutHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ChangeMessageVisibilityBatchResult.h b/include/aws/sqs/model/ChangeMessageVisibilityBatchResult.h new file mode 100644 index 0000000000000000000000000000000000000000..88b7c03b02f1408583f27491a066d8516c939a54 --- /dev/null +++ b/include/aws/sqs/model/ChangeMessageVisibilityBatchResult.h @@ -0,0 +1,106 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

For each message in the batch, the response contains a + * ChangeMessageVisibilityBatchResultEntry tag if the message + * succeeds or a BatchResultErrorEntry tag if the message + * fails.

See Also:

AWS + * API Reference

+ */ + class ChangeMessageVisibilityBatchResult + { + public: + AWS_SQS_API ChangeMessageVisibilityBatchResult(); + AWS_SQS_API ChangeMessageVisibilityBatchResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API ChangeMessageVisibilityBatchResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of ChangeMessageVisibilityBatchResultEntry + * items.

+ */ + inline const Aws::Vector& GetSuccessful() const{ return m_successful; } + inline void SetSuccessful(const Aws::Vector& value) { m_successful = value; } + inline void SetSuccessful(Aws::Vector&& value) { m_successful = std::move(value); } + inline ChangeMessageVisibilityBatchResult& WithSuccessful(const Aws::Vector& value) { SetSuccessful(value); return *this;} + inline ChangeMessageVisibilityBatchResult& WithSuccessful(Aws::Vector&& value) { SetSuccessful(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchResult& AddSuccessful(const ChangeMessageVisibilityBatchResultEntry& value) { m_successful.push_back(value); return *this; } + inline ChangeMessageVisibilityBatchResult& AddSuccessful(ChangeMessageVisibilityBatchResultEntry&& value) { m_successful.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A list of BatchResultErrorEntry items.

+ */ + inline const Aws::Vector& GetFailed() const{ return m_failed; } + inline void SetFailed(const Aws::Vector& value) { m_failed = value; } + inline void SetFailed(Aws::Vector&& value) { m_failed = std::move(value); } + inline ChangeMessageVisibilityBatchResult& WithFailed(const Aws::Vector& value) { SetFailed(value); return *this;} + inline ChangeMessageVisibilityBatchResult& WithFailed(Aws::Vector&& value) { SetFailed(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchResult& AddFailed(const BatchResultErrorEntry& value) { m_failed.push_back(value); return *this; } + inline ChangeMessageVisibilityBatchResult& AddFailed(BatchResultErrorEntry&& value) { m_failed.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ChangeMessageVisibilityBatchResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ChangeMessageVisibilityBatchResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ChangeMessageVisibilityBatchResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ChangeMessageVisibilityBatchResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_successful; + + Aws::Vector m_failed; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ChangeMessageVisibilityBatchResultEntry.h b/include/aws/sqs/model/ChangeMessageVisibilityBatchResultEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..207bfb1571b2abb7c89bf1d7ff08d7b035d251f8 --- /dev/null +++ b/include/aws/sqs/model/ChangeMessageVisibilityBatchResultEntry.h @@ -0,0 +1,63 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Encloses the Id of an entry in + * ChangeMessageVisibilityBatch.

See Also:

AWS + * API Reference

+ */ + class ChangeMessageVisibilityBatchResultEntry + { + public: + AWS_SQS_API ChangeMessageVisibilityBatchResultEntry(); + AWS_SQS_API ChangeMessageVisibilityBatchResultEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API ChangeMessageVisibilityBatchResultEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Represents a message whose visibility timeout has been changed + * successfully.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline ChangeMessageVisibilityBatchResultEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline ChangeMessageVisibilityBatchResultEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline ChangeMessageVisibilityBatchResultEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ChangeMessageVisibilityRequest.h b/include/aws/sqs/model/ChangeMessageVisibilityRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..1b0acdeffd1a80e96860cc527edd4d5ef4598dd9 --- /dev/null +++ b/include/aws/sqs/model/ChangeMessageVisibilityRequest.h @@ -0,0 +1,92 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + */ + class ChangeMessageVisibilityRequest : public SQSRequest + { + public: + AWS_SQS_API ChangeMessageVisibilityRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ChangeMessageVisibility"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue whose message's visibility is changed.

+ *

Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline ChangeMessageVisibilityRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline ChangeMessageVisibilityRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline ChangeMessageVisibilityRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

The receipt handle associated with the message, whose visibility timeout is + * changed. This parameter is returned by the ReceiveMessage + * action.

+ */ + inline const Aws::String& GetReceiptHandle() const{ return m_receiptHandle; } + inline bool ReceiptHandleHasBeenSet() const { return m_receiptHandleHasBeenSet; } + inline void SetReceiptHandle(const Aws::String& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = value; } + inline void SetReceiptHandle(Aws::String&& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = std::move(value); } + inline void SetReceiptHandle(const char* value) { m_receiptHandleHasBeenSet = true; m_receiptHandle.assign(value); } + inline ChangeMessageVisibilityRequest& WithReceiptHandle(const Aws::String& value) { SetReceiptHandle(value); return *this;} + inline ChangeMessageVisibilityRequest& WithReceiptHandle(Aws::String&& value) { SetReceiptHandle(std::move(value)); return *this;} + inline ChangeMessageVisibilityRequest& WithReceiptHandle(const char* value) { SetReceiptHandle(value); return *this;} + ///@} + + ///@{ + /** + *

The new value for the message's visibility timeout (in seconds). Values + * range: 0 to 43200. Maximum: 12 hours.

+ */ + inline int GetVisibilityTimeout() const{ return m_visibilityTimeout; } + inline bool VisibilityTimeoutHasBeenSet() const { return m_visibilityTimeoutHasBeenSet; } + inline void SetVisibilityTimeout(int value) { m_visibilityTimeoutHasBeenSet = true; m_visibilityTimeout = value; } + inline ChangeMessageVisibilityRequest& WithVisibilityTimeout(int value) { SetVisibilityTimeout(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::String m_receiptHandle; + bool m_receiptHandleHasBeenSet = false; + + int m_visibilityTimeout; + bool m_visibilityTimeoutHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/CreateQueueRequest.h b/include/aws/sqs/model/CreateQueueRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f16c4bdf53c1deaf2afa244470c7932a09b358da --- /dev/null +++ b/include/aws/sqs/model/CreateQueueRequest.h @@ -0,0 +1,272 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class CreateQueueRequest : public SQSRequest + { + public: + AWS_SQS_API CreateQueueRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "CreateQueue"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The name of the new queue. The following limits apply to this name:

    + *
  • A queue name can have up to 80 characters.

  • Valid + * values: alphanumeric characters, hyphens (-), and underscores + * (_).

  • A FIFO queue name must end with the + * .fifo suffix.

Queue URLs and names are + * case-sensitive.

+ */ + inline const Aws::String& GetQueueName() const{ return m_queueName; } + inline bool QueueNameHasBeenSet() const { return m_queueNameHasBeenSet; } + inline void SetQueueName(const Aws::String& value) { m_queueNameHasBeenSet = true; m_queueName = value; } + inline void SetQueueName(Aws::String&& value) { m_queueNameHasBeenSet = true; m_queueName = std::move(value); } + inline void SetQueueName(const char* value) { m_queueNameHasBeenSet = true; m_queueName.assign(value); } + inline CreateQueueRequest& WithQueueName(const Aws::String& value) { SetQueueName(value); return *this;} + inline CreateQueueRequest& WithQueueName(Aws::String&& value) { SetQueueName(std::move(value)); return *this;} + inline CreateQueueRequest& WithQueueName(const char* value) { SetQueueName(value); return *this;} + ///@} + + ///@{ + /** + *

A map of attributes with their corresponding values.

The following + * lists the names, descriptions, and values of the special request parameters that + * the CreateQueue action uses:

  • + * DelaySeconds – The length of time, in seconds, for which the + * delivery of all messages in the queue is delayed. Valid values: An integer from + * 0 to 900 seconds (15 minutes). Default: 0.

  • + * MaximumMessageSize – The limit of how many bytes a message can + * contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes + * (1 KiB) to 262,144 bytes (256 KiB). Default: 262,144 (256 KiB).

  • + *

    MessageRetentionPeriod – The length of time, in seconds, for + * which Amazon SQS retains a message. Valid values: An integer from 60 seconds (1 + * minute) to 1,209,600 seconds (14 days). Default: 345,600 (4 days). When you + * change a queue's attributes, the change can take up to 60 seconds for most of + * the attributes to propagate throughout the Amazon SQS system. Changes made to + * the MessageRetentionPeriod attribute can take up to 15 minutes and + * will impact existing messages in the queue potentially causing them to be + * expired and deleted if the MessageRetentionPeriod is reduced below + * the age of existing messages.

  • Policy – The + * queue's policy. A valid Amazon Web Services policy. For more information about + * policy structure, see Overview + * of Amazon Web Services IAM Policies in the IAM User Guide.

  • + *
  • ReceiveMessageWaitTimeSeconds – The length of time, in + * seconds, for which a ReceiveMessage action waits for a + * message to arrive. Valid values: An integer from 0 to 20 (seconds). Default: 0. + *

  • VisibilityTimeout – The visibility timeout for + * the queue, in seconds. Valid values: An integer from 0 to 43,200 (12 hours). + * Default: 30. For more information about the visibility timeout, see Visibility + * Timeout in the Amazon SQS Developer Guide.

The + * following attributes apply only to dead-letter + * queues:

  • RedrivePolicy – The string that + * includes the parameters for the dead-letter queue functionality of the source + * queue as a JSON object. The parameters are as follows:

    • + * deadLetterTargetArn – The Amazon Resource Name (ARN) of the + * dead-letter queue to which Amazon SQS moves messages after the value of + * maxReceiveCount is exceeded.

    • + * maxReceiveCount – The number of times a message is delivered to the + * source queue before being moved to the dead-letter queue. Default: 10. When the + * ReceiveCount for a message exceeds the maxReceiveCount + * for a queue, Amazon SQS moves the message to the dead-letter-queue.

    • + *
  • RedriveAllowPolicy – The string that includes + * the parameters for the permissions for the dead-letter queue redrive permission + * and which source queues can specify dead-letter queues as a JSON object. The + * parameters are as follows:

    • redrivePermission – + * The permission type that defines which source queues can specify the current + * queue as the dead-letter queue. Valid values are:

      • + * allowAll – (Default) Any source queues in this Amazon Web Services + * account in the same Region can specify this queue as the dead-letter queue.

        + *
      • denyAll – No source queues can specify this queue as + * the dead-letter queue.

      • byQueue – Only queues + * specified by the sourceQueueArns parameter can specify this queue + * as the dead-letter queue.

    • + * sourceQueueArns – The Amazon Resource Names (ARN)s of the source + * queues that can specify this queue as the dead-letter queue and redrive + * messages. You can specify this parameter only when the + * redrivePermission parameter is set to byQueue. You can + * specify up to 10 source queue ARNs. To allow more than 10 source queues to + * specify dead-letter queues, set the redrivePermission parameter to + * allowAll.

The dead-letter + * queue of a FIFO queue must also be a FIFO queue. Similarly, the dead-letter + * queue of a standard queue must also be a standard queue.

The + * following attributes apply only to server-side-encryption:

+ *
  • KmsMasterKeyId – The ID of an Amazon Web Services + * managed customer master key (CMK) for Amazon SQS or a custom CMK. For more + * information, see Key + * Terms. While the alias of the Amazon Web Services managed CMK for Amazon SQS + * is always alias/aws/sqs, the alias of a custom CMK can, for + * example, be alias/MyAlias . For more examples, see KeyId + * in the Key Management Service API Reference.

  • + * KmsDataKeyReusePeriodSeconds – The length of time, in seconds, for + * which Amazon SQS can reuse a data + * key to encrypt or decrypt messages before calling KMS again. An integer + * representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 + * hours). Default: 300 (5 minutes). A shorter time period provides better security + * but results in more calls to KMS which might incur charges after Free Tier. For + * more information, see How + * Does the Data Key Reuse Period Work?

  • + * SqsManagedSseEnabled – Enables server-side queue encryption using + * SQS owned encryption keys. Only one server-side encryption option is supported + * per queue (for example, SSE-KMS + * or SSE-SQS).

    + *

The following attributes apply only to FIFO + * (first-in-first-out) queues:

  • FifoQueue – + * Designates a queue as FIFO. Valid values are true and + * false. If you don't specify the FifoQueue attribute, + * Amazon SQS creates a standard queue. You can provide this attribute only during + * queue creation. You can't change it for an existing queue. When you set this + * attribute, you must also provide the MessageGroupId for your + * messages explicitly.

    For more information, see FIFO + * queue logic in the Amazon SQS Developer Guide.

  • + * ContentBasedDeduplication – Enables content-based deduplication. + * Valid values are true and false. For more information, + * see Exactly-once + * processing in the Amazon SQS Developer Guide. Note the following: + *

    • Every message must have a unique + * MessageDeduplicationId.

      • You may provide a + * MessageDeduplicationId explicitly.

      • If you aren't + * able to provide a MessageDeduplicationId and you enable + * ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 + * hash to generate the MessageDeduplicationId using the body of the + * message (but not the attributes of the message).

      • If you don't + * provide a MessageDeduplicationId and the queue doesn't have + * ContentBasedDeduplication set, the action fails with an error.

        + *
      • If the queue has ContentBasedDeduplication set, your + * MessageDeduplicationId overrides the generated one.

      + *
    • When ContentBasedDeduplication is in effect, messages + * with identical content sent within the deduplication interval are treated as + * duplicates and only one copy of the message is delivered.

    • If + * you send one message with ContentBasedDeduplication enabled and + * then another message with a MessageDeduplicationId that is the same + * as the one generated for the first MessageDeduplicationId, the two + * messages are treated as duplicates and only one copy of the message is + * delivered.

The following attributes apply only + * to high + * throughput for FIFO queues:

  • + * DeduplicationScope – Specifies whether message deduplication occurs + * at the message group or queue level. Valid values are messageGroup + * and queue.

  • FifoThroughputLimit – + * Specifies whether the FIFO queue throughput quota applies to the entire queue or + * per message group. Valid values are perQueue and + * perMessageGroupId. The perMessageGroupId value is + * allowed only when the value for DeduplicationScope is + * messageGroup.

To enable high throughput for FIFO + * queues, do the following:

  • Set DeduplicationScope + * to messageGroup.

  • Set + * FifoThroughputLimit to perMessageGroupId.

  • + *

If you set these attributes to anything other than the values shown for + * enabling high throughput, normal throughput is in effect and deduplication + * occurs as specified.

For information on throughput quotas, see Quotas + * related to messages in the Amazon SQS Developer Guide.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline CreateQueueRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline CreateQueueRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline CreateQueueRequest& AddAttributes(const QueueAttributeName& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline CreateQueueRequest& AddAttributes(QueueAttributeName&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreateQueueRequest& AddAttributes(const QueueAttributeName& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline CreateQueueRequest& AddAttributes(QueueAttributeName&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline CreateQueueRequest& AddAttributes(QueueAttributeName&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline CreateQueueRequest& AddAttributes(const QueueAttributeName& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

Add cost allocation tags to the specified Amazon SQS queue. For an overview, + * see Tagging + * Your Amazon SQS Queues in the Amazon SQS Developer Guide.

When + * you use queue tags, keep the following guidelines in mind:

  • + *

    Adding more than 50 tags to a queue isn't recommended.

  • Tags + * don't have any semantic meaning. Amazon SQS interprets tags as character + * strings.

  • Tags are case-sensitive.

  • A new tag + * with a key identical to that of an existing tag overwrites the existing tag.

    + *

For a full list of tag restrictions, see Quotas + * related to queues in the Amazon SQS Developer Guide.

To + * be able to tag a queue on creation, you must have the + * sqs:CreateQueue and sqs:TagQueue permissions.

+ *

Cross-account permissions don't apply to this action. For more information, + * see Grant + * cross-account permissions to a role and a username in the Amazon SQS + * Developer Guide.

+ */ + inline const Aws::Map& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Map& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Map&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline CreateQueueRequest& WithTags(const Aws::Map& value) { SetTags(value); return *this;} + inline CreateQueueRequest& WithTags(Aws::Map&& value) { SetTags(std::move(value)); return *this;} + inline CreateQueueRequest& AddTags(const Aws::String& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + inline CreateQueueRequest& AddTags(Aws::String&& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline CreateQueueRequest& AddTags(const Aws::String& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline CreateQueueRequest& AddTags(Aws::String&& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), std::move(value)); return *this; } + inline CreateQueueRequest& AddTags(const char* key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline CreateQueueRequest& AddTags(Aws::String&& key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline CreateQueueRequest& AddTags(const char* key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_queueName; + bool m_queueNameHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + + Aws::Map m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/CreateQueueResult.h b/include/aws/sqs/model/CreateQueueResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a0e458aaf73c5a6941e149089c3b47449cb8ed69 --- /dev/null +++ b/include/aws/sqs/model/CreateQueueResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

Returns the QueueUrl attribute of the created + * queue.

See Also:

AWS + * API Reference

+ */ + class CreateQueueResult + { + public: + AWS_SQS_API CreateQueueResult(); + AWS_SQS_API CreateQueueResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API CreateQueueResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The URL of the created Amazon SQS queue.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrl.assign(value); } + inline CreateQueueResult& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline CreateQueueResult& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline CreateQueueResult& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline CreateQueueResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline CreateQueueResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline CreateQueueResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline CreateQueueResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline CreateQueueResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/DeleteMessageBatchRequest.h b/include/aws/sqs/model/DeleteMessageBatchRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..646f3559e4ea1f9313043ddf38b36a11a393a50d --- /dev/null +++ b/include/aws/sqs/model/DeleteMessageBatchRequest.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DeleteMessageBatchRequest : public SQSRequest + { + public: + AWS_SQS_API DeleteMessageBatchRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteMessageBatch"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue from which messages are deleted.

Queue + * URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline DeleteMessageBatchRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline DeleteMessageBatchRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline DeleteMessageBatchRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

Lists the receipt handles for the messages to be deleted.

+ */ + inline const Aws::Vector& GetEntries() const{ return m_entries; } + inline bool EntriesHasBeenSet() const { return m_entriesHasBeenSet; } + inline void SetEntries(const Aws::Vector& value) { m_entriesHasBeenSet = true; m_entries = value; } + inline void SetEntries(Aws::Vector&& value) { m_entriesHasBeenSet = true; m_entries = std::move(value); } + inline DeleteMessageBatchRequest& WithEntries(const Aws::Vector& value) { SetEntries(value); return *this;} + inline DeleteMessageBatchRequest& WithEntries(Aws::Vector&& value) { SetEntries(std::move(value)); return *this;} + inline DeleteMessageBatchRequest& AddEntries(const DeleteMessageBatchRequestEntry& value) { m_entriesHasBeenSet = true; m_entries.push_back(value); return *this; } + inline DeleteMessageBatchRequest& AddEntries(DeleteMessageBatchRequestEntry&& value) { m_entriesHasBeenSet = true; m_entries.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Vector m_entries; + bool m_entriesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/DeleteMessageBatchRequestEntry.h b/include/aws/sqs/model/DeleteMessageBatchRequestEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..77ee912636c8ab9edf97c57f6f441c9de7b807e6 --- /dev/null +++ b/include/aws/sqs/model/DeleteMessageBatchRequestEntry.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Encloses a receipt handle and an identifier for it.

See Also:

+ * AWS + * API Reference

+ */ + class DeleteMessageBatchRequestEntry + { + public: + AWS_SQS_API DeleteMessageBatchRequestEntry(); + AWS_SQS_API DeleteMessageBatchRequestEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API DeleteMessageBatchRequestEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

The identifier for this particular receipt handle. This is used to + * communicate the result.

The Ids of a batch request + * need to be unique within a request.

This identifier can have up to 80 + * characters. The following characters are accepted: alphanumeric characters, + * hyphens(-), and underscores (_).

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline DeleteMessageBatchRequestEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline DeleteMessageBatchRequestEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline DeleteMessageBatchRequestEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

A receipt handle.

+ */ + inline const Aws::String& GetReceiptHandle() const{ return m_receiptHandle; } + inline bool ReceiptHandleHasBeenSet() const { return m_receiptHandleHasBeenSet; } + inline void SetReceiptHandle(const Aws::String& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = value; } + inline void SetReceiptHandle(Aws::String&& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = std::move(value); } + inline void SetReceiptHandle(const char* value) { m_receiptHandleHasBeenSet = true; m_receiptHandle.assign(value); } + inline DeleteMessageBatchRequestEntry& WithReceiptHandle(const Aws::String& value) { SetReceiptHandle(value); return *this;} + inline DeleteMessageBatchRequestEntry& WithReceiptHandle(Aws::String&& value) { SetReceiptHandle(std::move(value)); return *this;} + inline DeleteMessageBatchRequestEntry& WithReceiptHandle(const char* value) { SetReceiptHandle(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_receiptHandle; + bool m_receiptHandleHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/DeleteMessageBatchResult.h b/include/aws/sqs/model/DeleteMessageBatchResult.h new file mode 100644 index 0000000000000000000000000000000000000000..41c6ad3d9401ef7befb36c02b60407c40e4c05aa --- /dev/null +++ b/include/aws/sqs/model/DeleteMessageBatchResult.h @@ -0,0 +1,105 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

For each message in the batch, the response contains a + * DeleteMessageBatchResultEntry tag if the message is deleted or a + * BatchResultErrorEntry tag if the message can't be + * deleted.

See Also:

AWS + * API Reference

+ */ + class DeleteMessageBatchResult + { + public: + AWS_SQS_API DeleteMessageBatchResult(); + AWS_SQS_API DeleteMessageBatchResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API DeleteMessageBatchResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of DeleteMessageBatchResultEntry items.

+ */ + inline const Aws::Vector& GetSuccessful() const{ return m_successful; } + inline void SetSuccessful(const Aws::Vector& value) { m_successful = value; } + inline void SetSuccessful(Aws::Vector&& value) { m_successful = std::move(value); } + inline DeleteMessageBatchResult& WithSuccessful(const Aws::Vector& value) { SetSuccessful(value); return *this;} + inline DeleteMessageBatchResult& WithSuccessful(Aws::Vector&& value) { SetSuccessful(std::move(value)); return *this;} + inline DeleteMessageBatchResult& AddSuccessful(const DeleteMessageBatchResultEntry& value) { m_successful.push_back(value); return *this; } + inline DeleteMessageBatchResult& AddSuccessful(DeleteMessageBatchResultEntry&& value) { m_successful.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A list of BatchResultErrorEntry items.

+ */ + inline const Aws::Vector& GetFailed() const{ return m_failed; } + inline void SetFailed(const Aws::Vector& value) { m_failed = value; } + inline void SetFailed(Aws::Vector&& value) { m_failed = std::move(value); } + inline DeleteMessageBatchResult& WithFailed(const Aws::Vector& value) { SetFailed(value); return *this;} + inline DeleteMessageBatchResult& WithFailed(Aws::Vector&& value) { SetFailed(std::move(value)); return *this;} + inline DeleteMessageBatchResult& AddFailed(const BatchResultErrorEntry& value) { m_failed.push_back(value); return *this; } + inline DeleteMessageBatchResult& AddFailed(BatchResultErrorEntry&& value) { m_failed.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline DeleteMessageBatchResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline DeleteMessageBatchResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline DeleteMessageBatchResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline DeleteMessageBatchResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline DeleteMessageBatchResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_successful; + + Aws::Vector m_failed; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/DeleteMessageBatchResultEntry.h b/include/aws/sqs/model/DeleteMessageBatchResultEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..5c480167b2d8549515886754c71e5593c4575fb3 --- /dev/null +++ b/include/aws/sqs/model/DeleteMessageBatchResultEntry.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Encloses the Id of an entry in + * DeleteMessageBatch.

See Also:

AWS + * API Reference

+ */ + class DeleteMessageBatchResultEntry + { + public: + AWS_SQS_API DeleteMessageBatchResultEntry(); + AWS_SQS_API DeleteMessageBatchResultEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API DeleteMessageBatchResultEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Represents a successfully deleted message.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline DeleteMessageBatchResultEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline DeleteMessageBatchResultEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline DeleteMessageBatchResultEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/DeleteMessageRequest.h b/include/aws/sqs/model/DeleteMessageRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..82bbc1125f7350d7435a7fc807cacd30133372a8 --- /dev/null +++ b/include/aws/sqs/model/DeleteMessageRequest.h @@ -0,0 +1,79 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DeleteMessageRequest : public SQSRequest + { + public: + AWS_SQS_API DeleteMessageRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteMessage"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue from which messages are deleted.

Queue + * URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline DeleteMessageRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline DeleteMessageRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline DeleteMessageRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

The receipt handle associated with the message to delete.

+ */ + inline const Aws::String& GetReceiptHandle() const{ return m_receiptHandle; } + inline bool ReceiptHandleHasBeenSet() const { return m_receiptHandleHasBeenSet; } + inline void SetReceiptHandle(const Aws::String& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = value; } + inline void SetReceiptHandle(Aws::String&& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = std::move(value); } + inline void SetReceiptHandle(const char* value) { m_receiptHandleHasBeenSet = true; m_receiptHandle.assign(value); } + inline DeleteMessageRequest& WithReceiptHandle(const Aws::String& value) { SetReceiptHandle(value); return *this;} + inline DeleteMessageRequest& WithReceiptHandle(Aws::String&& value) { SetReceiptHandle(std::move(value)); return *this;} + inline DeleteMessageRequest& WithReceiptHandle(const char* value) { SetReceiptHandle(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::String m_receiptHandle; + bool m_receiptHandleHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/DeleteQueueRequest.h b/include/aws/sqs/model/DeleteQueueRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..b6185e4a4b3def2ad1b72403b7951f04d722c1a6 --- /dev/null +++ b/include/aws/sqs/model/DeleteQueueRequest.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class DeleteQueueRequest : public SQSRequest + { + public: + AWS_SQS_API DeleteQueueRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "DeleteQueue"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue to delete.

Queue URLs and names are + * case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline DeleteQueueRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline DeleteQueueRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline DeleteQueueRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/GetQueueAttributesRequest.h b/include/aws/sqs/model/GetQueueAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..f4fe94950e476c31344e89fa98fc6409ca9bfbe0 --- /dev/null +++ b/include/aws/sqs/model/GetQueueAttributesRequest.h @@ -0,0 +1,213 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class GetQueueAttributesRequest : public SQSRequest + { + public: + AWS_SQS_API GetQueueAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetQueueAttributes"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue whose attribute information is retrieved.

+ *

Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline GetQueueAttributesRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline GetQueueAttributesRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline GetQueueAttributesRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

A list of attributes for which to retrieve information.

The + * AttributeNames parameter is optional, but if you don't specify + * values for this parameter, the request returns empty results.

In + * the future, new attributes might be added. If you write code that calls this + * action, we recommend that you structure your code so that it can handle new + * attributes gracefully.

The following attributes are + * supported:

The + * ApproximateNumberOfMessagesDelayed, + * ApproximateNumberOfMessagesNotVisible, and + * ApproximateNumberOfMessages metrics may not achieve consistency + * until at least 1 minute after the producers stop sending messages. This period + * is required for the queue metadata to reach eventual consistency.

+ *
  • All – Returns all values.

  • + *
  • ApproximateNumberOfMessages – Returns the approximate + * number of messages available for retrieval from the queue.

  • + * ApproximateNumberOfMessagesDelayed – Returns the approximate number + * of messages in the queue that are delayed and not available for reading + * immediately. This can happen when the queue is configured as a delay queue or + * when a message has been sent with a delay parameter.

  • + * ApproximateNumberOfMessagesNotVisible – Returns the approximate + * number of messages that are in flight. Messages are considered to be in + * flight if they have been sent to a client but have not yet been deleted or + * have not yet reached the end of their visibility window.

  • + * CreatedTimestamp – Returns the time when the queue was created in + * seconds (epoch time).

    + *
  • DelaySeconds – Returns the default delay on the + * queue in seconds.

  • LastModifiedTimestamp – + * Returns the time when the queue was last changed in seconds (epoch time).

  • + *

    MaximumMessageSize – Returns the limit of how many bytes a + * message can contain before Amazon SQS rejects it.

  • + * MessageRetentionPeriod – Returns the length of time, in seconds, + * for which Amazon SQS retains a message. When you change a queue's attributes, + * the change can take up to 60 seconds for most of the attributes to propagate + * throughout the Amazon SQS system. Changes made to the + * MessageRetentionPeriod attribute can take up to 15 minutes and will + * impact existing messages in the queue potentially causing them to be expired and + * deleted if the MessageRetentionPeriod is reduced below the age of + * existing messages.

  • Policy – Returns the policy + * of the queue.

  • QueueArn – Returns the Amazon + * resource name (ARN) of the queue.

  • + * ReceiveMessageWaitTimeSeconds – Returns the length of time, in + * seconds, for which the ReceiveMessage action waits for a message to + * arrive.

  • VisibilityTimeout – Returns the + * visibility timeout for the queue. For more information about the visibility + * timeout, see Visibility + * Timeout in the Amazon SQS Developer Guide.

The + * following attributes apply only to dead-letter + * queues:

  • RedrivePolicy – The string that + * includes the parameters for the dead-letter queue functionality of the source + * queue as a JSON object. The parameters are as follows:

    • + * deadLetterTargetArn – The Amazon Resource Name (ARN) of the + * dead-letter queue to which Amazon SQS moves messages after the value of + * maxReceiveCount is exceeded.

    • + * maxReceiveCount – The number of times a message is delivered to the + * source queue before being moved to the dead-letter queue. Default: 10. When the + * ReceiveCount for a message exceeds the maxReceiveCount + * for a queue, Amazon SQS moves the message to the dead-letter-queue.

    • + *
  • RedriveAllowPolicy – The string that includes + * the parameters for the permissions for the dead-letter queue redrive permission + * and which source queues can specify dead-letter queues as a JSON object. The + * parameters are as follows:

    • redrivePermission – + * The permission type that defines which source queues can specify the current + * queue as the dead-letter queue. Valid values are:

      • + * allowAll – (Default) Any source queues in this Amazon Web Services + * account in the same Region can specify this queue as the dead-letter queue.

        + *
      • denyAll – No source queues can specify this queue as + * the dead-letter queue.

      • byQueue – Only queues + * specified by the sourceQueueArns parameter can specify this queue + * as the dead-letter queue.

    • + * sourceQueueArns – The Amazon Resource Names (ARN)s of the source + * queues that can specify this queue as the dead-letter queue and redrive + * messages. You can specify this parameter only when the + * redrivePermission parameter is set to byQueue. You can + * specify up to 10 source queue ARNs. To allow more than 10 source queues to + * specify dead-letter queues, set the redrivePermission parameter to + * allowAll.

The dead-letter + * queue of a FIFO queue must also be a FIFO queue. Similarly, the dead-letter + * queue of a standard queue must also be a standard queue.

The + * following attributes apply only to server-side-encryption:

+ *
  • KmsMasterKeyId – Returns the ID of an Amazon Web + * Services managed customer master key (CMK) for Amazon SQS or a custom CMK. For + * more information, see Key + * Terms.

  • KmsDataKeyReusePeriodSeconds – + * Returns the length of time, in seconds, for which Amazon SQS can reuse a data + * key to encrypt or decrypt messages before calling KMS again. For more + * information, see How + * Does the Data Key Reuse Period Work?.

  • + * SqsManagedSseEnabled – Returns information about whether the queue + * is using SSE-SQS encryption using SQS owned encryption keys. Only one + * server-side encryption option is supported per queue (for example, SSE-KMS + * or SSE-SQS).

    + *

The following attributes apply only to FIFO + * (first-in-first-out) queues:

  • FifoQueue – + * Returns information about whether the queue is FIFO. For more information, see + * FIFO + * queue logic in the Amazon SQS Developer Guide.

    To + * determine whether a queue is FIFO, + * you can check whether QueueName ends with the .fifo + * suffix.

  • ContentBasedDeduplication – + * Returns whether content-based deduplication is enabled for the queue. For more + * information, see Exactly-once + * processing in the Amazon SQS Developer Guide.

The + * following attributes apply only to high + * throughput for FIFO queues:

  • + * DeduplicationScope – Specifies whether message deduplication occurs + * at the message group or queue level. Valid values are messageGroup + * and queue.

  • FifoThroughputLimit – + * Specifies whether the FIFO queue throughput quota applies to the entire queue or + * per message group. Valid values are perQueue and + * perMessageGroupId. The perMessageGroupId value is + * allowed only when the value for DeduplicationScope is + * messageGroup.

To enable high throughput for FIFO + * queues, do the following:

  • Set DeduplicationScope + * to messageGroup.

  • Set + * FifoThroughputLimit to perMessageGroupId.

  • + *

If you set these attributes to anything other than the values shown for + * enabling high throughput, normal throughput is in effect and deduplication + * occurs as specified.

For information on throughput quotas, see Quotas + * related to messages in the Amazon SQS Developer Guide.

+ */ + inline const Aws::Vector& GetAttributeNames() const{ return m_attributeNames; } + inline bool AttributeNamesHasBeenSet() const { return m_attributeNamesHasBeenSet; } + inline void SetAttributeNames(const Aws::Vector& value) { m_attributeNamesHasBeenSet = true; m_attributeNames = value; } + inline void SetAttributeNames(Aws::Vector&& value) { m_attributeNamesHasBeenSet = true; m_attributeNames = std::move(value); } + inline GetQueueAttributesRequest& WithAttributeNames(const Aws::Vector& value) { SetAttributeNames(value); return *this;} + inline GetQueueAttributesRequest& WithAttributeNames(Aws::Vector&& value) { SetAttributeNames(std::move(value)); return *this;} + inline GetQueueAttributesRequest& AddAttributeNames(const QueueAttributeName& value) { m_attributeNamesHasBeenSet = true; m_attributeNames.push_back(value); return *this; } + inline GetQueueAttributesRequest& AddAttributeNames(QueueAttributeName&& value) { m_attributeNamesHasBeenSet = true; m_attributeNames.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Vector m_attributeNames; + bool m_attributeNamesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/GetQueueAttributesResult.h b/include/aws/sqs/model/GetQueueAttributesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0eb0c0fb6cf16b6353a1253fb29a96bccae6ddf4 --- /dev/null +++ b/include/aws/sqs/model/GetQueueAttributesResult.h @@ -0,0 +1,90 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

A list of returned queue attributes.

See Also:

AWS + * API Reference

+ */ + class GetQueueAttributesResult + { + public: + AWS_SQS_API GetQueueAttributesResult(); + AWS_SQS_API GetQueueAttributesResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API GetQueueAttributesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A map of attributes to their respective values.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline void SetAttributes(const Aws::Map& value) { m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributes = std::move(value); } + inline GetQueueAttributesResult& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline GetQueueAttributesResult& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline GetQueueAttributesResult& AddAttributes(const QueueAttributeName& key, const Aws::String& value) { m_attributes.emplace(key, value); return *this; } + inline GetQueueAttributesResult& AddAttributes(QueueAttributeName&& key, const Aws::String& value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetQueueAttributesResult& AddAttributes(const QueueAttributeName& key, Aws::String&& value) { m_attributes.emplace(key, std::move(value)); return *this; } + inline GetQueueAttributesResult& AddAttributes(QueueAttributeName&& key, Aws::String&& value) { m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline GetQueueAttributesResult& AddAttributes(QueueAttributeName&& key, const char* value) { m_attributes.emplace(std::move(key), value); return *this; } + inline GetQueueAttributesResult& AddAttributes(const QueueAttributeName& key, const char* value) { m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetQueueAttributesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetQueueAttributesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetQueueAttributesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetQueueAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetQueueAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Map m_attributes; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/GetQueueUrlRequest.h b/include/aws/sqs/model/GetQueueUrlRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a6a12879a03056bf1de63f9ddb336ff8c0406fdf --- /dev/null +++ b/include/aws/sqs/model/GetQueueUrlRequest.h @@ -0,0 +1,83 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

Retrieves the URL of an existing queue based on its name and, optionally, the + * Amazon Web Services account ID.

See Also:

AWS + * API Reference

+ */ + class GetQueueUrlRequest : public SQSRequest + { + public: + AWS_SQS_API GetQueueUrlRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "GetQueueUrl"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

(Required) The name of the queue for which you want to fetch the URL. The + * name can be up to 80 characters long and can include alphanumeric characters, + * hyphens (-), and underscores (_). Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueName() const{ return m_queueName; } + inline bool QueueNameHasBeenSet() const { return m_queueNameHasBeenSet; } + inline void SetQueueName(const Aws::String& value) { m_queueNameHasBeenSet = true; m_queueName = value; } + inline void SetQueueName(Aws::String&& value) { m_queueNameHasBeenSet = true; m_queueName = std::move(value); } + inline void SetQueueName(const char* value) { m_queueNameHasBeenSet = true; m_queueName.assign(value); } + inline GetQueueUrlRequest& WithQueueName(const Aws::String& value) { SetQueueName(value); return *this;} + inline GetQueueUrlRequest& WithQueueName(Aws::String&& value) { SetQueueName(std::move(value)); return *this;} + inline GetQueueUrlRequest& WithQueueName(const char* value) { SetQueueName(value); return *this;} + ///@} + + ///@{ + /** + *

(Optional) The Amazon Web Services account ID of the account that created the + * queue. This is only required when you are attempting to access a queue owned by + * another Amazon Web Services account.

+ */ + inline const Aws::String& GetQueueOwnerAWSAccountId() const{ return m_queueOwnerAWSAccountId; } + inline bool QueueOwnerAWSAccountIdHasBeenSet() const { return m_queueOwnerAWSAccountIdHasBeenSet; } + inline void SetQueueOwnerAWSAccountId(const Aws::String& value) { m_queueOwnerAWSAccountIdHasBeenSet = true; m_queueOwnerAWSAccountId = value; } + inline void SetQueueOwnerAWSAccountId(Aws::String&& value) { m_queueOwnerAWSAccountIdHasBeenSet = true; m_queueOwnerAWSAccountId = std::move(value); } + inline void SetQueueOwnerAWSAccountId(const char* value) { m_queueOwnerAWSAccountIdHasBeenSet = true; m_queueOwnerAWSAccountId.assign(value); } + inline GetQueueUrlRequest& WithQueueOwnerAWSAccountId(const Aws::String& value) { SetQueueOwnerAWSAccountId(value); return *this;} + inline GetQueueUrlRequest& WithQueueOwnerAWSAccountId(Aws::String&& value) { SetQueueOwnerAWSAccountId(std::move(value)); return *this;} + inline GetQueueUrlRequest& WithQueueOwnerAWSAccountId(const char* value) { SetQueueOwnerAWSAccountId(value); return *this;} + ///@} + private: + + Aws::String m_queueName; + bool m_queueNameHasBeenSet = false; + + Aws::String m_queueOwnerAWSAccountId; + bool m_queueOwnerAWSAccountIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/GetQueueUrlResult.h b/include/aws/sqs/model/GetQueueUrlResult.h new file mode 100644 index 0000000000000000000000000000000000000000..06b7b125d90f631dd57b99c82fd8e5c02b032c4e --- /dev/null +++ b/include/aws/sqs/model/GetQueueUrlResult.h @@ -0,0 +1,87 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

For more information, see Interpreting + * Responses in the Amazon SQS Developer Guide.

See Also:

+ * AWS + * API Reference

+ */ + class GetQueueUrlResult + { + public: + AWS_SQS_API GetQueueUrlResult(); + AWS_SQS_API GetQueueUrlResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API GetQueueUrlResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The URL of the queue.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrl.assign(value); } + inline GetQueueUrlResult& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline GetQueueUrlResult& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline GetQueueUrlResult& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline GetQueueUrlResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline GetQueueUrlResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline GetQueueUrlResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline GetQueueUrlResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline GetQueueUrlResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListDeadLetterSourceQueuesRequest.h b/include/aws/sqs/model/ListDeadLetterSourceQueuesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..a3293bf35320e86e4cadc4d4b41e96a52a3b1ae3 --- /dev/null +++ b/include/aws/sqs/model/ListDeadLetterSourceQueuesRequest.h @@ -0,0 +1,94 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class ListDeadLetterSourceQueuesRequest : public SQSRequest + { + public: + AWS_SQS_API ListDeadLetterSourceQueuesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListDeadLetterSourceQueues"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of a dead-letter queue.

Queue URLs and names are + * case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline ListDeadLetterSourceQueuesRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline ListDeadLetterSourceQueuesRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline ListDeadLetterSourceQueuesRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

Pagination token to request the next set of results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListDeadLetterSourceQueuesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListDeadLetterSourceQueuesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListDeadLetterSourceQueuesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

Maximum number of results to include in the response. Value range is 1 to + * 1000. You must set MaxResults to receive a value for + * NextToken in the response.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline ListDeadLetterSourceQueuesRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListDeadLetterSourceQueuesResult.h b/include/aws/sqs/model/ListDeadLetterSourceQueuesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..ddf500c774a2c9ade9b7a1fdeadcbde0982df15c --- /dev/null +++ b/include/aws/sqs/model/ListDeadLetterSourceQueuesResult.h @@ -0,0 +1,104 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

A list of your dead letter source queues.

See Also:

AWS + * API Reference

+ */ + class ListDeadLetterSourceQueuesResult + { + public: + AWS_SQS_API ListDeadLetterSourceQueuesResult(); + AWS_SQS_API ListDeadLetterSourceQueuesResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API ListDeadLetterSourceQueuesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of source queue URLs that have the RedrivePolicy queue + * attribute configured with a dead-letter queue.

+ */ + inline const Aws::Vector& GetQueueUrls() const{ return m_queueUrls; } + inline void SetQueueUrls(const Aws::Vector& value) { m_queueUrls = value; } + inline void SetQueueUrls(Aws::Vector&& value) { m_queueUrls = std::move(value); } + inline ListDeadLetterSourceQueuesResult& WithQueueUrls(const Aws::Vector& value) { SetQueueUrls(value); return *this;} + inline ListDeadLetterSourceQueuesResult& WithQueueUrls(Aws::Vector&& value) { SetQueueUrls(std::move(value)); return *this;} + inline ListDeadLetterSourceQueuesResult& AddQueueUrls(const Aws::String& value) { m_queueUrls.push_back(value); return *this; } + inline ListDeadLetterSourceQueuesResult& AddQueueUrls(Aws::String&& value) { m_queueUrls.push_back(std::move(value)); return *this; } + inline ListDeadLetterSourceQueuesResult& AddQueueUrls(const char* value) { m_queueUrls.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Pagination token to include in the next request. Token value is + * null if there are no additional results to request, or if you did + * not set MaxResults in the request.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListDeadLetterSourceQueuesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListDeadLetterSourceQueuesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListDeadLetterSourceQueuesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListDeadLetterSourceQueuesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListDeadLetterSourceQueuesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListDeadLetterSourceQueuesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListDeadLetterSourceQueuesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListDeadLetterSourceQueuesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_queueUrls; + + Aws::String m_nextToken; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListMessageMoveTasksRequest.h b/include/aws/sqs/model/ListMessageMoveTasksRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..fbd48995d78af8171626f135520b6783effe0aab --- /dev/null +++ b/include/aws/sqs/model/ListMessageMoveTasksRequest.h @@ -0,0 +1,72 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + */ + class ListMessageMoveTasksRequest : public SQSRequest + { + public: + AWS_SQS_API ListMessageMoveTasksRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListMessageMoveTasks"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The ARN of the queue whose message movement tasks are to be listed.

+ */ + inline const Aws::String& GetSourceArn() const{ return m_sourceArn; } + inline bool SourceArnHasBeenSet() const { return m_sourceArnHasBeenSet; } + inline void SetSourceArn(const Aws::String& value) { m_sourceArnHasBeenSet = true; m_sourceArn = value; } + inline void SetSourceArn(Aws::String&& value) { m_sourceArnHasBeenSet = true; m_sourceArn = std::move(value); } + inline void SetSourceArn(const char* value) { m_sourceArnHasBeenSet = true; m_sourceArn.assign(value); } + inline ListMessageMoveTasksRequest& WithSourceArn(const Aws::String& value) { SetSourceArn(value); return *this;} + inline ListMessageMoveTasksRequest& WithSourceArn(Aws::String&& value) { SetSourceArn(std::move(value)); return *this;} + inline ListMessageMoveTasksRequest& WithSourceArn(const char* value) { SetSourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The maximum number of results to include in the response. The default is 1, + * which provides the most recent message movement task. The upper limit is 10.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline ListMessageMoveTasksRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + private: + + Aws::String m_sourceArn; + bool m_sourceArnHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListMessageMoveTasksResult.h b/include/aws/sqs/model/ListMessageMoveTasksResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0275ff411ebf8a926f439132d030b75141cef37c --- /dev/null +++ b/include/aws/sqs/model/ListMessageMoveTasksResult.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + class ListMessageMoveTasksResult + { + public: + AWS_SQS_API ListMessageMoveTasksResult(); + AWS_SQS_API ListMessageMoveTasksResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API ListMessageMoveTasksResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of message movement tasks and their attributes.

+ */ + inline const Aws::Vector& GetResults() const{ return m_results; } + inline void SetResults(const Aws::Vector& value) { m_results = value; } + inline void SetResults(Aws::Vector&& value) { m_results = std::move(value); } + inline ListMessageMoveTasksResult& WithResults(const Aws::Vector& value) { SetResults(value); return *this;} + inline ListMessageMoveTasksResult& WithResults(Aws::Vector&& value) { SetResults(std::move(value)); return *this;} + inline ListMessageMoveTasksResult& AddResults(const ListMessageMoveTasksResultEntry& value) { m_results.push_back(value); return *this; } + inline ListMessageMoveTasksResult& AddResults(ListMessageMoveTasksResultEntry&& value) { m_results.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListMessageMoveTasksResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListMessageMoveTasksResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListMessageMoveTasksResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListMessageMoveTasksResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListMessageMoveTasksResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_results; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListMessageMoveTasksResultEntry.h b/include/aws/sqs/model/ListMessageMoveTasksResultEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..23348910e0a349e99de0130ec9c2ac9fb9d0c922 --- /dev/null +++ b/include/aws/sqs/model/ListMessageMoveTasksResultEntry.h @@ -0,0 +1,195 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Contains the details of a message movement task.

See Also:

+ * AWS + * API Reference

+ */ + class ListMessageMoveTasksResultEntry + { + public: + AWS_SQS_API ListMessageMoveTasksResultEntry(); + AWS_SQS_API ListMessageMoveTasksResultEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API ListMessageMoveTasksResultEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

An identifier associated with a message movement task. When this field is + * returned in the response of the ListMessageMoveTasks action, it is + * only populated for tasks that are in RUNNING status.

+ */ + inline const Aws::String& GetTaskHandle() const{ return m_taskHandle; } + inline bool TaskHandleHasBeenSet() const { return m_taskHandleHasBeenSet; } + inline void SetTaskHandle(const Aws::String& value) { m_taskHandleHasBeenSet = true; m_taskHandle = value; } + inline void SetTaskHandle(Aws::String&& value) { m_taskHandleHasBeenSet = true; m_taskHandle = std::move(value); } + inline void SetTaskHandle(const char* value) { m_taskHandleHasBeenSet = true; m_taskHandle.assign(value); } + inline ListMessageMoveTasksResultEntry& WithTaskHandle(const Aws::String& value) { SetTaskHandle(value); return *this;} + inline ListMessageMoveTasksResultEntry& WithTaskHandle(Aws::String&& value) { SetTaskHandle(std::move(value)); return *this;} + inline ListMessageMoveTasksResultEntry& WithTaskHandle(const char* value) { SetTaskHandle(value); return *this;} + ///@} + + ///@{ + /** + *

The status of the message movement task. Possible values are: RUNNING, + * COMPLETED, CANCELLING, CANCELLED, and FAILED.

+ */ + inline const Aws::String& GetStatus() const{ return m_status; } + inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } + inline void SetStatus(const Aws::String& value) { m_statusHasBeenSet = true; m_status = value; } + inline void SetStatus(Aws::String&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } + inline void SetStatus(const char* value) { m_statusHasBeenSet = true; m_status.assign(value); } + inline ListMessageMoveTasksResultEntry& WithStatus(const Aws::String& value) { SetStatus(value); return *this;} + inline ListMessageMoveTasksResultEntry& WithStatus(Aws::String&& value) { SetStatus(std::move(value)); return *this;} + inline ListMessageMoveTasksResultEntry& WithStatus(const char* value) { SetStatus(value); return *this;} + ///@} + + ///@{ + /** + *

The ARN of the queue that contains the messages to be moved to another + * queue.

+ */ + inline const Aws::String& GetSourceArn() const{ return m_sourceArn; } + inline bool SourceArnHasBeenSet() const { return m_sourceArnHasBeenSet; } + inline void SetSourceArn(const Aws::String& value) { m_sourceArnHasBeenSet = true; m_sourceArn = value; } + inline void SetSourceArn(Aws::String&& value) { m_sourceArnHasBeenSet = true; m_sourceArn = std::move(value); } + inline void SetSourceArn(const char* value) { m_sourceArnHasBeenSet = true; m_sourceArn.assign(value); } + inline ListMessageMoveTasksResultEntry& WithSourceArn(const Aws::String& value) { SetSourceArn(value); return *this;} + inline ListMessageMoveTasksResultEntry& WithSourceArn(Aws::String&& value) { SetSourceArn(std::move(value)); return *this;} + inline ListMessageMoveTasksResultEntry& WithSourceArn(const char* value) { SetSourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The ARN of the destination queue if it has been specified in the + * StartMessageMoveTask request. If a DestinationArn has + * not been specified in the StartMessageMoveTask request, this field + * value will be NULL.

+ */ + inline const Aws::String& GetDestinationArn() const{ return m_destinationArn; } + inline bool DestinationArnHasBeenSet() const { return m_destinationArnHasBeenSet; } + inline void SetDestinationArn(const Aws::String& value) { m_destinationArnHasBeenSet = true; m_destinationArn = value; } + inline void SetDestinationArn(Aws::String&& value) { m_destinationArnHasBeenSet = true; m_destinationArn = std::move(value); } + inline void SetDestinationArn(const char* value) { m_destinationArnHasBeenSet = true; m_destinationArn.assign(value); } + inline ListMessageMoveTasksResultEntry& WithDestinationArn(const Aws::String& value) { SetDestinationArn(value); return *this;} + inline ListMessageMoveTasksResultEntry& WithDestinationArn(Aws::String&& value) { SetDestinationArn(std::move(value)); return *this;} + inline ListMessageMoveTasksResultEntry& WithDestinationArn(const char* value) { SetDestinationArn(value); return *this;} + ///@} + + ///@{ + /** + *

The number of messages to be moved per second (the message movement rate), if + * it has been specified in the StartMessageMoveTask request. If a + * MaxNumberOfMessagesPerSecond has not been specified in the + * StartMessageMoveTask request, this field value will be NULL.

+ */ + inline int GetMaxNumberOfMessagesPerSecond() const{ return m_maxNumberOfMessagesPerSecond; } + inline bool MaxNumberOfMessagesPerSecondHasBeenSet() const { return m_maxNumberOfMessagesPerSecondHasBeenSet; } + inline void SetMaxNumberOfMessagesPerSecond(int value) { m_maxNumberOfMessagesPerSecondHasBeenSet = true; m_maxNumberOfMessagesPerSecond = value; } + inline ListMessageMoveTasksResultEntry& WithMaxNumberOfMessagesPerSecond(int value) { SetMaxNumberOfMessagesPerSecond(value); return *this;} + ///@} + + ///@{ + /** + *

The approximate number of messages already moved to the destination + * queue.

+ */ + inline long long GetApproximateNumberOfMessagesMoved() const{ return m_approximateNumberOfMessagesMoved; } + inline bool ApproximateNumberOfMessagesMovedHasBeenSet() const { return m_approximateNumberOfMessagesMovedHasBeenSet; } + inline void SetApproximateNumberOfMessagesMoved(long long value) { m_approximateNumberOfMessagesMovedHasBeenSet = true; m_approximateNumberOfMessagesMoved = value; } + inline ListMessageMoveTasksResultEntry& WithApproximateNumberOfMessagesMoved(long long value) { SetApproximateNumberOfMessagesMoved(value); return *this;} + ///@} + + ///@{ + /** + *

The number of messages to be moved from the source queue. This number is + * obtained at the time of starting the message movement task and is only included + * after the message movement task is selected to start.

+ */ + inline long long GetApproximateNumberOfMessagesToMove() const{ return m_approximateNumberOfMessagesToMove; } + inline bool ApproximateNumberOfMessagesToMoveHasBeenSet() const { return m_approximateNumberOfMessagesToMoveHasBeenSet; } + inline void SetApproximateNumberOfMessagesToMove(long long value) { m_approximateNumberOfMessagesToMoveHasBeenSet = true; m_approximateNumberOfMessagesToMove = value; } + inline ListMessageMoveTasksResultEntry& WithApproximateNumberOfMessagesToMove(long long value) { SetApproximateNumberOfMessagesToMove(value); return *this;} + ///@} + + ///@{ + /** + *

The task failure reason (only included if the task status is FAILED).

+ */ + inline const Aws::String& GetFailureReason() const{ return m_failureReason; } + inline bool FailureReasonHasBeenSet() const { return m_failureReasonHasBeenSet; } + inline void SetFailureReason(const Aws::String& value) { m_failureReasonHasBeenSet = true; m_failureReason = value; } + inline void SetFailureReason(Aws::String&& value) { m_failureReasonHasBeenSet = true; m_failureReason = std::move(value); } + inline void SetFailureReason(const char* value) { m_failureReasonHasBeenSet = true; m_failureReason.assign(value); } + inline ListMessageMoveTasksResultEntry& WithFailureReason(const Aws::String& value) { SetFailureReason(value); return *this;} + inline ListMessageMoveTasksResultEntry& WithFailureReason(Aws::String&& value) { SetFailureReason(std::move(value)); return *this;} + inline ListMessageMoveTasksResultEntry& WithFailureReason(const char* value) { SetFailureReason(value); return *this;} + ///@} + + ///@{ + /** + *

The timestamp of starting the message movement task.

+ */ + inline long long GetStartedTimestamp() const{ return m_startedTimestamp; } + inline bool StartedTimestampHasBeenSet() const { return m_startedTimestampHasBeenSet; } + inline void SetStartedTimestamp(long long value) { m_startedTimestampHasBeenSet = true; m_startedTimestamp = value; } + inline ListMessageMoveTasksResultEntry& WithStartedTimestamp(long long value) { SetStartedTimestamp(value); return *this;} + ///@} + private: + + Aws::String m_taskHandle; + bool m_taskHandleHasBeenSet = false; + + Aws::String m_status; + bool m_statusHasBeenSet = false; + + Aws::String m_sourceArn; + bool m_sourceArnHasBeenSet = false; + + Aws::String m_destinationArn; + bool m_destinationArnHasBeenSet = false; + + int m_maxNumberOfMessagesPerSecond; + bool m_maxNumberOfMessagesPerSecondHasBeenSet = false; + + long long m_approximateNumberOfMessagesMoved; + bool m_approximateNumberOfMessagesMovedHasBeenSet = false; + + long long m_approximateNumberOfMessagesToMove; + bool m_approximateNumberOfMessagesToMoveHasBeenSet = false; + + Aws::String m_failureReason; + bool m_failureReasonHasBeenSet = false; + + long long m_startedTimestamp; + bool m_startedTimestampHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListQueueTagsRequest.h b/include/aws/sqs/model/ListQueueTagsRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..3c9bf3c1868f1c28906a82229cbaddd16aa46645 --- /dev/null +++ b/include/aws/sqs/model/ListQueueTagsRequest.h @@ -0,0 +1,58 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + */ + class ListQueueTagsRequest : public SQSRequest + { + public: + AWS_SQS_API ListQueueTagsRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListQueueTags"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the queue.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline ListQueueTagsRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline ListQueueTagsRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline ListQueueTagsRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListQueueTagsResult.h b/include/aws/sqs/model/ListQueueTagsResult.h new file mode 100644 index 0000000000000000000000000000000000000000..bb9657684e89adb6955a7b7e384ad93e21f201a0 --- /dev/null +++ b/include/aws/sqs/model/ListQueueTagsResult.h @@ -0,0 +1,85 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + class ListQueueTagsResult + { + public: + AWS_SQS_API ListQueueTagsResult(); + AWS_SQS_API ListQueueTagsResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API ListQueueTagsResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

The list of all tags added to the specified queue.

+ */ + inline const Aws::Map& GetTags() const{ return m_tags; } + inline void SetTags(const Aws::Map& value) { m_tags = value; } + inline void SetTags(Aws::Map&& value) { m_tags = std::move(value); } + inline ListQueueTagsResult& WithTags(const Aws::Map& value) { SetTags(value); return *this;} + inline ListQueueTagsResult& WithTags(Aws::Map&& value) { SetTags(std::move(value)); return *this;} + inline ListQueueTagsResult& AddTags(const Aws::String& key, const Aws::String& value) { m_tags.emplace(key, value); return *this; } + inline ListQueueTagsResult& AddTags(Aws::String&& key, const Aws::String& value) { m_tags.emplace(std::move(key), value); return *this; } + inline ListQueueTagsResult& AddTags(const Aws::String& key, Aws::String&& value) { m_tags.emplace(key, std::move(value)); return *this; } + inline ListQueueTagsResult& AddTags(Aws::String&& key, Aws::String&& value) { m_tags.emplace(std::move(key), std::move(value)); return *this; } + inline ListQueueTagsResult& AddTags(const char* key, Aws::String&& value) { m_tags.emplace(key, std::move(value)); return *this; } + inline ListQueueTagsResult& AddTags(Aws::String&& key, const char* value) { m_tags.emplace(std::move(key), value); return *this; } + inline ListQueueTagsResult& AddTags(const char* key, const char* value) { m_tags.emplace(key, value); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListQueueTagsResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListQueueTagsResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListQueueTagsResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListQueueTagsResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListQueueTagsResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Map m_tags; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListQueuesRequest.h b/include/aws/sqs/model/ListQueuesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..104e3e4369211a21f0c4abe92f5166f61aefc9c6 --- /dev/null +++ b/include/aws/sqs/model/ListQueuesRequest.h @@ -0,0 +1,95 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class ListQueuesRequest : public SQSRequest + { + public: + AWS_SQS_API ListQueuesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ListQueues"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

A string to use for filtering the list results. Only those queues whose name + * begins with the specified string are returned.

Queue URLs and names are + * case-sensitive.

+ */ + inline const Aws::String& GetQueueNamePrefix() const{ return m_queueNamePrefix; } + inline bool QueueNamePrefixHasBeenSet() const { return m_queueNamePrefixHasBeenSet; } + inline void SetQueueNamePrefix(const Aws::String& value) { m_queueNamePrefixHasBeenSet = true; m_queueNamePrefix = value; } + inline void SetQueueNamePrefix(Aws::String&& value) { m_queueNamePrefixHasBeenSet = true; m_queueNamePrefix = std::move(value); } + inline void SetQueueNamePrefix(const char* value) { m_queueNamePrefixHasBeenSet = true; m_queueNamePrefix.assign(value); } + inline ListQueuesRequest& WithQueueNamePrefix(const Aws::String& value) { SetQueueNamePrefix(value); return *this;} + inline ListQueuesRequest& WithQueueNamePrefix(Aws::String&& value) { SetQueueNamePrefix(std::move(value)); return *this;} + inline ListQueuesRequest& WithQueueNamePrefix(const char* value) { SetQueueNamePrefix(value); return *this;} + ///@} + + ///@{ + /** + *

Pagination token to request the next set of results.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } + inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } + inline ListQueuesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListQueuesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListQueuesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + /** + *

Maximum number of results to include in the response. Value range is 1 to + * 1000. You must set MaxResults to receive a value for + * NextToken in the response.

+ */ + inline int GetMaxResults() const{ return m_maxResults; } + inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } + inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } + inline ListQueuesRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} + ///@} + private: + + Aws::String m_queueNamePrefix; + bool m_queueNamePrefixHasBeenSet = false; + + Aws::String m_nextToken; + bool m_nextTokenHasBeenSet = false; + + int m_maxResults; + bool m_maxResultsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ListQueuesResult.h b/include/aws/sqs/model/ListQueuesResult.h new file mode 100644 index 0000000000000000000000000000000000000000..0b0be9fe7c94a1fb839eacf3886456bbd38cb95f --- /dev/null +++ b/include/aws/sqs/model/ListQueuesResult.h @@ -0,0 +1,104 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

A list of your queues.

See Also:

AWS + * API Reference

+ */ + class ListQueuesResult + { + public: + AWS_SQS_API ListQueuesResult(); + AWS_SQS_API ListQueuesResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API ListQueuesResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of queue URLs, up to 1,000 entries, or the value of + * MaxResults that you sent in the request.

+ */ + inline const Aws::Vector& GetQueueUrls() const{ return m_queueUrls; } + inline void SetQueueUrls(const Aws::Vector& value) { m_queueUrls = value; } + inline void SetQueueUrls(Aws::Vector&& value) { m_queueUrls = std::move(value); } + inline ListQueuesResult& WithQueueUrls(const Aws::Vector& value) { SetQueueUrls(value); return *this;} + inline ListQueuesResult& WithQueueUrls(Aws::Vector&& value) { SetQueueUrls(std::move(value)); return *this;} + inline ListQueuesResult& AddQueueUrls(const Aws::String& value) { m_queueUrls.push_back(value); return *this; } + inline ListQueuesResult& AddQueueUrls(Aws::String&& value) { m_queueUrls.push_back(std::move(value)); return *this; } + inline ListQueuesResult& AddQueueUrls(const char* value) { m_queueUrls.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Pagination token to include in the next request. Token value is + * null if there are no additional results to request, or if you did + * not set MaxResults in the request.

+ */ + inline const Aws::String& GetNextToken() const{ return m_nextToken; } + inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } + inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } + inline void SetNextToken(const char* value) { m_nextToken.assign(value); } + inline ListQueuesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} + inline ListQueuesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} + inline ListQueuesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ListQueuesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ListQueuesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ListQueuesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ListQueuesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ListQueuesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_queueUrls; + + Aws::String m_nextToken; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/Message.h b/include/aws/sqs/model/Message.h new file mode 100644 index 0000000000000000000000000000000000000000..1dca116d90763485f3f60f03015cbe7fdb526585 --- /dev/null +++ b/include/aws/sqs/model/Message.h @@ -0,0 +1,195 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

An Amazon SQS message.

See Also:

AWS API + * Reference

+ */ + class Message + { + public: + AWS_SQS_API Message(); + AWS_SQS_API Message(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Message& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

A unique identifier for the message. A MessageIdis considered + * unique across all Amazon Web Services accounts for an extended period of + * time.

+ */ + inline const Aws::String& GetMessageId() const{ return m_messageId; } + inline bool MessageIdHasBeenSet() const { return m_messageIdHasBeenSet; } + inline void SetMessageId(const Aws::String& value) { m_messageIdHasBeenSet = true; m_messageId = value; } + inline void SetMessageId(Aws::String&& value) { m_messageIdHasBeenSet = true; m_messageId = std::move(value); } + inline void SetMessageId(const char* value) { m_messageIdHasBeenSet = true; m_messageId.assign(value); } + inline Message& WithMessageId(const Aws::String& value) { SetMessageId(value); return *this;} + inline Message& WithMessageId(Aws::String&& value) { SetMessageId(std::move(value)); return *this;} + inline Message& WithMessageId(const char* value) { SetMessageId(value); return *this;} + ///@} + + ///@{ + /** + *

An identifier associated with the act of receiving the message. A new receipt + * handle is returned every time you receive a message. When deleting a message, + * you provide the last received receipt handle to delete the message.

+ */ + inline const Aws::String& GetReceiptHandle() const{ return m_receiptHandle; } + inline bool ReceiptHandleHasBeenSet() const { return m_receiptHandleHasBeenSet; } + inline void SetReceiptHandle(const Aws::String& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = value; } + inline void SetReceiptHandle(Aws::String&& value) { m_receiptHandleHasBeenSet = true; m_receiptHandle = std::move(value); } + inline void SetReceiptHandle(const char* value) { m_receiptHandleHasBeenSet = true; m_receiptHandle.assign(value); } + inline Message& WithReceiptHandle(const Aws::String& value) { SetReceiptHandle(value); return *this;} + inline Message& WithReceiptHandle(Aws::String&& value) { SetReceiptHandle(std::move(value)); return *this;} + inline Message& WithReceiptHandle(const char* value) { SetReceiptHandle(value); return *this;} + ///@} + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message body string.

+ */ + inline const Aws::String& GetMD5OfBody() const{ return m_mD5OfBody; } + inline bool MD5OfBodyHasBeenSet() const { return m_mD5OfBodyHasBeenSet; } + inline void SetMD5OfBody(const Aws::String& value) { m_mD5OfBodyHasBeenSet = true; m_mD5OfBody = value; } + inline void SetMD5OfBody(Aws::String&& value) { m_mD5OfBodyHasBeenSet = true; m_mD5OfBody = std::move(value); } + inline void SetMD5OfBody(const char* value) { m_mD5OfBodyHasBeenSet = true; m_mD5OfBody.assign(value); } + inline Message& WithMD5OfBody(const Aws::String& value) { SetMD5OfBody(value); return *this;} + inline Message& WithMD5OfBody(Aws::String&& value) { SetMD5OfBody(std::move(value)); return *this;} + inline Message& WithMD5OfBody(const char* value) { SetMD5OfBody(value); return *this;} + ///@} + + ///@{ + /** + *

The message's contents (not URL-encoded).

+ */ + inline const Aws::String& GetBody() const{ return m_body; } + inline bool BodyHasBeenSet() const { return m_bodyHasBeenSet; } + inline void SetBody(const Aws::String& value) { m_bodyHasBeenSet = true; m_body = value; } + inline void SetBody(Aws::String&& value) { m_bodyHasBeenSet = true; m_body = std::move(value); } + inline void SetBody(const char* value) { m_bodyHasBeenSet = true; m_body.assign(value); } + inline Message& WithBody(const Aws::String& value) { SetBody(value); return *this;} + inline Message& WithBody(Aws::String&& value) { SetBody(std::move(value)); return *this;} + inline Message& WithBody(const char* value) { SetBody(value); return *this;} + ///@} + + ///@{ + /** + *

A map of the attributes requested in ReceiveMessage to + * their respective values. Supported attributes:

  • + * ApproximateReceiveCount

  • + * ApproximateFirstReceiveTimestamp

  • + * MessageDeduplicationId

  • + * MessageGroupId

  • SenderId

  • + *
  • SentTimestamp

  • + * SequenceNumber

+ * ApproximateFirstReceiveTimestamp and SentTimestamp are + * each returned as an integer representing the epoch time in + * milliseconds.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline Message& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline Message& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline Message& AddAttributes(const MessageSystemAttributeName& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline Message& AddAttributes(MessageSystemAttributeName&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline Message& AddAttributes(const MessageSystemAttributeName& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline Message& AddAttributes(MessageSystemAttributeName&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline Message& AddAttributes(MessageSystemAttributeName&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline Message& AddAttributes(const MessageSystemAttributeName& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message attribute string. You can use + * this attribute to verify that Amazon SQS received the message correctly. Amazon + * SQS URL-decodes the message before creating the MD5 digest. For information + * about MD5, see RFC1321.

+ */ + inline const Aws::String& GetMD5OfMessageAttributes() const{ return m_mD5OfMessageAttributes; } + inline bool MD5OfMessageAttributesHasBeenSet() const { return m_mD5OfMessageAttributesHasBeenSet; } + inline void SetMD5OfMessageAttributes(const Aws::String& value) { m_mD5OfMessageAttributesHasBeenSet = true; m_mD5OfMessageAttributes = value; } + inline void SetMD5OfMessageAttributes(Aws::String&& value) { m_mD5OfMessageAttributesHasBeenSet = true; m_mD5OfMessageAttributes = std::move(value); } + inline void SetMD5OfMessageAttributes(const char* value) { m_mD5OfMessageAttributesHasBeenSet = true; m_mD5OfMessageAttributes.assign(value); } + inline Message& WithMD5OfMessageAttributes(const Aws::String& value) { SetMD5OfMessageAttributes(value); return *this;} + inline Message& WithMD5OfMessageAttributes(Aws::String&& value) { SetMD5OfMessageAttributes(std::move(value)); return *this;} + inline Message& WithMD5OfMessageAttributes(const char* value) { SetMD5OfMessageAttributes(value); return *this;} + ///@} + + ///@{ + /** + *

Each message attribute consists of a Name, Type, + * and Value. For more information, see Amazon + * SQS message attributes in the Amazon SQS Developer Guide.

+ */ + inline const Aws::Map& GetMessageAttributes() const{ return m_messageAttributes; } + inline bool MessageAttributesHasBeenSet() const { return m_messageAttributesHasBeenSet; } + inline void SetMessageAttributes(const Aws::Map& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = value; } + inline void SetMessageAttributes(Aws::Map&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = std::move(value); } + inline Message& WithMessageAttributes(const Aws::Map& value) { SetMessageAttributes(value); return *this;} + inline Message& WithMessageAttributes(Aws::Map&& value) { SetMessageAttributes(std::move(value)); return *this;} + inline Message& AddMessageAttributes(const Aws::String& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + inline Message& AddMessageAttributes(Aws::String&& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), value); return *this; } + inline Message& AddMessageAttributes(const Aws::String& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline Message& AddMessageAttributes(Aws::String&& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), std::move(value)); return *this; } + inline Message& AddMessageAttributes(const char* key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline Message& AddMessageAttributes(const char* key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_messageId; + bool m_messageIdHasBeenSet = false; + + Aws::String m_receiptHandle; + bool m_receiptHandleHasBeenSet = false; + + Aws::String m_mD5OfBody; + bool m_mD5OfBodyHasBeenSet = false; + + Aws::String m_body; + bool m_bodyHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + + Aws::String m_mD5OfMessageAttributes; + bool m_mD5OfMessageAttributesHasBeenSet = false; + + Aws::Map m_messageAttributes; + bool m_messageAttributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/MessageAttributeValue.h b/include/aws/sqs/model/MessageAttributeValue.h new file mode 100644 index 0000000000000000000000000000000000000000..ae8150f7c5933781afe7a05d4f546e9025277d6a --- /dev/null +++ b/include/aws/sqs/model/MessageAttributeValue.h @@ -0,0 +1,146 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

The user-specified message attribute value. For string data types, the + * Value attribute has the same restrictions on the content as the + * message body. For more information, see SendMessage.

+ *

Name, type, value and the message + * body must not be empty or null. All parts of the message attribute, including + * Name, Type, and Value, are part of the + * message size restriction (256 KiB or 262,144 bytes).

See Also:

+ * AWS + * API Reference

+ */ + class MessageAttributeValue + { + public: + AWS_SQS_API MessageAttributeValue(); + AWS_SQS_API MessageAttributeValue(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API MessageAttributeValue& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Strings are Unicode with UTF-8 binary encoding. For a list of code values, + * see ASCII + * Printable Characters.

+ */ + inline const Aws::String& GetStringValue() const{ return m_stringValue; } + inline bool StringValueHasBeenSet() const { return m_stringValueHasBeenSet; } + inline void SetStringValue(const Aws::String& value) { m_stringValueHasBeenSet = true; m_stringValue = value; } + inline void SetStringValue(Aws::String&& value) { m_stringValueHasBeenSet = true; m_stringValue = std::move(value); } + inline void SetStringValue(const char* value) { m_stringValueHasBeenSet = true; m_stringValue.assign(value); } + inline MessageAttributeValue& WithStringValue(const Aws::String& value) { SetStringValue(value); return *this;} + inline MessageAttributeValue& WithStringValue(Aws::String&& value) { SetStringValue(std::move(value)); return *this;} + inline MessageAttributeValue& WithStringValue(const char* value) { SetStringValue(value); return *this;} + ///@} + + ///@{ + /** + *

Binary type attributes can store any binary data, such as compressed data, + * encrypted data, or images.

+ */ + inline const Aws::Utils::ByteBuffer& GetBinaryValue() const{ return m_binaryValue; } + inline bool BinaryValueHasBeenSet() const { return m_binaryValueHasBeenSet; } + inline void SetBinaryValue(const Aws::Utils::ByteBuffer& value) { m_binaryValueHasBeenSet = true; m_binaryValue = value; } + inline void SetBinaryValue(Aws::Utils::ByteBuffer&& value) { m_binaryValueHasBeenSet = true; m_binaryValue = std::move(value); } + inline MessageAttributeValue& WithBinaryValue(const Aws::Utils::ByteBuffer& value) { SetBinaryValue(value); return *this;} + inline MessageAttributeValue& WithBinaryValue(Aws::Utils::ByteBuffer&& value) { SetBinaryValue(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Not implemented. Reserved for future use.

+ */ + inline const Aws::Vector& GetStringListValues() const{ return m_stringListValues; } + inline bool StringListValuesHasBeenSet() const { return m_stringListValuesHasBeenSet; } + inline void SetStringListValues(const Aws::Vector& value) { m_stringListValuesHasBeenSet = true; m_stringListValues = value; } + inline void SetStringListValues(Aws::Vector&& value) { m_stringListValuesHasBeenSet = true; m_stringListValues = std::move(value); } + inline MessageAttributeValue& WithStringListValues(const Aws::Vector& value) { SetStringListValues(value); return *this;} + inline MessageAttributeValue& WithStringListValues(Aws::Vector&& value) { SetStringListValues(std::move(value)); return *this;} + inline MessageAttributeValue& AddStringListValues(const Aws::String& value) { m_stringListValuesHasBeenSet = true; m_stringListValues.push_back(value); return *this; } + inline MessageAttributeValue& AddStringListValues(Aws::String&& value) { m_stringListValuesHasBeenSet = true; m_stringListValues.push_back(std::move(value)); return *this; } + inline MessageAttributeValue& AddStringListValues(const char* value) { m_stringListValuesHasBeenSet = true; m_stringListValues.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Not implemented. Reserved for future use.

+ */ + inline const Aws::Vector& GetBinaryListValues() const{ return m_binaryListValues; } + inline bool BinaryListValuesHasBeenSet() const { return m_binaryListValuesHasBeenSet; } + inline void SetBinaryListValues(const Aws::Vector& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues = value; } + inline void SetBinaryListValues(Aws::Vector&& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues = std::move(value); } + inline MessageAttributeValue& WithBinaryListValues(const Aws::Vector& value) { SetBinaryListValues(value); return *this;} + inline MessageAttributeValue& WithBinaryListValues(Aws::Vector&& value) { SetBinaryListValues(std::move(value)); return *this;} + inline MessageAttributeValue& AddBinaryListValues(const Aws::Utils::ByteBuffer& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues.push_back(value); return *this; } + inline MessageAttributeValue& AddBinaryListValues(Aws::Utils::ByteBuffer&& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Amazon SQS supports the following logical data types: String, + * Number, and Binary. For the Number data + * type, you must use StringValue.

You can also append custom + * labels. For more information, see Amazon + * SQS Message Attributes in the Amazon SQS Developer Guide.

+ */ + inline const Aws::String& GetDataType() const{ return m_dataType; } + inline bool DataTypeHasBeenSet() const { return m_dataTypeHasBeenSet; } + inline void SetDataType(const Aws::String& value) { m_dataTypeHasBeenSet = true; m_dataType = value; } + inline void SetDataType(Aws::String&& value) { m_dataTypeHasBeenSet = true; m_dataType = std::move(value); } + inline void SetDataType(const char* value) { m_dataTypeHasBeenSet = true; m_dataType.assign(value); } + inline MessageAttributeValue& WithDataType(const Aws::String& value) { SetDataType(value); return *this;} + inline MessageAttributeValue& WithDataType(Aws::String&& value) { SetDataType(std::move(value)); return *this;} + inline MessageAttributeValue& WithDataType(const char* value) { SetDataType(value); return *this;} + ///@} + private: + + Aws::String m_stringValue; + bool m_stringValueHasBeenSet = false; + + Aws::Utils::ByteBuffer m_binaryValue; + bool m_binaryValueHasBeenSet = false; + + Aws::Vector m_stringListValues; + bool m_stringListValuesHasBeenSet = false; + + Aws::Vector m_binaryListValues; + bool m_binaryListValuesHasBeenSet = false; + + Aws::String m_dataType; + bool m_dataTypeHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/MessageSystemAttributeName.h b/include/aws/sqs/model/MessageSystemAttributeName.h new file mode 100644 index 0000000000000000000000000000000000000000..a4185c929dd2be6500552a6c13e9592c0fde1ec0 --- /dev/null +++ b/include/aws/sqs/model/MessageSystemAttributeName.h @@ -0,0 +1,39 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + enum class MessageSystemAttributeName + { + NOT_SET, + All, + SenderId, + SentTimestamp, + ApproximateReceiveCount, + ApproximateFirstReceiveTimestamp, + SequenceNumber, + MessageDeduplicationId, + MessageGroupId, + AWSTraceHeader, + DeadLetterQueueSourceArn + }; + +namespace MessageSystemAttributeNameMapper +{ +AWS_SQS_API MessageSystemAttributeName GetMessageSystemAttributeNameForName(const Aws::String& name); + +AWS_SQS_API Aws::String GetNameForMessageSystemAttributeName(MessageSystemAttributeName value); +} // namespace MessageSystemAttributeNameMapper +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/MessageSystemAttributeNameForSends.h b/include/aws/sqs/model/MessageSystemAttributeNameForSends.h new file mode 100644 index 0000000000000000000000000000000000000000..b576db5bf28f71b412aa84688d183d246c41c382 --- /dev/null +++ b/include/aws/sqs/model/MessageSystemAttributeNameForSends.h @@ -0,0 +1,30 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + enum class MessageSystemAttributeNameForSends + { + NOT_SET, + AWSTraceHeader + }; + +namespace MessageSystemAttributeNameForSendsMapper +{ +AWS_SQS_API MessageSystemAttributeNameForSends GetMessageSystemAttributeNameForSendsForName(const Aws::String& name); + +AWS_SQS_API Aws::String GetNameForMessageSystemAttributeNameForSends(MessageSystemAttributeNameForSends value); +} // namespace MessageSystemAttributeNameForSendsMapper +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/MessageSystemAttributeValue.h b/include/aws/sqs/model/MessageSystemAttributeValue.h new file mode 100644 index 0000000000000000000000000000000000000000..cd431fc377b394388b5da4318103483ec8c355e1 --- /dev/null +++ b/include/aws/sqs/model/MessageSystemAttributeValue.h @@ -0,0 +1,143 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

The user-specified message system attribute value. For string data types, the + * Value attribute has the same restrictions on the content as the + * message body. For more information, see SendMessage.

+ *

Name, type, value and the message + * body must not be empty or null.

See Also:

AWS + * API Reference

+ */ + class MessageSystemAttributeValue + { + public: + AWS_SQS_API MessageSystemAttributeValue(); + AWS_SQS_API MessageSystemAttributeValue(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API MessageSystemAttributeValue& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

Strings are Unicode with UTF-8 binary encoding. For a list of code values, + * see ASCII + * Printable Characters.

+ */ + inline const Aws::String& GetStringValue() const{ return m_stringValue; } + inline bool StringValueHasBeenSet() const { return m_stringValueHasBeenSet; } + inline void SetStringValue(const Aws::String& value) { m_stringValueHasBeenSet = true; m_stringValue = value; } + inline void SetStringValue(Aws::String&& value) { m_stringValueHasBeenSet = true; m_stringValue = std::move(value); } + inline void SetStringValue(const char* value) { m_stringValueHasBeenSet = true; m_stringValue.assign(value); } + inline MessageSystemAttributeValue& WithStringValue(const Aws::String& value) { SetStringValue(value); return *this;} + inline MessageSystemAttributeValue& WithStringValue(Aws::String&& value) { SetStringValue(std::move(value)); return *this;} + inline MessageSystemAttributeValue& WithStringValue(const char* value) { SetStringValue(value); return *this;} + ///@} + + ///@{ + /** + *

Binary type attributes can store any binary data, such as compressed data, + * encrypted data, or images.

+ */ + inline const Aws::Utils::ByteBuffer& GetBinaryValue() const{ return m_binaryValue; } + inline bool BinaryValueHasBeenSet() const { return m_binaryValueHasBeenSet; } + inline void SetBinaryValue(const Aws::Utils::ByteBuffer& value) { m_binaryValueHasBeenSet = true; m_binaryValue = value; } + inline void SetBinaryValue(Aws::Utils::ByteBuffer&& value) { m_binaryValueHasBeenSet = true; m_binaryValue = std::move(value); } + inline MessageSystemAttributeValue& WithBinaryValue(const Aws::Utils::ByteBuffer& value) { SetBinaryValue(value); return *this;} + inline MessageSystemAttributeValue& WithBinaryValue(Aws::Utils::ByteBuffer&& value) { SetBinaryValue(std::move(value)); return *this;} + ///@} + + ///@{ + /** + *

Not implemented. Reserved for future use.

+ */ + inline const Aws::Vector& GetStringListValues() const{ return m_stringListValues; } + inline bool StringListValuesHasBeenSet() const { return m_stringListValuesHasBeenSet; } + inline void SetStringListValues(const Aws::Vector& value) { m_stringListValuesHasBeenSet = true; m_stringListValues = value; } + inline void SetStringListValues(Aws::Vector&& value) { m_stringListValuesHasBeenSet = true; m_stringListValues = std::move(value); } + inline MessageSystemAttributeValue& WithStringListValues(const Aws::Vector& value) { SetStringListValues(value); return *this;} + inline MessageSystemAttributeValue& WithStringListValues(Aws::Vector&& value) { SetStringListValues(std::move(value)); return *this;} + inline MessageSystemAttributeValue& AddStringListValues(const Aws::String& value) { m_stringListValuesHasBeenSet = true; m_stringListValues.push_back(value); return *this; } + inline MessageSystemAttributeValue& AddStringListValues(Aws::String&& value) { m_stringListValuesHasBeenSet = true; m_stringListValues.push_back(std::move(value)); return *this; } + inline MessageSystemAttributeValue& AddStringListValues(const char* value) { m_stringListValuesHasBeenSet = true; m_stringListValues.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

Not implemented. Reserved for future use.

+ */ + inline const Aws::Vector& GetBinaryListValues() const{ return m_binaryListValues; } + inline bool BinaryListValuesHasBeenSet() const { return m_binaryListValuesHasBeenSet; } + inline void SetBinaryListValues(const Aws::Vector& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues = value; } + inline void SetBinaryListValues(Aws::Vector&& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues = std::move(value); } + inline MessageSystemAttributeValue& WithBinaryListValues(const Aws::Vector& value) { SetBinaryListValues(value); return *this;} + inline MessageSystemAttributeValue& WithBinaryListValues(Aws::Vector&& value) { SetBinaryListValues(std::move(value)); return *this;} + inline MessageSystemAttributeValue& AddBinaryListValues(const Aws::Utils::ByteBuffer& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues.push_back(value); return *this; } + inline MessageSystemAttributeValue& AddBinaryListValues(Aws::Utils::ByteBuffer&& value) { m_binaryListValuesHasBeenSet = true; m_binaryListValues.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

Amazon SQS supports the following logical data types: String, + * Number, and Binary. For the Number data + * type, you must use StringValue.

You can also append custom + * labels. For more information, see Amazon + * SQS Message Attributes in the Amazon SQS Developer Guide.

+ */ + inline const Aws::String& GetDataType() const{ return m_dataType; } + inline bool DataTypeHasBeenSet() const { return m_dataTypeHasBeenSet; } + inline void SetDataType(const Aws::String& value) { m_dataTypeHasBeenSet = true; m_dataType = value; } + inline void SetDataType(Aws::String&& value) { m_dataTypeHasBeenSet = true; m_dataType = std::move(value); } + inline void SetDataType(const char* value) { m_dataTypeHasBeenSet = true; m_dataType.assign(value); } + inline MessageSystemAttributeValue& WithDataType(const Aws::String& value) { SetDataType(value); return *this;} + inline MessageSystemAttributeValue& WithDataType(Aws::String&& value) { SetDataType(std::move(value)); return *this;} + inline MessageSystemAttributeValue& WithDataType(const char* value) { SetDataType(value); return *this;} + ///@} + private: + + Aws::String m_stringValue; + bool m_stringValueHasBeenSet = false; + + Aws::Utils::ByteBuffer m_binaryValue; + bool m_binaryValueHasBeenSet = false; + + Aws::Vector m_stringListValues; + bool m_stringListValuesHasBeenSet = false; + + Aws::Vector m_binaryListValues; + bool m_binaryListValuesHasBeenSet = false; + + Aws::String m_dataType; + bool m_dataTypeHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/PurgeQueueRequest.h b/include/aws/sqs/model/PurgeQueueRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..0a8a7671f2ef003a21fce80707327aa3b7d477c8 --- /dev/null +++ b/include/aws/sqs/model/PurgeQueueRequest.h @@ -0,0 +1,62 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class PurgeQueueRequest : public SQSRequest + { + public: + AWS_SQS_API PurgeQueueRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "PurgeQueue"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the queue from which the PurgeQueue action deletes + * messages.

Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline PurgeQueueRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline PurgeQueueRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline PurgeQueueRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/QueueAttributeName.h b/include/aws/sqs/model/QueueAttributeName.h new file mode 100644 index 0000000000000000000000000000000000000000..235e3c728786a51ab75b8daf9e9fcdcc3c10adfa --- /dev/null +++ b/include/aws/sqs/model/QueueAttributeName.h @@ -0,0 +1,55 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + enum class QueueAttributeName + { + NOT_SET, + All, + Policy, + VisibilityTimeout, + MaximumMessageSize, + MessageRetentionPeriod, + ApproximateNumberOfMessages, + ApproximateNumberOfMessagesNotVisible, + CreatedTimestamp, + LastModifiedTimestamp, + QueueArn, + ApproximateNumberOfMessagesDelayed, + DelaySeconds, + ReceiveMessageWaitTimeSeconds, + RedrivePolicy, + FifoQueue, + ContentBasedDeduplication, + KmsMasterKeyId, + KmsDataKeyReusePeriodSeconds, + DeduplicationScope, + FifoThroughputLimit, + RedriveAllowPolicy, + SqsManagedSseEnabled, + SentTimestamp, + ApproximateFirstReceiveTimestamp, + ApproximateReceiveCount, + SenderId + }; + +namespace QueueAttributeNameMapper +{ +AWS_SQS_API QueueAttributeName GetQueueAttributeNameForName(const Aws::String& name); + +AWS_SQS_API Aws::String GetNameForQueueAttributeName(QueueAttributeName value); +} // namespace QueueAttributeNameMapper +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ReceiveMessageRequest.h b/include/aws/sqs/model/ReceiveMessageRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..76665e998ff0783d52fb12573c0e753ccf74a224 --- /dev/null +++ b/include/aws/sqs/model/ReceiveMessageRequest.h @@ -0,0 +1,273 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

Retrieves one or more messages from a specified queue.

See + * Also:

AWS + * API Reference

+ */ + class ReceiveMessageRequest : public SQSRequest + { + public: + AWS_SQS_API ReceiveMessageRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "ReceiveMessage"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue from which messages are received.

+ *

Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline ReceiveMessageRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline ReceiveMessageRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline ReceiveMessageRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

A list of attributes that need to be returned along with each message. These + * attributes include:

  • All – Returns all values.

    + *
  • ApproximateFirstReceiveTimestamp – Returns the time + * the message was first received from the queue (epoch time in + * milliseconds).

  • ApproximateReceiveCount – Returns + * the number of times a message has been received across all queues but not + * deleted.

  • AWSTraceHeader – Returns the X-Ray + * trace header string.

  • SenderId

    • + *

      For a user, returns the user ID, for example + * ABCDEFGHI1JKLMNOPQ23R.

    • For an IAM role, returns + * the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456.

      + *
  • SentTimestamp – Returns the time the + * message was sent to the queue (epoch time in + * milliseconds).

  • SqsManagedSseEnabled – Enables + * server-side queue encryption using SQS owned encryption keys. Only one + * server-side encryption option is supported per queue (for example, SSE-KMS + * or SSE-SQS).

    + *
  • MessageDeduplicationId – Returns the value provided + * by the producer that calls the SendMessage action.

    + *
  • MessageGroupId – Returns the value provided by the + * producer that calls the SendMessage action. Messages with + * the same MessageGroupId are returned in sequence.

  • + *

    SequenceNumber – Returns the value provided by Amazon SQS.

    + *
+ */ + inline const Aws::Vector& GetMessageSystemAttributeNames() const{ return m_messageSystemAttributeNames; } + inline bool MessageSystemAttributeNamesHasBeenSet() const { return m_messageSystemAttributeNamesHasBeenSet; } + inline void SetMessageSystemAttributeNames(const Aws::Vector& value) { m_messageSystemAttributeNamesHasBeenSet = true; m_messageSystemAttributeNames = value; } + inline void SetMessageSystemAttributeNames(Aws::Vector&& value) { m_messageSystemAttributeNamesHasBeenSet = true; m_messageSystemAttributeNames = std::move(value); } + inline ReceiveMessageRequest& WithMessageSystemAttributeNames(const Aws::Vector& value) { SetMessageSystemAttributeNames(value); return *this;} + inline ReceiveMessageRequest& WithMessageSystemAttributeNames(Aws::Vector&& value) { SetMessageSystemAttributeNames(std::move(value)); return *this;} + inline ReceiveMessageRequest& AddMessageSystemAttributeNames(const MessageSystemAttributeName& value) { m_messageSystemAttributeNamesHasBeenSet = true; m_messageSystemAttributeNames.push_back(value); return *this; } + inline ReceiveMessageRequest& AddMessageSystemAttributeNames(MessageSystemAttributeName&& value) { m_messageSystemAttributeNamesHasBeenSet = true; m_messageSystemAttributeNames.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

The name of the message attribute, where N is the index.

  • + *

    The name can contain alphanumeric characters and the underscore + * (_), hyphen (-), and period (.).

    + *
  • The name is case-sensitive and must be unique among all attribute + * names for the message.

  • The name must not start with + * AWS-reserved prefixes such as AWS. or Amazon. (or any + * casing variants).

  • The name must not start or end with a period + * (.), and it should not have periods in succession + * (..).

  • The name can be up to 256 characters + * long.

When using ReceiveMessage, you can send a + * list of attribute names to receive, or you can return all of the attributes by + * specifying All or .* in your request. You can also use + * all message attributes starting with a prefix, for example + * bar.*.

+ */ + inline const Aws::Vector& GetMessageAttributeNames() const{ return m_messageAttributeNames; } + inline bool MessageAttributeNamesHasBeenSet() const { return m_messageAttributeNamesHasBeenSet; } + inline void SetMessageAttributeNames(const Aws::Vector& value) { m_messageAttributeNamesHasBeenSet = true; m_messageAttributeNames = value; } + inline void SetMessageAttributeNames(Aws::Vector&& value) { m_messageAttributeNamesHasBeenSet = true; m_messageAttributeNames = std::move(value); } + inline ReceiveMessageRequest& WithMessageAttributeNames(const Aws::Vector& value) { SetMessageAttributeNames(value); return *this;} + inline ReceiveMessageRequest& WithMessageAttributeNames(Aws::Vector&& value) { SetMessageAttributeNames(std::move(value)); return *this;} + inline ReceiveMessageRequest& AddMessageAttributeNames(const Aws::String& value) { m_messageAttributeNamesHasBeenSet = true; m_messageAttributeNames.push_back(value); return *this; } + inline ReceiveMessageRequest& AddMessageAttributeNames(Aws::String&& value) { m_messageAttributeNamesHasBeenSet = true; m_messageAttributeNames.push_back(std::move(value)); return *this; } + inline ReceiveMessageRequest& AddMessageAttributeNames(const char* value) { m_messageAttributeNamesHasBeenSet = true; m_messageAttributeNames.push_back(value); return *this; } + ///@} + + ///@{ + /** + *

The maximum number of messages to return. Amazon SQS never returns more + * messages than this value (however, fewer messages might be returned). Valid + * values: 1 to 10. Default: 1.

+ */ + inline int GetMaxNumberOfMessages() const{ return m_maxNumberOfMessages; } + inline bool MaxNumberOfMessagesHasBeenSet() const { return m_maxNumberOfMessagesHasBeenSet; } + inline void SetMaxNumberOfMessages(int value) { m_maxNumberOfMessagesHasBeenSet = true; m_maxNumberOfMessages = value; } + inline ReceiveMessageRequest& WithMaxNumberOfMessages(int value) { SetMaxNumberOfMessages(value); return *this;} + ///@} + + ///@{ + /** + *

The duration (in seconds) that the received messages are hidden from + * subsequent retrieve requests after being retrieved by a + * ReceiveMessage request. If not specified, the default visibility + * timeout for the queue is used, which is 30 seconds.

Understanding + * VisibilityTimeout:

  • When a message is received from + * a queue, it becomes temporarily invisible to other consumers for the duration of + * the visibility timeout. This prevents multiple consumers from processing the + * same message simultaneously. If the message is not deleted or its visibility + * timeout is not extended before the timeout expires, it becomes visible again and + * can be retrieved by other consumers.

  • Setting an appropriate + * visibility timeout is crucial. If it's too short, the message might become + * visible again before processing is complete, leading to duplicate processing. If + * it's too long, it delays the reprocessing of messages if the initial processing + * fails.

  • You can adjust the visibility timeout using the + * --visibility-timeout parameter in the receive-message + * command to match the processing time required by your application.

  • + *
  • A message that isn't deleted or a message whose visibility isn't + * extended before the visibility timeout expires counts as a failed receive. + * Depending on the configuration of the queue, the message might be sent to the + * dead-letter queue.

For more information, see Visibility + * Timeout in the Amazon SQS Developer Guide.

+ */ + inline int GetVisibilityTimeout() const{ return m_visibilityTimeout; } + inline bool VisibilityTimeoutHasBeenSet() const { return m_visibilityTimeoutHasBeenSet; } + inline void SetVisibilityTimeout(int value) { m_visibilityTimeoutHasBeenSet = true; m_visibilityTimeout = value; } + inline ReceiveMessageRequest& WithVisibilityTimeout(int value) { SetVisibilityTimeout(value); return *this;} + ///@} + + ///@{ + /** + *

The duration (in seconds) for which the call waits for a message to arrive in + * the queue before returning. If a message is available, the call returns sooner + * than WaitTimeSeconds. If no messages are available and the wait + * time expires, the call does not return a message list. If you are using the Java + * SDK, it returns a ReceiveMessageResponse object, which has a empty + * list instead of a Null object.

To avoid HTTP errors, ensure + * that the HTTP response timeout for ReceiveMessage requests is + * longer than the WaitTimeSeconds parameter. For example, with the + * Java SDK, you can set HTTP transport settings using the + * NettyNioAsyncHttpClient for asynchronous clients, or the + * ApacheHttpClient for synchronous clients.

+ */ + inline int GetWaitTimeSeconds() const{ return m_waitTimeSeconds; } + inline bool WaitTimeSecondsHasBeenSet() const { return m_waitTimeSecondsHasBeenSet; } + inline void SetWaitTimeSeconds(int value) { m_waitTimeSecondsHasBeenSet = true; m_waitTimeSeconds = value; } + inline ReceiveMessageRequest& WithWaitTimeSeconds(int value) { SetWaitTimeSeconds(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) queues.

The + * token used for deduplication of ReceiveMessage calls. If a + * networking issue occurs after a ReceiveMessage action, and instead + * of a response you receive a generic error, it is possible to retry the same + * action with an identical ReceiveRequestAttemptId to retrieve the + * same set of messages, even if their visibility timeout has not yet expired.

+ *
  • You can use ReceiveRequestAttemptId only for 5 minutes + * after a ReceiveMessage action.

  • When you set + * FifoQueue, a caller of the ReceiveMessage action can + * provide a ReceiveRequestAttemptId explicitly.

  • It + * is possible to retry the ReceiveMessage action with the same + * ReceiveRequestAttemptId if none of the messages have been modified + * (deleted or had their visibility changes).

  • During a visibility + * timeout, subsequent calls with the same ReceiveRequestAttemptId + * return the same messages and receipt handles. If a retry occurs within the + * deduplication interval, it resets the visibility timeout. For more information, + * see Visibility + * Timeout in the Amazon SQS Developer Guide.

    If a + * caller of the ReceiveMessage action still processes messages when + * the visibility timeout expires and messages become visible, another worker + * consuming from the same queue can receive the same messages and therefore + * process duplicates. Also, if a consumer whose message processing time is longer + * than the visibility timeout tries to delete the processed messages, the action + * fails with an error.

    To mitigate this effect, ensure that your + * application observes a safe threshold before the visibility timeout expires and + * extend the visibility timeout as necessary.

  • While + * messages with a particular MessageGroupId are invisible, no more + * messages belonging to the same MessageGroupId are returned until + * the visibility timeout expires. You can still receive messages with another + * MessageGroupId as long as it is also visible.

  • If + * a caller of ReceiveMessage can't track the + * ReceiveRequestAttemptId, no retries work until the original + * visibility timeout expires. As a result, delays might occur but the messages in + * the queue remain in a strict order.

The maximum length of + * ReceiveRequestAttemptId is 128 characters. + * ReceiveRequestAttemptId can contain alphanumeric characters + * (a-z, A-Z, 0-9) and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

For best + * practices of using ReceiveRequestAttemptId, see Using + * the ReceiveRequestAttemptId Request Parameter in the Amazon SQS Developer + * Guide.

+ */ + inline const Aws::String& GetReceiveRequestAttemptId() const{ return m_receiveRequestAttemptId; } + inline bool ReceiveRequestAttemptIdHasBeenSet() const { return m_receiveRequestAttemptIdHasBeenSet; } + inline void SetReceiveRequestAttemptId(const Aws::String& value) { m_receiveRequestAttemptIdHasBeenSet = true; m_receiveRequestAttemptId = value; } + inline void SetReceiveRequestAttemptId(Aws::String&& value) { m_receiveRequestAttemptIdHasBeenSet = true; m_receiveRequestAttemptId = std::move(value); } + inline void SetReceiveRequestAttemptId(const char* value) { m_receiveRequestAttemptIdHasBeenSet = true; m_receiveRequestAttemptId.assign(value); } + inline ReceiveMessageRequest& WithReceiveRequestAttemptId(const Aws::String& value) { SetReceiveRequestAttemptId(value); return *this;} + inline ReceiveMessageRequest& WithReceiveRequestAttemptId(Aws::String&& value) { SetReceiveRequestAttemptId(std::move(value)); return *this;} + inline ReceiveMessageRequest& WithReceiveRequestAttemptId(const char* value) { SetReceiveRequestAttemptId(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Vector m_messageSystemAttributeNames; + bool m_messageSystemAttributeNamesHasBeenSet = false; + + Aws::Vector m_messageAttributeNames; + bool m_messageAttributeNamesHasBeenSet = false; + + int m_maxNumberOfMessages; + bool m_maxNumberOfMessagesHasBeenSet = false; + + int m_visibilityTimeout; + bool m_visibilityTimeoutHasBeenSet = false; + + int m_waitTimeSeconds; + bool m_waitTimeSecondsHasBeenSet = false; + + Aws::String m_receiveRequestAttemptId; + bool m_receiveRequestAttemptIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ReceiveMessageResult.h b/include/aws/sqs/model/ReceiveMessageResult.h new file mode 100644 index 0000000000000000000000000000000000000000..33bab0436bbd01ae5d7a1dff4fe1bf8646429e7a --- /dev/null +++ b/include/aws/sqs/model/ReceiveMessageResult.h @@ -0,0 +1,86 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

A list of received messages.

See Also:

AWS + * API Reference

+ */ + class ReceiveMessageResult + { + public: + AWS_SQS_API ReceiveMessageResult(); + AWS_SQS_API ReceiveMessageResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API ReceiveMessageResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of messages.

+ */ + inline const Aws::Vector& GetMessages() const{ return m_messages; } + inline void SetMessages(const Aws::Vector& value) { m_messages = value; } + inline void SetMessages(Aws::Vector&& value) { m_messages = std::move(value); } + inline ReceiveMessageResult& WithMessages(const Aws::Vector& value) { SetMessages(value); return *this;} + inline ReceiveMessageResult& WithMessages(Aws::Vector&& value) { SetMessages(std::move(value)); return *this;} + inline ReceiveMessageResult& AddMessages(const Message& value) { m_messages.push_back(value); return *this; } + inline ReceiveMessageResult& AddMessages(Message&& value) { m_messages.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline ReceiveMessageResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ReceiveMessageResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ReceiveMessageResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline ReceiveMessageResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline ReceiveMessageResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_messages; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/RemovePermissionRequest.h b/include/aws/sqs/model/RemovePermissionRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..45636a384e9cb72040fec70bb085110692237d6d --- /dev/null +++ b/include/aws/sqs/model/RemovePermissionRequest.h @@ -0,0 +1,80 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class RemovePermissionRequest : public SQSRequest + { + public: + AWS_SQS_API RemovePermissionRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "RemovePermission"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue from which permissions are removed.

+ *

Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline RemovePermissionRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline RemovePermissionRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline RemovePermissionRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

The identification of the permission to remove. This is the label added using + * the AddPermission action.

+ */ + inline const Aws::String& GetLabel() const{ return m_label; } + inline bool LabelHasBeenSet() const { return m_labelHasBeenSet; } + inline void SetLabel(const Aws::String& value) { m_labelHasBeenSet = true; m_label = value; } + inline void SetLabel(Aws::String&& value) { m_labelHasBeenSet = true; m_label = std::move(value); } + inline void SetLabel(const char* value) { m_labelHasBeenSet = true; m_label.assign(value); } + inline RemovePermissionRequest& WithLabel(const Aws::String& value) { SetLabel(value); return *this;} + inline RemovePermissionRequest& WithLabel(Aws::String&& value) { SetLabel(std::move(value)); return *this;} + inline RemovePermissionRequest& WithLabel(const char* value) { SetLabel(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::String m_label; + bool m_labelHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/ResponseMetadata.h b/include/aws/sqs/model/ResponseMetadata.h new file mode 100644 index 0000000000000000000000000000000000000000..93f901ca4135bce7d9d06ed15da3e974cdf7589b --- /dev/null +++ b/include/aws/sqs/model/ResponseMetadata.h @@ -0,0 +1,54 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + class ResponseMetadata + { + public: + AWS_SQS_API ResponseMetadata(); + AWS_SQS_API ResponseMetadata(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API ResponseMetadata& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline bool RequestIdHasBeenSet() const { return m_requestIdHasBeenSet; } + inline void SetRequestId(const Aws::String& value) { m_requestIdHasBeenSet = true; m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestIdHasBeenSet = true; m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestIdHasBeenSet = true; m_requestId.assign(value); } + inline ResponseMetadata& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline ResponseMetadata& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline ResponseMetadata& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + private: + + Aws::String m_requestId; + bool m_requestIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/SendMessageBatchRequest.h b/include/aws/sqs/model/SendMessageBatchRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d86035fa3f0d2cff721df834edf0525b1c02d7d6 --- /dev/null +++ b/include/aws/sqs/model/SendMessageBatchRequest.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class SendMessageBatchRequest : public SQSRequest + { + public: + AWS_SQS_API SendMessageBatchRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SendMessageBatch"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue to which batched messages are sent.

+ *

Queue URLs and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline SendMessageBatchRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline SendMessageBatchRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline SendMessageBatchRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

A list of SendMessageBatchRequestEntry items.

+ */ + inline const Aws::Vector& GetEntries() const{ return m_entries; } + inline bool EntriesHasBeenSet() const { return m_entriesHasBeenSet; } + inline void SetEntries(const Aws::Vector& value) { m_entriesHasBeenSet = true; m_entries = value; } + inline void SetEntries(Aws::Vector&& value) { m_entriesHasBeenSet = true; m_entries = std::move(value); } + inline SendMessageBatchRequest& WithEntries(const Aws::Vector& value) { SetEntries(value); return *this;} + inline SendMessageBatchRequest& WithEntries(Aws::Vector&& value) { SetEntries(std::move(value)); return *this;} + inline SendMessageBatchRequest& AddEntries(const SendMessageBatchRequestEntry& value) { m_entriesHasBeenSet = true; m_entries.push_back(value); return *this; } + inline SendMessageBatchRequest& AddEntries(SendMessageBatchRequestEntry&& value) { m_entriesHasBeenSet = true; m_entries.push_back(std::move(value)); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Vector m_entries; + bool m_entriesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/SendMessageBatchRequestEntry.h b/include/aws/sqs/model/SendMessageBatchRequestEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..e278fe9fbc6d9c6ad3f2392e241e059a55a4ca59 --- /dev/null +++ b/include/aws/sqs/model/SendMessageBatchRequestEntry.h @@ -0,0 +1,250 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Contains the details of a single Amazon SQS message along with an + * Id.

See Also:

AWS + * API Reference

+ */ + class SendMessageBatchRequestEntry + { + public: + AWS_SQS_API SendMessageBatchRequestEntry(); + AWS_SQS_API SendMessageBatchRequestEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API SendMessageBatchRequestEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

An identifier for a message in this batch used to communicate the result.

+ *

The Ids of a batch request need to be unique within a + * request.

This identifier can have up to 80 characters. The following + * characters are accepted: alphanumeric characters, hyphens(-), and underscores + * (_).

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline SendMessageBatchRequestEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline SendMessageBatchRequestEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline SendMessageBatchRequestEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

The body of the message.

+ */ + inline const Aws::String& GetMessageBody() const{ return m_messageBody; } + inline bool MessageBodyHasBeenSet() const { return m_messageBodyHasBeenSet; } + inline void SetMessageBody(const Aws::String& value) { m_messageBodyHasBeenSet = true; m_messageBody = value; } + inline void SetMessageBody(Aws::String&& value) { m_messageBodyHasBeenSet = true; m_messageBody = std::move(value); } + inline void SetMessageBody(const char* value) { m_messageBodyHasBeenSet = true; m_messageBody.assign(value); } + inline SendMessageBatchRequestEntry& WithMessageBody(const Aws::String& value) { SetMessageBody(value); return *this;} + inline SendMessageBatchRequestEntry& WithMessageBody(Aws::String&& value) { SetMessageBody(std::move(value)); return *this;} + inline SendMessageBatchRequestEntry& WithMessageBody(const char* value) { SetMessageBody(value); return *this;} + ///@} + + ///@{ + /** + *

The length of time, in seconds, for which a specific message is delayed. + * Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive + * DelaySeconds value become available for processing after the delay + * period is finished. If you don't specify a value, the default value for the + * queue is applied.

When you set FifoQueue, you can't + * set DelaySeconds per message. You can set this parameter only on a + * queue level.

+ */ + inline int GetDelaySeconds() const{ return m_delaySeconds; } + inline bool DelaySecondsHasBeenSet() const { return m_delaySecondsHasBeenSet; } + inline void SetDelaySeconds(int value) { m_delaySecondsHasBeenSet = true; m_delaySeconds = value; } + inline SendMessageBatchRequestEntry& WithDelaySeconds(int value) { SetDelaySeconds(value); return *this;} + ///@} + + ///@{ + /** + *

Each message attribute consists of a Name, Type, + * and Value. For more information, see Amazon + * SQS message attributes in the Amazon SQS Developer Guide.

+ */ + inline const Aws::Map& GetMessageAttributes() const{ return m_messageAttributes; } + inline bool MessageAttributesHasBeenSet() const { return m_messageAttributesHasBeenSet; } + inline void SetMessageAttributes(const Aws::Map& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = value; } + inline void SetMessageAttributes(Aws::Map&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = std::move(value); } + inline SendMessageBatchRequestEntry& WithMessageAttributes(const Aws::Map& value) { SetMessageAttributes(value); return *this;} + inline SendMessageBatchRequestEntry& WithMessageAttributes(Aws::Map&& value) { SetMessageAttributes(std::move(value)); return *this;} + inline SendMessageBatchRequestEntry& AddMessageAttributes(const Aws::String& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + inline SendMessageBatchRequestEntry& AddMessageAttributes(Aws::String&& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), value); return *this; } + inline SendMessageBatchRequestEntry& AddMessageAttributes(const Aws::String& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline SendMessageBatchRequestEntry& AddMessageAttributes(Aws::String&& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), std::move(value)); return *this; } + inline SendMessageBatchRequestEntry& AddMessageAttributes(const char* key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline SendMessageBatchRequestEntry& AddMessageAttributes(const char* key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

The message system attribute to send Each message system attribute consists + * of a Name, Type, and Value.

+ *
  • Currently, the only supported message system attribute + * is AWSTraceHeader. Its type must be String and its + * value must be a correctly formatted X-Ray trace header string.

  • + *

    The size of a message system attribute doesn't count towards the total size + * of a message.

+ */ + inline const Aws::Map& GetMessageSystemAttributes() const{ return m_messageSystemAttributes; } + inline bool MessageSystemAttributesHasBeenSet() const { return m_messageSystemAttributesHasBeenSet; } + inline void SetMessageSystemAttributes(const Aws::Map& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes = value; } + inline void SetMessageSystemAttributes(Aws::Map&& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes = std::move(value); } + inline SendMessageBatchRequestEntry& WithMessageSystemAttributes(const Aws::Map& value) { SetMessageSystemAttributes(value); return *this;} + inline SendMessageBatchRequestEntry& WithMessageSystemAttributes(Aws::Map&& value) { SetMessageSystemAttributes(std::move(value)); return *this;} + inline SendMessageBatchRequestEntry& AddMessageSystemAttributes(const MessageSystemAttributeNameForSends& key, const MessageSystemAttributeValue& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(key, value); return *this; } + inline SendMessageBatchRequestEntry& AddMessageSystemAttributes(MessageSystemAttributeNameForSends&& key, const MessageSystemAttributeValue& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(std::move(key), value); return *this; } + inline SendMessageBatchRequestEntry& AddMessageSystemAttributes(const MessageSystemAttributeNameForSends& key, MessageSystemAttributeValue&& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(key, std::move(value)); return *this; } + inline SendMessageBatchRequestEntry& AddMessageSystemAttributes(MessageSystemAttributeNameForSends&& key, MessageSystemAttributeValue&& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(std::move(key), std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) queues.

The + * token used for deduplication of messages within a 5-minute minimum deduplication + * interval. If a message with a particular MessageDeduplicationId is + * sent successfully, subsequent messages with the same + * MessageDeduplicationId are accepted successfully but aren't + * delivered. For more information, see + * Exactly-once processing in the Amazon SQS Developer Guide.

    + *
  • Every message must have a unique + * MessageDeduplicationId,

    • You may provide a + * MessageDeduplicationId explicitly.

    • If you aren't + * able to provide a MessageDeduplicationId and you enable + * ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 + * hash to generate the MessageDeduplicationId using the body of the + * message (but not the attributes of the message).

    • If you don't + * provide a MessageDeduplicationId and the queue doesn't have + * ContentBasedDeduplication set, the action fails with an error.

      + *
    • If the queue has ContentBasedDeduplication set, your + * MessageDeduplicationId overrides the generated one.

    + *
  • When ContentBasedDeduplication is in effect, messages + * with identical content sent within the deduplication interval are treated as + * duplicates and only one copy of the message is delivered.

  • If + * you send one message with ContentBasedDeduplication enabled and + * then another message with a MessageDeduplicationId that is the same + * as the one generated for the first MessageDeduplicationId, the two + * messages are treated as duplicates and only one copy of the message is + * delivered.

The MessageDeduplicationId is + * available to the consumer of the message (this can be useful for troubleshooting + * delivery issues).

If a message is sent successfully but the + * acknowledgement is lost and the message is resent with the same + * MessageDeduplicationId after the deduplication interval, Amazon SQS + * can't detect duplicate messages.

Amazon SQS continues to keep track of + * the message deduplication ID even after the message is received and deleted.

+ *

The length of MessageDeduplicationId is 128 characters. + * MessageDeduplicationId can contain alphanumeric characters + * (a-z, A-Z, 0-9) and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

For best + * practices of using MessageDeduplicationId, see Using + * the MessageDeduplicationId Property in the Amazon SQS Developer + * Guide.

+ */ + inline const Aws::String& GetMessageDeduplicationId() const{ return m_messageDeduplicationId; } + inline bool MessageDeduplicationIdHasBeenSet() const { return m_messageDeduplicationIdHasBeenSet; } + inline void SetMessageDeduplicationId(const Aws::String& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = value; } + inline void SetMessageDeduplicationId(Aws::String&& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = std::move(value); } + inline void SetMessageDeduplicationId(const char* value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId.assign(value); } + inline SendMessageBatchRequestEntry& WithMessageDeduplicationId(const Aws::String& value) { SetMessageDeduplicationId(value); return *this;} + inline SendMessageBatchRequestEntry& WithMessageDeduplicationId(Aws::String&& value) { SetMessageDeduplicationId(std::move(value)); return *this;} + inline SendMessageBatchRequestEntry& WithMessageDeduplicationId(const char* value) { SetMessageDeduplicationId(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) queues.

The + * tag that specifies that a message belongs to a specific message group. Messages + * that belong to the same message group are processed in a FIFO manner (however, + * messages in different message groups might be processed out of order). To + * interleave multiple ordered streams within a single queue, use + * MessageGroupId values (for example, session data for multiple + * users). In this scenario, multiple consumers can process the queue, but the + * session data of each user is processed in a FIFO fashion.

  • You + * must associate a non-empty MessageGroupId with a message. If you + * don't provide a MessageGroupId, the action fails.

  • + *

    ReceiveMessage might return messages with multiple + * MessageGroupId values. For each MessageGroupId, the + * messages are sorted by time sent. The caller can't specify a + * MessageGroupId.

The length of + * MessageGroupId is 128 characters. Valid values: alphanumeric + * characters and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

For best + * practices of using MessageGroupId, see Using + * the MessageGroupId Property in the Amazon SQS Developer Guide.

+ *

MessageGroupId is required for FIFO queues. You + * can't use it for Standard queues.

+ */ + inline const Aws::String& GetMessageGroupId() const{ return m_messageGroupId; } + inline bool MessageGroupIdHasBeenSet() const { return m_messageGroupIdHasBeenSet; } + inline void SetMessageGroupId(const Aws::String& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = value; } + inline void SetMessageGroupId(Aws::String&& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = std::move(value); } + inline void SetMessageGroupId(const char* value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId.assign(value); } + inline SendMessageBatchRequestEntry& WithMessageGroupId(const Aws::String& value) { SetMessageGroupId(value); return *this;} + inline SendMessageBatchRequestEntry& WithMessageGroupId(Aws::String&& value) { SetMessageGroupId(std::move(value)); return *this;} + inline SendMessageBatchRequestEntry& WithMessageGroupId(const char* value) { SetMessageGroupId(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_messageBody; + bool m_messageBodyHasBeenSet = false; + + int m_delaySeconds; + bool m_delaySecondsHasBeenSet = false; + + Aws::Map m_messageAttributes; + bool m_messageAttributesHasBeenSet = false; + + Aws::Map m_messageSystemAttributes; + bool m_messageSystemAttributesHasBeenSet = false; + + Aws::String m_messageDeduplicationId; + bool m_messageDeduplicationIdHasBeenSet = false; + + Aws::String m_messageGroupId; + bool m_messageGroupIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/SendMessageBatchResult.h b/include/aws/sqs/model/SendMessageBatchResult.h new file mode 100644 index 0000000000000000000000000000000000000000..8d479abb0eb9a6a5594704cd3a07f5246bfc361e --- /dev/null +++ b/include/aws/sqs/model/SendMessageBatchResult.h @@ -0,0 +1,106 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

For each message in the batch, the response contains a + * SendMessageBatchResultEntry tag if the message succeeds or a + * BatchResultErrorEntry tag if the message + * fails.

See Also:

AWS + * API Reference

+ */ + class SendMessageBatchResult + { + public: + AWS_SQS_API SendMessageBatchResult(); + AWS_SQS_API SendMessageBatchResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API SendMessageBatchResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

A list of SendMessageBatchResultEntry items.

+ */ + inline const Aws::Vector& GetSuccessful() const{ return m_successful; } + inline void SetSuccessful(const Aws::Vector& value) { m_successful = value; } + inline void SetSuccessful(Aws::Vector&& value) { m_successful = std::move(value); } + inline SendMessageBatchResult& WithSuccessful(const Aws::Vector& value) { SetSuccessful(value); return *this;} + inline SendMessageBatchResult& WithSuccessful(Aws::Vector&& value) { SetSuccessful(std::move(value)); return *this;} + inline SendMessageBatchResult& AddSuccessful(const SendMessageBatchResultEntry& value) { m_successful.push_back(value); return *this; } + inline SendMessageBatchResult& AddSuccessful(SendMessageBatchResultEntry&& value) { m_successful.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

A list of BatchResultErrorEntry items with error + * details about each message that can't be enqueued.

+ */ + inline const Aws::Vector& GetFailed() const{ return m_failed; } + inline void SetFailed(const Aws::Vector& value) { m_failed = value; } + inline void SetFailed(Aws::Vector&& value) { m_failed = std::move(value); } + inline SendMessageBatchResult& WithFailed(const Aws::Vector& value) { SetFailed(value); return *this;} + inline SendMessageBatchResult& WithFailed(Aws::Vector&& value) { SetFailed(std::move(value)); return *this;} + inline SendMessageBatchResult& AddFailed(const BatchResultErrorEntry& value) { m_failed.push_back(value); return *this; } + inline SendMessageBatchResult& AddFailed(BatchResultErrorEntry&& value) { m_failed.push_back(std::move(value)); return *this; } + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline SendMessageBatchResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline SendMessageBatchResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline SendMessageBatchResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline SendMessageBatchResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline SendMessageBatchResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::Vector m_successful; + + Aws::Vector m_failed; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/SendMessageBatchResultEntry.h b/include/aws/sqs/model/SendMessageBatchResultEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..11a3f0915240de4b43408b368f811094e3019dd5 --- /dev/null +++ b/include/aws/sqs/model/SendMessageBatchResultEntry.h @@ -0,0 +1,161 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include + +namespace Aws +{ +namespace Utils +{ +namespace Json +{ + class JsonValue; + class JsonView; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + + /** + *

Encloses a MessageId for a successfully-enqueued message in a + * SendMessageBatch.

See Also:

AWS + * API Reference

+ */ + class SendMessageBatchResultEntry + { + public: + AWS_SQS_API SendMessageBatchResultEntry(); + AWS_SQS_API SendMessageBatchResultEntry(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API SendMessageBatchResultEntry& operator=(Aws::Utils::Json::JsonView jsonValue); + AWS_SQS_API Aws::Utils::Json::JsonValue Jsonize() const; + + + ///@{ + /** + *

An identifier for the message in this batch.

+ */ + inline const Aws::String& GetId() const{ return m_id; } + inline bool IdHasBeenSet() const { return m_idHasBeenSet; } + inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } + inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } + inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } + inline SendMessageBatchResultEntry& WithId(const Aws::String& value) { SetId(value); return *this;} + inline SendMessageBatchResultEntry& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} + inline SendMessageBatchResultEntry& WithId(const char* value) { SetId(value); return *this;} + ///@} + + ///@{ + /** + *

An identifier for the message.

+ */ + inline const Aws::String& GetMessageId() const{ return m_messageId; } + inline bool MessageIdHasBeenSet() const { return m_messageIdHasBeenSet; } + inline void SetMessageId(const Aws::String& value) { m_messageIdHasBeenSet = true; m_messageId = value; } + inline void SetMessageId(Aws::String&& value) { m_messageIdHasBeenSet = true; m_messageId = std::move(value); } + inline void SetMessageId(const char* value) { m_messageIdHasBeenSet = true; m_messageId.assign(value); } + inline SendMessageBatchResultEntry& WithMessageId(const Aws::String& value) { SetMessageId(value); return *this;} + inline SendMessageBatchResultEntry& WithMessageId(Aws::String&& value) { SetMessageId(std::move(value)); return *this;} + inline SendMessageBatchResultEntry& WithMessageId(const char* value) { SetMessageId(value); return *this;} + ///@} + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message body string. You can use this + * attribute to verify that Amazon SQS received the message correctly. Amazon SQS + * URL-decodes the message before creating the MD5 digest. For information about + * MD5, see RFC1321.

+ */ + inline const Aws::String& GetMD5OfMessageBody() const{ return m_mD5OfMessageBody; } + inline bool MD5OfMessageBodyHasBeenSet() const { return m_mD5OfMessageBodyHasBeenSet; } + inline void SetMD5OfMessageBody(const Aws::String& value) { m_mD5OfMessageBodyHasBeenSet = true; m_mD5OfMessageBody = value; } + inline void SetMD5OfMessageBody(Aws::String&& value) { m_mD5OfMessageBodyHasBeenSet = true; m_mD5OfMessageBody = std::move(value); } + inline void SetMD5OfMessageBody(const char* value) { m_mD5OfMessageBodyHasBeenSet = true; m_mD5OfMessageBody.assign(value); } + inline SendMessageBatchResultEntry& WithMD5OfMessageBody(const Aws::String& value) { SetMD5OfMessageBody(value); return *this;} + inline SendMessageBatchResultEntry& WithMD5OfMessageBody(Aws::String&& value) { SetMD5OfMessageBody(std::move(value)); return *this;} + inline SendMessageBatchResultEntry& WithMD5OfMessageBody(const char* value) { SetMD5OfMessageBody(value); return *this;} + ///@} + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message attribute string. You can use + * this attribute to verify that Amazon SQS received the message correctly. Amazon + * SQS URL-decodes the message before creating the MD5 digest. For information + * about MD5, see RFC1321.

+ */ + inline const Aws::String& GetMD5OfMessageAttributes() const{ return m_mD5OfMessageAttributes; } + inline bool MD5OfMessageAttributesHasBeenSet() const { return m_mD5OfMessageAttributesHasBeenSet; } + inline void SetMD5OfMessageAttributes(const Aws::String& value) { m_mD5OfMessageAttributesHasBeenSet = true; m_mD5OfMessageAttributes = value; } + inline void SetMD5OfMessageAttributes(Aws::String&& value) { m_mD5OfMessageAttributesHasBeenSet = true; m_mD5OfMessageAttributes = std::move(value); } + inline void SetMD5OfMessageAttributes(const char* value) { m_mD5OfMessageAttributesHasBeenSet = true; m_mD5OfMessageAttributes.assign(value); } + inline SendMessageBatchResultEntry& WithMD5OfMessageAttributes(const Aws::String& value) { SetMD5OfMessageAttributes(value); return *this;} + inline SendMessageBatchResultEntry& WithMD5OfMessageAttributes(Aws::String&& value) { SetMD5OfMessageAttributes(std::move(value)); return *this;} + inline SendMessageBatchResultEntry& WithMD5OfMessageAttributes(const char* value) { SetMD5OfMessageAttributes(value); return *this;} + ///@} + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message system attribute string. You can + * use this attribute to verify that Amazon SQS received the message correctly. + * Amazon SQS URL-decodes the message before creating the MD5 digest. For + * information about MD5, see RFC1321.

+ */ + inline const Aws::String& GetMD5OfMessageSystemAttributes() const{ return m_mD5OfMessageSystemAttributes; } + inline bool MD5OfMessageSystemAttributesHasBeenSet() const { return m_mD5OfMessageSystemAttributesHasBeenSet; } + inline void SetMD5OfMessageSystemAttributes(const Aws::String& value) { m_mD5OfMessageSystemAttributesHasBeenSet = true; m_mD5OfMessageSystemAttributes = value; } + inline void SetMD5OfMessageSystemAttributes(Aws::String&& value) { m_mD5OfMessageSystemAttributesHasBeenSet = true; m_mD5OfMessageSystemAttributes = std::move(value); } + inline void SetMD5OfMessageSystemAttributes(const char* value) { m_mD5OfMessageSystemAttributesHasBeenSet = true; m_mD5OfMessageSystemAttributes.assign(value); } + inline SendMessageBatchResultEntry& WithMD5OfMessageSystemAttributes(const Aws::String& value) { SetMD5OfMessageSystemAttributes(value); return *this;} + inline SendMessageBatchResultEntry& WithMD5OfMessageSystemAttributes(Aws::String&& value) { SetMD5OfMessageSystemAttributes(std::move(value)); return *this;} + inline SendMessageBatchResultEntry& WithMD5OfMessageSystemAttributes(const char* value) { SetMD5OfMessageSystemAttributes(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) queues.

The + * large, non-consecutive number that Amazon SQS assigns to each message.

+ *

The length of SequenceNumber is 128 bits. As + * SequenceNumber continues to increase for a particular + * MessageGroupId.

+ */ + inline const Aws::String& GetSequenceNumber() const{ return m_sequenceNumber; } + inline bool SequenceNumberHasBeenSet() const { return m_sequenceNumberHasBeenSet; } + inline void SetSequenceNumber(const Aws::String& value) { m_sequenceNumberHasBeenSet = true; m_sequenceNumber = value; } + inline void SetSequenceNumber(Aws::String&& value) { m_sequenceNumberHasBeenSet = true; m_sequenceNumber = std::move(value); } + inline void SetSequenceNumber(const char* value) { m_sequenceNumberHasBeenSet = true; m_sequenceNumber.assign(value); } + inline SendMessageBatchResultEntry& WithSequenceNumber(const Aws::String& value) { SetSequenceNumber(value); return *this;} + inline SendMessageBatchResultEntry& WithSequenceNumber(Aws::String&& value) { SetSequenceNumber(std::move(value)); return *this;} + inline SendMessageBatchResultEntry& WithSequenceNumber(const char* value) { SetSequenceNumber(value); return *this;} + ///@} + private: + + Aws::String m_id; + bool m_idHasBeenSet = false; + + Aws::String m_messageId; + bool m_messageIdHasBeenSet = false; + + Aws::String m_mD5OfMessageBody; + bool m_mD5OfMessageBodyHasBeenSet = false; + + Aws::String m_mD5OfMessageAttributes; + bool m_mD5OfMessageAttributesHasBeenSet = false; + + Aws::String m_mD5OfMessageSystemAttributes; + bool m_mD5OfMessageSystemAttributesHasBeenSet = false; + + Aws::String m_sequenceNumber; + bool m_sequenceNumberHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/SendMessageRequest.h b/include/aws/sqs/model/SendMessageRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c7cd5f33648df3d93a687501d0187aa85b7c7b63 --- /dev/null +++ b/include/aws/sqs/model/SendMessageRequest.h @@ -0,0 +1,257 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class SendMessageRequest : public SQSRequest + { + public: + AWS_SQS_API SendMessageRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SendMessage"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue to which a message is sent.

Queue URLs + * and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline SendMessageRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline SendMessageRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline SendMessageRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

The message to send. The minimum size is one character. The maximum size is + * 256 KiB.

A message can include only XML, JSON, and + * unformatted text. The following Unicode characters are allowed. For more + * information, see the W3C + * specification for characters.

#x9 | #xA | + * #xD | #x20 to #xD7FF | + * #xE000 to #xFFFD | #x10000 to + * #x10FFFF

Amazon SQS does not throw an exception or + * completely reject the message if it contains invalid characters. Instead, it + * replaces those invalid characters with U+FFFD before storing the + * message in the queue, as long as the message body contains at least one valid + * character.

+ */ + inline const Aws::String& GetMessageBody() const{ return m_messageBody; } + inline bool MessageBodyHasBeenSet() const { return m_messageBodyHasBeenSet; } + inline void SetMessageBody(const Aws::String& value) { m_messageBodyHasBeenSet = true; m_messageBody = value; } + inline void SetMessageBody(Aws::String&& value) { m_messageBodyHasBeenSet = true; m_messageBody = std::move(value); } + inline void SetMessageBody(const char* value) { m_messageBodyHasBeenSet = true; m_messageBody.assign(value); } + inline SendMessageRequest& WithMessageBody(const Aws::String& value) { SetMessageBody(value); return *this;} + inline SendMessageRequest& WithMessageBody(Aws::String&& value) { SetMessageBody(std::move(value)); return *this;} + inline SendMessageRequest& WithMessageBody(const char* value) { SetMessageBody(value); return *this;} + ///@} + + ///@{ + /** + *

The length of time, in seconds, for which to delay a specific message. Valid + * values: 0 to 900. Maximum: 15 minutes. Messages with a positive + * DelaySeconds value become available for processing after the delay + * period is finished. If you don't specify a value, the default value for the + * queue applies.

When you set FifoQueue, you can't set + * DelaySeconds per message. You can set this parameter only on a + * queue level.

+ */ + inline int GetDelaySeconds() const{ return m_delaySeconds; } + inline bool DelaySecondsHasBeenSet() const { return m_delaySecondsHasBeenSet; } + inline void SetDelaySeconds(int value) { m_delaySecondsHasBeenSet = true; m_delaySeconds = value; } + inline SendMessageRequest& WithDelaySeconds(int value) { SetDelaySeconds(value); return *this;} + ///@} + + ///@{ + /** + *

Each message attribute consists of a Name, Type, + * and Value. For more information, see Amazon + * SQS message attributes in the Amazon SQS Developer Guide.

+ */ + inline const Aws::Map& GetMessageAttributes() const{ return m_messageAttributes; } + inline bool MessageAttributesHasBeenSet() const { return m_messageAttributesHasBeenSet; } + inline void SetMessageAttributes(const Aws::Map& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = value; } + inline void SetMessageAttributes(Aws::Map&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes = std::move(value); } + inline SendMessageRequest& WithMessageAttributes(const Aws::Map& value) { SetMessageAttributes(value); return *this;} + inline SendMessageRequest& WithMessageAttributes(Aws::Map&& value) { SetMessageAttributes(std::move(value)); return *this;} + inline SendMessageRequest& AddMessageAttributes(const Aws::String& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + inline SendMessageRequest& AddMessageAttributes(Aws::String&& key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), value); return *this; } + inline SendMessageRequest& AddMessageAttributes(const Aws::String& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline SendMessageRequest& AddMessageAttributes(Aws::String&& key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(std::move(key), std::move(value)); return *this; } + inline SendMessageRequest& AddMessageAttributes(const char* key, MessageAttributeValue&& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, std::move(value)); return *this; } + inline SendMessageRequest& AddMessageAttributes(const char* key, const MessageAttributeValue& value) { m_messageAttributesHasBeenSet = true; m_messageAttributes.emplace(key, value); return *this; } + ///@} + + ///@{ + /** + *

The message system attribute to send. Each message system attribute consists + * of a Name, Type, and Value.

+ *
  • Currently, the only supported message system attribute + * is AWSTraceHeader. Its type must be String and its + * value must be a correctly formatted X-Ray trace header string.

  • + *

    The size of a message system attribute doesn't count towards the total size + * of a message.

+ */ + inline const Aws::Map& GetMessageSystemAttributes() const{ return m_messageSystemAttributes; } + inline bool MessageSystemAttributesHasBeenSet() const { return m_messageSystemAttributesHasBeenSet; } + inline void SetMessageSystemAttributes(const Aws::Map& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes = value; } + inline void SetMessageSystemAttributes(Aws::Map&& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes = std::move(value); } + inline SendMessageRequest& WithMessageSystemAttributes(const Aws::Map& value) { SetMessageSystemAttributes(value); return *this;} + inline SendMessageRequest& WithMessageSystemAttributes(Aws::Map&& value) { SetMessageSystemAttributes(std::move(value)); return *this;} + inline SendMessageRequest& AddMessageSystemAttributes(const MessageSystemAttributeNameForSends& key, const MessageSystemAttributeValue& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(key, value); return *this; } + inline SendMessageRequest& AddMessageSystemAttributes(MessageSystemAttributeNameForSends&& key, const MessageSystemAttributeValue& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(std::move(key), value); return *this; } + inline SendMessageRequest& AddMessageSystemAttributes(const MessageSystemAttributeNameForSends& key, MessageSystemAttributeValue&& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(key, std::move(value)); return *this; } + inline SendMessageRequest& AddMessageSystemAttributes(MessageSystemAttributeNameForSends&& key, MessageSystemAttributeValue&& value) { m_messageSystemAttributesHasBeenSet = true; m_messageSystemAttributes.emplace(std::move(key), std::move(value)); return *this; } + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) queues.

The + * token used for deduplication of sent messages. If a message with a particular + * MessageDeduplicationId is sent successfully, any messages sent with + * the same MessageDeduplicationId are accepted successfully but + * aren't delivered during the 5-minute deduplication interval. For more + * information, see + * Exactly-once processing in the Amazon SQS Developer Guide.

    + *
  • Every message must have a unique + * MessageDeduplicationId,

    • You may provide a + * MessageDeduplicationId explicitly.

    • If you aren't + * able to provide a MessageDeduplicationId and you enable + * ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 + * hash to generate the MessageDeduplicationId using the body of the + * message (but not the attributes of the message).

    • If you don't + * provide a MessageDeduplicationId and the queue doesn't have + * ContentBasedDeduplication set, the action fails with an error.

      + *
    • If the queue has ContentBasedDeduplication set, your + * MessageDeduplicationId overrides the generated one.

    + *
  • When ContentBasedDeduplication is in effect, messages + * with identical content sent within the deduplication interval are treated as + * duplicates and only one copy of the message is delivered.

  • If + * you send one message with ContentBasedDeduplication enabled and + * then another message with a MessageDeduplicationId that is the same + * as the one generated for the first MessageDeduplicationId, the two + * messages are treated as duplicates and only one copy of the message is + * delivered.

The MessageDeduplicationId is + * available to the consumer of the message (this can be useful for troubleshooting + * delivery issues).

If a message is sent successfully but the + * acknowledgement is lost and the message is resent with the same + * MessageDeduplicationId after the deduplication interval, Amazon SQS + * can't detect duplicate messages.

Amazon SQS continues to keep track of + * the message deduplication ID even after the message is received and deleted.

+ *

The maximum length of MessageDeduplicationId is 128 + * characters. MessageDeduplicationId can contain alphanumeric + * characters (a-z, A-Z, 0-9) and + * punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

+ *

For best practices of using MessageDeduplicationId, see Using + * the MessageDeduplicationId Property in the Amazon SQS Developer + * Guide.

+ */ + inline const Aws::String& GetMessageDeduplicationId() const{ return m_messageDeduplicationId; } + inline bool MessageDeduplicationIdHasBeenSet() const { return m_messageDeduplicationIdHasBeenSet; } + inline void SetMessageDeduplicationId(const Aws::String& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = value; } + inline void SetMessageDeduplicationId(Aws::String&& value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId = std::move(value); } + inline void SetMessageDeduplicationId(const char* value) { m_messageDeduplicationIdHasBeenSet = true; m_messageDeduplicationId.assign(value); } + inline SendMessageRequest& WithMessageDeduplicationId(const Aws::String& value) { SetMessageDeduplicationId(value); return *this;} + inline SendMessageRequest& WithMessageDeduplicationId(Aws::String&& value) { SetMessageDeduplicationId(std::move(value)); return *this;} + inline SendMessageRequest& WithMessageDeduplicationId(const char* value) { SetMessageDeduplicationId(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) queues.

The + * tag that specifies that a message belongs to a specific message group. Messages + * that belong to the same message group are processed in a FIFO manner (however, + * messages in different message groups might be processed out of order). To + * interleave multiple ordered streams within a single queue, use + * MessageGroupId values (for example, session data for multiple + * users). In this scenario, multiple consumers can process the queue, but the + * session data of each user is processed in a FIFO fashion.

  • You + * must associate a non-empty MessageGroupId with a message. If you + * don't provide a MessageGroupId, the action fails.

  • + *

    ReceiveMessage might return messages with multiple + * MessageGroupId values. For each MessageGroupId, the + * messages are sorted by time sent. The caller can't specify a + * MessageGroupId.

The maximum length of + * MessageGroupId is 128 characters. Valid values: alphanumeric + * characters and punctuation + * (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

For best + * practices of using MessageGroupId, see Using + * the MessageGroupId Property in the Amazon SQS Developer Guide.

+ *

MessageGroupId is required for FIFO queues. You + * can't use it for Standard queues.

+ */ + inline const Aws::String& GetMessageGroupId() const{ return m_messageGroupId; } + inline bool MessageGroupIdHasBeenSet() const { return m_messageGroupIdHasBeenSet; } + inline void SetMessageGroupId(const Aws::String& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = value; } + inline void SetMessageGroupId(Aws::String&& value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId = std::move(value); } + inline void SetMessageGroupId(const char* value) { m_messageGroupIdHasBeenSet = true; m_messageGroupId.assign(value); } + inline SendMessageRequest& WithMessageGroupId(const Aws::String& value) { SetMessageGroupId(value); return *this;} + inline SendMessageRequest& WithMessageGroupId(Aws::String&& value) { SetMessageGroupId(std::move(value)); return *this;} + inline SendMessageRequest& WithMessageGroupId(const char* value) { SetMessageGroupId(value); return *this;} + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::String m_messageBody; + bool m_messageBodyHasBeenSet = false; + + int m_delaySeconds; + bool m_delaySecondsHasBeenSet = false; + + Aws::Map m_messageAttributes; + bool m_messageAttributesHasBeenSet = false; + + Aws::Map m_messageSystemAttributes; + bool m_messageSystemAttributesHasBeenSet = false; + + Aws::String m_messageDeduplicationId; + bool m_messageDeduplicationIdHasBeenSet = false; + + Aws::String m_messageGroupId; + bool m_messageGroupIdHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/SendMessageResult.h b/include/aws/sqs/model/SendMessageResult.h new file mode 100644 index 0000000000000000000000000000000000000000..22b570a10c360e432dc8fef2831e6e5cf5e9f028 --- /dev/null +++ b/include/aws/sqs/model/SendMessageResult.h @@ -0,0 +1,160 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + /** + *

The MD5OfMessageBody and MessageId + * elements.

See Also:

AWS + * API Reference

+ */ + class SendMessageResult + { + public: + AWS_SQS_API SendMessageResult(); + AWS_SQS_API SendMessageResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API SendMessageResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message body string. You can use this + * attribute to verify that Amazon SQS received the message correctly. Amazon SQS + * URL-decodes the message before creating the MD5 digest. For information about + * MD5, see RFC1321.

+ */ + inline const Aws::String& GetMD5OfMessageBody() const{ return m_mD5OfMessageBody; } + inline void SetMD5OfMessageBody(const Aws::String& value) { m_mD5OfMessageBody = value; } + inline void SetMD5OfMessageBody(Aws::String&& value) { m_mD5OfMessageBody = std::move(value); } + inline void SetMD5OfMessageBody(const char* value) { m_mD5OfMessageBody.assign(value); } + inline SendMessageResult& WithMD5OfMessageBody(const Aws::String& value) { SetMD5OfMessageBody(value); return *this;} + inline SendMessageResult& WithMD5OfMessageBody(Aws::String&& value) { SetMD5OfMessageBody(std::move(value)); return *this;} + inline SendMessageResult& WithMD5OfMessageBody(const char* value) { SetMD5OfMessageBody(value); return *this;} + ///@} + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message attribute string. You can use + * this attribute to verify that Amazon SQS received the message correctly. Amazon + * SQS URL-decodes the message before creating the MD5 digest. For information + * about MD5, see RFC1321.

+ */ + inline const Aws::String& GetMD5OfMessageAttributes() const{ return m_mD5OfMessageAttributes; } + inline void SetMD5OfMessageAttributes(const Aws::String& value) { m_mD5OfMessageAttributes = value; } + inline void SetMD5OfMessageAttributes(Aws::String&& value) { m_mD5OfMessageAttributes = std::move(value); } + inline void SetMD5OfMessageAttributes(const char* value) { m_mD5OfMessageAttributes.assign(value); } + inline SendMessageResult& WithMD5OfMessageAttributes(const Aws::String& value) { SetMD5OfMessageAttributes(value); return *this;} + inline SendMessageResult& WithMD5OfMessageAttributes(Aws::String&& value) { SetMD5OfMessageAttributes(std::move(value)); return *this;} + inline SendMessageResult& WithMD5OfMessageAttributes(const char* value) { SetMD5OfMessageAttributes(value); return *this;} + ///@} + + ///@{ + /** + *

An MD5 digest of the non-URL-encoded message system attribute string. You can + * use this attribute to verify that Amazon SQS received the message correctly. + * Amazon SQS URL-decodes the message before creating the MD5 digest.

+ */ + inline const Aws::String& GetMD5OfMessageSystemAttributes() const{ return m_mD5OfMessageSystemAttributes; } + inline void SetMD5OfMessageSystemAttributes(const Aws::String& value) { m_mD5OfMessageSystemAttributes = value; } + inline void SetMD5OfMessageSystemAttributes(Aws::String&& value) { m_mD5OfMessageSystemAttributes = std::move(value); } + inline void SetMD5OfMessageSystemAttributes(const char* value) { m_mD5OfMessageSystemAttributes.assign(value); } + inline SendMessageResult& WithMD5OfMessageSystemAttributes(const Aws::String& value) { SetMD5OfMessageSystemAttributes(value); return *this;} + inline SendMessageResult& WithMD5OfMessageSystemAttributes(Aws::String&& value) { SetMD5OfMessageSystemAttributes(std::move(value)); return *this;} + inline SendMessageResult& WithMD5OfMessageSystemAttributes(const char* value) { SetMD5OfMessageSystemAttributes(value); return *this;} + ///@} + + ///@{ + /** + *

An attribute containing the MessageId of the message sent to the + * queue. For more information, see Queue + * and Message Identifiers in the Amazon SQS Developer Guide.

+ */ + inline const Aws::String& GetMessageId() const{ return m_messageId; } + inline void SetMessageId(const Aws::String& value) { m_messageId = value; } + inline void SetMessageId(Aws::String&& value) { m_messageId = std::move(value); } + inline void SetMessageId(const char* value) { m_messageId.assign(value); } + inline SendMessageResult& WithMessageId(const Aws::String& value) { SetMessageId(value); return *this;} + inline SendMessageResult& WithMessageId(Aws::String&& value) { SetMessageId(std::move(value)); return *this;} + inline SendMessageResult& WithMessageId(const char* value) { SetMessageId(value); return *this;} + ///@} + + ///@{ + /** + *

This parameter applies only to FIFO (first-in-first-out) queues.

The + * large, non-consecutive number that Amazon SQS assigns to each message.

+ *

The length of SequenceNumber is 128 bits. + * SequenceNumber continues to increase for a particular + * MessageGroupId.

+ */ + inline const Aws::String& GetSequenceNumber() const{ return m_sequenceNumber; } + inline void SetSequenceNumber(const Aws::String& value) { m_sequenceNumber = value; } + inline void SetSequenceNumber(Aws::String&& value) { m_sequenceNumber = std::move(value); } + inline void SetSequenceNumber(const char* value) { m_sequenceNumber.assign(value); } + inline SendMessageResult& WithSequenceNumber(const Aws::String& value) { SetSequenceNumber(value); return *this;} + inline SendMessageResult& WithSequenceNumber(Aws::String&& value) { SetSequenceNumber(std::move(value)); return *this;} + inline SendMessageResult& WithSequenceNumber(const char* value) { SetSequenceNumber(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline SendMessageResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline SendMessageResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline SendMessageResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline SendMessageResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline SendMessageResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_mD5OfMessageBody; + + Aws::String m_mD5OfMessageAttributes; + + Aws::String m_mD5OfMessageSystemAttributes; + + Aws::String m_messageId; + + Aws::String m_sequenceNumber; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/SetQueueAttributesRequest.h b/include/aws/sqs/model/SetQueueAttributesRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c19c9dad0492cd89a6c1e0c0989f8f3f2786275f --- /dev/null +++ b/include/aws/sqs/model/SetQueueAttributesRequest.h @@ -0,0 +1,220 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + *

See Also:

AWS + * API Reference

+ */ + class SetQueueAttributesRequest : public SQSRequest + { + public: + AWS_SQS_API SetQueueAttributesRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "SetQueueAttributes"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the Amazon SQS queue whose attributes are set.

Queue URLs + * and names are case-sensitive.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline SetQueueAttributesRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline SetQueueAttributesRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline SetQueueAttributesRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

A map of attributes to set.

The following lists the names, + * descriptions, and values of the special request parameters that the + * SetQueueAttributes action uses:

  • + * DelaySeconds – The length of time, in seconds, for which the + * delivery of all messages in the queue is delayed. Valid values: An integer from + * 0 to 900 (15 minutes). Default: 0.

  • + * MaximumMessageSize – The limit of how many bytes a message can + * contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes + * (1 KiB) up to 262,144 bytes (256 KiB). Default: 262,144 (256 KiB).

  • + *
  • MessageRetentionPeriod – The length of time, in seconds, + * for which Amazon SQS retains a message. Valid values: An integer representing + * seconds, from 60 (1 minute) to 1,209,600 (14 days). Default: 345,600 (4 days). + * When you change a queue's attributes, the change can take up to 60 seconds for + * most of the attributes to propagate throughout the Amazon SQS system. Changes + * made to the MessageRetentionPeriod attribute can take up to 15 + * minutes and will impact existing messages in the queue potentially causing them + * to be expired and deleted if the MessageRetentionPeriod is reduced + * below the age of existing messages.

  • Policy – The + * queue's policy. A valid Amazon Web Services policy. For more information about + * policy structure, see Overview + * of Amazon Web Services IAM Policies in the Identity and Access Management + * User Guide.

  • ReceiveMessageWaitTimeSeconds – + * The length of time, in seconds, for which a ReceiveMessage + * action waits for a message to arrive. Valid values: An integer from 0 to 20 + * (seconds). Default: 0.

  • VisibilityTimeout – The + * visibility timeout for the queue, in seconds. Valid values: An integer from 0 to + * 43,200 (12 hours). Default: 30. For more information about the visibility + * timeout, see Visibility + * Timeout in the Amazon SQS Developer Guide.

The + * following attributes apply only to dead-letter + * queues:

  • RedrivePolicy – The string that + * includes the parameters for the dead-letter queue functionality of the source + * queue as a JSON object. The parameters are as follows:

    • + * deadLetterTargetArn – The Amazon Resource Name (ARN) of the + * dead-letter queue to which Amazon SQS moves messages after the value of + * maxReceiveCount is exceeded.

    • + * maxReceiveCount – The number of times a message is delivered to the + * source queue before being moved to the dead-letter queue. Default: 10. When the + * ReceiveCount for a message exceeds the maxReceiveCount + * for a queue, Amazon SQS moves the message to the dead-letter-queue.

    • + *
  • RedriveAllowPolicy – The string that includes + * the parameters for the permissions for the dead-letter queue redrive permission + * and which source queues can specify dead-letter queues as a JSON object. The + * parameters are as follows:

    • redrivePermission – + * The permission type that defines which source queues can specify the current + * queue as the dead-letter queue. Valid values are:

      • + * allowAll – (Default) Any source queues in this Amazon Web Services + * account in the same Region can specify this queue as the dead-letter queue.

        + *
      • denyAll – No source queues can specify this queue as + * the dead-letter queue.

      • byQueue – Only queues + * specified by the sourceQueueArns parameter can specify this queue + * as the dead-letter queue.

    • + * sourceQueueArns – The Amazon Resource Names (ARN)s of the source + * queues that can specify this queue as the dead-letter queue and redrive + * messages. You can specify this parameter only when the + * redrivePermission parameter is set to byQueue. You can + * specify up to 10 source queue ARNs. To allow more than 10 source queues to + * specify dead-letter queues, set the redrivePermission parameter to + * allowAll.

The dead-letter + * queue of a FIFO queue must also be a FIFO queue. Similarly, the dead-letter + * queue of a standard queue must also be a standard queue.

The + * following attributes apply only to server-side-encryption:

+ *
  • KmsMasterKeyId – The ID of an Amazon Web Services + * managed customer master key (CMK) for Amazon SQS or a custom CMK. For more + * information, see Key + * Terms. While the alias of the AWS-managed CMK for Amazon SQS is always + * alias/aws/sqs, the alias of a custom CMK can, for example, be + * alias/MyAlias . For more examples, see KeyId + * in the Key Management Service API Reference.

  • + * KmsDataKeyReusePeriodSeconds – The length of time, in seconds, for + * which Amazon SQS can reuse a data + * key to encrypt or decrypt messages before calling KMS again. An integer + * representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 + * hours). Default: 300 (5 minutes). A shorter time period provides better security + * but results in more calls to KMS which might incur charges after Free Tier. For + * more information, see How + * Does the Data Key Reuse Period Work?.

  • + * SqsManagedSseEnabled – Enables server-side queue encryption using + * SQS owned encryption keys. Only one server-side encryption option is supported + * per queue (for example, SSE-KMS + * or SSE-SQS).

    + *

The following attribute applies only to FIFO + * (first-in-first-out) queues:

  • + * ContentBasedDeduplication – Enables content-based deduplication. + * For more information, see Exactly-once + * processing in the Amazon SQS Developer Guide. Note the following: + *

    • Every message must have a unique + * MessageDeduplicationId.

      • You may provide a + * MessageDeduplicationId explicitly.

      • If you aren't + * able to provide a MessageDeduplicationId and you enable + * ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 + * hash to generate the MessageDeduplicationId using the body of the + * message (but not the attributes of the message).

      • If you don't + * provide a MessageDeduplicationId and the queue doesn't have + * ContentBasedDeduplication set, the action fails with an error.

        + *
      • If the queue has ContentBasedDeduplication set, your + * MessageDeduplicationId overrides the generated one.

      + *
    • When ContentBasedDeduplication is in effect, messages + * with identical content sent within the deduplication interval are treated as + * duplicates and only one copy of the message is delivered.

    • If + * you send one message with ContentBasedDeduplication enabled and + * then another message with a MessageDeduplicationId that is the same + * as the one generated for the first MessageDeduplicationId, the two + * messages are treated as duplicates and only one copy of the message is + * delivered.

The following attributes apply only + * to high + * throughput for FIFO queues:

  • + * DeduplicationScope – Specifies whether message deduplication occurs + * at the message group or queue level. Valid values are messageGroup + * and queue.

  • FifoThroughputLimit – + * Specifies whether the FIFO queue throughput quota applies to the entire queue or + * per message group. Valid values are perQueue and + * perMessageGroupId. The perMessageGroupId value is + * allowed only when the value for DeduplicationScope is + * messageGroup.

To enable high throughput for FIFO + * queues, do the following:

  • Set DeduplicationScope + * to messageGroup.

  • Set + * FifoThroughputLimit to perMessageGroupId.

  • + *

If you set these attributes to anything other than the values shown for + * enabling high throughput, normal throughput is in effect and deduplication + * occurs as specified.

For information on throughput quotas, see Quotas + * related to messages in the Amazon SQS Developer Guide.

+ */ + inline const Aws::Map& GetAttributes() const{ return m_attributes; } + inline bool AttributesHasBeenSet() const { return m_attributesHasBeenSet; } + inline void SetAttributes(const Aws::Map& value) { m_attributesHasBeenSet = true; m_attributes = value; } + inline void SetAttributes(Aws::Map&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } + inline SetQueueAttributesRequest& WithAttributes(const Aws::Map& value) { SetAttributes(value); return *this;} + inline SetQueueAttributesRequest& WithAttributes(Aws::Map&& value) { SetAttributes(std::move(value)); return *this;} + inline SetQueueAttributesRequest& AddAttributes(const QueueAttributeName& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + inline SetQueueAttributesRequest& AddAttributes(QueueAttributeName&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetQueueAttributesRequest& AddAttributes(const QueueAttributeName& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } + inline SetQueueAttributesRequest& AddAttributes(QueueAttributeName&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } + inline SetQueueAttributesRequest& AddAttributes(QueueAttributeName&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } + inline SetQueueAttributesRequest& AddAttributes(const QueueAttributeName& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Map m_attributes; + bool m_attributesHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/StartMessageMoveTaskRequest.h b/include/aws/sqs/model/StartMessageMoveTaskRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..bdff534713e987469c0d4f1b85eeb47724e2f46a --- /dev/null +++ b/include/aws/sqs/model/StartMessageMoveTaskRequest.h @@ -0,0 +1,98 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + */ + class StartMessageMoveTaskRequest : public SQSRequest + { + public: + AWS_SQS_API StartMessageMoveTaskRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "StartMessageMoveTask"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The ARN of the queue that contains the messages to be moved to another queue. + * Currently, only ARNs of dead-letter queues (DLQs) whose sources are other Amazon + * SQS queues are accepted. DLQs whose sources are non-SQS queues, such as Lambda + * or Amazon SNS topics, are not currently supported.

+ */ + inline const Aws::String& GetSourceArn() const{ return m_sourceArn; } + inline bool SourceArnHasBeenSet() const { return m_sourceArnHasBeenSet; } + inline void SetSourceArn(const Aws::String& value) { m_sourceArnHasBeenSet = true; m_sourceArn = value; } + inline void SetSourceArn(Aws::String&& value) { m_sourceArnHasBeenSet = true; m_sourceArn = std::move(value); } + inline void SetSourceArn(const char* value) { m_sourceArnHasBeenSet = true; m_sourceArn.assign(value); } + inline StartMessageMoveTaskRequest& WithSourceArn(const Aws::String& value) { SetSourceArn(value); return *this;} + inline StartMessageMoveTaskRequest& WithSourceArn(Aws::String&& value) { SetSourceArn(std::move(value)); return *this;} + inline StartMessageMoveTaskRequest& WithSourceArn(const char* value) { SetSourceArn(value); return *this;} + ///@} + + ///@{ + /** + *

The ARN of the queue that receives the moved messages. You can use this field + * to specify the destination queue where you would like to redrive messages. If + * this field is left blank, the messages will be redriven back to their respective + * original source queues.

+ */ + inline const Aws::String& GetDestinationArn() const{ return m_destinationArn; } + inline bool DestinationArnHasBeenSet() const { return m_destinationArnHasBeenSet; } + inline void SetDestinationArn(const Aws::String& value) { m_destinationArnHasBeenSet = true; m_destinationArn = value; } + inline void SetDestinationArn(Aws::String&& value) { m_destinationArnHasBeenSet = true; m_destinationArn = std::move(value); } + inline void SetDestinationArn(const char* value) { m_destinationArnHasBeenSet = true; m_destinationArn.assign(value); } + inline StartMessageMoveTaskRequest& WithDestinationArn(const Aws::String& value) { SetDestinationArn(value); return *this;} + inline StartMessageMoveTaskRequest& WithDestinationArn(Aws::String&& value) { SetDestinationArn(std::move(value)); return *this;} + inline StartMessageMoveTaskRequest& WithDestinationArn(const char* value) { SetDestinationArn(value); return *this;} + ///@} + + ///@{ + /** + *

The number of messages to be moved per second (the message movement rate). + * You can use this field to define a fixed message movement rate. The maximum + * value for messages per second is 500. If this field is left blank, the system + * will optimize the rate based on the queue message backlog size, which may vary + * throughout the duration of the message movement task.

+ */ + inline int GetMaxNumberOfMessagesPerSecond() const{ return m_maxNumberOfMessagesPerSecond; } + inline bool MaxNumberOfMessagesPerSecondHasBeenSet() const { return m_maxNumberOfMessagesPerSecondHasBeenSet; } + inline void SetMaxNumberOfMessagesPerSecond(int value) { m_maxNumberOfMessagesPerSecondHasBeenSet = true; m_maxNumberOfMessagesPerSecond = value; } + inline StartMessageMoveTaskRequest& WithMaxNumberOfMessagesPerSecond(int value) { SetMaxNumberOfMessagesPerSecond(value); return *this;} + ///@} + private: + + Aws::String m_sourceArn; + bool m_sourceArnHasBeenSet = false; + + Aws::String m_destinationArn; + bool m_destinationArnHasBeenSet = false; + + int m_maxNumberOfMessagesPerSecond; + bool m_maxNumberOfMessagesPerSecondHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/StartMessageMoveTaskResult.h b/include/aws/sqs/model/StartMessageMoveTaskResult.h new file mode 100644 index 0000000000000000000000000000000000000000..4fe00b3efeb907448e5458bb58c4d9e846da49d1 --- /dev/null +++ b/include/aws/sqs/model/StartMessageMoveTaskResult.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include + +namespace Aws +{ +template +class AmazonWebServiceResult; + +namespace Utils +{ +namespace Json +{ + class JsonValue; +} // namespace Json +} // namespace Utils +namespace SQS +{ +namespace Model +{ + class StartMessageMoveTaskResult + { + public: + AWS_SQS_API StartMessageMoveTaskResult(); + AWS_SQS_API StartMessageMoveTaskResult(const Aws::AmazonWebServiceResult& result); + AWS_SQS_API StartMessageMoveTaskResult& operator=(const Aws::AmazonWebServiceResult& result); + + + ///@{ + /** + *

An identifier associated with a message movement task. You can use this + * identifier to cancel a specified message movement task using the + * CancelMessageMoveTask action.

+ */ + inline const Aws::String& GetTaskHandle() const{ return m_taskHandle; } + inline void SetTaskHandle(const Aws::String& value) { m_taskHandle = value; } + inline void SetTaskHandle(Aws::String&& value) { m_taskHandle = std::move(value); } + inline void SetTaskHandle(const char* value) { m_taskHandle.assign(value); } + inline StartMessageMoveTaskResult& WithTaskHandle(const Aws::String& value) { SetTaskHandle(value); return *this;} + inline StartMessageMoveTaskResult& WithTaskHandle(Aws::String&& value) { SetTaskHandle(std::move(value)); return *this;} + inline StartMessageMoveTaskResult& WithTaskHandle(const char* value) { SetTaskHandle(value); return *this;} + ///@} + + ///@{ + + inline const Aws::String& GetRequestId() const{ return m_requestId; } + inline void SetRequestId(const Aws::String& value) { m_requestId = value; } + inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } + inline void SetRequestId(const char* value) { m_requestId.assign(value); } + inline StartMessageMoveTaskResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} + inline StartMessageMoveTaskResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} + inline StartMessageMoveTaskResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} + ///@} + + ///@{ + + inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } + inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } + inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } + inline StartMessageMoveTaskResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} + inline StartMessageMoveTaskResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} + ///@} + private: + + Aws::String m_taskHandle; + + Aws::String m_requestId; + + ResponseMetadata m_responseMetadata; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/TagQueueRequest.h b/include/aws/sqs/model/TagQueueRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..251f0f5f5b4bd36c7716ff6f2868faca20cddb74 --- /dev/null +++ b/include/aws/sqs/model/TagQueueRequest.h @@ -0,0 +1,81 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + */ + class TagQueueRequest : public SQSRequest + { + public: + AWS_SQS_API TagQueueRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "TagQueue"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the queue.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline TagQueueRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline TagQueueRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline TagQueueRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

The list of tags to be added to the specified queue.

+ */ + inline const Aws::Map& GetTags() const{ return m_tags; } + inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } + inline void SetTags(const Aws::Map& value) { m_tagsHasBeenSet = true; m_tags = value; } + inline void SetTags(Aws::Map&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } + inline TagQueueRequest& WithTags(const Aws::Map& value) { SetTags(value); return *this;} + inline TagQueueRequest& WithTags(Aws::Map&& value) { SetTags(std::move(value)); return *this;} + inline TagQueueRequest& AddTags(const Aws::String& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + inline TagQueueRequest& AddTags(Aws::String&& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline TagQueueRequest& AddTags(const Aws::String& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline TagQueueRequest& AddTags(Aws::String&& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), std::move(value)); return *this; } + inline TagQueueRequest& AddTags(const char* key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } + inline TagQueueRequest& AddTags(Aws::String&& key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } + inline TagQueueRequest& AddTags(const char* key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Map m_tags; + bool m_tagsHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/sqs/model/UntagQueueRequest.h b/include/aws/sqs/model/UntagQueueRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..86f68a5fdf3fd18fd9fb0354db907aaf6db6ec71 --- /dev/null +++ b/include/aws/sqs/model/UntagQueueRequest.h @@ -0,0 +1,77 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once +#include +#include +#include +#include +#include + +namespace Aws +{ +namespace SQS +{ +namespace Model +{ + + /** + */ + class UntagQueueRequest : public SQSRequest + { + public: + AWS_SQS_API UntagQueueRequest(); + + // Service request name is the Operation name which will send this request out, + // each operation should has unique request name, so that we can get operation's name from this request. + // Note: this is not true for response, multiple operations may have the same response name, + // so we can not get operation's name from response. + inline virtual const char* GetServiceRequestName() const override { return "UntagQueue"; } + + AWS_SQS_API Aws::String SerializePayload() const override; + + AWS_SQS_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; + + + ///@{ + /** + *

The URL of the queue.

+ */ + inline const Aws::String& GetQueueUrl() const{ return m_queueUrl; } + inline bool QueueUrlHasBeenSet() const { return m_queueUrlHasBeenSet; } + inline void SetQueueUrl(const Aws::String& value) { m_queueUrlHasBeenSet = true; m_queueUrl = value; } + inline void SetQueueUrl(Aws::String&& value) { m_queueUrlHasBeenSet = true; m_queueUrl = std::move(value); } + inline void SetQueueUrl(const char* value) { m_queueUrlHasBeenSet = true; m_queueUrl.assign(value); } + inline UntagQueueRequest& WithQueueUrl(const Aws::String& value) { SetQueueUrl(value); return *this;} + inline UntagQueueRequest& WithQueueUrl(Aws::String&& value) { SetQueueUrl(std::move(value)); return *this;} + inline UntagQueueRequest& WithQueueUrl(const char* value) { SetQueueUrl(value); return *this;} + ///@} + + ///@{ + /** + *

The list of tags to be removed from the specified queue.

+ */ + inline const Aws::Vector& GetTagKeys() const{ return m_tagKeys; } + inline bool TagKeysHasBeenSet() const { return m_tagKeysHasBeenSet; } + inline void SetTagKeys(const Aws::Vector& value) { m_tagKeysHasBeenSet = true; m_tagKeys = value; } + inline void SetTagKeys(Aws::Vector&& value) { m_tagKeysHasBeenSet = true; m_tagKeys = std::move(value); } + inline UntagQueueRequest& WithTagKeys(const Aws::Vector& value) { SetTagKeys(value); return *this;} + inline UntagQueueRequest& WithTagKeys(Aws::Vector&& value) { SetTagKeys(std::move(value)); return *this;} + inline UntagQueueRequest& AddTagKeys(const Aws::String& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; } + inline UntagQueueRequest& AddTagKeys(Aws::String&& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(std::move(value)); return *this; } + inline UntagQueueRequest& AddTagKeys(const char* value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; } + ///@} + private: + + Aws::String m_queueUrl; + bool m_queueUrlHasBeenSet = false; + + Aws::Vector m_tagKeys; + bool m_tagKeysHasBeenSet = false; + }; + +} // namespace Model +} // namespace SQS +} // namespace Aws diff --git a/include/aws/testing/async_stream_tester.h b/include/aws/testing/async_stream_tester.h new file mode 100644 index 0000000000000000000000000000000000000000..72fcfd3b7b6e7686bed1ebbfe133b4cfa4950d18 --- /dev/null +++ b/include/aws/testing/async_stream_tester.h @@ -0,0 +1,264 @@ +#ifndef AWS_TESTING_ASYNC_STREAM_TESTER_H +#define AWS_TESTING_ASYNC_STREAM_TESTER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include +#include +#include +#include +#include +#include + +#ifndef AWS_UNSTABLE_TESTING_API +# error This code is designed for use by AWS owned libraries for the AWS C99 SDK. \ +You are welcome to use it, but we make no promises on the stability of this API. \ +To enable use of this code, set the AWS_UNSTABLE_TESTING_API compiler flag. +#endif + +/** + * Use aws_async_input_stream_tester to test edge cases in systems that take async streams. + * You can customize its behavior (e.g. fail on 3rd read, always complete async, always complete synchronously, etc) + */ + +enum aws_async_read_completion_strategy { + /* the tester has its own thread, and reads always complete from there */ + AWS_ASYNC_READ_COMPLETES_ON_ANOTHER_THREAD, + /* reads complete before read() even returns */ + AWS_ASYNC_READ_COMPLETES_IMMEDIATELY, + /* sometimes reads complete immediately, sometimes they complete on another thread */ + AWS_ASYNC_READ_COMPLETES_ON_RANDOM_THREAD, +}; + +struct aws_async_input_stream_tester_options { + /* the async tester uses the synchronous tester under the hood, + * so here are those options */ + struct aws_input_stream_tester_options base; + + enum aws_async_read_completion_strategy completion_strategy; + + /* if non-zero, a read will take at least this long to complete */ + uint64_t read_duration_ns; +}; + +struct aws_async_input_stream_tester { + struct aws_async_input_stream base; + struct aws_allocator *alloc; + struct aws_async_input_stream_tester_options options; + struct aws_input_stream *source_stream; + + struct aws_thread thread; + struct { + struct aws_mutex lock; + struct aws_condition_variable cvar; + + /* when thread should perform a read, these are set */ + struct aws_byte_buf *read_dest; + struct aws_future_bool *read_future; + + /* if true, thread should shut down */ + bool do_shutdown; + } synced_data; + + struct aws_atomic_var num_outstanding_reads; +}; + +static inline void s_async_input_stream_tester_do_actual_read( + struct aws_async_input_stream_tester *impl, + struct aws_byte_buf *dest, + struct aws_future_bool *read_future) { + + int error_code = 0; + + /* delay, if that's how we're configured */ + if (impl->options.read_duration_ns != 0) { + aws_thread_current_sleep(impl->options.read_duration_ns); + } + + /* Keep calling read() until we get some data, or hit EOF. + * We do this because the synchronous aws_input_stream API allows + * 0 byte reads, but the aws_async_input_stream API does not. */ + size_t prev_len = dest->len; + struct aws_stream_status status = {.is_end_of_stream = false, .is_valid = true}; + while ((dest->len == prev_len) && !status.is_end_of_stream) { + /* read from stream */ + if (aws_input_stream_read(impl->source_stream, dest) != AWS_OP_SUCCESS) { + error_code = aws_last_error(); + goto done; + } + + /* check if stream is done */ + if (aws_input_stream_get_status(impl->source_stream, &status) != AWS_OP_SUCCESS) { + error_code = aws_last_error(); + goto done; + } + } + +done: + aws_atomic_fetch_sub(&impl->num_outstanding_reads, 1); + + if (error_code != 0) { + aws_future_bool_set_error(read_future, error_code); + } else { + aws_future_bool_set_result(read_future, status.is_end_of_stream); + } + + aws_future_bool_release(read_future); +} + +static inline struct aws_future_bool *s_async_input_stream_tester_read( + struct aws_async_input_stream *stream, + struct aws_byte_buf *dest) { + + struct aws_async_input_stream_tester *impl = (struct aws_async_input_stream_tester *)stream->impl; + + size_t prev_outstanding_reads = aws_atomic_fetch_add(&impl->num_outstanding_reads, 1); + AWS_FATAL_ASSERT(prev_outstanding_reads == 0 && "Overlapping read() calls are forbidden"); + + struct aws_future_bool *read_future = aws_future_bool_new(stream->alloc); + + bool do_on_thread = false; + switch (impl->options.completion_strategy) { + case AWS_ASYNC_READ_COMPLETES_ON_ANOTHER_THREAD: + do_on_thread = true; + break; + case AWS_ASYNC_READ_COMPLETES_IMMEDIATELY: + do_on_thread = false; + break; + case AWS_ASYNC_READ_COMPLETES_ON_RANDOM_THREAD: + do_on_thread = (rand() % 2 == 0); + break; + } + + if (do_on_thread) { + /* BEGIN CRITICAL SECTION */ + aws_mutex_lock(&impl->synced_data.lock); + impl->synced_data.read_dest = dest; + impl->synced_data.read_future = aws_future_bool_acquire(read_future); + AWS_FATAL_ASSERT(aws_condition_variable_notify_all(&impl->synced_data.cvar) == AWS_OP_SUCCESS); + aws_mutex_unlock(&impl->synced_data.lock); + /* END CRITICAL SECTION */ + } else { + /* acquire additional refcount on future, since we call release once it's complete */ + aws_future_bool_acquire(read_future); + s_async_input_stream_tester_do_actual_read(impl, dest, read_future); + } + + return read_future; +} + +static inline void s_async_input_stream_tester_do_actual_destroy(struct aws_async_input_stream_tester *impl) { + if (impl->options.completion_strategy != AWS_ASYNC_READ_COMPLETES_IMMEDIATELY) { + aws_condition_variable_clean_up(&impl->synced_data.cvar); + aws_mutex_clean_up(&impl->synced_data.lock); + } + + aws_input_stream_release(impl->source_stream); + aws_mem_release(impl->base.alloc, impl); +} + +/* refcount has reached zero */ +static inline void s_async_input_stream_tester_destroy(struct aws_async_input_stream *async_stream) { + struct aws_async_input_stream_tester *impl = (struct aws_async_input_stream_tester *)async_stream->impl; + + if (impl->options.completion_strategy == AWS_ASYNC_READ_COMPLETES_IMMEDIATELY) { + s_async_input_stream_tester_do_actual_destroy(impl); + } else { + /* signal thread to finish cleaning things up */ + + /* BEGIN CRITICAL SECTION */ + aws_mutex_lock(&impl->synced_data.lock); + impl->synced_data.do_shutdown = true; + AWS_FATAL_ASSERT(aws_condition_variable_notify_all(&impl->synced_data.cvar) == AWS_OP_SUCCESS); + aws_mutex_unlock(&impl->synced_data.lock); + /* END CRITICAL SECTION */ + } +} + +static inline bool s_async_input_stream_tester_thread_pred(void *arg) { + struct aws_async_input_stream_tester *impl = (struct aws_async_input_stream_tester *)arg; + return impl->synced_data.do_shutdown || (impl->synced_data.read_dest != NULL); +} + +static inline void s_async_input_stream_tester_thread(void *arg) { + struct aws_async_input_stream_tester *impl = (struct aws_async_input_stream_tester *)arg; + bool do_shutdown = false; + struct aws_byte_buf *read_dest = NULL; + struct aws_future_bool *read_future = NULL; + while (!do_shutdown) { + /* BEGIN CRITICAL SECTION */ + aws_mutex_lock(&impl->synced_data.lock); + AWS_FATAL_ASSERT( + aws_condition_variable_wait_pred( + &impl->synced_data.cvar, &impl->synced_data.lock, s_async_input_stream_tester_thread_pred, impl) == + AWS_OP_SUCCESS); + + /* acquire work */ + do_shutdown = impl->synced_data.do_shutdown; + read_dest = impl->synced_data.read_dest; + impl->synced_data.read_dest = NULL; + read_future = impl->synced_data.read_future; + impl->synced_data.read_future = NULL; + + aws_mutex_unlock(&impl->synced_data.lock); + /* END CRITICAL SECTION */ + + if (read_dest != NULL) { + s_async_input_stream_tester_do_actual_read(impl, read_dest, read_future); + } + } + + /* thread has shut down, finish destruction */ + s_async_input_stream_tester_do_actual_destroy(impl); +} + +static inline uint64_t aws_async_input_stream_tester_total_bytes_read( + const struct aws_async_input_stream *async_stream) { + + const struct aws_async_input_stream_tester *async_impl = + (const struct aws_async_input_stream_tester *)async_stream->impl; + const struct aws_input_stream_tester *synchronous_impl = + (const struct aws_input_stream_tester *)async_impl->source_stream->impl; + return synchronous_impl->total_bytes_read; +} + +static struct aws_async_input_stream_vtable s_async_input_stream_tester_vtable = { + .destroy = s_async_input_stream_tester_destroy, + .read = s_async_input_stream_tester_read, +}; + +static inline struct aws_async_input_stream *aws_async_input_stream_new_tester( + struct aws_allocator *alloc, + const struct aws_async_input_stream_tester_options *options) { + + struct aws_async_input_stream_tester *impl = + (struct aws_async_input_stream_tester *)aws_mem_calloc(alloc, 1, sizeof(struct aws_async_input_stream_tester)); + aws_async_input_stream_init_base(&impl->base, alloc, &s_async_input_stream_tester_vtable, impl); + impl->options = *options; + aws_atomic_init_int(&impl->num_outstanding_reads, 0); + + impl->source_stream = aws_input_stream_new_tester(alloc, &options->base); + AWS_FATAL_ASSERT(impl->source_stream); + + if (options->completion_strategy != AWS_ASYNC_READ_COMPLETES_IMMEDIATELY) { + aws_mutex_init(&impl->synced_data.lock); + aws_condition_variable_init(&impl->synced_data.cvar); + + AWS_FATAL_ASSERT(aws_thread_init(&impl->thread, alloc) == AWS_OP_SUCCESS); + struct aws_thread_options thread_options = *aws_default_thread_options(); + thread_options.name = aws_byte_cursor_from_c_str("AsyncStream"); + thread_options.join_strategy = AWS_TJS_MANAGED; + + AWS_FATAL_ASSERT( + aws_thread_launch(&impl->thread, s_async_input_stream_tester_thread, impl, &thread_options) == + AWS_OP_SUCCESS); + } + + return &impl->base; +} + +#endif /* AWS_TESTING_ASYNC_STREAM_TESTER_H */ diff --git a/include/aws/testing/aws_test_harness.h b/include/aws/testing/aws_test_harness.h new file mode 100644 index 0000000000000000000000000000000000000000..769e75fc9776bf318bb5bad86f46e4d1689129ec --- /dev/null +++ b/include/aws/testing/aws_test_harness.h @@ -0,0 +1,572 @@ +#ifndef AWS_TESTING_AWS_TEST_HARNESS_H +#define AWS_TESTING_AWS_TEST_HARNESS_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/** + * The return code for skipped tests. Use the return code if the test should be skipped. + */ +#define AWS_OP_SKIP (-2) + +#ifndef AWS_UNSTABLE_TESTING_API +# error The AWS Test Fixture is designed only for use by AWS owned libraries for the AWS C99 SDK. You are welcome to use it, \ +but you should be aware we make no promises on the stability of this API. To enable use of the aws test fixtures, set \ +the AWS_UNSTABLE_TESTING_API compiler flag +#endif + +#ifndef AWS_TESTING_REPORT_FD +# define AWS_TESTING_REPORT_FD stderr +#endif + +#ifdef _MSC_VER +# pragma warning(disable : 4221) /* aggregate initializer using local variable addresses */ +# pragma warning(disable : 4204) /* non-constant aggregate initializer */ +#endif + +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#endif + +/** Prints a message to AWS_TESTING_REPORT_FD using printf format that appends the function, file and line number. + * If format is null, returns 0 without printing anything; otherwise returns 1. + * If function or file are null, the function, file and line number are not appended. + */ +static int s_cunit_failure_message0( + const char *prefix, + const char *function, + const char *file, + int line, + const char *format, + ...) { + if (!format) { + return 0; + } + + fprintf(AWS_TESTING_REPORT_FD, "%s", prefix); + + va_list ap; + va_start(ap, format); + vfprintf(AWS_TESTING_REPORT_FD, format, ap); + va_end(ap); + + if (function && file) { + fprintf(AWS_TESTING_REPORT_FD, " [%s(): %s:%d]\n", function, file, line); + } else { + fprintf(AWS_TESTING_REPORT_FD, "\n"); + } + + return 1; +} + +#define FAIL_PREFIX "***FAILURE*** " +#define CUNIT_FAILURE_MESSAGE(func, file, line, format, ...) \ + s_cunit_failure_message0(FAIL_PREFIX, func, file, line, format, #__VA_ARGS__) + +#define SUCCESS (0) +#define FAILURE (-1) +/* The exit code returned to ctest to indicate the test is skipped. Refer to cmake doc: + * https://cmake.org/cmake/help/latest/prop_test/SKIP_RETURN_CODE.html + * The value has no special meaning, it's just an arbitrary exit code reducing the chance of clashing with exit codes + * that may be returned from various tools (e.g. sanitizer). */ +#define SKIP (103) + +#define RETURN_SUCCESS(format, ...) \ + do { \ + printf(format, ##__VA_ARGS__); \ + printf("\n"); \ + return SUCCESS; \ + } while (0) + +#define PRINT_FAIL_INTERNAL(...) CUNIT_FAILURE_MESSAGE(__func__, __FILE__, __LINE__, ##__VA_ARGS__, (const char *)NULL) + +#define PRINT_FAIL_INTERNAL0(...) \ + s_cunit_failure_message0(FAIL_PREFIX, __func__, __FILE__, __LINE__, ##__VA_ARGS__, (const char *)NULL) + +#define PRINT_FAIL_WITHOUT_LOCATION(...) \ + s_cunit_failure_message0(FAIL_PREFIX, NULL, NULL, __LINE__, ##__VA_ARGS__, (const char *)NULL) + +#define POSTFAIL_INTERNAL() \ + do { \ + return FAILURE; \ + } while (0) + +#define FAIL(...) \ + do { \ + PRINT_FAIL_INTERNAL0(__VA_ARGS__); \ + POSTFAIL_INTERNAL(); \ + } while (0) + +#define ASSERT_TRUE(condition, ...) \ + do { \ + if (!(condition)) { \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("Expected condition to be true: " #condition); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_FALSE(condition, ...) \ + do { \ + if ((condition)) { \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("Expected condition to be false: " #condition); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_SUCCESS(condition, ...) \ + do { \ + int assert_rv = (condition); \ + if (assert_rv != AWS_OP_SUCCESS) { \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0( \ + "Expected success at %s; got return value %d with last error %d\n", \ + #condition, \ + assert_rv, \ + aws_last_error()); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_FAILS(condition, ...) \ + do { \ + int assert_rv = (condition); \ + if (assert_rv != AWS_OP_ERR) { \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0( \ + "Expected failure at %s; got return value %d with last error %d\n", \ + #condition, \ + assert_rv, \ + aws_last_error()); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_ERROR(error, condition, ...) \ + do { \ + int assert_rv = (condition); \ + int assert_err = aws_last_error(); \ + int assert_err_expect = (error); \ + if (assert_rv != AWS_OP_ERR) { \ + fprintf( \ + AWS_TESTING_REPORT_FD, \ + "%sExpected error but no error occurred; rv=%d, aws_last_error=%d (expected %d): ", \ + FAIL_PREFIX, \ + assert_rv, \ + assert_err, \ + assert_err_expect); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("%s", #condition); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + if (assert_err != assert_err_expect) { \ + fprintf( \ + AWS_TESTING_REPORT_FD, \ + "%sIncorrect error code; aws_last_error=%d (expected %d): ", \ + FAIL_PREFIX, \ + assert_err, \ + assert_err_expect); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("%s", #condition); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_NULL(ptr, ...) \ + do { \ + /* XXX: Some tests use ASSERT_NULL on ints... */ \ + void *assert_p = (void *)(uintptr_t)(ptr); \ + if (assert_p) { \ + fprintf(AWS_TESTING_REPORT_FD, "%sExpected null but got %p: ", FAIL_PREFIX, assert_p); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("%s", #ptr); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_NOT_NULL(ptr, ...) \ + do { \ + /* XXX: Some tests use ASSERT_NULL on ints... */ \ + void *assert_p = (void *)(uintptr_t)(ptr); \ + if (!assert_p) { \ + fprintf(AWS_TESTING_REPORT_FD, "%sExpected non-null but got null: ", FAIL_PREFIX); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("%s", #ptr); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_TYP_EQUALS(type, formatarg, expected, got, ...) \ + do { \ + type assert_expected = (expected); \ + type assert_actual = (got); \ + if (assert_expected != assert_actual) { \ + fprintf( \ + AWS_TESTING_REPORT_FD, \ + "%s" formatarg " != " formatarg ": ", \ + FAIL_PREFIX, \ + assert_expected, \ + assert_actual); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("%s != %s", #expected, #got); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#ifdef _MSC_VER +# define ASSERT_INT_EQUALS(expected, got, ...) ASSERT_TYP_EQUALS(intmax_t, "%lld", expected, got, __VA_ARGS__) +# define ASSERT_UINT_EQUALS(expected, got, ...) ASSERT_TYP_EQUALS(uintmax_t, "%llu", expected, got, __VA_ARGS__) +#else +/* For comparing any signed integer types */ +# define ASSERT_INT_EQUALS(expected, got, ...) ASSERT_TYP_EQUALS(intmax_t, "%jd", expected, got, __VA_ARGS__) +/* For comparing any unsigned integer types */ +# define ASSERT_UINT_EQUALS(expected, got, ...) ASSERT_TYP_EQUALS(uintmax_t, "%ju", expected, got, __VA_ARGS__) +#endif + +#define ASSERT_PTR_EQUALS(expected, got, ...) \ + do { \ + void *assert_expected = (void *)(uintptr_t)(expected); \ + void *assert_actual = (void *)(uintptr_t)(got); \ + if (assert_expected != assert_actual) { \ + fprintf(AWS_TESTING_REPORT_FD, "%s%p != %p: ", FAIL_PREFIX, assert_expected, assert_actual); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("%s != %s", #expected, #got); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +/* note that uint8_t is promoted to unsigned int in varargs, so %02x is an acceptable format string */ +#define ASSERT_BYTE_HEX_EQUALS(expected, got, ...) ASSERT_TYP_EQUALS(uint8_t, "%02X", expected, got, __VA_ARGS__) +#define ASSERT_HEX_EQUALS(expected, got, ...) ASSERT_TYP_EQUALS(unsigned long long, "%llX", expected, got, __VA_ARGS__) + +#define ASSERT_STR_EQUALS(expected, got, ...) \ + do { \ + const char *assert_expected = (expected); \ + const char *assert_got = (got); \ + ASSERT_NOT_NULL(assert_expected); \ + ASSERT_NOT_NULL(assert_got); \ + if (strcmp(assert_expected, assert_got) != 0) { \ + fprintf( \ + AWS_TESTING_REPORT_FD, "%sExpected: \"%s\"; got: \"%s\": ", FAIL_PREFIX, assert_expected, assert_got); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("ASSERT_STR_EQUALS(%s, %s)", #expected, #got); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_BIN_ARRAYS_EQUALS(expected, expected_size, got, got_size, ...) \ + do { \ + const uint8_t *assert_ex_p = (const uint8_t *)(expected); \ + size_t assert_ex_s = (expected_size); \ + const uint8_t *assert_got_p = (const uint8_t *)(got); \ + size_t assert_got_s = (got_size); \ + if (assert_ex_s == 0 && assert_got_s == 0) { \ + break; \ + } \ + if (assert_ex_s != assert_got_s) { \ + fprintf(AWS_TESTING_REPORT_FD, "%sSize mismatch: %zu != %zu: ", FAIL_PREFIX, assert_ex_s, assert_got_s); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0( \ + "ASSERT_BIN_ARRAYS_EQUALS(%s, %s, %s, %s)", #expected, #expected_size, #got, #got_size); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + if (memcmp(assert_ex_p, assert_got_p, assert_got_s) != 0) { \ + if (assert_got_s <= 1024) { \ + for (size_t assert_i = 0; assert_i < assert_ex_s; ++assert_i) { \ + if (assert_ex_p[assert_i] != assert_got_p[assert_i]) { \ + fprintf( \ + AWS_TESTING_REPORT_FD, \ + "%sMismatch at byte[%zu]: 0x%02X != 0x%02X: ", \ + FAIL_PREFIX, \ + assert_i, \ + assert_ex_p[assert_i], \ + assert_got_p[assert_i]); \ + break; \ + } \ + } \ + } else { \ + fprintf(AWS_TESTING_REPORT_FD, "%sData mismatch: ", FAIL_PREFIX); \ + } \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0( \ + "ASSERT_BIN_ARRAYS_EQUALS(%s, %s, %s, %s)", #expected, #expected_size, #got, #got_size); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_CURSOR_VALUE_CSTRING_EQUALS(cursor, cstring, ...) \ + do { \ + const uint8_t *assert_ex_p = (const uint8_t *)((cursor).ptr); \ + size_t assert_ex_s = (cursor).len; \ + const uint8_t *assert_got_p = (const uint8_t *)cstring; \ + size_t assert_got_s = strlen(cstring); \ + if (assert_ex_s == 0 && assert_got_s == 0) { \ + break; \ + } \ + if (assert_ex_s != assert_got_s) { \ + fprintf(AWS_TESTING_REPORT_FD, "%sSize mismatch: %zu != %zu: \n", FAIL_PREFIX, assert_ex_s, assert_got_s); \ + fprintf( \ + AWS_TESTING_REPORT_FD, \ + "%sGot: \"" PRInSTR "\"; Expected: \"%s\" \n", \ + FAIL_PREFIX, \ + AWS_BYTE_CURSOR_PRI(cursor), \ + cstring); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("ASSERT_CURSOR_VALUE_STRING_EQUALS(%s, %s)", #cursor, #cstring); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + if (memcmp(assert_ex_p, assert_got_p, assert_got_s) != 0) { \ + fprintf( \ + AWS_TESTING_REPORT_FD, \ + "%sData mismatch; Got: \"" PRInSTR "\"; Expected: \"%s\" \n", \ + FAIL_PREFIX, \ + AWS_BYTE_CURSOR_PRI(cursor), \ + cstring); \ + if (!PRINT_FAIL_INTERNAL0(__VA_ARGS__)) { \ + PRINT_FAIL_INTERNAL0("ASSERT_CURSOR_VALUE_STRING_EQUALS(%s, %s)", #cursor, #cstring); \ + } \ + POSTFAIL_INTERNAL(); \ + } \ + } while (0) + +#define ASSERT_CURSOR_VALUE_STRING_EQUALS(cursor, string, ...) \ + ASSERT_CURSOR_VALUE_CSTRING_EQUALS(cursor, aws_string_c_str(string)); + +typedef int(aws_test_before_fn)(struct aws_allocator *allocator, void *ctx); +typedef int(aws_test_run_fn)(struct aws_allocator *allocator, void *ctx); +typedef int(aws_test_after_fn)(struct aws_allocator *allocator, int setup_result, void *ctx); + +struct aws_test_harness { + aws_test_before_fn *on_before; + aws_test_run_fn *run; + aws_test_after_fn *on_after; + void *ctx; + const char *test_name; + int suppress_memcheck; +}; + +#if defined(_WIN32) +# include +static LONG WINAPI s_test_print_stack_trace(struct _EXCEPTION_POINTERS *exception_pointers) { +# if !defined(AWS_HEADER_CHECKER) + aws_backtrace_print(stderr, exception_pointers); +# endif + return EXCEPTION_EXECUTE_HANDLER; +} +#elif defined(AWS_HAVE_EXECINFO) +# include +static void s_print_stack_trace(int sig, siginfo_t *sig_info, void *user_data) { + (void)sig; + (void)sig_info; + (void)user_data; +# if !defined(AWS_HEADER_CHECKER) + aws_backtrace_print(stderr, sig_info); +# endif + exit(-1); +} +#endif + +static inline int s_aws_run_test_case(struct aws_test_harness *harness) { + AWS_ASSERT(harness->run); +/* + * MSVC compiler has a weird interactive pop-up in debug whenever 'abort()' is called, which can be triggered + * by hitting any aws_assert or aws_pre_condition, causing the CI to hang. So disable the pop-up in tests. + */ +#ifdef _MSC_VER + _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); +#endif + +#if defined(_WIN32) + SetUnhandledExceptionFilter(s_test_print_stack_trace); + /* Set working directory to path to this exe */ + char cwd[512]; + DWORD len = GetModuleFileNameA(NULL, cwd, sizeof(cwd)); + DWORD idx = len - 1; + while (idx && cwd[idx] != '\\') { + idx--; + } + cwd[idx] = 0; + SetCurrentDirectory(cwd); +#elif defined(AWS_HAVE_EXECINFO) + struct sigaction sa; + memset(&sa, 0, sizeof(struct sigaction)); + sigemptyset(&sa.sa_mask); + + sa.sa_flags = SA_NODEFER; + sa.sa_sigaction = s_print_stack_trace; + + sigaction(SIGSEGV, &sa, NULL); +#endif + + /* track allocations and report leaks in tests, unless suppressed */ + struct aws_allocator *allocator = NULL; + if (harness->suppress_memcheck) { + allocator = aws_default_allocator(); + } else { + allocator = aws_mem_tracer_new(aws_default_allocator(), NULL, AWS_MEMTRACE_STACKS, 8); + } + + /* wire up a logger to stderr by default, may be replaced by some tests */ + struct aws_logger err_logger; + struct aws_logger_standard_options options; + options.file = AWS_TESTING_REPORT_FD; + options.level = AWS_LL_TRACE; + options.filename = NULL; + aws_logger_init_standard(&err_logger, aws_default_allocator(), &options); + aws_logger_set(&err_logger); + + int test_res = AWS_OP_ERR; + int setup_res = AWS_OP_SUCCESS; + if (harness->on_before) { + setup_res = harness->on_before(allocator, harness->ctx); + } + + if (!setup_res) { + test_res = harness->run(allocator, harness->ctx); + } + + if (harness->on_after) { + test_res |= harness->on_after(allocator, setup_res, harness->ctx); + } + + if (test_res != AWS_OP_SUCCESS) { + goto fail; + } + + if (!harness->suppress_memcheck) { + /* Reset the logger, as test can set their own logger and clean it up, + * but aws_mem_tracer_dump() needs a valid logger to be active */ + aws_logger_set(&err_logger); + + const size_t leaked_allocations = aws_mem_tracer_count(allocator); + const size_t leaked_bytes = aws_mem_tracer_bytes(allocator); + if (leaked_bytes) { + aws_mem_tracer_dump(allocator); + PRINT_FAIL_WITHOUT_LOCATION( + "Test leaked memory: %zu bytes %zu allocations", leaked_bytes, leaked_allocations); + goto fail; + } + + aws_mem_tracer_destroy(allocator); + } + + aws_logger_set(NULL); + aws_logger_clean_up(&err_logger); + + RETURN_SUCCESS("%s [ \033[32mOK\033[0m ]", harness->test_name); + +fail: + if (test_res == AWS_OP_SKIP) { + fprintf(AWS_TESTING_REPORT_FD, "%s [ \033[32mSKIP\033[0m ]\n", harness->test_name); + } else { + PRINT_FAIL_WITHOUT_LOCATION("%s [ \033[31mFAILED\033[0m ]", harness->test_name); + } + /* Use _Exit() to terminate without cleaning up resources. + * This prevents LeakSanitizer spam (yes, we know failing tests don't bother cleaning up). + * It also prevents errors where threads that haven't cleaned are still using the logger declared in this fn. */ + fflush(AWS_TESTING_REPORT_FD); + fflush(stdout); + fflush(stderr); + _Exit(test_res == AWS_OP_SKIP ? SKIP : FAILURE); +} + +/* Enables terminal escape sequences for text coloring on Windows. */ +/* https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences */ +#ifdef _WIN32 + +# include + +# ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +# define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +# endif + +static inline int enable_vt_mode(void) { + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); + if (hOut == INVALID_HANDLE_VALUE) { + return AWS_OP_ERR; + } + + DWORD dwMode = 0; + if (!GetConsoleMode(hOut, &dwMode)) { + return AWS_OP_ERR; + } + + dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + if (!SetConsoleMode(hOut, dwMode)) { + return AWS_OP_ERR; + } + return AWS_OP_SUCCESS; +} + +#else + +static inline int enable_vt_mode(void) { + return AWS_OP_ERR; +} + +#endif + +#define AWS_TEST_CASE_SUPRESSION(name, fn, s) \ + static int fn(struct aws_allocator *allocator, void *ctx); \ + static struct aws_test_harness name##_test = { \ + NULL, \ + fn, \ + NULL, \ + NULL, \ + #name, \ + s, \ + }; \ + int name(int argc, char *argv[]) { \ + (void)argc, (void)argv; \ + return s_aws_run_test_case(&name##_test); \ + } + +#define AWS_TEST_CASE_FIXTURE_SUPPRESSION(name, b, fn, af, c, s) \ + static int b(struct aws_allocator *allocator, void *ctx); \ + static int fn(struct aws_allocator *allocator, void *ctx); \ + static int af(struct aws_allocator *allocator, int setup_result, void *ctx); \ + static struct aws_test_harness name##_test = { \ + b, \ + fn, \ + af, \ + c, \ + #name, \ + s, \ + }; \ + int name(int argc, char *argv[]) { \ + (void)argc; \ + (void)argv; \ + return s_aws_run_test_case(&name##_test); \ + } + +#define AWS_TEST_CASE(name, fn) AWS_TEST_CASE_SUPRESSION(name, fn, 0) +#define AWS_TEST_CASE_FIXTURE(name, b, fn, af, c) AWS_TEST_CASE_FIXTURE_SUPPRESSION(name, b, fn, af, c, 0) + +#endif /* AWS_TESTING_AWS_TEST_HARNESS_H */ diff --git a/include/aws/testing/io_testing_channel.h b/include/aws/testing/io_testing_channel.h new file mode 100644 index 0000000000000000000000000000000000000000..311fbf6aef96c73a3e1e9179c3a739ab8761f3da --- /dev/null +++ b/include/aws/testing/io_testing_channel.h @@ -0,0 +1,644 @@ +#ifndef AWS_TESTING_IO_TESTING_CHANNEL_H +#define AWS_TESTING_IO_TESTING_CHANNEL_H +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include +#include +#include +#include +#include +#include + +struct testing_loop { + struct aws_allocator *allocator; + struct aws_task_scheduler scheduler; + bool mock_on_callers_thread; +}; + +static int s_testing_loop_run(struct aws_event_loop *event_loop) { + (void)event_loop; + return AWS_OP_SUCCESS; +} + +static int s_testing_loop_stop(struct aws_event_loop *event_loop) { + (void)event_loop; + return AWS_OP_SUCCESS; +} + +static int s_testing_loop_wait_for_stop_completion(struct aws_event_loop *event_loop) { + (void)event_loop; + return AWS_OP_SUCCESS; +} + +static void s_testing_loop_schedule_task_now(struct aws_event_loop *event_loop, struct aws_task *task) { + struct testing_loop *testing_loop = (struct testing_loop *)aws_event_loop_get_impl(event_loop); + aws_task_scheduler_schedule_now(&testing_loop->scheduler, task); +} + +static void s_testing_loop_schedule_task_future( + struct aws_event_loop *event_loop, + struct aws_task *task, + uint64_t run_at_nanos) { + + struct testing_loop *testing_loop = (struct testing_loop *)aws_event_loop_get_impl(event_loop); + aws_task_scheduler_schedule_future(&testing_loop->scheduler, task, run_at_nanos); +} + +static void s_testing_loop_cancel_task(struct aws_event_loop *event_loop, struct aws_task *task) { + struct testing_loop *testing_loop = (struct testing_loop *)aws_event_loop_get_impl(event_loop); + aws_task_scheduler_cancel_task(&testing_loop->scheduler, task); +} + +static bool s_testing_loop_is_on_callers_thread(struct aws_event_loop *event_loop) { + struct testing_loop *testing_loop = (struct testing_loop *)aws_event_loop_get_impl(event_loop); + return testing_loop->mock_on_callers_thread; +} + +static void s_testing_loop_start_destroy(struct aws_event_loop *event_loop) { + (void)event_loop; +} + +static void s_testing_loop_complete_destroy(struct aws_event_loop *event_loop) { + struct testing_loop *testing_loop = (struct testing_loop *)aws_event_loop_get_impl(event_loop); + struct aws_allocator *allocator = testing_loop->allocator; + aws_task_scheduler_clean_up(&testing_loop->scheduler); + aws_mem_release(allocator, testing_loop); + aws_event_loop_clean_up_base(event_loop); + aws_mem_release(allocator, event_loop); +} + +static struct aws_event_loop_vtable s_testing_loop_vtable = { + .start_destroy = s_testing_loop_start_destroy, + .complete_destroy = s_testing_loop_complete_destroy, + .is_on_callers_thread = s_testing_loop_is_on_callers_thread, + .run = s_testing_loop_run, + .schedule_task_now = s_testing_loop_schedule_task_now, + .schedule_task_future = s_testing_loop_schedule_task_future, + .cancel_task = s_testing_loop_cancel_task, + .stop = s_testing_loop_stop, + .wait_for_stop_completion = s_testing_loop_wait_for_stop_completion, +}; + +static struct aws_event_loop *s_testing_loop_new(struct aws_allocator *allocator, aws_io_clock_fn clock) { + struct testing_loop *testing_loop = + (struct testing_loop *)aws_mem_calloc(allocator, 1, sizeof(struct testing_loop)); + + aws_task_scheduler_init(&testing_loop->scheduler, allocator); + testing_loop->mock_on_callers_thread = true; + testing_loop->allocator = allocator; + + return aws_event_loop_new_base(allocator, clock, &s_testing_loop_vtable, testing_loop); +} + +typedef void(testing_channel_handler_on_shutdown_fn)( + enum aws_channel_direction dir, + int error_code, + bool free_scarce_resources_immediately, + void *user_data); + +struct testing_channel_handler { + struct aws_linked_list messages; + size_t latest_window_update; + size_t initial_window; + bool complete_write_immediately; + int complete_write_error_code; + testing_channel_handler_on_shutdown_fn *on_shutdown; + void *on_shutdown_user_data; + struct aws_crt_statistics_socket stats; +}; + +static int s_testing_channel_handler_process_read_message( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + struct aws_io_message *message) { + (void)handler; + (void)slot; + (void)message; + + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + aws_linked_list_push_back(&testing_handler->messages, &message->queueing_handle); + return AWS_OP_SUCCESS; +} + +static int s_testing_channel_handler_process_write_message( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + struct aws_io_message *message) { + (void)slot; + + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + aws_linked_list_push_back(&testing_handler->messages, &message->queueing_handle); + + /* Invoke completion callback if this is the left-most handler */ + if (message->on_completion && !slot->adj_left && testing_handler->complete_write_immediately) { + message->on_completion(slot->channel, message, testing_handler->complete_write_error_code, message->user_data); + message->on_completion = NULL; + } + + return AWS_OP_SUCCESS; +} + +static int s_testing_channel_handler_increment_read_window( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + size_t size) { + (void)slot; + + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + testing_handler->latest_window_update = size; + return AWS_OP_SUCCESS; +} + +static int s_testing_channel_handler_shutdown( + struct aws_channel_handler *handler, + struct aws_channel_slot *slot, + enum aws_channel_direction dir, + int error_code, + bool free_scarce_resources_immediately) { + + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + + /* If user has registered a callback, invoke it */ + if (testing_handler->on_shutdown) { + testing_handler->on_shutdown( + dir, error_code, free_scarce_resources_immediately, testing_handler->on_shutdown_user_data); + } + + if (dir == AWS_CHANNEL_DIR_WRITE) { + if (!slot->adj_left) { + /* Invoke the on_completion callbacks for any queued messages */ + struct aws_linked_list_node *node = aws_linked_list_begin(&testing_handler->messages); + while (node != aws_linked_list_end(&testing_handler->messages)) { + struct aws_io_message *msg = AWS_CONTAINER_OF(node, struct aws_io_message, queueing_handle); + + if (msg->on_completion) { + msg->on_completion(slot->channel, msg, AWS_IO_SOCKET_CLOSED, msg->user_data); + msg->on_completion = NULL; + } + + node = aws_linked_list_next(node); + } + } + } + + return aws_channel_slot_on_handler_shutdown_complete(slot, dir, error_code, free_scarce_resources_immediately); +} + +static size_t s_testing_channel_handler_initial_window_size(struct aws_channel_handler *handler) { + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + return testing_handler->initial_window; +} + +static size_t s_testing_channel_handler_message_overhead(struct aws_channel_handler *handler) { + (void)handler; + return 0; +} + +static void s_testing_channel_handler_destroy(struct aws_channel_handler *handler) { + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + + while (!aws_linked_list_empty(&testing_handler->messages)) { + struct aws_linked_list_node *node = aws_linked_list_pop_front(&testing_handler->messages); + struct aws_io_message *msg = AWS_CONTAINER_OF(node, struct aws_io_message, queueing_handle); + aws_mem_release(msg->allocator, msg); + } + + aws_mem_release(handler->alloc, testing_handler); + aws_mem_release(handler->alloc, handler); +} + +static void s_testing_channel_handler_reset_statistics(struct aws_channel_handler *handler) { + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + + aws_crt_statistics_socket_reset(&testing_handler->stats); +} + +static void s_testing_channel_handler_gather_statistics( + struct aws_channel_handler *handler, + struct aws_array_list *stats) { + struct testing_channel_handler *testing_handler = (struct testing_channel_handler *)handler->impl; + + void *stats_base = &testing_handler->stats; + aws_array_list_push_back(stats, &stats_base); +} + +static struct aws_channel_handler_vtable s_testing_channel_handler_vtable = { + .process_read_message = s_testing_channel_handler_process_read_message, + .process_write_message = s_testing_channel_handler_process_write_message, + .increment_read_window = s_testing_channel_handler_increment_read_window, + .shutdown = s_testing_channel_handler_shutdown, + .initial_window_size = s_testing_channel_handler_initial_window_size, + .message_overhead = s_testing_channel_handler_message_overhead, + .destroy = s_testing_channel_handler_destroy, + .gather_statistics = s_testing_channel_handler_gather_statistics, + .reset_statistics = s_testing_channel_handler_reset_statistics, +}; + +static struct aws_channel_handler *s_new_testing_channel_handler( + struct aws_allocator *allocator, + size_t initial_window) { + struct aws_channel_handler *handler = + (struct aws_channel_handler *)aws_mem_calloc(allocator, 1, sizeof(struct aws_channel_handler)); + struct testing_channel_handler *testing_handler = + (struct testing_channel_handler *)aws_mem_calloc(allocator, 1, sizeof(struct testing_channel_handler)); + aws_linked_list_init(&testing_handler->messages); + testing_handler->initial_window = initial_window; + testing_handler->latest_window_update = 0; + testing_handler->complete_write_immediately = true; + testing_handler->complete_write_error_code = AWS_ERROR_SUCCESS; + handler->impl = testing_handler; + handler->vtable = &s_testing_channel_handler_vtable; + handler->alloc = allocator; + + return handler; +} + +struct testing_channel { + struct aws_event_loop *loop; + struct testing_loop *loop_impl; + struct aws_channel *channel; + struct testing_channel_handler *left_handler_impl; + struct testing_channel_handler *right_handler_impl; + struct aws_channel_slot *left_handler_slot; + struct aws_channel_slot *right_handler_slot; + + void (*channel_shutdown)(int error_code, void *user_data); + void *channel_shutdown_user_data; + + bool channel_setup_completed; + bool channel_shutdown_completed; + int channel_shutdown_error_code; +}; + +static void s_testing_channel_on_setup_completed(struct aws_channel *channel, int error_code, void *user_data) { + (void)channel; + (void)error_code; + struct testing_channel *testing = (struct testing_channel *)user_data; + testing->channel_setup_completed = true; +} + +static void s_testing_channel_on_shutdown_completed(struct aws_channel *channel, int error_code, void *user_data) { + (void)channel; + (void)error_code; + struct testing_channel *testing = (struct testing_channel *)user_data; + testing->channel_shutdown_completed = true; + testing->channel_shutdown_error_code = error_code; + + if (testing->channel_shutdown) { + testing->channel_shutdown(error_code, testing->channel_shutdown_user_data); + } +} + +/** API for testing, use this for testing purely your channel handlers and nothing else. Because of that, the s_ + * convention isn't used on the functions (since they're intended for you to call). */ + +/** when you want to test the read path of your handler, call this with the message you want it to read. */ +static inline int testing_channel_push_read_message(struct testing_channel *testing, struct aws_io_message *message) { + return aws_channel_slot_send_message(testing->left_handler_slot, message, AWS_CHANNEL_DIR_READ); +} + +/** when you want to test the write path of your handler, call this with the message you want it to write. + * A downstream handler must have been installed */ +static inline int testing_channel_push_write_message(struct testing_channel *testing, struct aws_io_message *message) { + ASSERT_NOT_NULL(testing->right_handler_slot); + return aws_channel_slot_send_message(testing->right_handler_slot, message, AWS_CHANNEL_DIR_WRITE); +} + +/** when you want to test the write output of your handler, call this, get the queue and iterate the messages. */ +static inline struct aws_linked_list *testing_channel_get_written_message_queue(struct testing_channel *testing) { + return &testing->left_handler_impl->messages; +} + +/** Set whether written messages have their on_complete callbacks invoked immediately. + * The on_complete callback will be cleared after it is invoked. */ +static inline void testing_channel_complete_written_messages_immediately( + struct testing_channel *testing, + bool complete_immediately, + int complete_error_code) { + + testing->left_handler_impl->complete_write_immediately = complete_immediately; + testing->left_handler_impl->complete_write_error_code = complete_error_code; +} + +/** when you want to test the read output of your handler, call this, get the queue and iterate the messages. + * A downstream handler must have been installed */ +static inline struct aws_linked_list *testing_channel_get_read_message_queue(struct testing_channel *testing) { + AWS_ASSERT(testing->right_handler_impl); + return &testing->right_handler_impl->messages; +} + +/** When you want to see what the latest window update issues from your channel handler was, call this. */ +static inline size_t testing_channel_last_window_update(struct testing_channel *testing) { + return testing->left_handler_impl->latest_window_update; +} + +/** When you want the downstream handler to issue a window update */ +static inline int testing_channel_increment_read_window(struct testing_channel *testing, size_t size) { + ASSERT_NOT_NULL(testing->right_handler_slot); + return aws_channel_slot_increment_read_window(testing->right_handler_slot, size); +} + +/** Executes all currently scheduled tasks whose time has come. + * Use testing_channel_drain_queued_tasks() to repeatedly run tasks until only future-tasks remain. + */ +static inline void testing_channel_run_currently_queued_tasks(struct testing_channel *testing) { + AWS_ASSERT(aws_channel_thread_is_callers_thread(testing->channel)); + + uint64_t now = 0; + aws_event_loop_current_clock_time(testing->loop, &now); + aws_task_scheduler_run_all(&testing->loop_impl->scheduler, now); +} + +/** Repeatedly executes scheduled tasks until only those in the future remain. + * This covers the common case where there's a chain reaction of now-tasks scheduling further now-tasks. + */ +static inline void testing_channel_drain_queued_tasks(struct testing_channel *testing) { + AWS_ASSERT(aws_channel_thread_is_callers_thread(testing->channel)); + + uint64_t now = 0; + uint64_t next_task_time = 0; + size_t count = 0; + + while (true) { + aws_event_loop_current_clock_time(testing->loop, &now); + if (aws_task_scheduler_has_tasks(&testing->loop_impl->scheduler, &next_task_time) && (next_task_time <= now)) { + aws_task_scheduler_run_all(&testing->loop_impl->scheduler, now); + } else { + break; + } + + /* NOTE: This will loop infinitely if there's a task the perpetually re-schedules another task. + * Consider capping the number of loops if we want to support that behavior. */ + if ((++count % 1000) == 0) { + AWS_LOGF_WARN( + AWS_LS_IO_CHANNEL, + "id=%p: testing_channel_drain_queued_tasks() has looped %zu times.", + (void *)testing->channel, + count); + } + } +} +/** When you want to force the "not on channel thread path" for your handler, set 'on_users_thread' to false. + * when you want to undo that, set it back to true. If you set it to false, you'll need to call + * 'testing_channel_execute_queued_tasks()' to invoke the tasks that ended up being scheduled. */ +static inline void testing_channel_set_is_on_users_thread(struct testing_channel *testing, bool on_users_thread) { + testing->loop_impl->mock_on_callers_thread = on_users_thread; +} + +struct aws_testing_channel_options { + aws_io_clock_fn *clock_fn; +}; + +static inline int testing_channel_init( + struct testing_channel *testing, + struct aws_allocator *allocator, + struct aws_testing_channel_options *options) { + AWS_ZERO_STRUCT(*testing); + + testing->loop = s_testing_loop_new(allocator, options->clock_fn); + testing->loop_impl = (struct testing_loop *)aws_event_loop_get_impl(testing->loop); + + struct aws_channel_options args = { + .on_setup_completed = s_testing_channel_on_setup_completed, + .on_shutdown_completed = s_testing_channel_on_shutdown_completed, + .setup_user_data = testing, + .shutdown_user_data = testing, + .event_loop = testing->loop, + .enable_read_back_pressure = true, + }; + + testing->channel = aws_channel_new(allocator, &args); + + /* Wait for channel to finish setup */ + testing_channel_drain_queued_tasks(testing); + ASSERT_TRUE(testing->channel_setup_completed); + + testing->left_handler_slot = aws_channel_slot_new(testing->channel); + struct aws_channel_handler *handler = + (struct aws_channel_handler *)s_new_testing_channel_handler(allocator, 16 * 1024); + testing->left_handler_impl = (struct testing_channel_handler *)handler->impl; + ASSERT_SUCCESS(aws_channel_slot_set_handler(testing->left_handler_slot, handler)); + + return AWS_OP_SUCCESS; +} + +static inline int testing_channel_clean_up(struct testing_channel *testing) { + aws_channel_shutdown(testing->channel, AWS_ERROR_SUCCESS); + + /* Wait for channel to finish shutdown */ + testing_channel_drain_queued_tasks(testing); + ASSERT_TRUE(testing->channel_shutdown_completed); + + aws_channel_destroy(testing->channel); + + /* event_loop can't be destroyed from its own thread */ + testing_channel_set_is_on_users_thread(testing, false); + aws_event_loop_destroy(testing->loop); + + return AWS_OP_SUCCESS; +} + +/** When you want to test your handler with a downstream handler installed to the right. */ +static inline int testing_channel_install_downstream_handler(struct testing_channel *testing, size_t initial_window) { + ASSERT_NULL(testing->right_handler_slot); + + testing->right_handler_slot = aws_channel_slot_new(testing->channel); + ASSERT_NOT_NULL(testing->right_handler_slot); + ASSERT_SUCCESS(aws_channel_slot_insert_end(testing->channel, testing->right_handler_slot)); + + struct aws_channel_handler *handler = + s_new_testing_channel_handler(testing->left_handler_slot->alloc, initial_window); + ASSERT_NOT_NULL(handler); + testing->right_handler_impl = (struct testing_channel_handler *)handler->impl; + ASSERT_SUCCESS(aws_channel_slot_set_handler(testing->right_handler_slot, handler)); + + return AWS_OP_SUCCESS; +} + +/** Return whether channel is completely shut down */ +static inline bool testing_channel_is_shutdown_completed(const struct testing_channel *testing) { + return testing->channel_shutdown_completed; +} + +/** Return channel's shutdown error_code */ +static inline int testing_channel_get_shutdown_error_code(const struct testing_channel *testing) { + AWS_ASSERT(testing->channel_shutdown_completed); + return testing->channel_shutdown_error_code; +} + +/** + * Set a callback which is invoked during the handler's shutdown, + * once in the read direction and again in the write direction. + * Use this to inject actions that might occur in the middle of channel shutdown. + */ +static inline void testing_channel_set_downstream_handler_shutdown_callback( + struct testing_channel *testing, + testing_channel_handler_on_shutdown_fn *on_shutdown, + void *user_data) { + + AWS_ASSERT(testing->right_handler_impl); + testing->right_handler_impl->on_shutdown = on_shutdown; + testing->right_handler_impl->on_shutdown_user_data = user_data; +} + +/* Pop first message from queue and compare its contents to expected data. */ +static inline int testing_channel_check_written_message( + struct testing_channel *channel, + struct aws_byte_cursor expected) { + struct aws_linked_list *msgs = testing_channel_get_written_message_queue(channel); + ASSERT_TRUE(!aws_linked_list_empty(msgs)); + struct aws_linked_list_node *node = aws_linked_list_pop_front(msgs); + struct aws_io_message *msg = AWS_CONTAINER_OF(node, struct aws_io_message, queueing_handle); + + ASSERT_BIN_ARRAYS_EQUALS(expected.ptr, expected.len, msg->message_data.buffer, msg->message_data.len); + + aws_mem_release(msg->allocator, msg); + + return AWS_OP_SUCCESS; +} + +/* Pop first message from queue and compare its contents to expected data. */ +static inline int testing_channel_check_written_message_str(struct testing_channel *channel, const char *expected) { + return testing_channel_check_written_message(channel, aws_byte_cursor_from_c_str(expected)); +} + +/* copies all messages in a list into a buffer, cleans up messages*/ +static inline int testing_channel_drain_messages(struct aws_linked_list *msgs, struct aws_byte_buf *buffer) { + + while (!aws_linked_list_empty(msgs)) { + struct aws_linked_list_node *node = aws_linked_list_pop_front(msgs); + struct aws_io_message *msg = AWS_CONTAINER_OF(node, struct aws_io_message, queueing_handle); + + struct aws_byte_cursor msg_cursor = aws_byte_cursor_from_buf(&msg->message_data); + aws_byte_buf_append_dynamic(buffer, &msg_cursor); + + aws_mem_release(msg->allocator, msg); + } + + return AWS_OP_SUCCESS; +} + +/* Pop all messages from queue and compare their contents to expected data */ +static inline int testing_channel_check_messages_ex( + struct aws_linked_list *msgs, + struct aws_allocator *allocator, + struct aws_byte_cursor expected) { + struct aws_byte_buf all_msgs; + ASSERT_SUCCESS(aws_byte_buf_init(&all_msgs, allocator, 1024)); + + ASSERT_SUCCESS(testing_channel_drain_messages(msgs, &all_msgs)); + + ASSERT_BIN_ARRAYS_EQUALS(expected.ptr, expected.len, all_msgs.buffer, all_msgs.len); + aws_byte_buf_clean_up(&all_msgs); + return AWS_OP_SUCCESS; +} + +/* Check contents of all messages sent in the write direction. */ +static inline int testing_channel_check_written_messages( + struct testing_channel *channel, + struct aws_allocator *allocator, + struct aws_byte_cursor expected) { + + struct aws_linked_list *msgs = testing_channel_get_written_message_queue(channel); + return testing_channel_check_messages_ex(msgs, allocator, expected); +} + +/* Check contents of all messages sent in the write direction. */ +static inline int testing_channel_check_written_messages_str( + struct testing_channel *channel, + struct aws_allocator *allocator, + const char *expected) { + + return testing_channel_check_written_messages(channel, allocator, aws_byte_cursor_from_c_str(expected)); +} + +/* Extract contents of all messages sent in the write direction. */ +static inline int testing_channel_drain_written_messages(struct testing_channel *channel, struct aws_byte_buf *output) { + struct aws_linked_list *msgs = testing_channel_get_written_message_queue(channel); + ASSERT_SUCCESS(testing_channel_drain_messages(msgs, output)); + + return AWS_OP_SUCCESS; +} + +/* Check contents of all read-messages sent in the read direction by a midchannel http-handler */ +static inline int testing_channel_check_midchannel_read_messages( + struct testing_channel *channel, + struct aws_allocator *allocator, + struct aws_byte_cursor expected) { + + struct aws_linked_list *msgs = testing_channel_get_read_message_queue(channel); + return testing_channel_check_messages_ex(msgs, allocator, expected); +} + +/* Check contents of all read-messages sent in the read direction by a midchannel http-handler */ +static inline int testing_channel_check_midchannel_read_messages_str( + struct testing_channel *channel, + struct aws_allocator *allocator, + const char *expected) { + + return testing_channel_check_midchannel_read_messages(channel, allocator, aws_byte_cursor_from_c_str(expected)); +} + +/* For sending an aws_io_message into the channel, in the write or read direction */ +static inline int testing_channel_send_data( + struct testing_channel *channel, + struct aws_byte_cursor data, + enum aws_channel_direction dir, + bool ignore_send_message_errors) { + + struct aws_io_message *msg = + aws_channel_acquire_message_from_pool(channel->channel, AWS_IO_MESSAGE_APPLICATION_DATA, data.len); + ASSERT_NOT_NULL(msg); + + ASSERT_TRUE(aws_byte_buf_write_from_whole_cursor(&msg->message_data, data)); + + int err; + if (dir == AWS_CHANNEL_DIR_READ) { + err = testing_channel_push_read_message(channel, msg); + } else { + err = testing_channel_push_write_message(channel, msg); + } + + if (err) { + /* If an error happens, clean the message here. Else, the recipient of the message will take the ownership */ + aws_mem_release(msg->allocator, msg); + } + + if (!ignore_send_message_errors) { + ASSERT_SUCCESS(err); + } + + return AWS_OP_SUCCESS; +} + +/** Create an aws_io_message, containing the following data, and pushes it up the channel in the read direction */ +static inline int testing_channel_push_read_data(struct testing_channel *channel, struct aws_byte_cursor data) { + return testing_channel_send_data(channel, data, AWS_CHANNEL_DIR_READ, false); +} + +/** Create an aws_io_message, containing the following data, and pushes it up the channel in the read direction */ +static inline int testing_channel_push_read_str(struct testing_channel *channel, const char *str) { + return testing_channel_send_data(channel, aws_byte_cursor_from_c_str(str), AWS_CHANNEL_DIR_READ, false); +} + +/** Create an aws_io_message, containing the following data. + * Tries to push it up the channel in the read direction, but don't assert if the message can't be sent. + * Useful for testing data that arrives during handler shutdown */ +static inline int testing_channel_push_read_str_ignore_errors(struct testing_channel *channel, const char *str) { + return testing_channel_send_data(channel, aws_byte_cursor_from_c_str(str), AWS_CHANNEL_DIR_READ, true); +} + +/** Create an aws_io_message, containing the following data, and pushes it up the channel in the write direction */ +static inline int testing_channel_push_write_data(struct testing_channel *channel, struct aws_byte_cursor data) { + return testing_channel_send_data(channel, data, AWS_CHANNEL_DIR_WRITE, false); +} + +/** Create an aws_io_message, containing the following data, and pushes it up the channel in the write direction */ +static inline int testing_channel_push_write_str(struct testing_channel *channel, const char *str) { + return testing_channel_send_data(channel, aws_byte_cursor_from_c_str(str), AWS_CHANNEL_DIR_WRITE, false); +} + +#endif /* AWS_TESTING_IO_TESTING_CHANNEL_H */ diff --git a/include/aws/testing/stream_tester.h b/include/aws/testing/stream_tester.h new file mode 100644 index 0000000000000000000000000000000000000000..faad16a6d14314ecc19bc0948680dd1b5066944e --- /dev/null +++ b/include/aws/testing/stream_tester.h @@ -0,0 +1,227 @@ +#ifndef AWS_TESTING_STREAM_TESTER_H +#define AWS_TESTING_STREAM_TESTER_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#ifndef AWS_UNSTABLE_TESTING_API +# error This code is designed for use by AWS owned libraries for the AWS C99 SDK. \ +You are welcome to use it, but we make no promises on the stability of this API. \ +To enable use of this code, set the AWS_UNSTABLE_TESTING_API compiler flag. +#endif + +/** + * Use aws_input_stream tester to test edge cases in systems that take input streams. + * You can make it behave in specific weird ways (e.g. fail on 3rd read). + * + * There are a few ways to set what gets streamed. + * - source_bytes: if set, stream these bytes. + * - source_stream: if set, wrap this stream (but insert weird behavior like failing on 3rd read). + * - autogen_length: autogen streaming content N bytes in length. + */ + +enum aws_autogen_style { + AWS_AUTOGEN_LOREM_IPSUM, + AWS_AUTOGEN_ALPHABET, + AWS_AUTOGEN_NUMBERS, +}; + +struct aws_input_stream_tester_options { + /* bytes to be streamed. + * the stream copies these to its own internal buffer. + * or you can set the autogen_length */ + struct aws_byte_cursor source_bytes; + + /* wrap another stream */ + struct aws_input_stream *source_stream; + + /* if non-zero, autogen streaming content N bytes in length */ + size_t autogen_length; + + /* style of contents (if using autogen) */ + enum aws_autogen_style autogen_style; + + /* if non-zero, read at most N bytes per read() */ + size_t max_bytes_per_read; + + /* if non-zero, read 0 bytes the Nth time read() is called */ + size_t read_zero_bytes_on_nth_read; + + /* If false, EOF is reported by the read() which produces the last few bytes. + * If true, EOF isn't reported until there's one more read(), producing zero bytes. + * This emulates an underlying stream that reports EOF by reading 0 bytes */ + bool eof_requires_extra_read; + + /* if non-zero, fail the Nth time read() is called, raising `fail_with_error_code` */ + size_t fail_on_nth_read; + + /* error-code to raise if failing on purpose */ + int fail_with_error_code; +}; + +struct aws_input_stream_tester { + struct aws_input_stream base; + struct aws_allocator *alloc; + struct aws_input_stream_tester_options options; + struct aws_byte_buf source_buf; + struct aws_input_stream *source_stream; + size_t read_count; + bool num_bytes_last_read; /* number of bytes read in the most recent successful read() */ + uint64_t total_bytes_read; +}; + +static inline int s_input_stream_tester_seek( + struct aws_input_stream *stream, + int64_t offset, + enum aws_stream_seek_basis basis) { + + struct aws_input_stream_tester *impl = (struct aws_input_stream_tester *)stream->impl; + return aws_input_stream_seek(impl->source_stream, offset, basis); +} + +static inline int s_input_stream_tester_read(struct aws_input_stream *stream, struct aws_byte_buf *original_dest) { + struct aws_input_stream_tester *impl = (struct aws_input_stream_tester *)stream->impl; + + impl->read_count++; + + /* if we're configured to fail, then do it */ + if (impl->read_count == impl->options.fail_on_nth_read) { + AWS_FATAL_ASSERT(impl->options.fail_with_error_code != 0); + return aws_raise_error(impl->options.fail_with_error_code); + } + + /* cap how much is read, if that's how we're configured */ + size_t bytes_to_read = original_dest->capacity - original_dest->len; + if (impl->options.max_bytes_per_read != 0) { + bytes_to_read = aws_min_size(bytes_to_read, impl->options.max_bytes_per_read); + } + + if (impl->read_count == impl->options.read_zero_bytes_on_nth_read) { + bytes_to_read = 0; + } + + /* pass artificially capped buffer to actual stream */ + struct aws_byte_buf capped_buf = + aws_byte_buf_from_empty_array(original_dest->buffer + original_dest->len, bytes_to_read); + + if (aws_input_stream_read(impl->source_stream, &capped_buf)) { + return AWS_OP_ERR; + } + + size_t bytes_actually_read = capped_buf.len; + original_dest->len += bytes_actually_read; + impl->num_bytes_last_read = bytes_actually_read; + impl->total_bytes_read += bytes_actually_read; + + return AWS_OP_SUCCESS; +} + +static inline int s_input_stream_tester_get_status(struct aws_input_stream *stream, struct aws_stream_status *status) { + struct aws_input_stream_tester *impl = (struct aws_input_stream_tester *)stream->impl; + if (aws_input_stream_get_status(impl->source_stream, status)) { + return AWS_OP_ERR; + } + + /* if we're emulating a stream that requires an additional 0 byte read to realize it's EOF */ + if (impl->options.eof_requires_extra_read) { + if (impl->num_bytes_last_read > 0) { + status->is_end_of_stream = false; + } + } + + return AWS_OP_SUCCESS; +} + +static inline int s_input_stream_tester_get_length(struct aws_input_stream *stream, int64_t *out_length) { + struct aws_input_stream_tester *impl = (struct aws_input_stream_tester *)stream->impl; + return aws_input_stream_get_length(impl->source_stream, out_length); +} + +static struct aws_input_stream_vtable s_input_stream_tester_vtable = { + .seek = s_input_stream_tester_seek, + .read = s_input_stream_tester_read, + .get_status = s_input_stream_tester_get_status, + .get_length = s_input_stream_tester_get_length, +}; + +/* init byte-buf and fill it autogenned content */ +static inline void s_byte_buf_init_autogenned( + struct aws_byte_buf *buf, + struct aws_allocator *alloc, + size_t length, + enum aws_autogen_style style) { + + aws_byte_buf_init(buf, alloc, length); + struct aws_byte_cursor pattern = {0}; + switch (style) { + case AWS_AUTOGEN_LOREM_IPSUM: + pattern = aws_byte_cursor_from_c_str( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore " + "et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " + "aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse " + "cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa " + "qui officia deserunt mollit anim id est laborum. "); + break; + case AWS_AUTOGEN_ALPHABET: + pattern = aws_byte_cursor_from_c_str("abcdefghijklmnopqrstuvwxyz"); + break; + case AWS_AUTOGEN_NUMBERS: + pattern = aws_byte_cursor_from_c_str("1234567890"); + break; + } + + struct aws_byte_cursor pattern_cursor = {0}; + while (buf->len < buf->capacity) { + if (pattern_cursor.len == 0) { + pattern_cursor = pattern; + } + aws_byte_buf_write_to_capacity(buf, &pattern_cursor); + } +} + +static inline uint64_t aws_input_stream_tester_total_bytes_read(const struct aws_input_stream *stream) { + const struct aws_input_stream_tester *impl = (const struct aws_input_stream_tester *)stream->impl; + return impl->total_bytes_read; +} + +static inline void s_input_stream_tester_destroy(void *user_data) { + struct aws_input_stream_tester *impl = (struct aws_input_stream_tester *)user_data; + aws_input_stream_release(impl->source_stream); + aws_byte_buf_clean_up(&impl->source_buf); + aws_mem_release(impl->alloc, impl); +} + +static inline struct aws_input_stream *aws_input_stream_new_tester( + struct aws_allocator *alloc, + const struct aws_input_stream_tester_options *options) { + + struct aws_input_stream_tester *impl = + (struct aws_input_stream_tester *)aws_mem_calloc(alloc, 1, sizeof(struct aws_input_stream_tester)); + impl->base.impl = impl; + impl->base.vtable = &s_input_stream_tester_vtable; + aws_ref_count_init(&impl->base.ref_count, impl, s_input_stream_tester_destroy); + impl->alloc = alloc; + impl->options = *options; + + if (options->source_stream != NULL) { + AWS_FATAL_ASSERT((options->autogen_length == 0) && (options->source_bytes.len == 0)); + impl->source_stream = aws_input_stream_acquire(options->source_stream); + } else { + if (options->autogen_length > 0) { + AWS_FATAL_ASSERT(options->source_bytes.len == 0); + s_byte_buf_init_autogenned(&impl->source_buf, alloc, options->autogen_length, options->autogen_style); + } else { + aws_byte_buf_init_copy_from_cursor(&impl->source_buf, alloc, options->source_bytes); + } + struct aws_byte_cursor source_buf_cursor = aws_byte_cursor_from_buf(&impl->source_buf); + impl->source_stream = aws_input_stream_new_from_cursor(alloc, &source_buf_cursor); + AWS_FATAL_ASSERT(impl->source_stream); + } + + return &impl->base; +} + +#endif /* AWS_TESTING_STREAM_TESTER_H */ diff --git a/include/aws/transfer/TransferHandle.h b/include/aws/transfer/TransferHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..c96f3a358d4feb582c70f27478b403ec1e57b974 --- /dev/null +++ b/include/aws/transfer/TransferHandle.h @@ -0,0 +1,429 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Aws +{ + namespace Utils + { + template < typename T > class Array; + } + + namespace Transfer + { + class TransferHandle; + + typedef std::function CreateDownloadStreamCallback; + + static const char CLASS_TAG[] = "TransferManager"; + + struct DownloadConfiguration + { + DownloadConfiguration() : + versionId("") + {} + + Aws::String versionId; + + // TBI: controls for in-memory parts vs. resumable file-based parts with state serialization to/from file + }; + + class AWS_TRANSFER_API PartState + { + public: + PartState(); + PartState(int partId, uint64_t bestProgressInBytes, uint64_t sizeInBytes, bool lastPart = false); + + int GetPartId() const { return m_partId; } + + uint64_t GetBestProgressInBytes() const { return m_bestProgressInBytes; } + void SetBestProgressInBytes(uint64_t progressInBytes) { m_bestProgressInBytes = progressInBytes; } + + uint64_t GetSizeInBytes() const { return m_sizeInBytes; } + void SetSizeInBytes(uint64_t sizeInBytes) { m_sizeInBytes = sizeInBytes; } + + void Reset(); + + void OnDataTransferred(uint64_t amount, const std::shared_ptr &transferHandle); + + void SetETag(const Aws::String& eTag) { m_eTag = eTag; } + const Aws::String& GetETag() const { return m_eTag; } + + Aws::IOStream *GetDownloadPartStream() const { return m_downloadPartStream; } + void SetDownloadPartStream(Aws::IOStream *downloadPartStream) { m_downloadPartStream = downloadPartStream; } + + unsigned char* GetDownloadBuffer() const { return m_downloadBuffer; } + void SetDownloadBuffer(unsigned char* downloadBuffer) { m_downloadBuffer = downloadBuffer; } + + void SetRangeBegin(uint64_t rangeBegin) { m_rangeBegin = rangeBegin; } + uint64_t GetRangeBegin() const { return m_rangeBegin; } + + bool IsLastPart() { return m_lastPart; } + void SetLastPart() { m_lastPart = true; } + + Aws::String GetChecksum() const { return m_checksum; }; + void SetChecksum(const Aws::String& checksum) { m_checksum = checksum; } + private: + + int m_partId = 0; + + Aws::String m_eTag; + uint64_t m_currentProgressInBytes = 0; + uint64_t m_bestProgressInBytes = 0; + uint64_t m_sizeInBytes = 0; + uint64_t m_rangeBegin = 0; + + std::atomic m_downloadPartStream; + std::atomic m_downloadBuffer; + bool m_lastPart = false; + Aws::String m_checksum; + }; + + using PartPointer = std::shared_ptr< PartState >; + using PartStateMap = Aws::Map< int, PartPointer >; + + enum class TransferStatus + { + //this value is only used for directory synchronization + EXACT_OBJECT_ALREADY_EXISTS, + //Operation is still queued and has not begun processing + NOT_STARTED, + //Operation is now running + IN_PROGRESS, + //Operation was canceled. A Canceled operation can still be retried + CANCELED, + //Operation failed, A failed operation can still be retried. + FAILED, + //Operation was successful + COMPLETED, + //Operation either failed or was canceled and a user deleted the multipart upload from S3. + ABORTED + }; + + enum class TransferDirection + { + UPLOAD, + DOWNLOAD + }; + + /** + * This is the interface for interacting with an in-process transfer. All operations from TransferManager return an instance of this class. + * In addition to the status of the transfer and details about what operation is being performed, this class also has the Cancel() operation which is + * used to cancel a transfer, and WaitUntilCompleted() which will cause the calling thread to block until the transfer is finished. + * + * In the context that by the time you are using this class, it is thread safe. + */ + class AWS_TRANSFER_API TransferHandle + { + public: + /** + * Initialize with required information for an UPLOAD + */ + TransferHandle(const Aws::String& bucketName, const Aws::String& keyName, uint64_t totalSize, const Aws::String& targetFilePath = ""); + + /** + * Initialize with required information for a DOWNLOAD + */ + TransferHandle(const Aws::String& bucketName, const Aws::String& keyName, const Aws::String& targetFilePath = ""); + + /** + * Alternate DOWNLOAD constructor + */ + TransferHandle(const Aws::String& bucketName, const Aws::String& keyName, CreateDownloadStreamCallback createDownloadStreamFn, const Aws::String& targetFilePath = ""); + + /** + * Alternate DOWNLOAD constructor + */ + TransferHandle(const Aws::String& bucketName, const Aws::String& keyName, + const uint64_t fileOffset, const uint64_t downloadBytes, + CreateDownloadStreamCallback createDownloadStreamFn, const Aws::String& targetFilePath = ""); + + + ~TransferHandle(); + + /** + * Whether or not this transfer is being performed using parallel parts via a multi-part s3 api. + */ + inline bool IsMultipart() const { return m_isMultipart.load(); } + /** + * Whether or not this transfer is being performed using parallel parts via a multi-part s3 api. + */ + inline void SetIsMultipart(bool value) { m_isMultipart.store(value); } + /** + * If this is a multi-part transfer, this is the ID of it. e.g. UploadId for UploadPart + */ + inline const Aws::String GetMultiPartId() const { std::lock_guard locker(m_getterSetterLock); return m_multipartId; } + /** + * If this is a multi-part transfer, this is the ID of it. e.g. UploadId for UploadPart + */ + inline void SetMultipartId(const Aws::String& value) { std::lock_guard locker(m_getterSetterLock); m_multipartId = value; } + /** + * Returns a copy of the completed parts, in the structure of . Used for all transfers. + */ + PartStateMap GetCompletedParts() const; + /** + * Set a pending part to completed along with its etag. Used fore all transfers. + */ + void ChangePartToCompleted(const PartPointer& partState, const Aws::String &eTag); + /** + * Returns a copy of the pending parts. Used for all transfers. + */ + PartStateMap GetPendingParts() const; + /** + * Returns true or false if there are currently any pending parts. + */ + bool HasPendingParts() const; + /** + * Set a part to pending. Used for all transfers. + */ + void AddPendingPart(const PartPointer& partState); + /** + * Returns a copy of the queued parts. Used for all transfers. + */ + PartStateMap GetQueuedParts() const; + /** + * Returns true or false if there are currently any queued parts. + */ + bool HasQueuedParts() const; + /** + * Set a part to queued. Used for all transfers. + */ + void AddQueuedPart(const PartPointer& partState); + /** + * Returns a copy of the failed parts. Used for all transfers. + */ + PartStateMap GetFailedParts() const; + /** + * Returns true or false if there are currently any failed parts. + */ + bool HasFailedParts() const; + /** + * Set a pending part to failed. Used for all transfers. + */ + void ChangePartToFailed(const PartPointer& partState); + /** + * Get all parts using transactions, mostly for internal purposes. + */ + void GetAllPartsTransactional(PartStateMap& queuedParts, PartStateMap& pendingParts, + PartStateMap& failedParts, PartStateMap& completedParts); + /** + * Returns true or false if any parts have been created for this transfer + */ + bool HasParts() const; + /** + * Returns false if Cancel has been called. Largely for internal use. + */ + bool ShouldContinue() const; + /** + * Cancel the transfer. This will happen asynchronously, so if you need to wait for it to be canceled, either handle the callbacks, + * or call WaitUntilFinished. + */ + void Cancel(); + + /** + * Reset the cancellation status for a retry. This will be done automatically by Transfer Manager. + */ + void Restart(); + /** + * Total bytes transferred successfully on this transfer operation. + * We implement transfer progress with two invariants: + * (1) Never lock; given a callback that can happen hundreds of times a second or more on a solid connection, it isn't acceptable to lock each time + * (2) Never go backwards, in spite of part upload/download failures. Negative progress (canceling a highly concurrent transfer can + * lead to an enormous step backwards if many parts are aborted at once) is a confusing and undesirable user experience. + * In this sense, progress represents a high-water mark, and in the presence of heavy failures or cancellation, it may appear to pause until the + * necessary retries exceed the previous high-water mark. + */ + inline uint64_t GetBytesTransferred() const { return m_bytesTransferred.load(); } + /** + * Total bytes transferred successfully on this transfer operation. + */ + void UpdateBytesTransferred(uint64_t amount) { m_bytesTransferred.fetch_add(amount); } + + /** + * The offset from which to start downloading + */ + inline uint64_t GetBytesOffset() const { return m_offset; } + /** + * The calculated total size of the object being transferred. + */ + inline uint64_t GetBytesTotalSize() const { return m_bytesTotalSize.load(); } + /** + * Sets the total size of the object being transferred. + */ + inline void SetBytesTotalSize(uint64_t value) { m_bytesTotalSize.store(value); } + + /** + * Gets the total bytes that is already transferred and available to users starting from the beginning of the file. + * For multiple-part downloads, it's guaranteed that these bytes are committed to the underlying stream already. + * For single-part downloads, it's also true since we write() directly to the underlying stream. + * A potential use case is to poll and stream bytes to users as we are still doing multi-part downloading. + */ + inline uint64_t GetBytesAvailableFromStart() const { return m_bytesAvailableFromStart.load(std::memory_order_relaxed); } + + /** + * Bucket portion of the object location in Amazon S3. + */ + inline const Aws::String& GetBucketName() const { return m_bucket; } + /** + * Key of the object location in Amazon S3. + */ + inline const Aws::String& GetKey() const { return m_key; } + /** + * If known, this is the location of the local file being uploaded from, or downloaded to. If you use the stream api however, this will + * always be blank. + */ + inline const Aws::String& GetTargetFilePath() const { return m_fileName; } + + /** + * (Download only) version id of the object to retrieve; if not specified in constructor, then latest is used + */ + const Aws::String GetVersionId() const { std::lock_guard locker(m_getterSetterLock); return m_versionId; } + void SetVersionId(const Aws::String& versionId) { std::lock_guard locker(m_getterSetterLock); m_versionId = versionId; } + + /** + * Upload or Download? + */ + inline TransferDirection GetTransferDirection() const { return m_direction; } + /** + * Content type of the object being transferred + */ + inline const Aws::String GetContentType() const { std::lock_guard locker(m_getterSetterLock); return m_contentType; } + /** + * Content type of the object being transferred + */ + inline void SetContentType(const Aws::String& value) { std::lock_guard locker(m_getterSetterLock); m_contentType = value; } + /** + * In case of an upload, this is the metadata that was placed on the object when it was uploaded. + * In the case of a download, this is the object metadata from the GetObject operation. + */ + inline const Aws::Map GetMetadata() const { std::lock_guard locker(m_getterSetterLock); return m_metadata; } + /** + * In case of an upload, this is the metadata that was placed on the object when it was uploaded. + * In the case of a download, this is the object metadata from the GetObject operation. + */ + inline void SetMetadata(const Aws::Map& value) { std::lock_guard locker(m_getterSetterLock); m_metadata = value; } + + /** + * Add a new entry to or update an existed entry of m_metadata, useful when users want to get ETag directly from metadata. + */ + inline void AddMetadataEntry(const Aws::String& key, const Aws::String& value) { std::lock_guard locker(m_getterSetterLock); m_metadata[key] = value; } + + /** + * Arbitrary user context that can be accessed from the callbacks + */ + inline void SetContext(const std::shared_ptr& context) { std::lock_guard locker(m_getterSetterLock); m_context = context; } + + /** + * Returns arbitrary user context or nullptr if it's not set. + */ + inline std::shared_ptr GetContext() const { std::lock_guard locker(m_getterSetterLock); return m_context; } + + /** + * The current status of the operation + */ + TransferStatus GetStatus() const; + /** + * The current status of the operation + */ + void UpdateStatus(TransferStatus value); + + /** + * The last error that was encountered by the transfer. You can handle each error individually via the errorCallback callback function + * in the TransferConfiguration. + */ + inline const Aws::Client::AWSError GetLastError() const { std::lock_guard locker(m_getterSetterLock); return m_lastError; } + /** + * The last error that was encountered by the transfer. You can handle each error individually via the errorCallback callback function + * in the TransferConfiguration. + */ + inline void SetError(const Aws::Client::AWSError& error) { std::lock_guard locker(m_getterSetterLock); m_lastError = error; } + /** + * Blocks the calling thread until the operation has finished. This function does not busy wait. It is safe for your CPU. + */ + void WaitUntilFinished() const; + + const CreateDownloadStreamCallback& GetCreateDownloadStreamFunction() const { return m_createDownloadStreamFn; } + + /** + * Write @partStream to the configured output (f)stream. + * Return empty string on success, string with error message on error. + */ + Aws::String WritePartToDownloadStream(Aws::IOStream* partStream, uint64_t writeOffset); + + void ApplyDownloadConfiguration(const DownloadConfiguration& downloadConfig); + + bool LockForCompletion() + { + bool expected = false; + return m_lastPart.compare_exchange_strong(expected, true/*desired*/); + } + + /* + * Returns a unique identifier tied to this particular transfer handle. + */ + Aws::String GetId() const; + + Aws::String GetChecksum() const { return m_checksum; } + void SetChecksum(const Aws::String& checksum) { this->m_checksum = checksum; } + + private: + void CleanupDownloadStream(); + + std::atomic m_isMultipart; + Aws::String m_multipartId; + TransferDirection m_direction; + PartStateMap m_completedParts; + PartStateMap m_pendingParts; + PartStateMap m_queuedParts; + PartStateMap m_failedParts; + std::atomic m_bytesTransferred; + std::atomic m_lastPart; + std::atomic m_bytesTotalSize; + std::atomic m_bytesAvailableFromStart; + /* The next part number to watch, that is able to grow m_bytesAvailableFromStart. */ + uint32_t m_nextPartToWatch; + uint64_t m_offset; + Aws::String m_bucket; + Aws::String m_key; + Aws::String m_fileName; + Aws::String m_contentType; + Aws::String m_versionId; + Aws::Map m_metadata; + TransferStatus m_status; + Aws::Client::AWSError m_lastError; + std::atomic m_cancel; + std::shared_ptr m_context; + const Utils::UUID m_handleId; + + CreateDownloadStreamCallback m_createDownloadStreamFn; + Aws::IOStream* m_downloadStream; + /* in case customer stream is not based off 0 */ + uint64_t m_downloadStreamBaseOffset; + + mutable std::mutex m_downloadStreamLock; + mutable std::mutex m_partsLock; + mutable std::mutex m_statusLock; + mutable std::condition_variable m_waitUntilFinishedSignal; + mutable std::mutex m_getterSetterLock; + Aws::String m_checksum; + }; + + AWS_TRANSFER_API Aws::OStream& operator << (Aws::OStream& s, TransferStatus status); + } +} diff --git a/include/aws/transfer/TransferManager.h b/include/aws/transfer/TransferManager.h new file mode 100644 index 0000000000000000000000000000000000000000..c04f6bad975445fcdf3fa6342ea60d9d03d5973a --- /dev/null +++ b/include/aws/transfer/TransferManager.h @@ -0,0 +1,357 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace Aws +{ + namespace Transfer + { + class TransferManager; + + typedef std::function&)> UploadProgressCallback; + typedef std::function&)> DownloadProgressCallback; + typedef std::function&)> TransferStatusUpdatedCallback; + typedef std::function&, const Aws::Client::AWSError&)> ErrorCallback; + typedef std::function&)> TransferInitiatedCallback; + + const uint64_t MB5 = 5 * 1024 * 1024; + + /** + * Configuration for use with TransferManager. The data here will be copied directly to TransferManager. + */ + struct TransferManagerConfiguration + { + TransferManagerConfiguration(Aws::Utils::Threading::Executor* executor) + : s3Client(nullptr), + transferExecutor(executor), + computeContentMD5(false), + transferBufferMaxHeapSize(10 * MB5), + bufferSize(MB5) + { + } + /** + * S3 Client to use for transfers. You are responsible for setting this. + */ + std::shared_ptr s3Client; + /** + * Executor to use for the transfer manager threads. This probably shouldn't be the same executor + * you are using for your client configuration. This executor will be used in a different context than the s3 client is used. + * It is not a bug to use the same executor, but at least be aware that this is how the manager will be used. + */ + Aws::Utils::Threading::Executor* transferExecutor = nullptr; + + /** + * Threading Executor shared pointer. + * Created and owned by Transfer manager if no raw pointer `transferExecutor` is provided. + */ + std::shared_ptr spExecutor = nullptr; + + /** + * Threading Executor factory method. Default creates a factory that creates DefaultExecutor + */ + std::function()> executorCreateFn; + + /** + * deprecated, will now automatically use CR64 checksums. use a different checksum by specifying the + * checksumAlgorithm parameter. + */ + bool computeContentMD5 = false; + /** + * If you have special arguments you want passed to our put object calls, put them here. We will copy the template for each put object call + * overriding the body stream, bucket, and key. If object metadata is passed through, we will override that as well. + */ + Aws::S3::Model::PutObjectRequest putObjectTemplate; + /** + * If you have special arguments you want passed to our get object calls, put them here. We will copy the template for each put object call + * overriding the body stream, bucket, and key. If object metadata is passed through, we will override that as well. + */ + Aws::S3::Model::GetObjectRequest getObjectTemplate; + /** + * If you have special arguments you want passed to our head object calls, put them here. We will copy the template for each call + * overriding the body stream, bucket, and key. If object metadata is passed through, we will override that as well. + */ + Aws::S3::Model::HeadObjectRequest headObjectTemplate; + /** + * If you have special arguments you want passed to our create multipart upload calls, put them here. We will copy the template for each call + * overriding the body stream, bucket, and key. If object metadata is passed through, we will override that as well. + */ + Aws::S3::Model::CreateMultipartUploadRequest createMultipartUploadTemplate; + /** + * If you have special arguments you want passed to our upload part calls, put them here. We will copy the template for each call + * overriding the body stream, bucket, and key. If object metadata is passed through, we will override that as well. + */ + Aws::S3::Model::UploadPartRequest uploadPartTemplate; + /** + * Maximum size of the working buffers to use. This is not the same thing as max heap size for your process. This is the maximum amount of memory we will + * allocate for all transfer buffers. default is 50MB. + * If you are using Aws::Utils::Threading::PooledThreadExecutor for transferExecutor, this size should be greater than bufferSize * poolSize. + */ + uint64_t transferBufferMaxHeapSize = 10 * MB5; + /** + * Defaults to 5MB. If you are uploading large files, (larger than 50GB, this needs to be specified to be something larger than 5MB. Also keep in mind that you may need + * to increase your max heap size if this is something you plan on increasing. + */ + uint64_t bufferSize = MB5; + + /** + * Callback to receive progress updates for uploads. + */ + UploadProgressCallback uploadProgressCallback; + /** + * Callback to receive progress updates for downloads. + */ + DownloadProgressCallback downloadProgressCallback; + /** + * Callback to receive updates on the status of the transfer. + */ + TransferStatusUpdatedCallback transferStatusUpdatedCallback; + /** + * Callback to receive initiated transfers for the directory operations. + */ + TransferInitiatedCallback transferInitiatedCallback; + /** + * Callback to receive all errors that are thrown over the course of a transfer. + */ + ErrorCallback errorCallback; + /** + * To support Customer Access Log Information when access S3. + * https://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html + * Note: query string key not started with "x-" will be filtered out. + * key/val of map entries will be key/val of query strings. + */ + Aws::Map customizedAccessLogTag; + + /** + * Set the Checksum Algorithm for the transfer manager to use for multipart + * upload. Defaults to CRC32. Will be overwritten to use MD5 if computeContentMD5 + * is set to true. + */ + Aws::S3::Model::ChecksumAlgorithm checksumAlgorithm = S3::Model::ChecksumAlgorithm::CRC64NVME; + }; + + /** + * This is a utility around Amazon Simple Storage Service. It can Upload large files via parts in parallel, Upload files less than 5MB in single PutObject, and download files via GetObject, + * If a transfer fails, it can be retried for an upload. For a download, there is nothing to retry in case of failure. Just download it again. You can also abort any in progress transfers. + * The key interface for controlling and knowing the status of your upload is the TransferHandle. An instance of TransferHandle is returned from each of the public functions in this interface. + * Keep a reference to the pointer. Each of the callbacks will also pass the handle that has received an update. None of the public methods in this interface block. + */ + class AWS_TRANSFER_API TransferManager : public std::enable_shared_from_this + { + public: + /** + * Create a new TransferManager instance initialized with config. + */ + static std::shared_ptr Create(const TransferManagerConfiguration& config); + + /** + * Blocks the calling thread until all this instance TransferManager operations have finished. + * + * TransferManager API may outlive InitAPI{...}ShutdownAPI scope if TransferHandle status were not completed. + * Use this method before ShutdownAPI call if individual TransferHandles are not verified for completion. + * @param timeoutMs, how many milliseconds to block wait + * @return COMPLETED if all tasks are finished, IN_PROGRESS if timeoutMs was reached. + */ + TransferStatus WaitUntilAllFinished(int64_t timeoutMs = std::numeric_limits::max()); + + /** + * Cancels all TransferManager operations in the current context of the TransferManager. + * Non-blocking, please call `WaitUntilAllFinished` method if ShutdownAPI() is going to follow. + */ + void CancelAll(); + + ~TransferManager(); + + /** + * Uploads a file via filename, to bucketName/keyName in S3. contentType and metadata will be added to the object. If the object + * is larger than the configured bufferSize, then a multi-part upload will be performed. Keeps file to be unopened until doing + * actual upload, this is useful for uploading directories with many small files (avoid having too many open files, which may + * exceed system limit) If an optional checksum is given, the checksum will be sent as either the checksum header or the ful + * body checksum on the multipart upload. + */ + std::shared_ptr UploadFile(const Aws::String& fileName, const Aws::String& bucketName, + const Aws::String& keyName, const Aws::String& contentType, + const Aws::Map& metadata, + const std::shared_ptr& context = nullptr, + const Aws::String& precalculatedChecksum = {}); + + /** + * Uploads the contents of stream, to bucketName/keyName in S3. contentType and metadata will be added to the object. If the + * object is larger than the configured bufferSize, then a multi-part upload will be performed. If an optional checksum is + * given, the checksum will be sent as either the checksum header or the ful body checksum on the multipart upload. + */ + std::shared_ptr UploadFile(const std::shared_ptr& stream, const Aws::String& bucketName, + const Aws::String& keyName, const Aws::String& contentType, + const Aws::Map& metadata, + const std::shared_ptr& context = nullptr, + const Aws::String& precalculatedChecksum = {}); + + /** + * Downloads the contents of bucketName/keyName in S3 to the file specified by writeToFile. This will perform a GetObject operation. + */ + std::shared_ptr DownloadFile(const Aws::String& bucketName, + const Aws::String& keyName, + const Aws::String& writeToFile, + const DownloadConfiguration& downloadConfig = DownloadConfiguration(), + const std::shared_ptr& context = nullptr); + /** + * Downloads the contents of bucketName/keyName in S3 and writes it to writeToStream. This will perform a GetObject operation. + */ + std::shared_ptr DownloadFile(const Aws::String& bucketName, + const Aws::String& keyName, + CreateDownloadStreamCallback writeToStreamfn, + const DownloadConfiguration& downloadConfig = DownloadConfiguration(), + const Aws::String& writeToFile = "", + const std::shared_ptr& context = nullptr); + + /** + * Downloads the contents of bucketName/keyName in S3 and writes it to writeToStream. This will perform a GetObject operation for the given range. + */ + std::shared_ptr DownloadFile(const Aws::String& bucketName, + const Aws::String& keyName, + uint64_t fileOffset, + uint64_t downloadBytes, + CreateDownloadStreamCallback writeToStreamfn, + const DownloadConfiguration& downloadConfig = DownloadConfiguration(), + const Aws::String& writeToFile = "", + const std::shared_ptr& context = nullptr); + + /** + * Retry an download that failed from a previous DownloadFile operation. If a multi-part download was used, only the failed parts will be re-fetched. + */ + std::shared_ptr RetryDownload(const std::shared_ptr& retryHandle); + + /** + * Retry an upload that failed from a previous UploadFile operation. If a multi-part upload was used, only the failed parts will be re-sent. + */ + std::shared_ptr RetryUpload(const Aws::String& fileName, const std::shared_ptr& retryHandle); + /** + * Retry an upload that failed from a previous UploadFile operation. If a multi-part upload was used, only the failed parts will be re-sent. + */ + std::shared_ptr RetryUpload(const std::shared_ptr& stream, const std::shared_ptr& retryHandle); + + /** + * By default, multi-part uploads will remain in a FAILED state if they fail, or a CANCELED state if they were canceled. Leaving failed uploads around + * still costs the owner of the bucket money. If you know you will not be retrying the request, abort the request after canceling it or if it fails and you don't + * intend to retry it. + */ + void AbortMultipartUpload(const std::shared_ptr& inProgressHandle); + + /** + * Uploads entire contents of directory to Amazon S3 bucket and stores them in a directory starting at prefix. This is an asynchronous method. You will receive notifications + * that an upload has started via the transferInitiatedCallback callback function in your configuration. If you do not set this callback, then you will not be able to handle + * the file transfers. + * + * directory: the absolute directory on disk to upload + * bucketName: the name of the S3 bucket to upload to + * prefix: the prefix to put on all objects uploaded (e.g. put them in x directory in the bucket). + */ + void UploadDirectory(const Aws::String& directory, const Aws::String& bucketName, const Aws::String& prefix, const Aws::Map& metadata); + + /** + * Downloads entire contents of an Amazon S3 bucket starting at prefix stores them in a directory (not including the prefix). This is an asynchronous method. You will receive notifications + * that a download has started via the transferInitiatedCallback callback function in your configuration. If you do not set this callback, then you will not be able to handle + * the file transfers. If an error occurs prior to the transfer being initiated (e.g. list objects fails, then an error will be passed through the errorCallback). + * + * directory: the absolute directory on disk to download to + * bucketName: the name of the S3 bucket to download from + * prefix: the prefix in the bucket to use as the root directory (e.g. download all objects at x prefix in S3 and then store them starting in directory with the prefix stripped out). + */ + void DownloadToDirectory(const Aws::String& directory, const Aws::String& bucketName, const Aws::String& prefix = Aws::String()); + + private: + /** + * To ensure TransferManager is always created as a shared_ptr, since it inherits enable_shared_from_this. + */ + TransferManager(const TransferManagerConfiguration& config); + + /** + * Creates TransferHandle. + * fileName is not necessary if this handle will upload data from an IOStream + */ + std::shared_ptr CreateUploadFileHandle(Aws::IOStream* fileStream, const Aws::String& bucketName, + const Aws::String& keyName, const Aws::String& contentType, + const Aws::Map& metadata, + const std::shared_ptr& context, + const Aws::String& fileName = "", const Aws::String& checksum = ""); + + /** + * Submits the actual task to task scheduler + */ + std::shared_ptr SubmitUpload(const std::shared_ptr& handle, const std::shared_ptr& fileStream = nullptr); + + bool MultipartUploadSupported(uint64_t length) const; + bool InitializePartsForDownload(const std::shared_ptr& handle); + + void DoMultiPartUpload(const std::shared_ptr& streamToPut, const std::shared_ptr& handle); + void DoSinglePartUpload(const std::shared_ptr& streamToPut, const std::shared_ptr& handle); + + void DoMultiPartUpload(const std::shared_ptr& handle); + void DoSinglePartUpload(const std::shared_ptr& handle); + + void DoDownload(const std::shared_ptr& handle); + void DoSinglePartDownload(const std::shared_ptr& handle); + + void HandleGetObjectResponse(const Aws::S3::S3Client* client, + const Aws::S3::Model::GetObjectRequest& request, + const Aws::S3::Model::GetObjectOutcome& outcome, + const std::shared_ptr& context); + + void WaitForCancellationAndAbortUpload(const std::shared_ptr& canceledHandle); + void HandleUploadPartResponse(const Aws::S3::S3Client*, const Aws::S3::Model::UploadPartRequest&, const Aws::S3::Model::UploadPartOutcome&, const std::shared_ptr&); + void HandlePutObjectResponse(const Aws::S3::S3Client*, const Aws::S3::Model::PutObjectRequest&, const Aws::S3::Model::PutObjectOutcome&, const std::shared_ptr&); + void HandleListObjectsResponse(const Aws::S3::S3Client*, const Aws::S3::Model::ListObjectsV2Request&, const Aws::S3::Model::ListObjectsV2Outcome&, const std::shared_ptr&); + + TransferStatus DetermineIfFailedOrCanceled(const TransferHandle&) const; + void TriggerUploadProgressCallback(const std::shared_ptr&) const; + void TriggerDownloadProgressCallback(const std::shared_ptr&) const; + void TriggerTransferStatusUpdatedCallback(const std::shared_ptr&) const; + void TriggerErrorCallback(const std::shared_ptr&, const Aws::Client::AWSError& error)const; + + /** + * Internal methods for tracking currently running TransferHandles + * @param handle + */ + void AddTask(std::shared_ptr handle); + void RemoveTask(const std::shared_ptr& handle); + + /** + * Sets the checksum on a Completed Part based on the state, and the algorithm selected. + * @param state The state of the completed part as tracker by the transfer manager. + * @param part The completed part of the MPU. + */ + void SetChecksumForAlgorithm(const std::shared_ptr& state, Aws::S3::Model::CompletedPart& part); + + static Aws::String DetermineFilePath(const Aws::String& directory, const Aws::String& prefix, const Aws::String& keyName); + + Aws::Utils::ExclusiveOwnershipResourceManager m_bufferManager; + TransferManagerConfiguration m_transferConfig; + + mutable Aws::UnorderedSet> m_tasks; + mutable std::condition_variable m_tasksSignal; + mutable std::mutex m_tasksMutex; + + protected: + static bool IsWithinParentDirectory(Aws::String parentDirectory, Aws::String filePath); + }; + + + } +} diff --git a/include/aws/transfer/Transfer_EXPORTS.h b/include/aws/transfer/Transfer_EXPORTS.h new file mode 100644 index 0000000000000000000000000000000000000000..78a44d992b953e7914151591e8280d7e305b6a09 --- /dev/null +++ b/include/aws/transfer/Transfer_EXPORTS.h @@ -0,0 +1,28 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#ifdef _MSC_VER + //disable windows complaining about max template size. + #pragma warning (disable : 4503) +#endif + +#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #ifdef _MSC_VER + #pragma warning(disable : 4251) + #endif // _MSC_VER + + #ifdef USE_IMPORT_EXPORT + #ifdef AWS_TRANSFER_EXPORTS + #define AWS_TRANSFER_API __declspec(dllexport) + #else + #define AWS_TRANSFER_API __declspec(dllimport) + #endif // AWS_TRANSFER_EXPORTS + #else // USE_IMPORT_EXPORT + #define AWS_TRANSFER_API + #endif // USE_IMPORT_EXPORT +#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #define AWS_TRANSFER_API +#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)