Skip to content

associate_resource async

associate_resource(
    application: ApplicationSpecifier,
    resource_type: ResourceType,
    resource: ResourceSpecifier,
    *,
    config_overrides: Optional[AsyncServiceCatalogAppRegistryClientConfig] = None,
    options: Optional[Options] = None,
) -> AssociateResourceResponse

Associates a resource with an application. The resource can be specified by its ARN or name. The application can be specified by ARN, ID, or name.

Minimum permissions

You must have the following permissions to associate a resource using the OPTIONS parameter set to APPLY_APPLICATION_TAG.

  • tag:GetResources

  • tag:TagResources

You must also have these additional permissions if you don't use the AWSServiceCatalogAppRegistryFullAccess policy. For more information, see AWSServiceCatalogAppRegistryFullAccess in the AppRegistry Administrator Guide.

  • resource-groups:AssociateResource

  • cloudformation:UpdateStack

  • cloudformation:DescribeStacks

In addition, you must have the tagging permission defined by the Amazon Web Services service that creates the resource. For more information, see TagResources in the Resource Groups Tagging API Reference.

Parameters:

  • application (ApplicationSpecifier) –

    The name, ID, or ARN of the application.

  • resource_type (ResourceType) –

    The type of resource of which the application will be associated.

  • resource (ResourceSpecifier) –

    The name or ID of the resource of which the application will be associated.

  • options (Optional[Options], default: None ) –

    Determines whether an application tag is applied or skipped.

Raises:

Source code in docs_src/capo_service_catalog_appregistry/_services/async_service_catalog_app_registry.py
async def associate_resource(
    self,
    application: "capo_service_catalog_appregistry.types.application_specifier.ApplicationSpecifier",
    resource_type: "capo_service_catalog_appregistry.types.resource_type.ResourceType",
    resource: "capo_service_catalog_appregistry.types.resource_specifier.ResourceSpecifier",
    *,
    config_overrides: Optional[AsyncServiceCatalogAppRegistryClientConfig] = None,
    options: Optional[
        "capo_service_catalog_appregistry.types.options.Options"
    ] = None,
) -> "capo_service_catalog_appregistry.types.associate_resource_response.AssociateResourceResponse":
    """<p> Associates a resource with an application. The resource can be specified by its ARN or name. The application can be specified by ARN, ID, or name. </p> <p> <b>Minimum permissions</b> </p> <p> You must have the following permissions to associate a resource using the <code>OPTIONS</code> parameter set to <code>APPLY_APPLICATION_TAG</code>. </p> <ul> <li> <p> <code>tag:GetResources</code> </p> </li> <li> <p> <code>tag:TagResources</code> </p> </li> </ul> <p> You must also have these additional permissions if you don't use the <code>AWSServiceCatalogAppRegistryFullAccess</code> policy. For more information, see <a href="https://docs.aws.amazon.com/servicecatalog/latest/arguide/full.html">AWSServiceCatalogAppRegistryFullAccess</a> in the AppRegistry Administrator Guide. </p> <ul> <li> <p> <code>resource-groups:AssociateResource</code> </p> </li> <li> <p> <code>cloudformation:UpdateStack</code> </p> </li> <li> <p> <code>cloudformation:DescribeStacks</code> </p> </li> </ul> <note> <p> In addition, you must have the tagging permission defined by the Amazon Web Services service that creates the resource. For more information, see <a href="https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_TagResources.html">TagResources</a> in the <i>Resource Groups Tagging API Reference</i>. </p> </note>

    Args:
        application: <p> The name, ID, or ARN of the application. </p>
        resource_type: <p>The type of resource of which the application will be associated.</p>
        resource: <p>The name or ID of the resource of which the application will be associated.</p>
        options: <p> Determines whether an application tag is applied or skipped. </p>

    Raises:
        capo_service_catalog_appregistry.errors.conflict_exception.ConflictException: <p>There was a conflict when processing the request (for example, a resource with the given name already exists within the account).</p>
        capo_service_catalog_appregistry.errors.internal_server_exception.InternalServerException: <p>The service is experiencing internal problems.</p>
        capo_service_catalog_appregistry.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_service_catalog_appregistry.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> The maximum number of resources per account has been reached.</p>
        capo_service_catalog_appregistry.errors.throttling_exception.ThrottlingException: <p> The maximum number of API requests has been exceeded. </p>
        capo_service_catalog_appregistry.errors.validation_exception.ValidationException: <p>The request has invalid or missing parameters.</p>
        capo_service_catalog_appregistry.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_service_catalog_appregistry.types.associate_resource_request.AssociateResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_service_catalog_appregistry.types.associate_resource_response.AssociateResourceResponse"
    ]:
        import capo_service_catalog_appregistry._operations.aws242_app_registry.associate_resource

        (
            output,
            http_response,
        ) = await capo_service_catalog_appregistry._operations.aws242_app_registry.associate_resource.async_associate_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateResource")
    )
    input_: capo_service_catalog_appregistry.types.associate_resource_request.AssociateResourceRequest = {
        "application": application,
        "resource_type": resource_type,
        "resource": resource,
    }
    if options is not None:
        input_["options"] = options

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