createMesh method

Future<CreateMeshOutput> createMesh({
  1. required String meshName,
  2. String? clientToken,
  3. MeshSpec? spec,
  4. List<TagRef>? tags,
})

Creates a service mesh.

A service mesh is a logical boundary for network traffic between services that are represented by resources within the mesh. After you create your service mesh, you can create virtual services, virtual nodes, virtual routers, and routes to distribute traffic between the applications in your mesh.

For more information about service meshes, see Service meshes.

May throw NotFoundException. May throw BadRequestException. May throw ConflictException. May throw TooManyRequestsException. May throw ForbiddenException. May throw ServiceUnavailableException. May throw InternalServerErrorException. May throw LimitExceededException.

Parameter meshName : The name to use for the service mesh.

Parameter clientToken : Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.

Parameter spec : The service mesh specification to apply.

Parameter tags : Optional metadata that you can apply to the service mesh to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

Implementation

Future<CreateMeshOutput> createMesh({
  required String meshName,
  String? clientToken,
  MeshSpec? spec,
  List<TagRef>? tags,
}) async {
  ArgumentError.checkNotNull(meshName, 'meshName');
  _s.validateStringLength(
    'meshName',
    meshName,
    1,
    255,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'meshName': meshName,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (spec != null) 'spec': spec,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'PUT',
    requestUri: '/v20190125/meshes',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return CreateMeshOutput(
    mesh: MeshData.fromJson($json),
  );
}