createApplicationPresignedUrl method

Future<CreateApplicationPresignedUrlResponse> createApplicationPresignedUrl({
  1. required String applicationName,
  2. required UrlType urlType,
  3. int? sessionExpirationDurationInSeconds,
})

Creates and returns a URL that you can use to connect to an application's extension. Currently, the only available extension is the Apache Flink dashboard.

The IAM role or user used to call this API defines the permissions to access the extension. Once the presigned URL is created, no additional permission is required to access this URL. IAM authorization policies for this API are also enforced for every HTTP request that attempts to connect to the extension.

May throw ResourceNotFoundException. May throw ResourceInUseException. May throw InvalidArgumentException.

Parameter applicationName : The name of the application.

Parameter urlType : The type of the extension for which to create and return a URL. Currently, the only valid extension URL type is FLINK_DASHBOARD_URL.

Parameter sessionExpirationDurationInSeconds : The duration in seconds for which the returned URL will be valid.

Implementation

Future<CreateApplicationPresignedUrlResponse> createApplicationPresignedUrl({
  required String applicationName,
  required UrlType urlType,
  int? sessionExpirationDurationInSeconds,
}) async {
  ArgumentError.checkNotNull(applicationName, 'applicationName');
  _s.validateStringLength(
    'applicationName',
    applicationName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(urlType, 'urlType');
  _s.validateNumRange(
    'sessionExpirationDurationInSeconds',
    sessionExpirationDurationInSeconds,
    1800,
    43200,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'KinesisAnalytics_20180523.CreateApplicationPresignedUrl'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ApplicationName': applicationName,
      'UrlType': urlType.toValue(),
      if (sessionExpirationDurationInSeconds != null)
        'SessionExpirationDurationInSeconds':
            sessionExpirationDurationInSeconds,
    },
  );

  return CreateApplicationPresignedUrlResponse.fromJson(jsonResponse.body);
}