createGateway method

Future<CreateGatewayResponse> createGateway({
  1. required String gatewayName,
  2. required GatewayPlatform gatewayPlatform,
  3. String? gatewayVersion,
  4. Map<String, String>? tags,
})

Creates a gateway, which is a virtual or edge device that delivers industrial data streams from local servers to IoT SiteWise. For more information, see Ingesting data using a gateway in the IoT SiteWise User Guide.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ThrottlingException.

Parameter gatewayName : A unique name for the gateway.

Parameter gatewayPlatform : The gateway's platform. You can only specify one platform in a gateway.

Parameter gatewayVersion : The version of the gateway to create. Specify 3 to create an MQTT-enabled, V3 gateway and 2 to create a Classic streams, V2 gateway. If not specified, the default is 2 (Classic streams, V2 gateway). We recommend creating an MQTT-enabled gateway for self-hosted gateways and Siemens Industrial Edge gateways. For more information on gateway versions, see Use Amazon Web Services IoT SiteWise Edge Edge gateways.

Parameter tags : A list of key-value pairs that contain metadata for the gateway. For more information, see Tagging your IoT SiteWise resources in the IoT SiteWise User Guide.

Implementation

Future<CreateGatewayResponse> createGateway({
  required String gatewayName,
  required GatewayPlatform gatewayPlatform,
  String? gatewayVersion,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'gatewayName': gatewayName,
    'gatewayPlatform': gatewayPlatform,
    if (gatewayVersion != null) 'gatewayVersion': gatewayVersion,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/20200301/gateways',
    hostPrefix: 'api.',
    exceptionFnMap: _exceptionFns,
  );
  return CreateGatewayResponse.fromJson(response);
}