createVirtualGateway method

Future<CreateVirtualGatewayOutput> createVirtualGateway({
  1. required String meshName,
  2. required VirtualGatewaySpec spec,
  3. required String virtualGatewayName,
  4. String? clientToken,
  5. String? meshOwner,
  6. List<TagRef>? tags,
})

Creates a virtual gateway.

A virtual gateway allows resources outside your mesh to communicate to resources that are inside your mesh. The virtual gateway represents an Envoy proxy running in an Amazon ECS task, in a Kubernetes service, or on an Amazon EC2 instance. Unlike a virtual node, which represents an Envoy running with an application, a virtual gateway represents Envoy deployed by itself.

For more information about virtual gateways, see Virtual gateways.

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 of the service mesh to create the virtual gateway in.

Parameter spec : The virtual gateway specification to apply.

Parameter virtualGatewayName : The name to use for the virtual gateway.

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 meshOwner : The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then the account that you specify must share the mesh with your account before you can create the resource in the service mesh. For more information about mesh sharing, see Working with shared meshes.

Parameter tags : Optional metadata that you can apply to the virtual gateway 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<CreateVirtualGatewayOutput> createVirtualGateway({
  required String meshName,
  required VirtualGatewaySpec spec,
  required String virtualGatewayName,
  String? clientToken,
  String? meshOwner,
  List<TagRef>? tags,
}) async {
  ArgumentError.checkNotNull(meshName, 'meshName');
  _s.validateStringLength(
    'meshName',
    meshName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(spec, 'spec');
  ArgumentError.checkNotNull(virtualGatewayName, 'virtualGatewayName');
  _s.validateStringLength(
    'virtualGatewayName',
    virtualGatewayName,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'meshOwner',
    meshOwner,
    12,
    12,
  );
  final $query = <String, List<String>>{
    if (meshOwner != null) 'meshOwner': [meshOwner],
  };
  final $payload = <String, dynamic>{
    'spec': spec,
    'virtualGatewayName': virtualGatewayName,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/v20190125/meshes/${Uri.encodeComponent(meshName)}/virtualGateways',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return CreateVirtualGatewayOutput(
    virtualGateway: VirtualGatewayData.fromJson($json),
  );
}