aws_sdk_costexplorer

Struct Client

Source
pub struct Client { /* private fields */ }
Expand description

Client for AWS Cost Explorer Service

Client for invoking operations on AWS Cost Explorer Service. Each operation on AWS Cost Explorer Service 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_costexplorer::Client::new(&config);

Occasionally, SDKs may have additional service-specific values that can be set on the Config that is absent from SdkConfig, or slightly different settings for a specific client may be desired. The Builder 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_costexplorer::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.

§Using the Client

A client has a function for every operation that can be performed by the service. For example, the CreateCostCategoryDefinition operation has a Client::create_cost_category_definition, function which returns a builder for that operation. The fluent builder ultimately has a send() function that returns an async future that returns a result, as illustrated below:

let result = client.create_cost_category_definition()
    .name("example")
    .send()
    .await;

The underlying HTTP requests that get made by this can be modified with the customize_operation function on the fluent builder. See the customize module for more information.

Implementations§

Source§

impl Client

Source

pub fn create_anomaly_monitor(&self) -> CreateAnomalyMonitorFluentBuilder

Constructs a fluent builder for the CreateAnomalyMonitor operation.

  • The fluent builder is configurable:
    • anomaly_monitor(AnomalyMonitor) / set_anomaly_monitor(Option<AnomalyMonitor>):
      required: true

      The cost anomaly detection monitor object that you want to create.


    • resource_tags(ResourceTag) / set_resource_tags(Option<Vec::<ResourceTag>>):
      required: false

      An optional list of tags to associate with the specified AnomalyMonitor . You can use resource tags to control access to your monitor using IAM policies.

      Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags:

      • Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use

      • The maximum length of a key is 128 characters

      • The maximum length of a value is 256 characters

      • Keys and values can only contain alphanumeric characters, spaces, and any of the following: _.:/=+@-

      • Keys and values are case sensitive

      • Keys and values are trimmed for any leading or trailing whitespaces

      • Don’t use aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use


  • On success, responds with CreateAnomalyMonitorOutput with field(s):
    • monitor_arn(String):

      The unique identifier of your newly created cost anomaly detection monitor.

  • On failure, responds with SdkError<CreateAnomalyMonitorError>
Source§

impl Client

Source

pub fn create_anomaly_subscription( &self, ) -> CreateAnomalySubscriptionFluentBuilder

Constructs a fluent builder for the CreateAnomalySubscription operation.

Source§

impl Client

Source

pub fn create_cost_category_definition( &self, ) -> CreateCostCategoryDefinitionFluentBuilder

Constructs a fluent builder for the CreateCostCategoryDefinition operation.

Source§

impl Client

Source

pub fn delete_anomaly_monitor(&self) -> DeleteAnomalyMonitorFluentBuilder

Constructs a fluent builder for the DeleteAnomalyMonitor operation.

Source§

impl Client

Source

pub fn delete_anomaly_subscription( &self, ) -> DeleteAnomalySubscriptionFluentBuilder

Constructs a fluent builder for the DeleteAnomalySubscription operation.

Source§

impl Client

Source

pub fn delete_cost_category_definition( &self, ) -> DeleteCostCategoryDefinitionFluentBuilder

Constructs a fluent builder for the DeleteCostCategoryDefinition operation.

Source§

impl Client

Source

pub fn describe_cost_category_definition( &self, ) -> DescribeCostCategoryDefinitionFluentBuilder

Constructs a fluent builder for the DescribeCostCategoryDefinition operation.

Source§

impl Client

Source

pub fn get_anomalies(&self) -> GetAnomaliesFluentBuilder

Constructs a fluent builder for the GetAnomalies operation.

Source§

impl Client

Source

pub fn get_anomaly_monitors(&self) -> GetAnomalyMonitorsFluentBuilder

Constructs a fluent builder for the GetAnomalyMonitors operation.

Source§

impl Client

Source

pub fn get_anomaly_subscriptions(&self) -> GetAnomalySubscriptionsFluentBuilder

Constructs a fluent builder for the GetAnomalySubscriptions operation.

Source§

impl Client

Source

pub fn get_approximate_usage_records( &self, ) -> GetApproximateUsageRecordsFluentBuilder

Constructs a fluent builder for the GetApproximateUsageRecords operation.

Source§

impl Client

Source

pub fn get_commitment_purchase_analysis( &self, ) -> GetCommitmentPurchaseAnalysisFluentBuilder

Constructs a fluent builder for the GetCommitmentPurchaseAnalysis operation.

Source§

impl Client

Source

pub fn get_cost_and_usage(&self) -> GetCostAndUsageFluentBuilder

Constructs a fluent builder for the GetCostAndUsage operation.

  • The fluent builder is configurable:
    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      Sets the start date and end date for retrieving Amazon Web Services costs. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.


    • granularity(Granularity) / set_granularity(Option<Granularity>):
      required: true

      Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or HOURLY. If Granularity isn’t set, the response object doesn’t include the Granularity, either MONTHLY or DAILY, or HOURLY.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Filters Amazon Web Services costs by different dimensions. For example, you can specify SERVICE and LINKED_ACCOUNT and get the costs that are associated with that account’s usage of that service. You can nest Expression objects to define any combination of dimension filters. For more information, see Expression.

      Valid values for MatchOptions for Dimensions are EQUALS and CASE_SENSITIVE.

      Valid values for MatchOptions for CostCategories and Tags are EQUALS, ABSENT, and CASE_SENSITIVE. Default values are EQUALS and CASE_SENSITIVE.


    • metrics(impl Into<String>) / set_metrics(Option<Vec::<String>>):
      required: true

      Which metrics are returned in the query. For more information about blended and unblended rates, see Why does the “blended” annotation appear on some line items in my bill?.

      Valid values are AmortizedCost, BlendedCost, NetAmortizedCost, NetUnblendedCost, NormalizedUsageAmount, UnblendedCost, and UsageQuantity.

      If you return the UsageQuantity metric, the service aggregates all usage numbers without taking into account the units. For example, if you aggregate usageQuantity across all of Amazon EC2, the results aren’t meaningful because Amazon EC2 compute hours and data transfer are measured in different units (for example, hours and GB). To get more meaningful UsageQuantity metrics, filter by UsageType or UsageTypeGroups.

      Metrics is required for GetCostAndUsage requests.


    • group_by(GroupDefinition) / set_group_by(Option<Vec::<GroupDefinition>>):
      required: false

      You can group Amazon Web Services costs using up to two different groups, either dimensions, tag keys, cost categories, or any two group by types.

      Valid values for the DIMENSION type are AZ, INSTANCE_TYPE, LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, TENANCY, RECORD_TYPE, and USAGE_TYPE.

      When you group by the TAG type and include a valid tag key, you get all tag values, including empty strings.


    • billing_view_arn(impl Into<String>) / set_billing_view_arn(Option<String>):
      required: false

      The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.


  • On success, responds with GetCostAndUsageOutput with field(s):
  • On failure, responds with SdkError<GetCostAndUsageError>
Source§

impl Client

Source

pub fn get_cost_and_usage_with_resources( &self, ) -> GetCostAndUsageWithResourcesFluentBuilder

Constructs a fluent builder for the GetCostAndUsageWithResources operation.

  • The fluent builder is configurable:
    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      Sets the start and end dates for retrieving Amazon Web Services costs. The range must be within the last 14 days (the start date cannot be earlier than 14 days ago). The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.


    • granularity(Granularity) / set_granularity(Option<Granularity>):
      required: true

      Sets the Amazon Web Services cost granularity to MONTHLY, DAILY, or HOURLY. If Granularity isn’t set, the response object doesn’t include the Granularity, MONTHLY, DAILY, or HOURLY.


    • filter(Expression) / set_filter(Option<Expression>):
      required: true

      Filters Amazon Web Services costs by different dimensions. For example, you can specify SERVICE and LINKED_ACCOUNT and get the costs that are associated with that account’s usage of that service. You can nest Expression objects to define any combination of dimension filters. For more information, see Expression.

      The GetCostAndUsageWithResources operation requires that you either group by or filter by a ResourceId. It requires the Expression “SERVICE = Amazon Elastic Compute Cloud - Compute” in the filter.

      Valid values for MatchOptions for Dimensions are EQUALS and CASE_SENSITIVE.

      Valid values for MatchOptions for CostCategories and Tags are EQUALS, ABSENT, and CASE_SENSITIVE. Default values are EQUALS and CASE_SENSITIVE.


    • metrics(impl Into<String>) / set_metrics(Option<Vec::<String>>):
      required: false

      Which metrics are returned in the query. For more information about blended and unblended rates, see Why does the “blended” annotation appear on some line items in my bill?.

      Valid values are AmortizedCost, BlendedCost, NetAmortizedCost, NetUnblendedCost, NormalizedUsageAmount, UnblendedCost, and UsageQuantity.

      If you return the UsageQuantity metric, the service aggregates all usage numbers without taking the units into account. For example, if you aggregate usageQuantity across all of Amazon EC2, the results aren’t meaningful because Amazon EC2 compute hours and data transfer are measured in different units (for example, hour or GB). To get more meaningful UsageQuantity metrics, filter by UsageType or UsageTypeGroups.

      Metrics is required for GetCostAndUsageWithResources requests.


    • group_by(GroupDefinition) / set_group_by(Option<Vec::<GroupDefinition>>):
      required: false

      You can group Amazon Web Services costs using up to two different groups: DIMENSION, TAG, COST_CATEGORY.


    • billing_view_arn(impl Into<String>) / set_billing_view_arn(Option<String>):
      required: false

      The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.


  • On success, responds with GetCostAndUsageWithResourcesOutput with field(s):
  • On failure, responds with SdkError<GetCostAndUsageWithResourcesError>
Source§

impl Client

Source

pub fn get_cost_categories(&self) -> GetCostCategoriesFluentBuilder

Constructs a fluent builder for the GetCostCategories operation.

  • The fluent builder is configurable:
    • search_string(impl Into<String>) / set_search_string(Option<String>):
      required: false

      The value that you want to search the filter values for.

      If you don’t specify a CostCategoryName, SearchString is used to filter Cost Category names that match the SearchString pattern. If you specify a CostCategoryName, SearchString is used to filter Cost Category values that match the SearchString pattern.


    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      The time period of the request.


    • cost_category_name(impl Into<String>) / set_cost_category_name(Option<String>):
      required: false

      The unique name of the Cost Category.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Use Expression to filter in various Cost Explorer APIs.

      Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.

      There are two patterns:

      • Simple dimension values.

        • There are three types of simple dimension values: CostCategories, Tags, and Dimensions.

          • Specify the CostCategories field to define a filter that acts on Cost Categories.

          • Specify the Tags field to define a filter that acts on Cost Allocation Tags.

          • Specify the Dimensions field to define a filter that acts on the DimensionValues .

        • For each filter type, you can set the dimension name and values for the filters that you plan to use.

          • For example, you can filter for REGION==us-east-1 OR REGION==us-west-1. For GetRightsizingRecommendation, the Region is a full name (for example, REGION==US East (N. Virginia).

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] } }

          • As shown in the previous example, lists of dimension values are combined with OR when applying the filter.

        • You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.

          • For example, you can filter for linked account names that start with “a”.

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “LINKED_ACCOUNT_NAME”, “MatchOptions”: [ “STARTS_WITH” ], “Values”: [ “a” ] } }

      • Compound Expression types with logical operations.

        • You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. By doing this, you can filter by more advanced options.

        • For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).

        • The corresponding Expression for this example is as follows: { “And”: [ {“Or”: [ {“Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] }}, {“Tags”: { “Key”: “TagName”, “Values”: [“Value1”] } } ]}, {“Not”: {“Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [“DataTransfer”] }}} ] }

        Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error: { “And”: [ … ], “Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [ “DataTransfer” ] } }

        The following is an example of the corresponding error message: “Expression has more than one roots. Only one root operator is allowed for each expression: And, Or, Not, Dimensions, Tags, CostCategories”

      For the GetRightsizingRecommendation action, a combination of OR and NOT isn’t supported. OR isn’t supported between different dimensions, or dimensions and tags. NOT operators aren’t supported. Dimensions are also limited to LINKED_ACCOUNT, REGION, or RIGHTSIZING_TYPE.

      For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren’t supported. Dimensions are limited to LINKED_ACCOUNT.


    • sort_by(SortDefinition) / set_sort_by(Option<Vec::<SortDefinition>>):
      required: false

      The value that you sort the data by.

      The key represents the cost and usage metrics. The following values are supported:

      • BlendedCost

      • UnblendedCost

      • AmortizedCost

      • NetAmortizedCost

      • NetUnblendedCost

      • UsageQuantity

      • NormalizedUsageAmount

      The supported key values for the SortOrder value are ASCENDING and DESCENDING.

      When you use the SortBy value, the NextPageToken and SearchString key values aren’t supported.


    • billing_view_arn(impl Into<String>) / set_billing_view_arn(Option<String>):
      required: false

      The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      This field is only used when the SortBy value is provided in the request.

      The maximum number of objects that are returned for this request. If MaxResults isn’t specified with the SortBy value, the request returns 1000 results as the default value for this parameter.

      For GetCostCategories, MaxResults has an upper quota of 1000.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      If the number of objects that are still available for retrieval exceeds the quota, Amazon Web Services returns a NextPageToken value in the response. To retrieve the next batch of objects, provide the NextPageToken from the previous call in your next request.


  • On success, responds with GetCostCategoriesOutput with field(s):
  • On failure, responds with SdkError<GetCostCategoriesError>
Source§

impl Client

Source

pub fn get_cost_forecast(&self) -> GetCostForecastFluentBuilder

Constructs a fluent builder for the GetCostForecast operation.

Source§

impl Client

Source

pub fn get_dimension_values(&self) -> GetDimensionValuesFluentBuilder

Constructs a fluent builder for the GetDimensionValues operation.

  • The fluent builder is configurable:
    • search_string(impl Into<String>) / set_search_string(Option<String>):
      required: false

      The value that you want to search the filter values for.


    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      The start date and end date for retrieving the dimension values. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.


    • dimension(Dimension) / set_dimension(Option<Dimension>):
      required: true

      The name of the dimension. Each Dimension is available for a different Context. For more information, see Context. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.


    • context(Context) / set_context(Option<Context>):
      required: false

      The context for the call to GetDimensionValues. This can be RESERVATIONS or COST_AND_USAGE. The default value is COST_AND_USAGE. If the context is set to RESERVATIONS, the resulting dimension values can be used in the GetReservationUtilization operation. If the context is set to COST_AND_USAGE, the resulting dimension values can be used in the GetCostAndUsage operation.

      If you set the context to COST_AND_USAGE, you can use the following dimensions for searching:

      • AZ - The Availability Zone. An example is us-east-1a.

      • BILLING_ENTITY - The Amazon Web Services seller that your account is with. Possible values are the following:

        - Amazon Web Services(Amazon Web Services): The entity that sells Amazon Web Services services.

        - AISPL (Amazon Internet Services Pvt. Ltd.): The local Indian entity that’s an acting reseller for Amazon Web Services services in India.

        - Amazon Web Services Marketplace: The entity that supports the sale of solutions that are built on Amazon Web Services by third-party software providers.

      • CACHE_ENGINE - The Amazon ElastiCache operating system. Examples are Windows or Linux.

      • DEPLOYMENT_OPTION - The scope of Amazon Relational Database Service deployments. Valid values are SingleAZ and MultiAZ.

      • DATABASE_ENGINE - The Amazon Relational Database Service database. Examples are Aurora or MySQL.

      • INSTANCE_TYPE - The type of Amazon EC2 instance. An example is m4.xlarge.

      • INSTANCE_TYPE_FAMILY - A family of instance types optimized to fit different use cases. Examples are Compute Optimized (for example, C4, C5, C6g, and C7g), Memory Optimization (for example, R4, R5n, R5b, and R6g).

      • INVOICING_ENTITY - The name of the entity that issues the Amazon Web Services invoice.

      • LEGAL_ENTITY_NAME - The name of the organization that sells you Amazon Web Services services, such as Amazon Web Services.

      • LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.

      • OPERATING_SYSTEM - The operating system. Examples are Windows or Linux.

      • OPERATION - The action performed. Examples include RunInstance and CreateBucket.

      • PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.

      • PURCHASE_TYPE - The reservation type of the purchase that this usage is related to. Examples include On-Demand Instances and Standard Reserved Instances.

      • RESERVATION_ID - The unique identifier for an Amazon Web Services Reservation Instance.

      • SAVINGS_PLAN_ARN - The unique identifier for your Savings Plans.

      • SAVINGS_PLANS_TYPE - Type of Savings Plans (EC2 Instance or Compute).

      • SERVICE - The Amazon Web Services service such as Amazon DynamoDB.

      • TENANCY - The tenancy of a resource. Examples are shared or dedicated.

      • USAGE_TYPE - The type of usage. An example is DataTransfer-In-Bytes. The response for the GetDimensionValues operation includes a unit attribute. Examples include GB and Hrs.

      • USAGE_TYPE_GROUP - The grouping of common usage types. An example is Amazon EC2: CloudWatch – Alarms. The response for this operation includes a unit attribute.

      • REGION - The Amazon Web Services Region.

      • RECORD_TYPE - The different types of charges such as Reserved Instance (RI) fees, usage costs, tax refunds, and credits.

      • RESOURCE_ID - The unique identifier of the resource. ResourceId is an opt-in feature only available for last 14 days for EC2-Compute Service.

      If you set the context to RESERVATIONS, you can use the following dimensions for searching:

      • AZ - The Availability Zone. An example is us-east-1a.

      • CACHE_ENGINE - The Amazon ElastiCache operating system. Examples are Windows or Linux.

      • DEPLOYMENT_OPTION - The scope of Amazon Relational Database Service deployments. Valid values are SingleAZ and MultiAZ.

      • INSTANCE_TYPE - The type of Amazon EC2 instance. An example is m4.xlarge.

      • LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.

      • PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.

      • REGION - The Amazon Web Services Region.

      • SCOPE (Utilization only) - The scope of a Reserved Instance (RI). Values are regional or a single Availability Zone.

      • TAG (Coverage only) - The tags that are associated with a Reserved Instance (RI).

      • TENANCY - The tenancy of a resource. Examples are shared or dedicated.

      If you set the context to SAVINGS_PLANS, you can use the following dimensions for searching:

      • SAVINGS_PLANS_TYPE - Type of Savings Plans (EC2 Instance or Compute)

      • PAYMENT_OPTION - The payment option for the given Savings Plans (for example, All Upfront)

      • REGION - The Amazon Web Services Region.

      • INSTANCE_TYPE_FAMILY - The family of instances (For example, m5)

      • LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.

      • SAVINGS_PLAN_ARN - The unique identifier for your Savings Plans.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Use Expression to filter in various Cost Explorer APIs.

      Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.

      There are two patterns:

      • Simple dimension values.

        • There are three types of simple dimension values: CostCategories, Tags, and Dimensions.

          • Specify the CostCategories field to define a filter that acts on Cost Categories.

          • Specify the Tags field to define a filter that acts on Cost Allocation Tags.

          • Specify the Dimensions field to define a filter that acts on the DimensionValues .

        • For each filter type, you can set the dimension name and values for the filters that you plan to use.

          • For example, you can filter for REGION==us-east-1 OR REGION==us-west-1. For GetRightsizingRecommendation, the Region is a full name (for example, REGION==US East (N. Virginia).

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] } }

          • As shown in the previous example, lists of dimension values are combined with OR when applying the filter.

        • You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.

          • For example, you can filter for linked account names that start with “a”.

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “LINKED_ACCOUNT_NAME”, “MatchOptions”: [ “STARTS_WITH” ], “Values”: [ “a” ] } }

      • Compound Expression types with logical operations.

        • You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. By doing this, you can filter by more advanced options.

        • For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).

        • The corresponding Expression for this example is as follows: { “And”: [ {“Or”: [ {“Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] }}, {“Tags”: { “Key”: “TagName”, “Values”: [“Value1”] } } ]}, {“Not”: {“Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [“DataTransfer”] }}} ] }

        Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error: { “And”: [ … ], “Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [ “DataTransfer” ] } }

        The following is an example of the corresponding error message: “Expression has more than one roots. Only one root operator is allowed for each expression: And, Or, Not, Dimensions, Tags, CostCategories”

      For the GetRightsizingRecommendation action, a combination of OR and NOT isn’t supported. OR isn’t supported between different dimensions, or dimensions and tags. NOT operators aren’t supported. Dimensions are also limited to LINKED_ACCOUNT, REGION, or RIGHTSIZING_TYPE.

      For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren’t supported. Dimensions are limited to LINKED_ACCOUNT.


    • sort_by(SortDefinition) / set_sort_by(Option<Vec::<SortDefinition>>):
      required: false

      The value that you want to sort the data by.

      The key represents cost and usage metrics. The following values are supported:

      • BlendedCost

      • UnblendedCost

      • AmortizedCost

      • NetAmortizedCost

      • NetUnblendedCost

      • UsageQuantity

      • NormalizedUsageAmount

      The supported values for the SortOrder key are ASCENDING or DESCENDING.

      When you specify a SortBy paramater, the context must be COST_AND_USAGE. Further, when using SortBy, NextPageToken and SearchString aren’t supported.


    • billing_view_arn(impl Into<String>) / set_billing_view_arn(Option<String>):
      required: false

      The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      This field is only used when SortBy is provided in the request. The maximum number of objects that are returned for this request. If MaxResults isn’t specified with SortBy, the request returns 1000 results as the default value for this parameter.

      For GetDimensionValues, MaxResults has an upper limit of 1000.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.


  • On success, responds with GetDimensionValuesOutput with field(s):
    • dimension_values(Vec::<DimensionValuesWithAttributes>):

      The filters that you used to filter your request. Some dimensions are available only for a specific context.

      If you set the context to COST_AND_USAGE, you can use the following dimensions for searching:

      • AZ - The Availability Zone. An example is us-east-1a.

      • DATABASE_ENGINE - The Amazon Relational Database Service database. Examples are Aurora or MySQL.

      • INSTANCE_TYPE - The type of Amazon EC2 instance. An example is m4.xlarge.

      • LEGAL_ENTITY_NAME - The name of the organization that sells you Amazon Web Services services, such as Amazon Web Services.

      • LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.

      • OPERATING_SYSTEM - The operating system. Examples are Windows or Linux.

      • OPERATION - The action performed. Examples include RunInstance and CreateBucket.

      • PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.

      • PURCHASE_TYPE - The reservation type of the purchase to which this usage is related. Examples include On-Demand Instances and Standard Reserved Instances.

      • SERVICE - The Amazon Web Services service such as Amazon DynamoDB.

      • USAGE_TYPE - The type of usage. An example is DataTransfer-In-Bytes. The response for the GetDimensionValues operation includes a unit attribute. Examples include GB and Hrs.

      • USAGE_TYPE_GROUP - The grouping of common usage types. An example is Amazon EC2: CloudWatch – Alarms. The response for this operation includes a unit attribute.

      • RECORD_TYPE - The different types of charges such as RI fees, usage costs, tax refunds, and credits.

      • RESOURCE_ID - The unique identifier of the resource. ResourceId is an opt-in feature only available for last 14 days for EC2-Compute Service. You can opt-in by enabling Hourly and Resource Level Data in Cost Management Console preferences.

      If you set the context to RESERVATIONS, you can use the following dimensions for searching:

      • AZ - The Availability Zone. An example is us-east-1a.

      • CACHE_ENGINE - The Amazon ElastiCache operating system. Examples are Windows or Linux.

      • DEPLOYMENT_OPTION - The scope of Amazon Relational Database Service deployments. Valid values are SingleAZ and MultiAZ.

      • INSTANCE_TYPE - The type of Amazon EC2 instance. An example is m4.xlarge.

      • LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.

      • PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.

      • REGION - The Amazon Web Services Region.

      • SCOPE (Utilization only) - The scope of a Reserved Instance (RI). Values are regional or a single Availability Zone.

      • TAG (Coverage only) - The tags that are associated with a Reserved Instance (RI).

      • TENANCY - The tenancy of a resource. Examples are shared or dedicated.

      If you set the context to SAVINGS_PLANS, you can use the following dimensions for searching:

      • SAVINGS_PLANS_TYPE - Type of Savings Plans (EC2 Instance or Compute)

      • PAYMENT_OPTION - Payment option for the given Savings Plans (for example, All Upfront)

      • REGION - The Amazon Web Services Region.

      • INSTANCE_TYPE_FAMILY - The family of instances (For example, m5)

      • LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.

      • SAVINGS_PLAN_ARN - The unique identifier for your Savings Plan

    • return_size(i32):

      The number of results that Amazon Web Services returned at one time.

    • total_size(i32):

      The total number of search results.

    • next_page_token(Option<String>):

      The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

  • On failure, responds with SdkError<GetDimensionValuesError>
Source§

impl Client

Source

pub fn get_reservation_coverage(&self) -> GetReservationCoverageFluentBuilder

Constructs a fluent builder for the GetReservationCoverage operation.

  • The fluent builder is configurable:
    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      The start and end dates of the period that you want to retrieve data about reservation coverage for. You can retrieve data for a maximum of 13 months: the last 12 months and the current month. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.


    • group_by(GroupDefinition) / set_group_by(Option<Vec::<GroupDefinition>>):
      required: false

      You can group the data by the following attributes:

      • AZ

      • CACHE_ENGINE

      • DATABASE_ENGINE

      • DEPLOYMENT_OPTION

      • INSTANCE_TYPE

      • INVOICING_ENTITY

      • LINKED_ACCOUNT

      • OPERATING_SYSTEM

      • PLATFORM

      • REGION

      • TENANCY


    • granularity(Granularity) / set_granularity(Option<Granularity>):
      required: false

      The granularity of the Amazon Web Services cost data for the reservation. Valid values are MONTHLY and DAILY.

      If GroupBy is set, Granularity can’t be set. If Granularity isn’t set, the response object doesn’t include Granularity, either MONTHLY or DAILY.

      The GetReservationCoverage operation supports only DAILY and MONTHLY granularities.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Filters utilization data by dimensions. You can filter by the following dimensions:

      • AZ

      • CACHE_ENGINE

      • DATABASE_ENGINE

      • DEPLOYMENT_OPTION

      • INSTANCE_TYPE

      • LINKED_ACCOUNT

      • OPERATING_SYSTEM

      • PLATFORM

      • REGION

      • SERVICE

      • TAG

      • TENANCY

      GetReservationCoverage uses the same Expression object as the other operations, but only AND is supported among each dimension. You can nest only one level deep. If there are multiple values for a dimension, they are OR’d together.

      If you don’t provide a SERVICE filter, Cost Explorer defaults to EC2.

      Cost category is also supported.


    • metrics(impl Into<String>) / set_metrics(Option<Vec::<String>>):
      required: false

      The measurement that you want your reservation coverage reported in.

      Valid values are Hour, Unit, and Cost. You can use multiple values in a request.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.


    • sort_by(SortDefinition) / set_sort_by(Option<SortDefinition>):
      required: false

      The value by which you want to sort the data.

      The following values are supported for Key:

      • OnDemandCost

      • CoverageHoursPercentage

      • OnDemandHours

      • ReservedHours

      • TotalRunningHours

      • CoverageNormalizedUnitsPercentage

      • OnDemandNormalizedUnits

      • ReservedNormalizedUnits

      • TotalRunningNormalizedUnits

      • Time

      Supported values for SortOrder are ASCENDING or DESCENDING.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      The maximum number of objects that you returned for this request. If more objects are available, in the response, Amazon Web Services provides a NextPageToken value that you can use in a subsequent call to get the next batch of objects.


  • On success, responds with GetReservationCoverageOutput with field(s):
  • On failure, responds with SdkError<GetReservationCoverageError>
Source§

impl Client

Source

pub fn get_reservation_purchase_recommendation( &self, ) -> GetReservationPurchaseRecommendationFluentBuilder

Constructs a fluent builder for the GetReservationPurchaseRecommendation operation.

  • The fluent builder is configurable:
    • account_id(impl Into<String>) / set_account_id(Option<String>):
      required: false

      The account ID that’s associated with the recommendation.


    • service(impl Into<String>) / set_service(Option<String>):
      required: true

      The specific service that you want recommendations for.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Use Expression to filter in various Cost Explorer APIs.

      Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.

      There are two patterns:

      • Simple dimension values.

        • There are three types of simple dimension values: CostCategories, Tags, and Dimensions.

          • Specify the CostCategories field to define a filter that acts on Cost Categories.

          • Specify the Tags field to define a filter that acts on Cost Allocation Tags.

          • Specify the Dimensions field to define a filter that acts on the DimensionValues .

        • For each filter type, you can set the dimension name and values for the filters that you plan to use.

          • For example, you can filter for REGION==us-east-1 OR REGION==us-west-1. For GetRightsizingRecommendation, the Region is a full name (for example, REGION==US East (N. Virginia).

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] } }

          • As shown in the previous example, lists of dimension values are combined with OR when applying the filter.

        • You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.

          • For example, you can filter for linked account names that start with “a”.

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “LINKED_ACCOUNT_NAME”, “MatchOptions”: [ “STARTS_WITH” ], “Values”: [ “a” ] } }

      • Compound Expression types with logical operations.

        • You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. By doing this, you can filter by more advanced options.

        • For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).

        • The corresponding Expression for this example is as follows: { “And”: [ {“Or”: [ {“Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] }}, {“Tags”: { “Key”: “TagName”, “Values”: [“Value1”] } } ]}, {“Not”: {“Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [“DataTransfer”] }}} ] }

        Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error: { “And”: [ … ], “Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [ “DataTransfer” ] } }

        The following is an example of the corresponding error message: “Expression has more than one roots. Only one root operator is allowed for each expression: And, Or, Not, Dimensions, Tags, CostCategories”

      For the GetRightsizingRecommendation action, a combination of OR and NOT isn’t supported. OR isn’t supported between different dimensions, or dimensions and tags. NOT operators aren’t supported. Dimensions are also limited to LINKED_ACCOUNT, REGION, or RIGHTSIZING_TYPE.

      For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren’t supported. Dimensions are limited to LINKED_ACCOUNT.


    • account_scope(AccountScope) / set_account_scope(Option<AccountScope>):
      required: false

      The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to PAYER. If the value is LINKED, recommendations are calculated for individual member accounts only.


    • lookback_period_in_days(LookbackPeriodInDays) / set_lookback_period_in_days(Option<LookbackPeriodInDays>):
      required: false

      The number of previous days that you want Amazon Web Services to consider when it calculates your recommendations.


    • term_in_years(TermInYears) / set_term_in_years(Option<TermInYears>):
      required: false

      The reservation term that you want recommendations for.


    • payment_option(PaymentOption) / set_payment_option(Option<PaymentOption>):
      required: false

      The reservation purchase option that you want recommendations for.


    • service_specification(ServiceSpecification) / set_service_specification(Option<ServiceSpecification>):
      required: false

      The hardware specifications for the service instances that you want recommendations for, such as standard or convertible Amazon EC2 instances.


    • page_size(i32) / set_page_size(Option<i32>):
      required: false

      The number of recommendations that you want returned in a single response object.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The pagination token that indicates the next set of results that you want to retrieve.


  • On success, responds with GetReservationPurchaseRecommendationOutput with field(s):
  • On failure, responds with SdkError<GetReservationPurchaseRecommendationError>
Source§

impl Client

Source

pub fn get_reservation_utilization( &self, ) -> GetReservationUtilizationFluentBuilder

Constructs a fluent builder for the GetReservationUtilization operation.

  • The fluent builder is configurable:
    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      Sets the start and end dates for retrieving Reserved Instance (RI) utilization. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.


    • group_by(GroupDefinition) / set_group_by(Option<Vec::<GroupDefinition>>):
      required: false

      Groups only by SUBSCRIPTION_ID. Metadata is included.


    • granularity(Granularity) / set_granularity(Option<Granularity>):
      required: false

      If GroupBy is set, Granularity can’t be set. If Granularity isn’t set, the response object doesn’t include Granularity, either MONTHLY or DAILY. If both GroupBy and Granularity aren’t set, GetReservationUtilization defaults to DAILY.

      The GetReservationUtilization operation supports only DAILY and MONTHLY granularities.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Filters utilization data by dimensions. You can filter by the following dimensions:

      • AZ

      • CACHE_ENGINE

      • DEPLOYMENT_OPTION

      • INSTANCE_TYPE

      • LINKED_ACCOUNT

      • OPERATING_SYSTEM

      • PLATFORM

      • REGION

      • SERVICE

        If not specified, the SERVICE filter defaults to Amazon Elastic Compute Cloud - Compute. Supported values for SERVICE are Amazon Elastic Compute Cloud - Compute, Amazon Relational Database Service, Amazon ElastiCache, Amazon Redshift, and Amazon Elasticsearch Service. The value for the SERVICE filter should not exceed “1”.

      • SCOPE

      • TENANCY

      GetReservationUtilization uses the same Expression object as the other operations, but only AND is supported among each dimension, and nesting is supported up to only one level deep. If there are multiple values for a dimension, they are OR’d together.


    • sort_by(SortDefinition) / set_sort_by(Option<SortDefinition>):
      required: false

      The value that you want to sort the data by.

      The following values are supported for Key:

      • UtilizationPercentage

      • UtilizationPercentageInUnits

      • PurchasedHours

      • PurchasedUnits

      • TotalActualHours

      • TotalActualUnits

      • UnusedHours

      • UnusedUnits

      • OnDemandCostOfRIHoursUsed

      • NetRISavings

      • TotalPotentialRISavings

      • AmortizedUpfrontFee

      • AmortizedRecurringFee

      • TotalAmortizedFee

      • RICostForUnusedHours

      • RealizedSavings

      • UnrealizedSavings

      The supported values for SortOrder are ASCENDING and DESCENDING.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      The maximum number of objects that you returned for this request. If more objects are available, in the response, Amazon Web Services provides a NextPageToken value that you can use in a subsequent call to get the next batch of objects.


  • On success, responds with GetReservationUtilizationOutput with field(s):
  • On failure, responds with SdkError<GetReservationUtilizationError>
Source§

impl Client

Source

pub fn get_rightsizing_recommendation( &self, ) -> GetRightsizingRecommendationFluentBuilder

Constructs a fluent builder for the GetRightsizingRecommendation operation.

  • The fluent builder is configurable:
    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Use Expression to filter in various Cost Explorer APIs.

      Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.

      There are two patterns:

      • Simple dimension values.

        • There are three types of simple dimension values: CostCategories, Tags, and Dimensions.

          • Specify the CostCategories field to define a filter that acts on Cost Categories.

          • Specify the Tags field to define a filter that acts on Cost Allocation Tags.

          • Specify the Dimensions field to define a filter that acts on the DimensionValues .

        • For each filter type, you can set the dimension name and values for the filters that you plan to use.

          • For example, you can filter for REGION==us-east-1 OR REGION==us-west-1. For GetRightsizingRecommendation, the Region is a full name (for example, REGION==US East (N. Virginia).

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] } }

          • As shown in the previous example, lists of dimension values are combined with OR when applying the filter.

        • You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.

          • For example, you can filter for linked account names that start with “a”.

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “LINKED_ACCOUNT_NAME”, “MatchOptions”: [ “STARTS_WITH” ], “Values”: [ “a” ] } }

      • Compound Expression types with logical operations.

        • You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. By doing this, you can filter by more advanced options.

        • For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).

        • The corresponding Expression for this example is as follows: { “And”: [ {“Or”: [ {“Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] }}, {“Tags”: { “Key”: “TagName”, “Values”: [“Value1”] } } ]}, {“Not”: {“Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [“DataTransfer”] }}} ] }

        Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error: { “And”: [ … ], “Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [ “DataTransfer” ] } }

        The following is an example of the corresponding error message: “Expression has more than one roots. Only one root operator is allowed for each expression: And, Or, Not, Dimensions, Tags, CostCategories”

      For the GetRightsizingRecommendation action, a combination of OR and NOT isn’t supported. OR isn’t supported between different dimensions, or dimensions and tags. NOT operators aren’t supported. Dimensions are also limited to LINKED_ACCOUNT, REGION, or RIGHTSIZING_TYPE.

      For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren’t supported. Dimensions are limited to LINKED_ACCOUNT.


    • configuration(RightsizingRecommendationConfiguration) / set_configuration(Option<RightsizingRecommendationConfiguration>):
      required: false

      You can use Configuration to customize recommendations across two attributes. You can choose to view recommendations for instances within the same instance families or across different instance families. You can also choose to view your estimated savings that are associated with recommendations with consideration of existing Savings Plans or RI benefits, or neither.


    • service(impl Into<String>) / set_service(Option<String>):
      required: true

      The specific service that you want recommendations for. The only valid value for GetRightsizingRecommendation is “AmazonEC2”.


    • page_size(i32) / set_page_size(Option<i32>):
      required: false

      The number of recommendations that you want returned in a single response object.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The pagination token that indicates the next set of results that you want to retrieve.


  • On success, responds with GetRightsizingRecommendationOutput with field(s):
  • On failure, responds with SdkError<GetRightsizingRecommendationError>
Source§

impl Client

Source

pub fn get_savings_plan_purchase_recommendation_details( &self, ) -> GetSavingsPlanPurchaseRecommendationDetailsFluentBuilder

Constructs a fluent builder for the GetSavingsPlanPurchaseRecommendationDetails operation.

Source§

impl Client

Source

pub fn get_savings_plans_coverage(&self) -> GetSavingsPlansCoverageFluentBuilder

Constructs a fluent builder for the GetSavingsPlansCoverage operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn get_savings_plans_purchase_recommendation( &self, ) -> GetSavingsPlansPurchaseRecommendationFluentBuilder

Constructs a fluent builder for the GetSavingsPlansPurchaseRecommendation operation.

Source§

impl Client

Source

pub fn get_savings_plans_utilization( &self, ) -> GetSavingsPlansUtilizationFluentBuilder

Constructs a fluent builder for the GetSavingsPlansUtilization operation.

Source§

impl Client

Source

pub fn get_savings_plans_utilization_details( &self, ) -> GetSavingsPlansUtilizationDetailsFluentBuilder

Constructs a fluent builder for the GetSavingsPlansUtilizationDetails operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn get_tags(&self) -> GetTagsFluentBuilder

Constructs a fluent builder for the GetTags operation.

  • The fluent builder is configurable:
    • search_string(impl Into<String>) / set_search_string(Option<String>):
      required: false

      The value that you want to search for.


    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      The start and end dates for retrieving the dimension values. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.


    • tag_key(impl Into<String>) / set_tag_key(Option<String>):
      required: false

      The key of the tag that you want to return values for.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      Use Expression to filter in various Cost Explorer APIs.

      Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.

      There are two patterns:

      • Simple dimension values.

        • There are three types of simple dimension values: CostCategories, Tags, and Dimensions.

          • Specify the CostCategories field to define a filter that acts on Cost Categories.

          • Specify the Tags field to define a filter that acts on Cost Allocation Tags.

          • Specify the Dimensions field to define a filter that acts on the DimensionValues .

        • For each filter type, you can set the dimension name and values for the filters that you plan to use.

          • For example, you can filter for REGION==us-east-1 OR REGION==us-west-1. For GetRightsizingRecommendation, the Region is a full name (for example, REGION==US East (N. Virginia).

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] } }

          • As shown in the previous example, lists of dimension values are combined with OR when applying the filter.

        • You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.

          • For example, you can filter for linked account names that start with “a”.

          • The corresponding Expression for this example is as follows: { “Dimensions”: { “Key”: “LINKED_ACCOUNT_NAME”, “MatchOptions”: [ “STARTS_WITH” ], “Values”: [ “a” ] } }

      • Compound Expression types with logical operations.

        • You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. By doing this, you can filter by more advanced options.

        • For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).

        • The corresponding Expression for this example is as follows: { “And”: [ {“Or”: [ {“Dimensions”: { “Key”: “REGION”, “Values”: [ “us-east-1”, “us-west-1” ] }}, {“Tags”: { “Key”: “TagName”, “Values”: [“Value1”] } } ]}, {“Not”: {“Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [“DataTransfer”] }}} ] }

        Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error: { “And”: [ … ], “Dimensions”: { “Key”: “USAGE_TYPE”, “Values”: [ “DataTransfer” ] } }

        The following is an example of the corresponding error message: “Expression has more than one roots. Only one root operator is allowed for each expression: And, Or, Not, Dimensions, Tags, CostCategories”

      For the GetRightsizingRecommendation action, a combination of OR and NOT isn’t supported. OR isn’t supported between different dimensions, or dimensions and tags. NOT operators aren’t supported. Dimensions are also limited to LINKED_ACCOUNT, REGION, or RIGHTSIZING_TYPE.

      For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren’t supported. Dimensions are limited to LINKED_ACCOUNT.


    • sort_by(SortDefinition) / set_sort_by(Option<Vec::<SortDefinition>>):
      required: false

      The value that you want to sort the data by.

      The key represents cost and usage metrics. The following values are supported:

      • BlendedCost

      • UnblendedCost

      • AmortizedCost

      • NetAmortizedCost

      • NetUnblendedCost

      • UsageQuantity

      • NormalizedUsageAmount

      The supported values for SortOrder are ASCENDING and DESCENDING.

      When you use SortBy, NextPageToken and SearchString aren’t supported.


    • billing_view_arn(impl Into<String>) / set_billing_view_arn(Option<String>):
      required: false

      The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      This field is only used when SortBy is provided in the request. The maximum number of objects that are returned for this request. If MaxResults isn’t specified with SortBy, the request returns 1000 results as the default value for this parameter.

      For GetTags, MaxResults has an upper quota of 1000.


    • next_page_token(impl Into<String>) / set_next_page_token(Option<String>):
      required: false

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.


  • On success, responds with GetTagsOutput with field(s):
    • next_page_token(Option<String>):

      The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

    • tags(Vec::<String>):

      The tags that match your request.

    • return_size(i32):

      The number of query results that Amazon Web Services returns at a time.

    • total_size(i32):

      The total number of query results.

  • On failure, responds with SdkError<GetTagsError>
Source§

impl Client

Source

pub fn get_usage_forecast(&self) -> GetUsageForecastFluentBuilder

Constructs a fluent builder for the GetUsageForecast operation.

  • The fluent builder is configurable:
    • time_period(DateInterval) / set_time_period(Option<DateInterval>):
      required: true

      The start and end dates of the period that you want to retrieve usage forecast for. The start date is included in the period, but the end date isn’t included in the period. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01. The start date must be equal to or later than the current date to avoid a validation error.


    • metric(Metric) / set_metric(Option<Metric>):
      required: true

      Which metric Cost Explorer uses to create your forecast.

      Valid values for a GetUsageForecast call are the following:

      • USAGE_QUANTITY

      • NORMALIZED_USAGE_AMOUNT


    • granularity(Granularity) / set_granularity(Option<Granularity>):
      required: true

      How granular you want the forecast to be. You can get 3 months of DAILY forecasts or 12 months of MONTHLY forecasts.

      The GetUsageForecast operation supports only DAILY and MONTHLY granularities.


    • filter(Expression) / set_filter(Option<Expression>):
      required: false

      The filters that you want to use to filter your forecast. The GetUsageForecast API supports filtering by the following dimensions:

      • AZ

      • INSTANCE_TYPE

      • LINKED_ACCOUNT

      • LINKED_ACCOUNT_NAME

      • OPERATION

      • PURCHASE_TYPE

      • REGION

      • SERVICE

      • USAGE_TYPE

      • USAGE_TYPE_GROUP

      • RECORD_TYPE

      • OPERATING_SYSTEM

      • TENANCY

      • SCOPE

      • PLATFORM

      • SUBSCRIPTION_ID

      • LEGAL_ENTITY_NAME

      • DEPLOYMENT_OPTION

      • DATABASE_ENGINE

      • INSTANCE_TYPE_FAMILY

      • BILLING_ENTITY

      • RESERVATION_ID

      • SAVINGS_PLAN_ARN


    • billing_view_arn(impl Into<String>) / set_billing_view_arn(Option<String>):
      required: false

      The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.


    • prediction_interval_level(i32) / set_prediction_interval_level(Option<i32>):
      required: false

      Amazon Web Services Cost Explorer always returns the mean forecast as a single point. You can request a prediction interval around the mean by specifying a confidence level. The higher the confidence level, the more confident Cost Explorer is about the actual value falling in the prediction interval. Higher confidence levels result in wider prediction intervals.


  • On success, responds with GetUsageForecastOutput with field(s):
  • On failure, responds with SdkError<GetUsageForecastError>
Source§

impl Client

Source

pub fn list_commitment_purchase_analyses( &self, ) -> ListCommitmentPurchaseAnalysesFluentBuilder

Constructs a fluent builder for the ListCommitmentPurchaseAnalyses operation.

Source§

impl Client

Source

pub fn list_cost_allocation_tag_backfill_history( &self, ) -> ListCostAllocationTagBackfillHistoryFluentBuilder

Constructs a fluent builder for the ListCostAllocationTagBackfillHistory operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn list_cost_allocation_tags(&self) -> ListCostAllocationTagsFluentBuilder

Constructs a fluent builder for the ListCostAllocationTags operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn list_cost_category_definitions( &self, ) -> ListCostCategoryDefinitionsFluentBuilder

Constructs a fluent builder for the ListCostCategoryDefinitions operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn list_savings_plans_purchase_recommendation_generation( &self, ) -> ListSavingsPlansPurchaseRecommendationGenerationFluentBuilder

Constructs a fluent builder for the ListSavingsPlansPurchaseRecommendationGeneration operation.

Source§

impl Client

Source

pub fn list_tags_for_resource(&self) -> ListTagsForResourceFluentBuilder

Constructs a fluent builder for the ListTagsForResource operation.

Source§

impl Client

Source

pub fn provide_anomaly_feedback(&self) -> ProvideAnomalyFeedbackFluentBuilder

Constructs a fluent builder for the ProvideAnomalyFeedback operation.

Source§

impl Client

Source

pub fn start_commitment_purchase_analysis( &self, ) -> StartCommitmentPurchaseAnalysisFluentBuilder

Constructs a fluent builder for the StartCommitmentPurchaseAnalysis operation.

Source§

impl Client

Source

pub fn start_cost_allocation_tag_backfill( &self, ) -> StartCostAllocationTagBackfillFluentBuilder

Constructs a fluent builder for the StartCostAllocationTagBackfill operation.

Source§

impl Client

Source

pub fn start_savings_plans_purchase_recommendation_generation( &self, ) -> StartSavingsPlansPurchaseRecommendationGenerationFluentBuilder

Constructs a fluent builder for the StartSavingsPlansPurchaseRecommendationGeneration operation.

Source§

impl Client

Source

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>):
      required: true

      The Amazon Resource Name (ARN) of the resource. For a list of supported resources, see ResourceTag.


    • resource_tags(ResourceTag) / set_resource_tags(Option<Vec::<ResourceTag>>):
      required: true

      A list of tag key-value pairs to be added to the resource.

      Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags:

      • Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use

      • The maximum length of a key is 128 characters

      • The maximum length of a value is 256 characters

      • Keys and values can only contain alphanumeric characters, spaces, and any of the following: _.:/=+@-

      • Keys and values are case sensitive

      • Keys and values are trimmed for any leading or trailing whitespaces

      • Don’t use aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use


  • On success, responds with TagResourceOutput
  • On failure, responds with SdkError<TagResourceError>
Source§

impl Client

Source

pub fn untag_resource(&self) -> UntagResourceFluentBuilder

Constructs a fluent builder for the UntagResource operation.

Source§

impl Client

Source

pub fn update_anomaly_monitor(&self) -> UpdateAnomalyMonitorFluentBuilder

Constructs a fluent builder for the UpdateAnomalyMonitor operation.

Source§

impl Client

Source

pub fn update_anomaly_subscription( &self, ) -> UpdateAnomalySubscriptionFluentBuilder

Constructs a fluent builder for the UpdateAnomalySubscription operation.

  • The fluent builder is configurable:
    • subscription_arn(impl Into<String>) / set_subscription_arn(Option<String>):
      required: true

      A cost anomaly subscription Amazon Resource Name (ARN).


    • threshold(f64) / set_threshold(Option<f64>):
      required: false

      (deprecated)

      The update to the threshold value for receiving notifications.

      This field has been deprecated. To update a threshold, use ThresholdExpression. Continued use of Threshold will be treated as shorthand syntax for a ThresholdExpression.

      You can specify either Threshold or ThresholdExpression, but not both.


    • frequency(AnomalySubscriptionFrequency) / set_frequency(Option<AnomalySubscriptionFrequency>):
      required: false

      The update to the frequency value that subscribers receive notifications.


    • monitor_arn_list(impl Into<String>) / set_monitor_arn_list(Option<Vec::<String>>):
      required: false

      A list of cost anomaly monitor ARNs.


    • subscribers(Subscriber) / set_subscribers(Option<Vec::<Subscriber>>):
      required: false

      The update to the subscriber list.


    • subscription_name(impl Into<String>) / set_subscription_name(Option<String>):
      required: false

      The new name of the subscription.


    • threshold_expression(Expression) / set_threshold_expression(Option<Expression>):
      required: false

      The update to the Expression object used to specify the anomalies that you want to generate alerts for. This supports dimensions and nested expressions. The supported dimensions are ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE, corresponding to an anomaly’s TotalImpact and TotalImpactPercentage, respectively (see Impact for more details). The supported nested expression types are AND and OR. The match option GREATER_THAN_OR_EQUAL is required. Values must be numbers between 0 and 10,000,000,000 in string format.

      You can specify either Threshold or ThresholdExpression, but not both.

      The following are examples of valid ThresholdExpressions:

      • Absolute threshold: { “Dimensions”: { “Key”: “ANOMALY_TOTAL_IMPACT_ABSOLUTE”, “MatchOptions”: [ “GREATER_THAN_OR_EQUAL” ], “Values”: [ “100” ] } }

      • Percentage threshold: { “Dimensions”: { “Key”: “ANOMALY_TOTAL_IMPACT_PERCENTAGE”, “MatchOptions”: [ “GREATER_THAN_OR_EQUAL” ], “Values”: [ “100” ] } }

      • AND two thresholds together: { “And”: [ { “Dimensions”: { “Key”: “ANOMALY_TOTAL_IMPACT_ABSOLUTE”, “MatchOptions”: [ “GREATER_THAN_OR_EQUAL” ], “Values”: [ “100” ] } }, { “Dimensions”: { “Key”: “ANOMALY_TOTAL_IMPACT_PERCENTAGE”, “MatchOptions”: [ “GREATER_THAN_OR_EQUAL” ], “Values”: [ “100” ] } } ] }

      • OR two thresholds together: { “Or”: [ { “Dimensions”: { “Key”: “ANOMALY_TOTAL_IMPACT_ABSOLUTE”, “MatchOptions”: [ “GREATER_THAN_OR_EQUAL” ], “Values”: [ “100” ] } }, { “Dimensions”: { “Key”: “ANOMALY_TOTAL_IMPACT_PERCENTAGE”, “MatchOptions”: [ “GREATER_THAN_OR_EQUAL” ], “Values”: [ “100” ] } } ] }


  • On success, responds with UpdateAnomalySubscriptionOutput with field(s):
  • On failure, responds with SdkError<UpdateAnomalySubscriptionError>
Source§

impl Client

Source

pub fn update_cost_allocation_tags_status( &self, ) -> UpdateCostAllocationTagsStatusFluentBuilder

Constructs a fluent builder for the UpdateCostAllocationTagsStatus operation.

Source§

impl Client

Source

pub fn update_cost_category_definition( &self, ) -> UpdateCostCategoryDefinitionFluentBuilder

Constructs a fluent builder for the UpdateCostCategoryDefinition operation.

Source§

impl Client

Source

pub fn from_conf(conf: Config) -> Self

Creates a new client from the service Config.

§Panics

This method will panic in the following cases:

  • Retries or timeouts are enabled without a sleep_impl configured.
  • Identity caching is enabled without a sleep_impl and time_source configured.
  • No behavior_version is provided.

The panic message for each of these will have instructions on how to resolve them.

Source

pub fn config(&self) -> &Config

Returns the client’s configuration.

Source§

impl Client

Source

pub fn new(sdk_config: &SdkConfig) -> Self

Creates a new client from an SDK Config.

§Panics
  • This method will panic if the sdk_config is missing an async sleep implementation. If you experience this panic, set the sleep_impl on the Config passed into this function to fix it.
  • This method will panic if the sdk_config is missing an HTTP connector. If you experience this panic, set the http_connector on the Config passed into this function to fix it.
  • This method will panic if no BehaviorVersion is provided. If you experience this panic, set behavior_version on the Config or enable the behavior-version-latest Cargo feature.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Paint for T
where T: ?Sized,

Source§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

§Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
Source§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to Color::Primary.

§Example
println!("{}", value.primary());
Source§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to Color::Fixed.

§Example
println!("{}", value.fixed(color));
Source§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to Color::Rgb.

§Example
println!("{}", value.rgb(r, g, b));
Source§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to Color::Black.

§Example
println!("{}", value.black());
Source§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to Color::Red.

§Example
println!("{}", value.red());
Source§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to Color::Green.

§Example
println!("{}", value.green());
Source§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to Color::Yellow.

§Example
println!("{}", value.yellow());
Source§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to Color::Blue.

§Example
println!("{}", value.blue());
Source§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to Color::Magenta.

§Example
println!("{}", value.magenta());
Source§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to Color::Cyan.

§Example
println!("{}", value.cyan());
Source§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to Color::White.

§Example
println!("{}", value.white());
Source§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightBlack.

§Example
println!("{}", value.bright_black());
Source§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightRed.

§Example
println!("{}", value.bright_red());
Source§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightGreen.

§Example
println!("{}", value.bright_green());
Source§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightYellow.

§Example
println!("{}", value.bright_yellow());
Source§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightBlue.

§Example
println!("{}", value.bright_blue());
Source§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightMagenta.

§Example
println!("{}", value.bright_magenta());
Source§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightCyan.

§Example
println!("{}", value.bright_cyan());
Source§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightWhite.

§Example
println!("{}", value.bright_white());
Source§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

§Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
Source§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to Color::Primary.

§Example
println!("{}", value.on_primary());
Source§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to Color::Fixed.

§Example
println!("{}", value.on_fixed(color));
Source§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to Color::Rgb.

§Example
println!("{}", value.on_rgb(r, g, b));
Source§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to Color::Black.

§Example
println!("{}", value.on_black());
Source§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to Color::Red.

§Example
println!("{}", value.on_red());
Source§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to Color::Green.

§Example
println!("{}", value.on_green());
Source§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to Color::Yellow.

§Example
println!("{}", value.on_yellow());
Source§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to Color::Blue.

§Example
println!("{}", value.on_blue());
Source§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to Color::Magenta.

§Example
println!("{}", value.on_magenta());
Source§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to Color::Cyan.

§Example
println!("{}", value.on_cyan());
Source§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to Color::White.

§Example
println!("{}", value.on_white());
Source§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightBlack.

§Example
println!("{}", value.on_bright_black());
Source§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightRed.

§Example
println!("{}", value.on_bright_red());
Source§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightGreen.

§Example
println!("{}", value.on_bright_green());
Source§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightYellow.

§Example
println!("{}", value.on_bright_yellow());
Source§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightBlue.

§Example
println!("{}", value.on_bright_blue());
Source§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightMagenta.

§Example
println!("{}", value.on_bright_magenta());
Source§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightCyan.

§Example
println!("{}", value.on_bright_cyan());
Source§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightWhite.

§Example
println!("{}", value.on_bright_white());
Source§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling Attribute value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

§Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
Source§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Bold.

§Example
println!("{}", value.bold());
Source§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Dim.

§Example
println!("{}", value.dim());
Source§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Italic.

§Example
println!("{}", value.italic());
Source§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Underline.

§Example
println!("{}", value.underline());

Returns self with the attr() set to Attribute::Blink.

§Example
println!("{}", value.blink());

Returns self with the attr() set to Attribute::RapidBlink.

§Example
println!("{}", value.rapid_blink());
Source§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Invert.

§Example
println!("{}", value.invert());
Source§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Conceal.

§Example
println!("{}", value.conceal());
Source§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Strike.

§Example
println!("{}", value.strike());
Source§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi Quirk value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

§Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
Source§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Mask.

§Example
println!("{}", value.mask());
Source§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Wrap.

§Example
println!("{}", value.wrap());
Source§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Linger.

§Example
println!("{}", value.linger());
Source§

fn clear(&self) -> Painted<&T>

👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear(). The clear() method will be removed in a future release.

Returns self with the quirk() set to Quirk::Clear.

§Example
println!("{}", value.clear());
Source§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Resetting.

§Example
println!("{}", value.resetting());
Source§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Bright.

§Example
println!("{}", value.bright());
Source§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::OnBright.

§Example
println!("{}", value.on_bright());
Source§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the Condition value applies. Replaces any previous condition.

See the crate level docs for more details.

§Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new Painted with a default Style. Read more
Source§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T