Skip to content

create_resource_group

create_resource_group(
    resource_group_tags: ResourceGroupTags,
    *,
    config_overrides: Optional[InspectorClientConfig] = None,
) -> CreateResourceGroupResponse

Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. For more information, see CreateAssessmentTarget.

Parameters:

  • resource_group_tags (ResourceGroupTags) –

    A collection of keys and an array of possible values, '[{"key":"key1","values":["Value1","Value2"]},{"key":"Key2","values":["Value3"]}]'.

    For example,'[{"key":"Name","values":["TestEC2Instance"]}]'.

Raises:

Examples:

Create resource group Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target.

>>> client.create_resource_group(resource_group_tags=[{'key': 'Name', 'value': 'example'}])
Source code in docs_src/capo_inspector/_services/inspector.py
def create_resource_group(
    self,
    resource_group_tags: "capo_inspector.types.resource_group_tags.ResourceGroupTags",
    *,
    config_overrides: Optional[InspectorClientConfig] = None,
) -> "capo_inspector.types.create_resource_group_response.CreateResourceGroupResponse":
    """<p>Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. For more information, see <a>CreateAssessmentTarget</a>.</p>

    Args:
        resource_group_tags: <p>A collection of keys and an array of possible values, '[{"key":"key1","values":["Value1","Value2"]},{"key":"Key2","values":["Value3"]}]'.</p> <p>For example,'[{"key":"Name","values":["TestEC2Instance"]}]'.</p>

    Raises:
        capo_inspector.errors.access_denied_exception.AccessDeniedException: <p>You do not have required permissions to access the requested resource.</p>
        capo_inspector.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_inspector.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
        capo_inspector.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current AWS account limits. The error code describes the limit exceeded.</p>
        capo_inspector.errors.service_temporarily_unavailable_exception.ServiceTemporarilyUnavailableException: <p>The serice is temporary unavailable.</p>
        capo_inspector.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create resource group
        Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target.

        >>> client.create_resource_group(resource_group_tags=[{'key': 'Name', 'value': 'example'}])
    """

    def _handler(
        req: "OperationRequest[capo_inspector.types.create_resource_group_request.CreateResourceGroupRequest]",
    ) -> OperationResponse[
        "capo_inspector.types.create_resource_group_response.CreateResourceGroupResponse"
    ]:
        import capo_inspector._operations.inspector_service.create_resource_group

        output, http_response = (
            capo_inspector._operations.inspector_service.create_resource_group.create_resource_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateResourceGroup")
    )
    input_: capo_inspector.types.create_resource_group_request.CreateResourceGroupRequest = {
        "resource_group_tags": resource_group_tags
    }

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