createComponent method

Future<CreateComponentOutput> createComponent({
  1. required String manifest,
  2. required String name,
  3. required String templateFile,
  4. String? clientToken,
  5. String? description,
  6. String? environmentName,
  7. String? serviceInstanceName,
  8. String? serviceName,
  9. String? serviceSpec,
  10. List<Tag>? tags,
})

Create an Proton component. A component is an infrastructure extension for a service instance.

For more information about components, see Proton components in the Proton User Guide.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter manifest : A path to a manifest file that lists the Infrastructure as Code (IaC) file, template language, and rendering engine for infrastructure that a custom component provisions.

Parameter name : The customer-provided name of the component.

Parameter templateFile : A path to the Infrastructure as Code (IaC) file describing infrastructure that a custom component provisions.

Parameter clientToken : The client token for the created component.

Parameter description : An optional customer-provided description of the component.

Parameter environmentName : The name of the Proton environment that you want to associate this component with. You must specify this when you don't specify serviceInstanceName and serviceName.

Parameter serviceInstanceName : The name of the service instance that you want to attach this component to. If you don't specify this, the component isn't attached to any service instance. Specify both serviceInstanceName and serviceName or neither of them.

Parameter serviceName : The name of the service that serviceInstanceName is associated with. If you don't specify this, the component isn't attached to any service instance. Specify both serviceInstanceName and serviceName or neither of them.

Parameter serviceSpec : The service spec that you want the component to use to access service inputs. Set this only when you attach the component to a service instance.

Parameter tags : An optional list of metadata items that you can associate with the Proton component. A tag is a key-value pair.

For more information, see Proton resources and tagging in the Proton User Guide.

Implementation

Future<CreateComponentOutput> createComponent({
  required String manifest,
  required String name,
  required String templateFile,
  String? clientToken,
  String? description,
  String? environmentName,
  String? serviceInstanceName,
  String? serviceName,
  String? serviceSpec,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AwsProton20200720.CreateComponent'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'manifest': manifest,
      'name': name,
      'templateFile': templateFile,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'description': description,
      if (environmentName != null) 'environmentName': environmentName,
      if (serviceInstanceName != null)
        'serviceInstanceName': serviceInstanceName,
      if (serviceName != null) 'serviceName': serviceName,
      if (serviceSpec != null) 'serviceSpec': serviceSpec,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateComponentOutput.fromJson(jsonResponse.body);
}