Skip to content

create_key_value_store

create_key_value_store(
    name: KeyValueStoreName,
    *,
    config_overrides: Optional[CloudFrontClientConfig] = None,
    comment: Optional[KeyValueStoreComment] = None,
    import_source: Optional[ImportSource] = None,
    tags: Optional[Tags] = None,
) -> CreateKeyValueStoreResult

Specifies the key value store resource to add to your account. In your account, the key value store names must be unique. You can also import key value store data in JSON format from an S3 bucket by providing a valid ImportSource that you own.

Parameters:

  • name (KeyValueStoreName) –

    The name of the key value store. The minimum length is 1 character and the maximum length is 64 characters.

  • comment (Optional[KeyValueStoreComment], default: None ) –

    The comment of the key value store.

  • import_source (Optional[ImportSource], default: None ) –

    The S3 bucket that provides the source for the import. The source must be in a valid JSON format.

Raises:

Examples:

To create a KeyValueStore Use the following command to create a KeyValueStore.

>>> client.create_key_value_store(name='my-keyvaluestore-name', comment='my-key-valuestore-comment', import_source={'SourceType': 'S3', 'SourceARN': 'arn:aws:s3:::amzn-s3-demo-bucket/validJSON.json'})
Source code in docs_src/capo_cloudfront/_services/cloud_front.py
def create_key_value_store(
    self,
    name: "capo_cloudfront.types.key_value_store_name.KeyValueStoreName",
    *,
    config_overrides: Optional[CloudFrontClientConfig] = None,
    comment: Optional[
        "capo_cloudfront.types.key_value_store_comment.KeyValueStoreComment"
    ] = None,
    import_source: Optional[
        "capo_cloudfront.types.import_source.ImportSource"
    ] = None,
    tags: Optional["capo_cloudfront.types.tags.Tags"] = None,
) -> (
    "capo_cloudfront.types.create_key_value_store_result.CreateKeyValueStoreResult"
):
    """<p>Specifies the key value store resource to add to your account. In your account, the key value store names must be unique. You can also import key value store data in JSON format from an S3 bucket by providing a valid <code>ImportSource</code> that you own.</p>

    Args:
        name: <p>The name of the key value store. The minimum length is 1 character and the maximum length is 64 characters.</p>
        comment: <p>The comment of the key value store.</p>
        import_source: <p>The S3 bucket that provides the source for the import. The source must be in a valid JSON format.</p>

    Raises:
        capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
        capo_cloudfront.errors.entity_already_exists.EntityAlreadyExists: <p>The entity already exists. You must provide a unique entity.</p>
        capo_cloudfront.errors.entity_limit_exceeded.EntityLimitExceeded: <p>The entity limit has been exceeded.</p>
        capo_cloudfront.errors.entity_size_limit_exceeded.EntitySizeLimitExceeded: <p>The entity size limit was exceeded.</p>
        capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
        capo_cloudfront.errors.unsupported_operation.UnsupportedOperation: <p>This operation is not supported in this Amazon Web Services Region.</p>
        capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a KeyValueStore
        Use the following command to create a KeyValueStore.

        >>> client.create_key_value_store(name='my-keyvaluestore-name', comment='my-key-valuestore-comment', import_source={'SourceType': 'S3', 'SourceARN': 'arn:aws:s3:::amzn-s3-demo-bucket/validJSON.json'})
    """

    def _handler(
        req: "OperationRequest[capo_cloudfront.types.create_key_value_store_request.CreateKeyValueStoreRequest]",
    ) -> OperationResponse[
        "capo_cloudfront.types.create_key_value_store_result.CreateKeyValueStoreResult"
    ]:
        import capo_cloudfront._operations.cloudfront2020_05_31.create_key_value_store

        output, http_response = (
            capo_cloudfront._operations.cloudfront2020_05_31.create_key_value_store.create_key_value_store(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateKeyValueStore")
    )
    input_: capo_cloudfront.types.create_key_value_store_request.CreateKeyValueStoreRequest = {
        "name": name
    }
    if comment is not None:
        input_["comment"] = comment
    if import_source is not None:
        input_["import_source"] = import_source
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output