Struct aws_sdk_bedrock::Client
source · pub struct Client { /* private fields */ }Expand description
Client for Amazon Bedrock
Client for invoking operations on Amazon Bedrock. Each operation on Amazon Bedrock is a method on this
this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.
Constructing a Client
A Config is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env(), since this will resolve an SdkConfig which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env() instead, which returns a ConfigLoader that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_bedrock::Client::new(&config);Occasionally, SDKs may have additional service-specific that can be set on the Config that
is absent from SdkConfig, or slightly different settings for a specific client may be desired.
The Config struct implements From<&SdkConfig>, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_bedrock::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();See the aws-config docs and Config for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
Implementations§
source§impl Client
impl Client
sourcepub fn create_model_customization_job(
&self
) -> CreateModelCustomizationJobFluentBuilder
pub fn create_model_customization_job( &self ) -> CreateModelCustomizationJobFluentBuilder
Constructs a fluent builder for the CreateModelCustomizationJob operation.
- The fluent builder is configurable:
job_name(impl Into<String>)/set_job_name(Option<String>):Enter a unique name for the fine-tuning job.
custom_model_name(impl Into<String>)/set_custom_model_name(Option<String>):Enter a name for the custom model.
role_arn(impl Into<String>)/set_role_arn(Option<String>):The Amazon Resource Name (ARN) of an IAM role that Bedrock can assume to perform tasks on your behalf. For example, during model training, Bedrock needs your permission to read input data from an S3 bucket, write model artifacts to an S3 bucket. To pass this role to Bedrock, the caller of this API must have the
iam:PassRolepermission.client_request_token(impl Into<String>)/set_client_request_token(Option<String>):Unique token value that you can provide. The GetModelCustomizationJob response includes the same token value.
base_model_identifier(impl Into<String>)/set_base_model_identifier(Option<String>):Name of the base model.
custom_model_kms_key_id(impl Into<String>)/set_custom_model_kms_key_id(Option<String>):The custom model is encrypted at rest using this key.
job_tags(Tag)/set_job_tags(Option<Vec<Tag>>):Assign tags to the job.
custom_model_tags(Tag)/set_custom_model_tags(Option<Vec<Tag>>):Assign tags to the custom model.
training_data_config(TrainingDataConfig)/set_training_data_config(Option<TrainingDataConfig>):Information about the training dataset.
validation_data_config(ValidationDataConfig)/set_validation_data_config(Option<ValidationDataConfig>):Information about the validation dataset.
output_data_config(OutputDataConfig)/set_output_data_config(Option<OutputDataConfig>):S3 location for the output data.
hyper_parameters(impl Into<String>, impl Into<String>)/set_hyper_parameters(Option<HashMap<String, String>>):Parameters related to tuning the model.
vpc_config(VpcConfig)/set_vpc_config(Option<VpcConfig>):VPC configuration (optional). Configuration parameters for the private Virtual Private Cloud (VPC) that contains the resources you are using for this job.
- On success, responds with
CreateModelCustomizationJobOutputwith field(s):job_arn(Option<String>):ARN of the fine tuning job
- On failure, responds with
SdkError<CreateModelCustomizationJobError>
source§impl Client
impl Client
sourcepub fn create_provisioned_model_throughput(
&self
) -> CreateProvisionedModelThroughputFluentBuilder
pub fn create_provisioned_model_throughput( &self ) -> CreateProvisionedModelThroughputFluentBuilder
Constructs a fluent builder for the CreateProvisionedModelThroughput operation.
- The fluent builder is configurable:
client_request_token(impl Into<String>)/set_client_request_token(Option<String>):Unique token value that you can provide. If this token matches a previous request, Bedrock ignores the request, but does not return an error.
model_units(i32)/set_model_units(Option<i32>):Number of model units to allocate.
provisioned_model_name(impl Into<String>)/set_provisioned_model_name(Option<String>):Unique name for this provisioned throughput.
model_id(impl Into<String>)/set_model_id(Option<String>):Name or ARN of the model to associate with this provisioned throughput.
commitment_duration(CommitmentDuration)/set_commitment_duration(Option<CommitmentDuration>):Commitment duration requested for the provisioned throughput.
tags(Tag)/set_tags(Option<Vec<Tag>>):Tags to associate with this provisioned throughput.
- On success, responds with
CreateProvisionedModelThroughputOutputwith field(s):provisioned_model_arn(Option<String>):The ARN for this provisioned throughput.
- On failure, responds with
SdkError<CreateProvisionedModelThroughputError>
source§impl Client
impl Client
sourcepub fn delete_custom_model(&self) -> DeleteCustomModelFluentBuilder
pub fn delete_custom_model(&self) -> DeleteCustomModelFluentBuilder
Constructs a fluent builder for the DeleteCustomModel operation.
- The fluent builder is configurable:
model_identifier(impl Into<String>)/set_model_identifier(Option<String>):Name of the model to delete.
- On success, responds with
DeleteCustomModelOutput - On failure, responds with
SdkError<DeleteCustomModelError>
source§impl Client
impl Client
sourcepub fn delete_model_invocation_logging_configuration(
&self
) -> DeleteModelInvocationLoggingConfigurationFluentBuilder
pub fn delete_model_invocation_logging_configuration( &self ) -> DeleteModelInvocationLoggingConfigurationFluentBuilder
Constructs a fluent builder for the DeleteModelInvocationLoggingConfiguration operation.
- The fluent builder takes no input, just
sendit. - On success, responds with
DeleteModelInvocationLoggingConfigurationOutput - On failure, responds with
SdkError<DeleteModelInvocationLoggingConfigurationError>
source§impl Client
impl Client
sourcepub fn delete_provisioned_model_throughput(
&self
) -> DeleteProvisionedModelThroughputFluentBuilder
pub fn delete_provisioned_model_throughput( &self ) -> DeleteProvisionedModelThroughputFluentBuilder
Constructs a fluent builder for the DeleteProvisionedModelThroughput operation.
- The fluent builder is configurable:
provisioned_model_id(impl Into<String>)/set_provisioned_model_id(Option<String>):The ARN or name of the provisioned throughput.
- On success, responds with
DeleteProvisionedModelThroughputOutput - On failure, responds with
SdkError<DeleteProvisionedModelThroughputError>
source§impl Client
impl Client
sourcepub fn get_custom_model(&self) -> GetCustomModelFluentBuilder
pub fn get_custom_model(&self) -> GetCustomModelFluentBuilder
Constructs a fluent builder for the GetCustomModel operation.
- The fluent builder is configurable:
model_identifier(impl Into<String>)/set_model_identifier(Option<String>):Name or ARN of the custom model.
- On success, responds with
GetCustomModelOutputwith field(s):model_arn(Option<String>):ARN associated with this model.
model_name(Option<String>):Model name associated with this model.
job_name(Option<String>):Job name associated with this model.
job_arn(Option<String>):Job ARN associated with this model.
base_model_arn(Option<String>):ARN of the base model.
model_kms_key_arn(Option<String>):The custom model is encrypted at rest using this key.
hyper_parameters(Option<HashMap<String, String>>):Hyperparameter values associated with this model.
training_data_config(Option<TrainingDataConfig>):Information about the training dataset.
validation_data_config(Option<ValidationDataConfig>):Array of up to 10 validators.
output_data_config(Option<OutputDataConfig>):Output data configuration associated with this custom model.
training_metrics(Option<TrainingMetrics>):The training metrics from the job creation.
validation_metrics(Option<Vec<ValidatorMetric>>):The validation metrics from the job creation.
creation_time(Option<DateTime>):Creation time of the model.
- On failure, responds with
SdkError<GetCustomModelError>
source§impl Client
impl Client
sourcepub fn get_foundation_model(&self) -> GetFoundationModelFluentBuilder
pub fn get_foundation_model(&self) -> GetFoundationModelFluentBuilder
Constructs a fluent builder for the GetFoundationModel operation.
- The fluent builder is configurable:
model_identifier(impl Into<String>)/set_model_identifier(Option<String>):The model identifier.
- On success, responds with
GetFoundationModelOutputwith field(s):model_details(Option<FoundationModelDetails>):Information about the foundation model.
- On failure, responds with
SdkError<GetFoundationModelError>
source§impl Client
impl Client
sourcepub fn get_model_customization_job(
&self
) -> GetModelCustomizationJobFluentBuilder
pub fn get_model_customization_job( &self ) -> GetModelCustomizationJobFluentBuilder
Constructs a fluent builder for the GetModelCustomizationJob operation.
- The fluent builder is configurable:
job_identifier(impl Into<String>)/set_job_identifier(Option<String>):Identifier for the customization job.
- On success, responds with
GetModelCustomizationJobOutputwith field(s):job_arn(Option<String>):The ARN of the customization job.
job_name(Option<String>):The name of the customization job.
output_model_name(Option<String>):The name of the output model.
output_model_arn(Option<String>):The ARN of the output model.
client_request_token(Option<String>):The token that you specified in the CreateCustomizationJob request.
role_arn(Option<String>):The ARN of the IAM role.
status(Option<ModelCustomizationJobStatus>):The status of the job. A successful job transitions from in-progress to completed when the output model is ready to use. If the job failed, the failure message contains information about why the job failed.
failure_message(Option<String>):Information about why the job failed.
creation_time(Option<DateTime>):Time that the resource was created.
last_modified_time(Option<DateTime>):Time that the resource was last modified.
end_time(Option<DateTime>):Time that the resource transitioned to terminal state.
base_model_arn(Option<String>):ARN of the base model.
hyper_parameters(Option<HashMap<String, String>>):The hyperparameter values for the job.
training_data_config(Option<TrainingDataConfig>):S3 Location of the training data.
validation_data_config(Option<ValidationDataConfig>):Array of up to 10 validators.
output_data_config(Option<OutputDataConfig>):Output data configuration
output_model_kms_key_arn(Option<String>):The custom model is encrypted at rest using this key.
training_metrics(Option<TrainingMetrics>):Metrics associated with the custom job.
validation_metrics(Option<Vec<ValidatorMetric>>):The loss metric for each validator that you provided in the createjob request.
vpc_config(Option<VpcConfig>):VPC configuration for the custom model job.
- On failure, responds with
SdkError<GetModelCustomizationJobError>
source§impl Client
impl Client
sourcepub fn get_model_invocation_logging_configuration(
&self
) -> GetModelInvocationLoggingConfigurationFluentBuilder
pub fn get_model_invocation_logging_configuration( &self ) -> GetModelInvocationLoggingConfigurationFluentBuilder
Constructs a fluent builder for the GetModelInvocationLoggingConfiguration operation.
- The fluent builder takes no input, just
sendit. - On success, responds with
GetModelInvocationLoggingConfigurationOutputwith field(s):logging_config(Option<LoggingConfig>):The current configuration values.
- On failure, responds with
SdkError<GetModelInvocationLoggingConfigurationError>
source§impl Client
impl Client
sourcepub fn get_provisioned_model_throughput(
&self
) -> GetProvisionedModelThroughputFluentBuilder
pub fn get_provisioned_model_throughput( &self ) -> GetProvisionedModelThroughputFluentBuilder
Constructs a fluent builder for the GetProvisionedModelThroughput operation.
- The fluent builder is configurable:
provisioned_model_id(impl Into<String>)/set_provisioned_model_id(Option<String>):The ARN or name of the provisioned throughput.
- On success, responds with
GetProvisionedModelThroughputOutputwith field(s):model_units(Option<i32>):The current number of model units requested to be available for this provisioned throughput.
desired_model_units(Option<i32>):The desired number of model units that was requested to be available for this provisioned throughput.
provisioned_model_name(Option<String>):The name of the provisioned throughput.
provisioned_model_arn(Option<String>):The ARN of the provisioned throughput.
model_arn(Option<String>):The ARN or name of the model associated with this provisioned throughput.
desired_model_arn(Option<String>):The ARN of the new model to asssociate with this provisioned throughput.
foundation_model_arn(Option<String>):ARN of the foundation model.
status(Option<ProvisionedModelStatus>):Status of the provisioned throughput.
creation_time(Option<DateTime>):The timestamp of the creation time for this provisioned throughput.
last_modified_time(Option<DateTime>):The timestamp of the last modified time of this provisioned throughput.
failure_message(Option<String>):Failure message for any issues that the create operation encounters.
commitment_duration(Option<CommitmentDuration>):Commitment duration of the provisioned throughput.
commitment_expiration_time(Option<DateTime>):Commitment expiration time for the provisioned throughput.
- On failure, responds with
SdkError<GetProvisionedModelThroughputError>
source§impl Client
impl Client
sourcepub fn list_custom_models(&self) -> ListCustomModelsFluentBuilder
pub fn list_custom_models(&self) -> ListCustomModelsFluentBuilder
Constructs a fluent builder for the ListCustomModels operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
creation_time_before(DateTime)/set_creation_time_before(Option<DateTime>):Return custom models created before the specified time.
creation_time_after(DateTime)/set_creation_time_after(Option<DateTime>):Return custom models created after the specified time.
name_contains(impl Into<String>)/set_name_contains(Option<String>):Return custom models only if the job name contains these characters.
base_model_arn_equals(impl Into<String>)/set_base_model_arn_equals(Option<String>):Return custom models only if the base model ARN matches this parameter.
foundation_model_arn_equals(impl Into<String>)/set_foundation_model_arn_equals(Option<String>):Return custom models only if the foundation model ARN matches this parameter.
max_results(i32)/set_max_results(Option<i32>):Maximum number of results to return in the response.
next_token(impl Into<String>)/set_next_token(Option<String>):Continuation token from the previous response, for Bedrock to list the next set of results.
sort_by(SortModelsBy)/set_sort_by(Option<SortModelsBy>):The field to sort by in the returned list of models.
sort_order(SortOrder)/set_sort_order(Option<SortOrder>):The sort order of the results.
- On success, responds with
ListCustomModelsOutputwith field(s):next_token(Option<String>):Continuation token for the next request to list the next set of results.
model_summaries(Option<Vec<CustomModelSummary>>):Model summaries.
- On failure, responds with
SdkError<ListCustomModelsError>
source§impl Client
impl Client
sourcepub fn list_foundation_models(&self) -> ListFoundationModelsFluentBuilder
pub fn list_foundation_models(&self) -> ListFoundationModelsFluentBuilder
Constructs a fluent builder for the ListFoundationModels operation.
- The fluent builder is configurable:
by_provider(impl Into<String>)/set_by_provider(Option<String>):A Bedrock model provider.
by_customization_type(ModelCustomization)/set_by_customization_type(Option<ModelCustomization>):List by customization type.
by_output_modality(ModelModality)/set_by_output_modality(Option<ModelModality>):List by output modality type.
by_inference_type(InferenceType)/set_by_inference_type(Option<InferenceType>):List by inference type.
- On success, responds with
ListFoundationModelsOutputwith field(s):model_summaries(Option<Vec<FoundationModelSummary>>):A list of bedrock foundation models.
- On failure, responds with
SdkError<ListFoundationModelsError>
source§impl Client
impl Client
sourcepub fn list_model_customization_jobs(
&self
) -> ListModelCustomizationJobsFluentBuilder
pub fn list_model_customization_jobs( &self ) -> ListModelCustomizationJobsFluentBuilder
Constructs a fluent builder for the ListModelCustomizationJobs operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
creation_time_after(DateTime)/set_creation_time_after(Option<DateTime>):Return customization jobs created after the specified time.
creation_time_before(DateTime)/set_creation_time_before(Option<DateTime>):Return customization jobs created before the specified time.
status_equals(FineTuningJobStatus)/set_status_equals(Option<FineTuningJobStatus>):Return customization jobs with the specified status.
name_contains(impl Into<String>)/set_name_contains(Option<String>):Return customization jobs only if the job name contains these characters.
max_results(i32)/set_max_results(Option<i32>):Maximum number of results to return in the response.
next_token(impl Into<String>)/set_next_token(Option<String>):Continuation token from the previous response, for Bedrock to list the next set of results.
sort_by(SortJobsBy)/set_sort_by(Option<SortJobsBy>):The field to sort by in the returned list of jobs.
sort_order(SortOrder)/set_sort_order(Option<SortOrder>):The sort order of the results.
- On success, responds with
ListModelCustomizationJobsOutputwith field(s):next_token(Option<String>):Page continuation token to use in the next request.
model_customization_job_summaries(Option<Vec<ModelCustomizationJobSummary>>):Job summaries.
- On failure, responds with
SdkError<ListModelCustomizationJobsError>
source§impl Client
impl Client
sourcepub fn list_provisioned_model_throughputs(
&self
) -> ListProvisionedModelThroughputsFluentBuilder
pub fn list_provisioned_model_throughputs( &self ) -> ListProvisionedModelThroughputsFluentBuilder
Constructs a fluent builder for the ListProvisionedModelThroughputs operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
creation_time_after(DateTime)/set_creation_time_after(Option<DateTime>):Return provisioned capacities created after the specified time.
creation_time_before(DateTime)/set_creation_time_before(Option<DateTime>):Return provisioned capacities created before the specified time.
status_equals(ProvisionedModelStatus)/set_status_equals(Option<ProvisionedModelStatus>):Return the list of provisioned capacities that match the specified status.
model_arn_equals(impl Into<String>)/set_model_arn_equals(Option<String>):Return the list of provisioned capacities where their model ARN is equal to this parameter.
name_contains(impl Into<String>)/set_name_contains(Option<String>):Return the list of provisioned capacities if their name contains these characters.
max_results(i32)/set_max_results(Option<i32>):THe maximum number of results to return in the response.
next_token(impl Into<String>)/set_next_token(Option<String>):Continuation token from the previous response, for Bedrock to list the next set of results.
sort_by(SortByProvisionedModels)/set_sort_by(Option<SortByProvisionedModels>):The field to sort by in the returned list of provisioned capacities.
sort_order(SortOrder)/set_sort_order(Option<SortOrder>):The sort order of the results.
- On success, responds with
ListProvisionedModelThroughputsOutputwith field(s):next_token(Option<String>):Continuation token for the next request to list the next set of results.
provisioned_model_summaries(Option<Vec<ProvisionedModelSummary>>):List of summaries, one for each provisioned throughput in the response.
- On failure, responds with
SdkError<ListProvisionedModelThroughputsError>
source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):The ARN of the resource.
- On success, responds with
ListTagsForResourceOutputwith field(s):tags(Option<Vec<Tag>>):An array of the tags associated with this resource.
- On failure, responds with
SdkError<ListTagsForResourceError>
source§impl Client
impl Client
sourcepub fn put_model_invocation_logging_configuration(
&self
) -> PutModelInvocationLoggingConfigurationFluentBuilder
pub fn put_model_invocation_logging_configuration( &self ) -> PutModelInvocationLoggingConfigurationFluentBuilder
Constructs a fluent builder for the PutModelInvocationLoggingConfiguration operation.
- The fluent builder is configurable:
logging_config(LoggingConfig)/set_logging_config(Option<LoggingConfig>):The logging configuration values to set.
- On success, responds with
PutModelInvocationLoggingConfigurationOutput - On failure, responds with
SdkError<PutModelInvocationLoggingConfigurationError>
source§impl Client
impl Client
sourcepub fn stop_model_customization_job(
&self
) -> StopModelCustomizationJobFluentBuilder
pub fn stop_model_customization_job( &self ) -> StopModelCustomizationJobFluentBuilder
Constructs a fluent builder for the StopModelCustomizationJob operation.
- The fluent builder is configurable:
job_identifier(impl Into<String>)/set_job_identifier(Option<String>):Job identifier of the job to stop.
- On success, responds with
StopModelCustomizationJobOutput - On failure, responds with
SdkError<StopModelCustomizationJobError>
source§impl Client
impl Client
sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):The ARN of the resource to tag.
tags(Tag)/set_tags(Option<Vec<Tag>>):Tags to associate with the resource.
- On success, responds with
TagResourceOutput - On failure, responds with
SdkError<TagResourceError>
source§impl Client
impl Client
sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):The ARN of the resource to untag.
tag_keys(impl Into<String>)/set_tag_keys(Option<Vec<String>>):Tag keys of the tags to remove from the resource.
- On success, responds with
UntagResourceOutput - On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn update_provisioned_model_throughput(
&self
) -> UpdateProvisionedModelThroughputFluentBuilder
pub fn update_provisioned_model_throughput( &self ) -> UpdateProvisionedModelThroughputFluentBuilder
Constructs a fluent builder for the UpdateProvisionedModelThroughput operation.
- The fluent builder is configurable:
provisioned_model_id(impl Into<String>)/set_provisioned_model_id(Option<String>):The ARN or name of the provisioned throughput to update.
desired_provisioned_model_name(impl Into<String>)/set_desired_provisioned_model_name(Option<String>):The new name for this provisioned throughput.
desired_model_id(impl Into<String>)/set_desired_model_id(Option<String>):The ARN of the new model to associate with this provisioned throughput.
- On success, responds with
UpdateProvisionedModelThroughputOutput - On failure, responds with
SdkError<UpdateProvisionedModelThroughputError>
source§impl Client
impl Client
sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
Panics
- This method will panic if the
sdk_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it.