importAsProvisionedProduct method

Future<ImportAsProvisionedProductOutput> importAsProvisionedProduct({
  1. required String physicalId,
  2. required String productId,
  3. required String provisionedProductName,
  4. required String provisioningArtifactId,
  5. String? acceptLanguage,
  6. String? idempotencyToken,
})

Requests the import of a resource as an Service Catalog provisioned product that is associated to an Service Catalog product and provisioning artifact. Once imported, all supported governance actions are supported on the provisioned product.

Resource import only supports CloudFormation stack ARNs. CloudFormation StackSets, and non-root nested stacks, are not supported.

The CloudFormation stack must have one of the following statuses to be imported: CREATE_COMPLETE, UPDATE_COMPLETE, UPDATE_ROLLBACK_COMPLETE, IMPORT_COMPLETE, and IMPORT_ROLLBACK_COMPLETE.

Import of the resource requires that the CloudFormation stack template matches the associated Service Catalog product provisioning artifact. The user or role that performs this operation must have the cloudformation:GetTemplate and cloudformation:DescribeStacks IAM policy permissions.

You can only import one provisioned product at a time. The product's CloudFormation stack must have the IMPORT_COMPLETE status before you import another.

May throw DuplicateResourceException. May throw InvalidParametersException. May throw InvalidStateException. May throw ResourceNotFoundException.

Parameter physicalId : The unique identifier of the resource to be imported. It only currently supports CloudFormation stack IDs.

Parameter productId : The product identifier.

Parameter provisionedProductName : The user-friendly name of the provisioned product. The value must be unique for the Amazon Web Services account. The name cannot be updated after the product is provisioned.

Parameter provisioningArtifactId : The identifier of the provisioning artifact.

Parameter acceptLanguage : The language code.

  • jp - Japanese
  • zh - Chinese

Parameter idempotencyToken : A unique identifier that you provide to ensure idempotency. If multiple requests differ only by the idempotency token, the same response is returned for each repeated request.

Implementation

Future<ImportAsProvisionedProductOutput> importAsProvisionedProduct({
  required String physicalId,
  required String productId,
  required String provisionedProductName,
  required String provisioningArtifactId,
  String? acceptLanguage,
  String? idempotencyToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWS242ServiceCatalogService.ImportAsProvisionedProduct'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PhysicalId': physicalId,
      'ProductId': productId,
      'ProvisionedProductName': provisionedProductName,
      'ProvisioningArtifactId': provisioningArtifactId,
      if (acceptLanguage != null) 'AcceptLanguage': acceptLanguage,
      'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
    },
  );

  return ImportAsProvisionedProductOutput.fromJson(jsonResponse.body);
}