createDomainUnit method

Future<CreateDomainUnitOutput> createDomainUnit({
  1. required String domainIdentifier,
  2. required String name,
  3. required String parentDomainUnitIdentifier,
  4. String? clientToken,
  5. String? description,
})

Creates a domain unit in Amazon DataZone.

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

Parameter domainIdentifier : The ID of the domain where you want to crate a domain unit.

Parameter name : The name of the domain unit.

Parameter parentDomainUnitIdentifier : The ID of the parent domain unit.

Parameter clientToken : A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.

Parameter description : The description of the domain unit.

Implementation

Future<CreateDomainUnitOutput> createDomainUnit({
  required String domainIdentifier,
  required String name,
  required String parentDomainUnitIdentifier,
  String? clientToken,
  String? description,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'parentDomainUnitIdentifier': parentDomainUnitIdentifier,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/domain-units',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDomainUnitOutput.fromJson(response);
}