createStreamUrl method
- required String applicationIdentifier,
- required String identifier,
- required List<
String> locations, - required Protocol protocol,
- required int urlExpiresAfterMinutes,
- Map<
String, String> ? additionalEnvironmentVariables, - List<
String> ? additionalLaunchArgs, - String? clientToken,
- String? description,
- DisplayConfiguration? displayConfiguration,
- String? roleArn,
- int? sessionLengthSeconds,
- int? usageLimit,
Creates a stream URL that grants temporary access to a stream session in a web browser without requiring an Amazon Web Services account or client integration.
You can use the stream URL to start a stream session up to the number of
times set by UsageLimit, until it expires after
UrlExpiresAfterMinutes. Each successful use starts a new
stream session.
To make the request idempotent, provide a ClientToken.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter applicationIdentifier :
An Amazon
Resource Name (ARN) or ID that uniquely identifies the application
resource. Example ARN:
arn:aws:gameliftstreams:us-west-2:111122223333:application/a-9ZY8X7Wv6.
Example ID: a-9ZY8X7Wv6.
This application must be associated with the stream group.
Parameter identifier :
An Amazon
Resource Name (ARN) or ID that uniquely identifies the stream group
resource. Example ARN:
arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4.
Example ID: sg-1AB2C3De4.
The stream session runs in this stream group.
Parameter locations :
A list of locations, in order of preference, where Amazon GameLift Streams
can place the stream session. Specify each location by its Amazon Web
Services Region code, for example us-east-1. For a complete
list of locations that Amazon GameLift Streams supports, refer to Regions,
quotas, and limitations in the Amazon GameLift Streams Developer
Guide.
Parameter protocol :
The data transport protocol for the stream session. Amazon GameLift
Streams supports WebRTC.
Parameter urlExpiresAfterMinutes :
The number of minutes after creation that the stream URL remains valid.
After this period, the status of the stream URL changes to
EXPIRED and it can no longer start stream sessions. The
minimum is 1 minute. For the maximum, see Regions,
quotas, and limitations in the Amazon GameLift Streams Developer
Guide.
Parameter additionalEnvironmentVariables :
A set of options that you can use to control the stream session runtime
environment, expressed as a set of key-value pairs. You can use this to
configure the application or stream session details. You can also provide
custom environment variables that Amazon GameLift Streams passes to your
game client.
AdditionalEnvironmentVariables and
AdditionalLaunchArgs have similar purposes.
AdditionalEnvironmentVariables passes data using environment
variables; while AdditionalLaunchArgs passes data using
command-line arguments.
Parameter additionalLaunchArgs :
A list of CLI arguments that are sent to the streaming server when a
stream session launches. You can use this to configure the application or
stream session details. You can also provide custom arguments that Amazon
GameLift Streams passes to your game client.
AdditionalEnvironmentVariables and
AdditionalLaunchArgs have similar purposes.
AdditionalEnvironmentVariables passes data using environment
variables; while AdditionalLaunchArgs passes data using
command-line arguments.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure this
request is idempotent. If you retry a request with the same
ClientToken, Amazon GameLift Streams returns the original
response without performing the operation again.
Parameter description :
A descriptive label for the stream URL.
Parameter displayConfiguration :
The display settings, such as resolution, for stream sessions started from
this stream URL.
Parameter roleArn :
The Amazon Resource Name (ARN) of the IAM role that Amazon GameLift
Streams assumes during stream sessions started from this stream URL. For
more information, see Provide
AWS credentials to your streaming application in the Amazon
GameLift Streams Developer Guide.
Parameter sessionLengthSeconds :
The maximum length of time, in seconds, that a stream session started from
this stream URL can run. Valid values are 1-86400 seconds (1 second to 24
hours). The default is 43200 seconds (12 hours).
Parameter usageLimit :
The maximum number of times the stream URL can start a stream session.
Each successful use reduces the remaining uses by one. The minimum is 1,
and the default is 1. For the maximum, see Regions,
quotas, and limitations in the Amazon GameLift Streams Developer
Guide.
Implementation
Future<CreateStreamUrlOutput> createStreamUrl({
required String applicationIdentifier,
required String identifier,
required List<String> locations,
required Protocol protocol,
required int urlExpiresAfterMinutes,
Map<String, String>? additionalEnvironmentVariables,
List<String>? additionalLaunchArgs,
String? clientToken,
String? description,
DisplayConfiguration? displayConfiguration,
String? roleArn,
int? sessionLengthSeconds,
int? usageLimit,
}) async {
_s.validateNumRange(
'urlExpiresAfterMinutes',
urlExpiresAfterMinutes,
1,
1152921504606846976,
isRequired: true,
);
_s.validateNumRange(
'sessionLengthSeconds',
sessionLengthSeconds,
1,
86400,
);
_s.validateNumRange(
'usageLimit',
usageLimit,
1,
1152921504606846976,
);
final $payload = <String, dynamic>{
'ApplicationIdentifier': applicationIdentifier,
'Locations': locations,
'Protocol': protocol.value,
'UrlExpiresAfterMinutes': urlExpiresAfterMinutes,
if (additionalEnvironmentVariables != null)
'AdditionalEnvironmentVariables': additionalEnvironmentVariables,
if (additionalLaunchArgs != null)
'AdditionalLaunchArgs': additionalLaunchArgs,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'Description': description,
if (displayConfiguration != null)
'DisplayConfiguration': displayConfiguration,
if (roleArn != null) 'RoleArn': roleArn,
if (sessionLengthSeconds != null)
'SessionLengthSeconds': sessionLengthSeconds,
if (usageLimit != null) 'UsageLimit': usageLimit,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/streamgroups/${Uri.encodeComponent(identifier)}/streamurls',
exceptionFnMap: _exceptionFns,
);
return CreateStreamUrlOutput.fromJson(response);
}