createProvisioningArtifact method

Future<CreateProvisioningArtifactOutput> createProvisioningArtifact({
  1. required ProvisioningArtifactProperties parameters,
  2. required String productId,
  3. String? acceptLanguage,
  4. String? idempotencyToken,
})

Creates a provisioning artifact (also known as a version) for the specified product.

You cannot create a provisioning artifact for a product that was shared with you.

The user or role that performs this operation must have the cloudformation:GetTemplate IAM policy permission. This policy permission is required when using the ImportFromPhysicalId template source in the information data section.

May throw ResourceNotFoundException. May throw InvalidParametersException. May throw LimitExceededException.

Parameter parameters : The configuration for the provisioning artifact.

Parameter productId : The product identifier.

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<CreateProvisioningArtifactOutput> createProvisioningArtifact({
  required ProvisioningArtifactProperties parameters,
  required String productId,
  String? acceptLanguage,
  String? idempotencyToken,
}) async {
  ArgumentError.checkNotNull(parameters, 'parameters');
  ArgumentError.checkNotNull(productId, 'productId');
  _s.validateStringLength(
    'productId',
    productId,
    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.CreateProvisioningArtifact'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Parameters': parameters,
      'ProductId': productId,
      if (acceptLanguage != null) 'AcceptLanguage': acceptLanguage,
      'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CreateProvisioningArtifactOutput.fromJson(jsonResponse.body);
}