createPlaybackRestrictionPolicy method

Future<CreatePlaybackRestrictionPolicyResponse> createPlaybackRestrictionPolicy({
  1. List<String>? allowedCountries,
  2. List<String>? allowedOrigins,
  3. bool? enableStrictOriginEnforcement,
  4. String? name,
  5. Map<String, String>? tags,
})

Creates a new playback restriction policy, for constraining playback by countries and/or origins.

May throw AccessDeniedException. May throw PendingVerification. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter allowedCountries : A list of country codes that control geoblocking restriction. Allowed values are the officially assigned ISO 3166-1 alpha-2 codes. Default: All countries (an empty array).

Parameter allowedOrigins : A list of origin sites that control CORS restriction. Allowed values are the same as valid values of the Origin header defined at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin. Default: All origins (an empty array).

Parameter enableStrictOriginEnforcement : Whether channel playback is constrained by origin site. Default: false.

Parameter name : Playback-restriction-policy name. The value does not need to be unique.

Parameter tags : Array of 1-50 maps, each of the form string:string (key:value). See Best practices and strategies in Tagging Amazon Web Services Resources and Tag Editor for details, including restrictions that apply to tags and "Tag naming limits and requirements"; Amazon IVS has no service-specific constraints beyond what is documented there.

Implementation

Future<CreatePlaybackRestrictionPolicyResponse>
    createPlaybackRestrictionPolicy({
  List<String>? allowedCountries,
  List<String>? allowedOrigins,
  bool? enableStrictOriginEnforcement,
  String? name,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    if (allowedCountries != null) 'allowedCountries': allowedCountries,
    if (allowedOrigins != null) 'allowedOrigins': allowedOrigins,
    if (enableStrictOriginEnforcement != null)
      'enableStrictOriginEnforcement': enableStrictOriginEnforcement,
    if (name != null) 'name': name,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/CreatePlaybackRestrictionPolicy',
    exceptionFnMap: _exceptionFns,
  );
  return CreatePlaybackRestrictionPolicyResponse.fromJson(response);
}