createLink method

Future<CreateLinkResponse> createLink({
  1. required Bandwidth bandwidth,
  2. required String globalNetworkId,
  3. required String siteId,
  4. String? description,
  5. String? provider,
  6. List<Tag>? tags,
  7. String? type,
})

Creates a new link for a specified site.

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

Parameter bandwidth : The upload speed and download speed in Mbps.

Parameter globalNetworkId : The ID of the global network.

Parameter siteId : The ID of the site.

Parameter description : A description of the link.

Length Constraints: Maximum length of 256 characters.

Parameter provider : The provider of the link.

Constraints: Cannot include the following characters: | \ ^

Length Constraints: Maximum length of 128 characters.

Parameter tags : The tags to apply to the resource during creation.

Parameter type : The type of the link.

Constraints: Cannot include the following characters: | \ ^

Length Constraints: Maximum length of 128 characters.

Implementation

Future<CreateLinkResponse> createLink({
  required Bandwidth bandwidth,
  required String globalNetworkId,
  required String siteId,
  String? description,
  String? provider,
  List<Tag>? tags,
  String? type,
}) async {
  ArgumentError.checkNotNull(bandwidth, 'bandwidth');
  ArgumentError.checkNotNull(globalNetworkId, 'globalNetworkId');
  ArgumentError.checkNotNull(siteId, 'siteId');
  final $payload = <String, dynamic>{
    'Bandwidth': bandwidth,
    'SiteId': siteId,
    if (description != null) 'Description': description,
    if (provider != null) 'Provider': provider,
    if (tags != null) 'Tags': tags,
    if (type != null) 'Type': type,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/global-networks/${Uri.encodeComponent(globalNetworkId)}/links',
    exceptionFnMap: _exceptionFns,
  );
  return CreateLinkResponse.fromJson(response);
}