createServiceNetwork method

Future<CreateServiceNetworkResponse> createServiceNetwork({
  1. required String name,
  2. AuthType? authType,
  3. String? clientToken,
  4. SharingConfig? sharingConfig,
  5. Map<String, String>? tags,
})

Creates a service network. A service network is a logical boundary for a collection of services. You can associate services and VPCs with a service network.

For more information, see Service networks in the Amazon VPC Lattice User Guide.

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

Parameter name : The name of the service network. The name must be unique to the account. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.

Parameter authType : The type of IAM policy.

  • NONE: The resource does not use an IAM policy. This is the default.
  • AWS_IAM: The resource uses an IAM policy. When this type is used, auth is enabled and an auth policy is required.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.

Parameter sharingConfig : Specify if the service network should be enabled for sharing.

Parameter tags : The tags for the service network.

Implementation

Future<CreateServiceNetworkResponse> createServiceNetwork({
  required String name,
  AuthType? authType,
  String? clientToken,
  SharingConfig? sharingConfig,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    if (authType != null) 'authType': authType.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (sharingConfig != null) 'sharingConfig': sharingConfig,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/servicenetworks',
    exceptionFnMap: _exceptionFns,
  );
  return CreateServiceNetworkResponse.fromJson(response);
}