Skip to content

create_deployment async

create_deployment(
    target_arn: TargetARN,
    *,
    config_overrides: Optional[AsyncGreengrassV2ClientConfig] = None,
    deployment_name: Optional[DeploymentNameString] = None,
    components: Optional[ComponentDeploymentSpecifications] = None,
    iot_job_configuration: Optional[DeploymentIoTJobConfiguration] = None,
    deployment_policies: Optional[DeploymentPolicies] = None,
    parent_target_arn: Optional[ThingGroupARN] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientTokenString] = None,
) -> CreateDeploymentResponse

Creates a continuous deployment for a target, which is a Greengrass core device or group of core devices. When you add a new core device to a group of core devices that has a deployment, IoT Greengrass deploys that group's deployment to the new device.

You can define one deployment for each target. When you create a new deployment for a target that has an existing deployment, you replace the previous deployment. IoT Greengrass applies the new deployment to the target devices.

Every deployment has a revision number that indicates how many deployment revisions you define for a target. Use this operation to create a new revision of an existing deployment.

For more information, see the Create deployments in the IoT Greengrass V2 Developer Guide.

Parameters:

  • target_arn (TargetARN) –

    The ARN of the target IoT thing or thing group. When creating a subdeployment, the targetARN can only be a thing group.

  • deployment_name (Optional[DeploymentNameString], default: None ) –

    The name of the deployment.

  • components (Optional[ComponentDeploymentSpecifications], default: None ) –

    The components to deploy. This is a dictionary, where each key is the name of a component, and each key's value is the version and configuration to deploy for that component.

  • iot_job_configuration (Optional[DeploymentIoTJobConfiguration], default: None ) –

    The job configuration for the deployment configuration. The job configuration specifies the rollout, timeout, and stop configurations for the deployment configuration.

  • deployment_policies (Optional[DeploymentPolicies], default: None ) –

    The deployment policies for the deployment. These policies define how the deployment updates components and handles failure.

  • parent_target_arn (Optional[ThingGroupARN], default: None ) –

    The parent deployment's target ARN within a subdeployment.

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

    A list of key-value pairs that contain metadata for the resource. For more information, see Tag your resources in the IoT Greengrass V2 Developer Guide.

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

    A unique, case-sensitive identifier that you can provide to ensure that the request is idempotent. Idempotency means that the request is successfully processed only once, even if you send the request multiple times. When a request succeeds, and you specify the same client token for subsequent successful requests, the IoT Greengrass V2 service returns the successful response that it caches from the previous request. IoT Greengrass V2 caches successful responses for idempotent requests for up to 8 hours.

Raises:

  • AccessDeniedException –

    You don't have permission to perform the action.

  • ConflictException –

    Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time.

  • InternalServerException –

    IoT Greengrass can't process your request right now. Try again later.

  • RequestAlreadyInProgressException –

    The request is already in progress. This exception occurs when you use a client token for multiple requests while IoT Greengrass is still processing an earlier request that uses the same client token.

  • ResourceNotFoundException –

    The requested resource can't be found.

  • ThrottlingException –

    Your request exceeded a request rate quota. For example, you might have exceeded the amount of times that you can retrieve device or deployment status per second.

  • ValidationException –

    The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_greengrassv2/_services/async_greengrass_v2.py
async def create_deployment(
    self,
    target_arn: "capo_greengrassv2.types.target_arn.TargetARN",
    *,
    config_overrides: Optional[AsyncGreengrassV2ClientConfig] = None,
    deployment_name: Optional[
        "capo_greengrassv2.types.deployment_name_string.DeploymentNameString"
    ] = None,
    components: Optional[
        "capo_greengrassv2.types.component_deployment_specifications.ComponentDeploymentSpecifications"
    ] = None,
    iot_job_configuration: Optional[
        "capo_greengrassv2.types.deployment_io_t_job_configuration.DeploymentIoTJobConfiguration"
    ] = None,
    deployment_policies: Optional[
        "capo_greengrassv2.types.deployment_policies.DeploymentPolicies"
    ] = None,
    parent_target_arn: Optional[
        "capo_greengrassv2.types.thing_group_arn.ThingGroupARN"
    ] = None,
    tags: Optional["capo_greengrassv2.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_greengrassv2.types.client_token_string.ClientTokenString"
    ] = None,
) -> "capo_greengrassv2.types.create_deployment_response.CreateDeploymentResponse":
    """<p>Creates a continuous deployment for a target, which is a Greengrass core device or group of core devices. When you add a new core device to a group of core devices that has a deployment, IoT Greengrass deploys that group's deployment to the new device.</p> <p>You can define one deployment for each target. When you create a new deployment for a target that has an existing deployment, you replace the previous deployment. IoT Greengrass applies the new deployment to the target devices.</p> <p>Every deployment has a revision number that indicates how many deployment revisions you define for a target. Use this operation to create a new revision of an existing deployment.</p> <p>For more information, see the <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/create-deployments.html">Create deployments</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>

    Args:
        target_arn: <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the target IoT thing or thing group. When creating a subdeployment, the targetARN can only be a thing group.</p>
        deployment_name: <p>The name of the deployment.</p>
        components: <p>The components to deploy. This is a dictionary, where each key is the name of a component, and each key's value is the version and configuration to deploy for that component.</p>
        iot_job_configuration: <p>The job configuration for the deployment configuration. The job configuration specifies the rollout, timeout, and stop configurations for the deployment configuration.</p>
        deployment_policies: <p>The deployment policies for the deployment. These policies define how the deployment updates components and handles failure.</p>
        parent_target_arn: <p>The parent deployment's target <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> within a subdeployment.</p>
        tags: <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
        client_token: <p>A unique, case-sensitive identifier that you can provide to ensure that the request is idempotent. Idempotency means that the request is successfully processed only once, even if you send the request multiple times. When a request succeeds, and you specify the same client token for subsequent successful requests, the IoT Greengrass V2 service returns the successful response that it caches from the previous request. IoT Greengrass V2 caches successful responses for idempotent requests for up to 8 hours.</p>

    Raises:
        capo_greengrassv2.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action.</p>
        capo_greengrassv2.errors.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time.</p>
        capo_greengrassv2.errors.internal_server_exception.InternalServerException: <p>IoT Greengrass can't process your request right now. Try again later.</p>
        capo_greengrassv2.errors.request_already_in_progress_exception.RequestAlreadyInProgressException: <p>The request is already in progress. This exception occurs when you use a client token for multiple requests while IoT Greengrass is still processing an earlier request that uses the same client token.</p>
        capo_greengrassv2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found.</p>
        capo_greengrassv2.errors.throttling_exception.ThrottlingException: <p>Your request exceeded a request rate quota. For example, you might have exceeded the amount of times that you can retrieve device or deployment status per second.</p>
        capo_greengrassv2.errors.validation_exception.ValidationException: <p>The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.</p>
        capo_greengrassv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_greengrassv2.types.create_deployment_request.CreateDeploymentRequest]",
    ) -> AsyncOperationResponse[
        "capo_greengrassv2.types.create_deployment_response.CreateDeploymentResponse"
    ]:
        import capo_greengrassv2._operations.greengrass_v2.create_deployment

        (
            output,
            http_response,
        ) = await capo_greengrassv2._operations.greengrass_v2.create_deployment.async_create_deployment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDeployment")
    )
    input_: capo_greengrassv2.types.create_deployment_request.CreateDeploymentRequest = {
        "target_arn": target_arn
    }
    if deployment_name is not None:
        input_["deployment_name"] = deployment_name
    if components is not None:
        input_["components"] = components
    if iot_job_configuration is not None:
        input_["iot_job_configuration"] = iot_job_configuration
    if deployment_policies is not None:
        input_["deployment_policies"] = deployment_policies
    if parent_target_arn is not None:
        input_["parent_target_arn"] = parent_target_arn
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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