Skip to content

tag_resource async

tag_resource(
    resource_arn: ScanNameArn,
    tags: TagMap,
    *,
    config_overrides: Optional[AsyncCodeGuruSecurityClientConfig] = None,
) -> TagResourceResponse

Use to add one or more tags to an existing scan.

Parameters:

  • resource_arn (ScanNameArn) –

    The ARN of the ScanName object. You can retrieve this ARN by calling CreateScan, ListScans, or GetScan.

  • tags (TagMap) –

    An array of key-value pairs used to tag an existing scan. A tag is a custom attribute label with two parts:

    • A tag key. For example, CostCenter, Environment, or Secret. Tag keys are case sensitive.

    • An optional tag value field. For example, 111122223333, Production, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.

Raises:

Source code in docs_src/capo_codeguru_security/_services/async_code_guru_security.py
async def tag_resource(
    self,
    resource_arn: "capo_codeguru_security.types.scan_name_arn.ScanNameArn",
    tags: "capo_codeguru_security.types.tag_map.TagMap",
    *,
    config_overrides: Optional[AsyncCodeGuruSecurityClientConfig] = None,
) -> "capo_codeguru_security.types.tag_resource_response.TagResourceResponse":
    """<p>Use to add one or more tags to an existing scan.</p>

    Args:
        resource_arn: <p>The ARN of the <code>ScanName</code> object. You can retrieve this ARN by calling <code>CreateScan</code>, <code>ListScans</code>, or <code>GetScan</code>.</p>
        tags: <p>An array of key-value pairs used to tag an existing scan. A tag is a custom attribute label with two parts:</p> <ul> <li> <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p> </li> <li> <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p> </li> </ul>

    Raises:
        capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_codeguru_security.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
        capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
        capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
        capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
        capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codeguru_security.types.tag_resource_request.TagResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_codeguru_security.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_codeguru_security._operations.aws_code_guru_security.tag_resource

        (
            output,
            http_response,
        ) = await capo_codeguru_security._operations.aws_code_guru_security.tag_resource.async_tag_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_codeguru_security.types.tag_resource_request.TagResourceRequest = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

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