Skip to content

create_resource_definition

create_resource_definition(
    *,
    config_overrides: Optional[GreengrassClientConfig] = None,
    amzn_client_token: Optional[__string] = None,
    initial_version: Optional[ResourceDefinitionVersion] = None,
    name: Optional[__string] = None,
    tags: Optional[Tags] = None,
) -> CreateResourceDefinitionResponse

Creates a resource definition which contains a list of resources to be used in a group. You can create an initial version of the definition by providing a list of resources now, or use ''CreateResourceDefinitionVersion'' later.

Parameters:

  • amzn_client_token (Optional[__string], default: None ) –

    A client token used to correlate requests and responses.

  • initial_version (Optional[ResourceDefinitionVersion], default: None ) –

    Information about the initial version of the resource definition.

  • name (Optional[__string], default: None ) –

    The name of the resource definition.

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

    Tag(s) to add to the new resource.

Raises:

Source code in docs_src/capo_greengrass/_services/greengrass.py
def create_resource_definition(
    self,
    *,
    config_overrides: Optional[GreengrassClientConfig] = None,
    amzn_client_token: Optional["capo_greengrass.types.__string.__string"] = None,
    initial_version: Optional[
        "capo_greengrass.types.resource_definition_version.ResourceDefinitionVersion"
    ] = None,
    name: Optional["capo_greengrass.types.__string.__string"] = None,
    tags: Optional["capo_greengrass.types.tags.Tags"] = None,
) -> "capo_greengrass.types.create_resource_definition_response.CreateResourceDefinitionResponse":
    """Creates a resource definition which contains a list of resources to be used in a group. You can create an initial version of the definition by providing a list of resources now, or use ''CreateResourceDefinitionVersion'' later.

    Args:
        amzn_client_token: A client token used to correlate requests and responses.
        initial_version: Information about the initial version of the resource definition.
        name: The name of the resource definition.
        tags: Tag(s) to add to the new resource.

    Raises:
        capo_greengrass.errors.bad_request_exception.BadRequestException: General error information.
        capo_greengrass.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_greengrass.types.create_resource_definition_request.CreateResourceDefinitionRequest]",
    ) -> OperationResponse[
        "capo_greengrass.types.create_resource_definition_response.CreateResourceDefinitionResponse"
    ]:
        import capo_greengrass._operations.greengrass.create_resource_definition

        output, http_response = (
            capo_greengrass._operations.greengrass.create_resource_definition.create_resource_definition(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateResourceDefinition")
    )
    input_: capo_greengrass.types.create_resource_definition_request.CreateResourceDefinitionRequest = {}
    if amzn_client_token is not None:
        input_["amzn_client_token"] = amzn_client_token
    if initial_version is not None:
        input_["initial_version"] = initial_version
    if name is not None:
        input_["name"] = name
    if tags is not None:
        input_["tags"] = tags

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