Skip to content

create_scope async

create_scope(
    targets: TargetResourceList,
    *,
    config_overrides: Optional[AsyncNetworkFlowMonitorClientConfig] = None,
    client_token: Optional[UuidString] = None,
    tags: Optional[TagMap] = None,
) -> CreateScopeOutput

In Network Flow Monitor, you specify a scope for the service to generate metrics for. By using the scope, Network Flow Monitor can generate a topology of all the resources to measure performance metrics for. When you create a scope, you enable permissions for Network Flow Monitor.

A scope is a Region-account pair or multiple Region-account pairs. Network Flow Monitor uses your scope to determine all the resources (the topology) where Network Flow Monitor will gather network flow performance metrics for you. To provide performance metrics, Network Flow Monitor uses the data that is sent by the Network Flow Monitor agents you install on the resources.

To define the Region-account pairs for your scope, the Network Flow Monitor API uses the following constucts, which allow for future flexibility in defining scopes:

  • Targets, which are arrays of targetResources.

  • Target resources, which are Region-targetIdentifier pairs.

  • Target identifiers, made up of a targetID (currently always an account ID) and a targetType (currently always an account).

Parameters:

  • targets (TargetResourceList) –

    The targets to define the scope to be monitored. A target is an array of targetResources, which are currently Region-account pairs, defined by targetResource constructs.

  • client_token (Optional[UuidString], default: None ) –

    A unique, case-sensitive string of up to 64 ASCII characters that you specify to make an idempotent API request. Don't reuse the same client token for other API requests.

  • tags (Optional[TagMap], default: None ) –

    The tags for a scope. You can add a maximum of 200 tags.

Raises:

Source code in docs_src/capo_networkflowmonitor/_services/async_network_flow_monitor.py
async def create_scope(
    self,
    targets: "capo_networkflowmonitor.types.target_resource_list.TargetResourceList",
    *,
    config_overrides: Optional[AsyncNetworkFlowMonitorClientConfig] = None,
    client_token: Optional[
        "capo_networkflowmonitor.types.uuid_string.UuidString"
    ] = None,
    tags: Optional["capo_networkflowmonitor.types.tag_map.TagMap"] = None,
) -> "capo_networkflowmonitor.types.create_scope_output.CreateScopeOutput":
    """<p>In Network Flow Monitor, you specify a scope for the service to generate metrics for. By using the scope, Network Flow Monitor can generate a topology of all the resources to measure performance metrics for. When you create a scope, you enable permissions for Network Flow Monitor.</p> <p>A scope is a Region-account pair or multiple Region-account pairs. Network Flow Monitor uses your scope to determine all the resources (the topology) where Network Flow Monitor will gather network flow performance metrics for you. To provide performance metrics, Network Flow Monitor uses the data that is sent by the Network Flow Monitor agents you install on the resources.</p> <p>To define the Region-account pairs for your scope, the Network Flow Monitor API uses the following constucts, which allow for future flexibility in defining scopes:</p> <ul> <li> <p> <i>Targets</i>, which are arrays of targetResources.</p> </li> <li> <p> <i>Target resources</i>, which are Region-targetIdentifier pairs.</p> </li> <li> <p> <i>Target identifiers</i>, made up of a targetID (currently always an account ID) and a targetType (currently always an account). </p> </li> </ul>

    Args:
        targets: <p>The targets to define the scope to be monitored. A target is an array of targetResources, which are currently Region-account pairs, defined by targetResource constructs.</p>
        client_token: <p>A unique, case-sensitive string of up to 64 ASCII characters that you specify to make an idempotent API request. Don't reuse the same client token for other API requests.</p>
        tags: <p>The tags for a scope. You can add a maximum of 200 tags.</p>

    Raises:
        capo_networkflowmonitor.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permission to perform this action.</p>
        capo_networkflowmonitor.errors.conflict_exception.ConflictException: <p>The requested resource is in use.</p>
        capo_networkflowmonitor.errors.internal_server_exception.InternalServerException: <p>An internal error occurred.</p>
        capo_networkflowmonitor.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request exceeded a service quota.</p>
        capo_networkflowmonitor.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_networkflowmonitor.errors.validation_exception.ValidationException: <p>Invalid request.</p>
        capo_networkflowmonitor.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_networkflowmonitor.types.create_scope_input.CreateScopeInput]",
    ) -> AsyncOperationResponse[
        "capo_networkflowmonitor.types.create_scope_output.CreateScopeOutput"
    ]:
        import capo_networkflowmonitor._operations.network_flow_monitor.create_scope

        (
            output,
            http_response,
        ) = await capo_networkflowmonitor._operations.network_flow_monitor.create_scope.async_create_scope(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateScope")
    )
    input_: capo_networkflowmonitor.types.create_scope_input.CreateScopeInput = {
        "targets": targets
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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