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 a Service Catalog provisioned product that is associated to a Service Catalog product and provisioning artifact. Once imported, all supported Service Catalog 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, 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.

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

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 AWS account. The name cannot be updated after the product is provisioned.

Parameter provisioningArtifactId : The identifier of the provisioning artifact.

Parameter acceptLanguage : The language code.

  • en - English (default)
  • 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 {
  ArgumentError.checkNotNull(physicalId, 'physicalId');
  ArgumentError.checkNotNull(productId, 'productId');
  _s.validateStringLength(
    'productId',
    productId,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      provisionedProductName, 'provisionedProductName');
  _s.validateStringLength(
    'provisionedProductName',
    provisionedProductName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      provisioningArtifactId, 'provisioningArtifactId');
  _s.validateStringLength(
    'provisioningArtifactId',
    provisioningArtifactId,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'acceptLanguage',
    acceptLanguage,
    0,
    100,
  );
  _s.validateStringLength(
    'idempotencyToken',
    idempotencyToken,
    1,
    128,
  );
  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);
}