ConfigService / Client / put_stored_query

put_stored_query#

ConfigService.Client.put_stored_query(**kwargs)#

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

Note

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

See also: AWS API Documentation

Request Syntax

response = client.put_stored_query(
    StoredQuery={
        'QueryId': 'string',
        'QueryArn': 'string',
        'QueryName': 'string',
        'Description': 'string',
        'Expression': 'string'
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters:
  • StoredQuery (dict) –

    [REQUIRED]

    A list of StoredQuery objects. The mandatory fields are QueryName and Expression.

    Note

    When you are creating a query, you must provide a query name and an expression. When you are updating a query, you must provide a query name but updating the description is optional.

    • QueryId (string) –

      The ID of the query.

    • QueryArn (string) –

      Amazon Resource Name (ARN) of the query. For example, arn:partition:service:region:account-id:resource-type/resource-name/resource-id.

    • QueryName (string) – [REQUIRED]

      The name of the query.

    • Description (string) –

      A unique description for the query.

    • Expression (string) –

      The expression of the query. For example, SELECT resourceId, resourceType, supplementaryConfiguration.BucketVersioningConfiguration.status WHERE resourceType = 'AWS::S3::Bucket' AND supplementaryConfiguration.BucketVersioningConfiguration.status = 'Off'.

  • Tags (list) –

    A list of Tags object.

    • (dict) –

      The tags for the resource. The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

      • Key (string) –

        One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

      • Value (string) –

        The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

Return type:

dict

Returns:

Response Syntax

{
    'QueryArn': 'string'
}

Response Structure

  • (dict) –

    • QueryArn (string) –

      Amazon Resource Name (ARN) of the query. For example, arn:partition:service:region:account-id:resource-type/resource-name/resource-id.

Exceptions

  • ConfigService.Client.exceptions.ValidationException

  • ConfigService.Client.exceptions.TooManyTagsException

  • ConfigService.Client.exceptions.ResourceConcurrentModificationException