Skip to content

create_hosted_configuration_version async

create_hosted_configuration_version(
    application_id: Name,
    configuration_profile_id: LongName,
    content: Blob,
    content_type: StringWithLengthBetween1And255,
    *,
    config_overrides: Optional[AsyncAppConfigClientConfig] = None,
    description: Optional[Description] = None,
    latest_version_number: Optional[Integer] = None,
    version_label: Optional[VersionLabel] = None,
) -> HostedConfigurationVersion

Creates a new configuration in the AppConfig hosted configuration store. If you're creating a feature flag, we recommend you familiarize yourself with the JSON schema for feature flag data. For more information, see Type reference for AWS.AppConfig.FeatureFlags in the AppConfig User Guide.

Parameters:

  • application_id (Name) –

    The application ID.

  • configuration_profile_id (LongName) –

    The configuration profile ID.

  • description (Optional[Description], default: None ) –

    A description of the configuration.

    Due to HTTP limitations, this field only supports ASCII characters.

  • content (Blob) –

    The configuration data, as bytes.

    AppConfig accepts any type of data, including text formats like JSON or TOML, or binary formats like protocol buffers or compressed data.

  • content_type (StringWithLengthBetween1And255) –

    A standard MIME type describing the format of the configuration content. For more information, see Content-Type.

  • latest_version_number (Optional[Integer], default: None ) –

    An optional locking token used to prevent race conditions from overwriting configuration updates when creating a new version. To ensure your data is not overwritten when creating multiple hosted configuration versions in rapid succession, specify the version number of the latest hosted configuration version.

  • version_label (Optional[VersionLabel], default: None ) –

    An optional, user-defined label for the AppConfig hosted configuration version. This value must contain at least one non-numeric character. For example, "v2.2.0".

Raises:

  • BadRequestException –

    The input fails to satisfy the constraints specified by an Amazon Web Services service.

  • ConflictException –

    The request could not be processed because of conflict in the current state of the resource.

  • InternalServerException –

    There was an internal failure in the AppConfig service.

  • PayloadTooLargeException –

    The configuration size is too large.

  • ResourceNotFoundException –

    The requested resource could not be found.

  • ServiceQuotaExceededException –

    The number of one more AppConfig resources exceeds the maximum allowed. Verify that your environment doesn't exceed the following service quotas:

    Applications: 100 max

    To resolve this issue, you can delete one or more resources and try again. Or, you can request a quota increase. For more information about quotas and to request an increase, see Service quotas for AppConfig in the Amazon Web Services General Reference.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To create a hosted configuration version The following create-hosted-configuration-version example creates a new configuration in the AWS AppConfig configuration store.

>>> await client.create_hosted_configuration_version(application_id='339ohji', configuration_profile_id='ur8hx2f', content='eyAiTmFtZSI6ICJFeGFtcGxlQXBwbGljYXRpb24iLCAiSWQiOiBFeGFtcGxlSUQsICJSYW5rIjogNyB9', content_type='text', latest_version_number=1)
Source code in docs_src/capo_appconfig/_services/async_app_config.py
async def create_hosted_configuration_version(
    self,
    application_id: "capo_appconfig.types.name.Name",
    configuration_profile_id: "capo_appconfig.types.long_name.LongName",
    content: "capo_appconfig.types.blob.Blob",
    content_type: "capo_appconfig.types.string_with_length_between1_and255.StringWithLengthBetween1And255",
    *,
    config_overrides: Optional[AsyncAppConfigClientConfig] = None,
    description: Optional["capo_appconfig.types.description.Description"] = None,
    latest_version_number: Optional["capo_appconfig.types.integer.Integer"] = None,
    version_label: Optional[
        "capo_appconfig.types.version_label.VersionLabel"
    ] = None,
) -> "capo_appconfig.types.hosted_configuration_version.HostedConfigurationVersion":
    """<p>Creates a new configuration in the AppConfig hosted configuration store. If you're creating a feature flag, we recommend you familiarize yourself with the JSON schema for feature flag data. For more information, see <a href="https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-type-reference-feature-flags.html">Type reference for AWS.AppConfig.FeatureFlags</a> in the <i>AppConfig User Guide</i>.</p>

    Args:
        application_id: <p>The application ID.</p>
        configuration_profile_id: <p>The configuration profile ID.</p>
        description: <p>A description of the configuration.</p> <note> <p>Due to HTTP limitations, this field only supports ASCII characters.</p> </note>
        content: <p>The configuration data, as bytes.</p> <note> <p>AppConfig accepts any type of data, including text formats like JSON or TOML, or binary formats like protocol buffers or compressed data.</p> </note>
        content_type: <p>A standard MIME type describing the format of the configuration content. For more information, see <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a>.</p>
        latest_version_number: <p>An optional locking token used to prevent race conditions from overwriting configuration updates when creating a new version. To ensure your data is not overwritten when creating multiple hosted configuration versions in rapid succession, specify the version number of the latest hosted configuration version.</p>
        version_label: <p>An optional, user-defined label for the AppConfig hosted configuration version. This value must contain at least one non-numeric character. For example, "v2.2.0".</p>

    Raises:
        capo_appconfig.errors.bad_request_exception.BadRequestException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_appconfig.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource.</p>
        capo_appconfig.errors.internal_server_exception.InternalServerException: <p>There was an internal failure in the AppConfig service.</p>
        capo_appconfig.errors.payload_too_large_exception.PayloadTooLargeException: <p>The configuration size is too large.</p>
        capo_appconfig.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_appconfig.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of one more AppConfig resources exceeds the maximum allowed. Verify that your environment doesn't exceed the following service quotas:</p> <p>Applications: 100 max</p> <p>To resolve this issue, you can delete one or more resources and try again. Or, you can request a quota increase. For more information about quotas and to request an increase, see <a href="https://docs.aws.amazon.com/general/latest/gr/appconfig.html#limits_appconfig">Service quotas for AppConfig</a> in the Amazon Web Services General Reference.</p>
        capo_appconfig.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a hosted configuration version
        The following create-hosted-configuration-version example creates a new configuration in the AWS AppConfig configuration store.

        >>> await client.create_hosted_configuration_version(application_id='339ohji', configuration_profile_id='ur8hx2f', content='eyAiTmFtZSI6ICJFeGFtcGxlQXBwbGljYXRpb24iLCAiSWQiOiBFeGFtcGxlSUQsICJSYW5rIjogNyB9', content_type='text', latest_version_number=1)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_appconfig.types.create_hosted_configuration_version_request.CreateHostedConfigurationVersionRequest]",
    ) -> AsyncOperationResponse[
        "capo_appconfig.types.hosted_configuration_version.HostedConfigurationVersion"
    ]:
        import capo_appconfig._operations.amazon_app_config.create_hosted_configuration_version

        (
            output,
            http_response,
        ) = await capo_appconfig._operations.amazon_app_config.create_hosted_configuration_version.async_create_hosted_configuration_version(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_appconfig.types.create_hosted_configuration_version_request.CreateHostedConfigurationVersionRequest",
    ) -> dict[str, Any]:
        import capo_appconfig.types.create_hosted_configuration_version_request

        return capo_appconfig.types.create_hosted_configuration_version_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_appconfig.types.hosted_configuration_version.HostedConfigurationVersion",
    ) -> dict[str, Any]:
        import capo_appconfig.types.hosted_configuration_version

        return capo_appconfig.types.hosted_configuration_version.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateHostedConfigurationVersion",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_appconfig.types.create_hosted_configuration_version_request.CreateHostedConfigurationVersionRequest = {
        "application_id": application_id,
        "configuration_profile_id": configuration_profile_id,
        "content": content,
        "content_type": content_type,
    }
    if description is not None:
        input_["description"] = description
    if latest_version_number is not None:
        input_["latest_version_number"] = latest_version_number
    if version_label is not None:
        input_["version_label"] = version_label

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output