text:
use std::error::Error;
use std::fmt;

use async_trait::async_trait;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError};

use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
use serde_json;
///
The configuration for Ad Marker Passthrough. Ad marker passthrough can be used to pass ad markers from the origin to the customized manifest.

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct AdMarkerPassthrough {
    ///
For HLS, when set to true, MediaTailor passes through EXT-X-CUE-IN, EXT-X-CUE-OUT, and EXT-X-SPLICEPOINT-SCTE35 ad markers from the origin manifest to the MediaTailor personalized manifest.

No logic is applied to these ad markers. For example, if EXT-X-CUE-OUT has a value of 60, but no ads are filled for that ad break, MediaTailor will not set the value to 0.

    #[serde(rename = "Enabled")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
}

///
The configuration for Avail Suppression. Ad suppression can be used to turn off ad personalization in a long manifest, or if a viewer joins mid-break.

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct AvailSuppression {
    ///
Sets the mode for avail suppression, also known as ad suppression. By default, ad suppression is off and all ad breaks are filled by MediaTailor with ads or slate.

    #[serde(rename = "Mode")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mode: Option<String>,
    ///
The avail suppression value is a live edge offset time in HH:MM:SS. MediaTailor won't fill ad breaks on or behind this time in the manifest lookback window.

    #[serde(rename = "Value")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
}

///
The configuration for bumpers. Bumpers are short audio or video clips that play at the start or before the end of an ad break.

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct Bumper {
    ///
The URL for the end bumper asset.

    #[serde(rename = "EndUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub end_url: Option<String>,
    ///
The URL for the start bumper asset.

    #[serde(rename = "StartUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub start_url: Option<String>,
}

///
The configuration for using a content delivery network (CDN), like Amazon CloudFront, for content and ad segment management.

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct CdnConfiguration {
    ///
A non-default content delivery network (CDN) to serve ad segments. By default, AWS Elemental MediaTailor uses Amazon CloudFront with default cache settings as its CDN for ad segments. To set up an alternate CDN, create a rule in your CDN for the following origin: ads.mediatailor.<region>.amazonaws.com. Then specify the rule's name in this AdSegmentUrlPrefix. When AWS Elemental MediaTailor serves a manifest, it reports your CDN as the source for ad segments.

    #[serde(rename = "AdSegmentUrlPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ad_segment_url_prefix: Option<String>,
    ///
A content delivery network (CDN) to cache content segments, so that content requests don't always have to go to the origin server. First, create a rule in your CDN for the content segment origin server. Then specify the rule's name in this ContentSegmentUrlPrefix. When AWS Elemental MediaTailor serves a manifest, it reports your CDN as the source for content segments.

    #[serde(rename = "ContentSegmentUrlPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub content_segment_url_prefix: Option<String>,
}

///
The configuration for DASH content.

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DashConfiguration {
    ///
The URL generated by MediaTailor to initiate a playback session. The session uses server-side reporting. This setting is ignored in PUT operations.

    #[serde(rename = "ManifestEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub manifest_endpoint_prefix: Option<String>,
    ///
The setting that controls whether MediaTailor includes the Location tag in DASH manifests. MediaTailor populates the Location tag with the URL for manifest update requests, to be used by players that don't support sticky redirects. Disable this if you have CDN routing rules set up for accessing MediaTailor manifests, and you are either using client-side reporting or your players support sticky HTTP redirects. Valid values are DISABLED and EMT_DEFAULT. The EMT_DEFAULT setting enables the inclusion of the tag and is the default value.

    #[serde(rename = "MpdLocation")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mpd_location: Option<String>,
    ///
The setting that controls whether MediaTailor handles manifests from the origin server as multi-period manifests or single-period manifests. If your origin server produces single-period manifests, set this to SINGLE_PERIOD. The default setting is MULTI_PERIOD. For multi-period manifests, omit this setting or set it to MULTI_PERIOD.

    #[serde(rename = "OriginManifestType")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub origin_manifest_type: Option<String>,
}

///
The configuration for DASH PUT operations.

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DashConfigurationForPut {
    ///
The setting that controls whether MediaTailor includes the Location tag in DASH manifests. MediaTailor populates the Location tag with the URL for manifest update requests, to be used by players that don't support sticky redirects. Disable this if you have CDN routing rules set up for accessing MediaTailor manifests, and you are either using client-side reporting or your players support sticky HTTP redirects. Valid values are DISABLED and EMT_DEFAULT. The EMT_DEFAULT setting enables the inclusion of the tag and is the default value.

    #[serde(rename = "MpdLocation")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mpd_location: Option<String>,
    ///
The setting that controls whether MediaTailor handles manifests from the origin server as multi-period manifests or single-period manifests. If your origin server produces single-period manifests, set this to SINGLE_PERIOD. The default setting is MULTI_PERIOD. For multi-period manifests, omit this setting or set it to MULTI_PERIOD.

    #[serde(rename = "OriginManifestType")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub origin_manifest_type: Option<String>,
}

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DeletePlaybackConfigurationRequest {
    ///
The identifier for the playback configuration.

    #[serde(rename = "Name")]
    pub name: String,
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DeletePlaybackConfigurationResponse {}

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetPlaybackConfigurationRequest {
    ///
The identifier for the playback configuration.

    #[serde(rename = "Name")]
    pub name: String,
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetPlaybackConfigurationResponse {
    ///
The URL for the ad decision server (ADS). This includes the specification of static parameters and placeholders for dynamic parameters. AWS Elemental MediaTailor substitutes player-specific and session-specific parameters as needed when calling the ADS. Alternately, for testing, you can provide a static VAST URL. The maximum length is 25,000 characters.

    #[serde(rename = "AdDecisionServerUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ad_decision_server_url: Option<String>,
    ///
The configuration for Avail Suppression. Ad suppression can be used to turn off ad personalization in a long manifest, or if a viewer joins mid-break.

    #[serde(rename = "AvailSuppression")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avail_suppression: Option<AvailSuppression>,
    ///
The configuration for bumpers. Bumpers are short audio or video clips that play at the start or before the end of an ad break.

    #[serde(rename = "Bumper")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bumper: Option<Bumper>,
    ///
The configuration for using a content delivery network (CDN), like Amazon CloudFront, for content and ad segment management.

    #[serde(rename = "CdnConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cdn_configuration: Option<CdnConfiguration>,
    ///
The configuration for DASH content.

    #[serde(rename = "DashConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dash_configuration: Option<DashConfiguration>,
    ///
The configuration for HLS content.

    #[serde(rename = "HlsConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hls_configuration: Option<HlsConfiguration>,
    ///
The configuration for pre-roll ad insertion.

    #[serde(rename = "LivePreRollConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub live_pre_roll_configuration: Option<LivePreRollConfiguration>,
    ///
The configuration for manifest processing rules. Manifest processing rules enable customization of the personalized manifests created by MediaTailor.

    #[serde(rename = "ManifestProcessingRules")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub manifest_processing_rules: Option<ManifestProcessingRules>,
    ///
The identifier for the playback configuration.

    #[serde(rename = "Name")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    ///
The maximum duration of underfilled ad time (in seconds) allowed in an ad break.

    #[serde(rename = "PersonalizationThresholdSeconds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub personalization_threshold_seconds: Option<i64>,
    ///
The Amazon Resource Name (ARN) for the playback configuration.

    #[serde(rename = "PlaybackConfigurationArn")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub playback_configuration_arn: Option<String>,
    ///
The URL that the player accesses to get a manifest from AWS Elemental MediaTailor. This session will use server-side reporting.

    #[serde(rename = "PlaybackEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub playback_endpoint_prefix: Option<String>,
    ///
The URL that the player uses to initialize a session that uses client-side reporting.

    #[serde(rename = "SessionInitializationEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub session_initialization_endpoint_prefix: Option<String>,
    ///
The URL for a high-quality video asset to transcode and use to fill in time that's not used by ads. AWS Elemental MediaTailor shows the slate to fill in gaps in media content. Configuring the slate is optional for non-VPAID playback configurations. For VPAID, the slate is required because MediaTailor provides it in the slots designated for dynamic ad content. The slate must be a high-quality asset that contains both audio and video.

    #[serde(rename = "SlateAdUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub slate_ad_url: Option<String>,
    ///
The tags assigned to the playback configuration.

    #[serde(rename = "Tags")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<::std::collections::HashMap<String, String>>,
    ///
The name that is used to associate this playback configuration with a custom transcode profile. This overrides the dynamic transcoding defaults of MediaTailor. Use this only if you have already set up custom profiles with the help of AWS Support.

    #[serde(rename = "TranscodeProfileName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub transcode_profile_name: Option<String>,
    ///
The URL prefix for the master playlist for the stream, minus the asset ID. The maximum length is 512 characters.

    #[serde(rename = "VideoContentSourceUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub video_content_source_url: Option<String>,
}

///
The configuration for HLS content.

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct HlsConfiguration {
    ///
The URL that is used to initiate a playback session for devices that support Apple HLS. The session uses server-side reporting.

    #[serde(rename = "ManifestEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub manifest_endpoint_prefix: Option<String>,
}

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListPlaybackConfigurationsRequest {
    ///
Maximum number of records to return.

    #[serde(rename = "MaxResults")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
    ///
Pagination token returned by the GET list request when results exceed the maximum allowed. Use the token to fetch the next page of results.

    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListPlaybackConfigurationsResponse {
    ///
Array of playback configurations. This might be all the available configurations or a subset, depending on the settings that you provide and the total number of configurations stored.

    #[serde(rename = "Items")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub items: Option<Vec<PlaybackConfiguration>>,
    ///
Pagination token returned by the GET list request when results exceed the maximum allowed. Use the token to fetch the next page of results.

    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
}

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListTagsForResourceRequest {
    ///
The Amazon Resource Name (ARN) for the playback configuration. You can get this from the response to any playback configuration request.

    #[serde(rename = "ResourceArn")]
    pub resource_arn: String,
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListTagsForResourceResponse {
    ///
A comma-separated list of tag key:value pairs. For example:
    /// {
    /// "Key1": "Value1",
    /// "Key2": "Value2"
    /// }
    ///

    #[serde(rename = "Tags")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<::std::collections::HashMap<String, String>>,
}

///
The configuration for pre-roll ad insertion.

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct LivePreRollConfiguration {
    ///
The URL for the ad decision server (ADS) for pre-roll ads. This includes the specification of static parameters and placeholders for dynamic parameters. AWS Elemental MediaTailor substitutes player-specific and session-specific parameters as needed when calling the ADS. Alternately, for testing, you can provide a static VAST URL. The maximum length is 25,000 characters.

    #[serde(rename = "AdDecisionServerUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ad_decision_server_url: Option<String>,
    ///
The maximum allowed duration for the pre-roll ad avail. AWS Elemental MediaTailor won't play pre-roll ads to exceed this duration, regardless of the total duration of ads that the ADS returns.

    #[serde(rename = "MaxDurationSeconds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_duration_seconds: Option<i64>,
}

///
The configuration for manifest processing rules. Manifest processing rules enable customization of the personalized manifests created by MediaTailor.

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct ManifestProcessingRules {
    #[serde(rename = "AdMarkerPassthrough")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ad_marker_passthrough: Option<AdMarkerPassthrough>,
}

///
The AWSMediaTailor configuration.

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct PlaybackConfiguration {
    ///
The URL for the ad decision server (ADS). This includes the specification of static parameters and placeholders for dynamic parameters. AWS Elemental MediaTailor substitutes player-specific and session-specific parameters as needed when calling the ADS. Alternately, for testing, you can provide a static VAST URL. The maximum length is 25,000 characters.

    #[serde(rename = "AdDecisionServerUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ad_decision_server_url: Option<String>,
    ///
The configuration for Avail Suppression. Ad suppression can be used to turn off ad personalization in a long manifest, or if a viewer joins mid-break.

    #[serde(rename = "AvailSuppression")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avail_suppression: Option<AvailSuppression>,
    ///
The configuration for bumpers. Bumpers are short audio or video clips that play at the start or before the end of an ad break.

    #[serde(rename = "Bumper")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bumper: Option<Bumper>,
    ///
The configuration for using a content delivery network (CDN), like Amazon CloudFront, for content and ad segment management.

    #[serde(rename = "CdnConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cdn_configuration: Option<CdnConfiguration>,
    ///
The configuration for DASH content.

    #[serde(rename = "DashConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dash_configuration: Option<DashConfiguration>,
    ///
The configuration for HLS content.

    #[serde(rename = "HlsConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hls_configuration: Option<HlsConfiguration>,
    ///
The configuration for manifest processing rules. Manifest processing rules enable customization of the personalized manifests created by MediaTailor.

    #[serde(rename = "ManifestProcessingRules")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub manifest_processing_rules: Option<ManifestProcessingRules>,
    ///
The identifier for the playback configuration.

    #[serde(rename = "Name")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    ///
The maximum duration of underfilled ad time (in seconds) allowed in an ad break.

    #[serde(rename = "PersonalizationThresholdSeconds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub personalization_threshold_seconds: Option<i64>,
    ///
The Amazon Resource Name (ARN) for the playback configuration.

    #[serde(rename = "PlaybackConfigurationArn")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub playback_configuration_arn: Option<String>,
    ///
The URL that the player accesses to get a manifest from AWS Elemental MediaTailor. This session will use server-side reporting.

    #[serde(rename = "PlaybackEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub playback_endpoint_prefix: Option<String>,
    ///
The URL that the player uses to initialize a session that uses client-side reporting.

    #[serde(rename = "SessionInitializationEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub session_initialization_endpoint_prefix: Option<String>,
    ///
The URL for a high-quality video asset to transcode and use to fill in time that's not used by ads. AWS Elemental MediaTailor shows the slate to fill in gaps in media content. Configuring the slate is optional for non-VPAID playback configurations. For VPAID, the slate is required because MediaTailor provides it in the slots designated for dynamic ad content. The slate must be a high-quality asset that contains both audio and video.

    #[serde(rename = "SlateAdUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub slate_ad_url: Option<String>,
    ///
The tags assigned to the playback configuration.

    #[serde(rename = "Tags")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<::std::collections::HashMap<String, String>>,
    ///
The name that is used to associate this playback configuration with a custom transcode profile. This overrides the dynamic transcoding defaults of MediaTailor. Use this only if you have already set up custom profiles with the help of AWS Support.

    #[serde(rename = "TranscodeProfileName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub transcode_profile_name: Option<String>,
    ///
The URL prefix for the master playlist for the stream, minus the asset ID. The maximum length is 512 characters.

    #[serde(rename = "VideoContentSourceUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub video_content_source_url: Option<String>,
}

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct PutPlaybackConfigurationRequest {
    ///
The URL for the ad decision server (ADS). This includes the specification of static parameters and placeholders for dynamic parameters. AWS Elemental MediaTailor substitutes player-specific and session-specific parameters as needed when calling the ADS. Alternately, for testing you can provide a static VAST URL. The maximum length is 25,000 characters.

    #[serde(rename = "AdDecisionServerUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ad_decision_server_url: Option<String>,
    ///
The configuration for Avail Suppression. Ad suppression can be used to turn off ad personalization in a long manifest, or if a viewer joins mid-break.

    #[serde(rename = "AvailSuppression")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avail_suppression: Option<AvailSuppression>,
    ///
The configuration for bumpers. Bumpers are short audio or video clips that play at the start or before the end of an ad break.

    #[serde(rename = "Bumper")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bumper: Option<Bumper>,
    ///
The configuration for using a content delivery network (CDN), like Amazon CloudFront, for content and ad segment management.

    #[serde(rename = "CdnConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cdn_configuration: Option<CdnConfiguration>,
    ///
The configuration for DASH content.

    #[serde(rename = "DashConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dash_configuration: Option<DashConfigurationForPut>,
    ///
The configuration for pre-roll ad insertion.

    #[serde(rename = "LivePreRollConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub live_pre_roll_configuration: Option<LivePreRollConfiguration>,
    ///
The configuration for manifest processing rules. Manifest processing rules enable customization of the personalized manifests created by MediaTailor.

    #[serde(rename = "ManifestProcessingRules")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub manifest_processing_rules: Option<ManifestProcessingRules>,
    ///
The identifier for the playback configuration.

    #[serde(rename = "Name")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    ///
The maximum duration of underfilled ad time (in seconds) allowed in an ad break.

    #[serde(rename = "PersonalizationThresholdSeconds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub personalization_threshold_seconds: Option<i64>,
    ///
The URL for a high-quality video asset to transcode and use to fill in time that's not used by ads. AWS Elemental MediaTailor shows the slate to fill in gaps in media content. Configuring the slate is optional for non-VPAID configurations. For VPAID, the slate is required because MediaTailor provides it in the slots that are designated for dynamic ad content. The slate must be a high-quality asset that contains both audio and video.

    #[serde(rename = "SlateAdUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub slate_ad_url: Option<String>,
    ///
The tags to assign to the playback configuration.

    #[serde(rename = "Tags")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<::std::collections::HashMap<String, String>>,
    ///
The name that is used to associate this playback configuration with a custom transcode profile. This overrides the dynamic transcoding defaults of MediaTailor. Use this only if you have already set up custom profiles with the help of AWS Support.

    #[serde(rename = "TranscodeProfileName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub transcode_profile_name: Option<String>,
    ///
The URL prefix for the master playlist for the stream, minus the asset ID. The maximum length is 512 characters.

    #[serde(rename = "VideoContentSourceUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub video_content_source_url: Option<String>,
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct PutPlaybackConfigurationResponse {
    ///
The URL for the ad decision server (ADS). This includes the specification of static parameters and placeholders for dynamic parameters. AWS Elemental MediaTailor substitutes player-specific and session-specific parameters as needed when calling the ADS. Alternately, for testing, you can provide a static VAST URL. The maximum length is 25,000 characters.

    #[serde(rename = "AdDecisionServerUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ad_decision_server_url: Option<String>,
    ///
The configuration for Avail Suppression. Ad suppression can be used to turn off ad personalization in a long manifest, or if a viewer joins mid-break.

    #[serde(rename = "AvailSuppression")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avail_suppression: Option<AvailSuppression>,
    ///
The configuration for bumpers. Bumpers are short audio or video clips that play at the start or before the end of an ad break.

    #[serde(rename = "Bumper")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bumper: Option<Bumper>,
    ///
The configuration for using a content delivery network (CDN), like Amazon CloudFront, for content and ad segment management.

    #[serde(rename = "CdnConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cdn_configuration: Option<CdnConfiguration>,
    ///
The configuration for DASH content.

    #[serde(rename = "DashConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dash_configuration: Option<DashConfiguration>,
    ///
The configuration for HLS content.

    #[serde(rename = "HlsConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hls_configuration: Option<HlsConfiguration>,
    ///
The configuration for pre-roll ad insertion.

    #[serde(rename = "LivePreRollConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub live_pre_roll_configuration: Option<LivePreRollConfiguration>,
    ///
The configuration for manifest processing rules. Manifest processing rules enable customization of the personalized manifests created by MediaTailor.

    #[serde(rename = "ManifestProcessingRules")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub manifest_processing_rules: Option<ManifestProcessingRules>,
    ///
The identifier for the playback configuration.

    #[serde(rename = "Name")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    ///
The maximum duration of underfilled ad time (in seconds) allowed in an ad break.

    #[serde(rename = "PersonalizationThresholdSeconds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub personalization_threshold_seconds: Option<i64>,
    ///
The Amazon Resource Name (ARN) for the playback configuration.

    #[serde(rename = "PlaybackConfigurationArn")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub playback_configuration_arn: Option<String>,
    ///
The URL that the player accesses to get a manifest from AWS Elemental MediaTailor. This session will use server-side reporting.

    #[serde(rename = "PlaybackEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub playback_endpoint_prefix: Option<String>,
    ///
The URL that the player uses to initialize a session that uses client-side reporting.

    #[serde(rename = "SessionInitializationEndpointPrefix")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub session_initialization_endpoint_prefix: Option<String>,
    ///
The URL for a high-quality video asset to transcode and use to fill in time that's not used by ads. AWS Elemental MediaTailor shows the slate to fill in gaps in media content. Configuring the slate is optional for non-VPAID playback configurations. For VPAID, the slate is required because MediaTailor provides it in the slots designated for dynamic ad content. The slate must be a high-quality asset that contains both audio and video.

    #[serde(rename = "SlateAdUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub slate_ad_url: Option<String>,
    ///
The tags assigned to the playback configuration.

    #[serde(rename = "Tags")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<::std::collections::HashMap<String, String>>,
    ///
The name that is used to associate this playback configuration with a custom transcode profile. This overrides the dynamic transcoding defaults of MediaTailor. Use this only if you have already set up custom profiles with the help of AWS Support.

    #[serde(rename = "TranscodeProfileName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub transcode_profile_name: Option<String>,
    ///
The URL prefix for the master playlist for the stream, minus the asset ID. The maximum length is 512 characters.

    #[serde(rename = "VideoContentSourceUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub video_content_source_url: Option<String>,
}

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct TagResourceRequest {
    ///
The Amazon Resource Name (ARN) for the playback configuration. You can get this from the response to any playback configuration request.

    #[serde(rename = "ResourceArn")]
    pub resource_arn: String,
    ///
A comma-separated list of tag key:value pairs. For example:
    /// {
    /// "Key1": "Value1",
    /// "Key2": "Value2"
    /// }
    ///

    #[serde(rename = "Tags")]
    pub tags: ::std::collections::HashMap<String, String>,
}

#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct UntagResourceRequest {
    ///
The Amazon Resource Name (ARN) for the playback configuration. You can get this from the response to any playback configuration request.

    #[serde(rename = "ResourceArn")]
    pub resource_arn: String,
    ///
A comma-separated list of the tag keys to remove from the playback configuration.

    #[serde(rename = "TagKeys")]
    pub tag_keys: Vec<String>,
}

/// Errors returned by DeletePlaybackConfiguration
#[derive(Debug, PartialEq)]
pub enum DeletePlaybackConfigurationError {}

impl DeletePlaybackConfigurationError {
    pub fn from_response(
        res: BufferedHttpResponse,
    ) -> RusotoError<DeletePlaybackConfigurationError> {
        if let Some(err) = proto::json::Error::parse_rest(&res) {
            match err.typ.as_str() {
                "ValidationException" => return RusotoError::Validation(err.msg),
                _ => {}
            }
        }
        RusotoError::Unknown(res)
    }
}
impl fmt::Display for DeletePlaybackConfigurationError {
    #[allow(unused_variables)]
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {}
    }
}
impl Error for DeletePlaybackConfigurationError {}
/// Errors returned by GetPlaybackConfiguration
#[derive(Debug, PartialEq)]
pub enum GetPlaybackConfigurationError {}

impl GetPlaybackConfigurationError {
    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetPlaybackConfigurationError> {
        if let Some(err) = proto::json::Error::parse_rest(&res) {
            match err.typ.as_str() {
                "ValidationException" => return RusotoError::Validation(err.msg),
                _ => {}
            }
        }
        RusotoError::Unknown(res)
    }
}
impl fmt::Display for GetPlaybackConfigurationError {
    #[allow(unused_variables)]
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {}
    }
}
impl Error for GetPlaybackConfigurationError {}
/// Errors returned by ListPlaybackConfigurations
#[derive(Debug, PartialEq)]
pub enum ListPlaybackConfigurationsError {}

impl ListPlaybackConfigurationsError {
    pub fn from_response(
        res: BufferedHttpResponse,
    ) -> RusotoError<ListPlaybackConfigurationsError> {
        if let Some(err) = proto::json::Error::parse_rest(&res) {
            match err.typ.as_str() {
                "ValidationException" => return RusotoError::Validation(err.msg),
                _ => {}
            }
        }
        RusotoError::Unknown(res)
    }
}
impl fmt::Display for ListPlaybackConfigurationsError {
    #[allow(unused_variables)]
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {}
    }
}
impl Error for ListPlaybackConfigurationsError {}
/// Errors returned by ListTagsForResource
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
    ///
Invalid request parameters.

    BadRequest(String),
}

impl ListTagsForResourceError {
    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
        if let Some(err) = proto::json::Error::parse_rest(&res) {
            match err.typ.as_str() {
                "BadRequestException" => {
                    return RusotoError::Service(ListTagsForResourceError::BadRequest(err.msg))
                }
                "ValidationException" => return RusotoError::Validation(err.msg),
                _ => {}
            }
        }
        RusotoError::Unknown(res)
    }
}
impl fmt::Display for ListTagsForResourceError {
    #[allow(unused_variables)]
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {
            ListTagsForResourceError::BadRequest(ref cause) => write!(f, "{}", cause),
        }
    }
}
impl Error for ListTagsForResourceError {}
/// Errors returned by PutPlaybackConfiguration
#[derive(Debug, PartialEq)]
pub enum PutPlaybackConfigurationError {}

impl PutPlaybackConfigurationError {
    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutPlaybackConfigurationError> {
        if let Some(err) = proto::json::Error::parse_rest(&res) {
            match err.typ.as_str() {
                "ValidationException" => return RusotoError::Validation(err.msg),
                _ => {}
            }
        }
        RusotoError::Unknown(res)
    }
}
impl fmt::Display for PutPlaybackConfigurationError {
    #[allow(unused_variables)]
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {}
    }
}
impl Error for PutPlaybackConfigurationError {}
/// Errors returned by TagResource
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
    ///
Invalid request parameters.

    BadRequest(String),
}

impl TagResourceError {
    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
        if let Some(err) = proto::json::Error::parse_rest(&res) {
            match err.typ.as_str() {
                "BadRequestException" => {
                    return RusotoError::Service(TagResourceError::BadRequest(err.msg))
                }
                "ValidationException" => return RusotoError::Validation(err.msg),
                _ => {}
            }
        }
        RusotoError::Unknown(res)
    }
}
impl fmt::Display for TagResourceError {
    #[allow(unused_variables)]
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {
            TagResourceError::BadRequest(ref cause) => write!(f, "{}", cause),
        }
    }
}
impl Error for TagResourceError {}
/// Errors returned by UntagResource
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
    ///
Invalid request parameters.

    BadRequest(String),
}

impl UntagResourceError {
    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
        if let Some(err) = proto::json::Error::parse_rest(&res) {
            match err.typ.as_str() {
                "BadRequestException" => {
                    return RusotoError::Service(UntagResourceError::BadRequest(err.msg))
                }
                "ValidationException" => return RusotoError::Validation(err.msg),
                _ => {}
            }
        }
        RusotoError::Unknown(res)
    }
}
impl fmt::Display for UntagResourceError {
    #[allow(unused_variables)]
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {
            UntagResourceError::BadRequest(ref cause) => write!(f, "{}", cause),
        }
    }
}
impl Error for UntagResourceError {}
/// Trait representing the capabilities of the MediaTailor API. MediaTailor clients implement this trait.
#[async_trait]
pub trait MediaTailor {
    ///
Deletes the playback configuration for the specified name.

    async fn delete_playback_configuration(
        &self,
        input: DeletePlaybackConfigurationRequest,
    ) -> Result<DeletePlaybackConfigurationResponse, RusotoError<DeletePlaybackConfigurationError>>;

    ///
Returns the playback configuration for the specified name.

    async fn get_playback_configuration(
        &self,
        input: GetPlaybackConfigurationRequest,
    ) -> Result<GetPlaybackConfigurationResponse, RusotoError<GetPlaybackConfigurationError>>;

    ///
Returns a list of the playback configurations defined in AWS Elemental MediaTailor. You can specify a maximum number of configurations to return at a time. The default maximum is 50. Results are returned in pagefuls. If MediaTailor has more configurations than the specified maximum, it provides parameters in the response that you can use to retrieve the next pageful.

    async fn list_playback_configurations(
        &self,
        input: ListPlaybackConfigurationsRequest,
    ) -> Result<ListPlaybackConfigurationsResponse, RusotoError<ListPlaybackConfigurationsError>>;

    ///
Returns a list of the tags assigned to the specified playback configuration resource.

    async fn list_tags_for_resource(
        &self,
        input: ListTagsForResourceRequest,
    ) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>>;

    ///
Adds a new playback configuration to AWS Elemental MediaTailor.

    async fn put_playback_configuration(
        &self,
        input: PutPlaybackConfigurationRequest,
    ) -> Result<PutPlaybackConfigurationResponse, RusotoError<PutPlaybackConfigurationError>>;

    ///
Adds tags to the specified playback configuration resource. You can specify one or more tags to add.

    async fn tag_resource(
        &self,
        input: TagResourceRequest,
    ) -> Result<(), RusotoError<TagResourceError>>;

    ///
Removes tags from the specified playback configuration resource. You can specify one or more tags to remove.

    async fn untag_resource(
        &self,
        input: UntagResourceRequest,
    ) -> Result<(), RusotoError<UntagResourceError>>;
}
/// A client for the MediaTailor API.
#[derive(Clone)]
pub struct MediaTailorClient {
    client: Client,
    region: region::Region,
}

impl MediaTailorClient {
    /// Creates a client backed by the default tokio event loop.
    ///
    /// The client will use the default credentials provider and tls client.
    pub fn new(region: region::Region) -> MediaTailorClient {
        MediaTailorClient {
            client: Client::shared(),
            region,
        }
    }

    pub fn new_with
(
        request_dispatcher: D,
        credentials_provider: P,
        region: region::Region,
    ) -> MediaTailorClient
    where
        P: ProvideAwsCredentials + Send + Sync + 'static,
        D: DispatchSignedRequest + Send + Sync + 'static,
    {
        MediaTailorClient {
            client: Client::new_with(credentials_provider, request_dispatcher),
            region,
        }
    }

    pub fn new_with_client(client: Client, region: region::Region) -> MediaTailorClient {
        MediaTailorClient { client, region }
    }
}

#[async_trait]
impl MediaTailor for MediaTailorClient {
    ///
Deletes the playback configuration for the specified name.

    #[allow(unused_mut)]
    async fn delete_playback_configuration(
        &self,
        input: DeletePlaybackConfigurationRequest,
    ) -> Result<DeletePlaybackConfigurationResponse, RusotoError<DeletePlaybackConfigurationError>>
    {
        let request_uri = format!("/playbackConfiguration/{name}", name = input.name);

        let mut request = SignedRequest::new("DELETE", "mediatailor", &self.region, &request_uri);
        request.set_content_type("application/x-amz-json-1.1".to_owned());

        request.set_endpoint_prefix("api.mediatailor".to_string());

        let mut response = self
            .client
            .sign_and_dispatch(request)
            .await
            .map_err(RusotoError::from)?;
        if response.status.as_u16() == 204 {
            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            let result = proto::json::ResponsePayload::new(&response)
                .deserialize::<DeletePlaybackConfigurationResponse, _>()?;

            Ok(result)
        } else {
            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            Err(DeletePlaybackConfigurationError::from_response(response))
        }
    }

    ///
Returns the playback configuration for the specified name.

    #[allow(unused_mut)]
    async fn get_playback_configuration(
        &self,
        input: GetPlaybackConfigurationRequest,
    ) -> Result<GetPlaybackConfigurationResponse, RusotoError<GetPlaybackConfigurationError>> {
        let request_uri = format!("/playbackConfiguration/{name}", name = input.name);

        let mut request = SignedRequest::new("GET", "mediatailor", &self.region, &request_uri);
        request.set_content_type("application/x-amz-json-1.1".to_owned());

        request.set_endpoint_prefix("api.mediatailor".to_string());

        let mut response = self
            .client
            .sign_and_dispatch(request)
            .await
            .map_err(RusotoError::from)?;
        if response.status.as_u16() == 200 {
            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            let result = proto::json::ResponsePayload::new(&response)
                .deserialize::<GetPlaybackConfigurationResponse, _>()?;

            Ok(result)
        } else {
            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            Err(GetPlaybackConfigurationError::from_response(response))
        }
    }

    ///
Returns a list of the playback configurations defined in AWS Elemental MediaTailor. You can specify a maximum number of configurations to return at a time. The default maximum is 50. Results are returned in pagefuls. If MediaTailor has more configurations than the specified maximum, it provides parameters in the response that you can use to retrieve the next pageful.

    #[allow(unused_mut)]
    async fn list_playback_configurations(
        &self,
        input: ListPlaybackConfigurationsRequest,
    ) -> Result<ListPlaybackConfigurationsResponse, RusotoError<ListPlaybackConfigurationsError>>
    {
        let request_uri = "/playbackConfigurations";

        let mut request = SignedRequest::new("GET", "mediatailor", &self.region, &request_uri);
        request.set_content_type("application/x-amz-json-1.1".to_owned());

        request.set_endpoint_prefix("api.mediatailor".to_string());

        let mut params = Params::new();
        if let Some(ref x) = input.max_results {
            params.put("MaxResults", x);
        }
        if let Some(ref x) = input.next_token {
            params.put("NextToken", x);
        }
        request.set_params(params);

        let mut response = self
            .client
            .sign_and_dispatch(request)
            .await
            .map_err(RusotoError::from)?;
        if response.status.as_u16() == 200 {
            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            let result = proto::json::ResponsePayload::new(&response)
                .deserialize::<ListPlaybackConfigurationsResponse, _>()?;

            Ok(result)
        } else {
            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            Err(ListPlaybackConfigurationsError::from_response(response))
        }
    }

    ///
Returns a list of the tags assigned to the specified playback configuration resource.

    #[allow(unused_mut)]
    async fn list_tags_for_resource(
        &self,
        input: ListTagsForResourceRequest,
    ) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>> {
        let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);

        let mut request = SignedRequest::new("GET", "mediatailor", &self.region, &request_uri);
        request.set_content_type("application/x-amz-json-1.1".to_owned());

        request.set_endpoint_prefix("api.mediatailor".to_string());

        let mut response = self
            .client
            .sign_and_dispatch(request)
            .await
            .map_err(RusotoError::from)?;
        if response.status.as_u16() == 200 {
            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            let result = proto::json::ResponsePayload::new(&response)
                .deserialize::<ListTagsForResourceResponse, _>()?;

            Ok(result)
        } else {
            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            Err(ListTagsForResourceError::from_response(response))
        }
    }

    ///
Adds a new playback configuration to AWS Elemental MediaTailor.

    #[allow(unused_mut)]
    async fn put_playback_configuration(
        &self,
        input: PutPlaybackConfigurationRequest,
    ) -> Result<PutPlaybackConfigurationResponse, RusotoError<PutPlaybackConfigurationError>> {
        let request_uri = "/playbackConfiguration";

        let mut request = SignedRequest::new("PUT", "mediatailor", &self.region, &request_uri);
        request.set_content_type("application/x-amz-json-1.1".to_owned());

        request.set_endpoint_prefix("api.mediatailor".to_string());
        let encoded = Some(serde_json::to_vec(&input).unwrap());
        request.set_payload(encoded);

        let mut response = self
            .client
            .sign_and_dispatch(request)
            .await
            .map_err(RusotoError::from)?;
        if response.status.as_u16() == 200 {
            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            let result = proto::json::ResponsePayload::new(&response)
                .deserialize::<PutPlaybackConfigurationResponse, _>()?;

            Ok(result)
        } else {
            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            Err(PutPlaybackConfigurationError::from_response(response))
        }
    }

    ///
Adds tags to the specified playback configuration resource. You can specify one or more tags to add.

    #[allow(unused_mut)]
    async fn tag_resource(
        &self,
        input: TagResourceRequest,
    ) -> Result<(), RusotoError<TagResourceError>> {
        let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);

        let mut request = SignedRequest::new("POST", "mediatailor", &self.region, &request_uri);
        request.set_content_type("application/x-amz-json-1.1".to_owned());

        request.set_endpoint_prefix("api.mediatailor".to_string());
        let encoded = Some(serde_json::to_vec(&input).unwrap());
        request.set_payload(encoded);

        let mut response = self
            .client
            .sign_and_dispatch(request)
            .await
            .map_err(RusotoError::from)?;
        if response.status.as_u16() == 204 {
            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            let result = ::std::mem::drop(response);

            Ok(result)
        } else {
            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            Err(TagResourceError::from_response(response))
        }
    }

    ///
Removes tags from the specified playback configuration resource. You can specify one or more tags to remove.

    #[allow(unused_mut)]
    async fn untag_resource(
        &self,
        input: UntagResourceRequest,
    ) -> Result<(), RusotoError<UntagResourceError>> {
        let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);

        let mut request = SignedRequest::new("DELETE", "mediatailor", &self.region, &request_uri);
        request.set_content_type("application/x-amz-json-1.1".to_owned());

        request.set_endpoint_prefix("api.mediatailor".to_string());

        let mut params = Params::new();
        for item in input.tag_keys.iter() {
            params.put("tagKeys", item);
        }
        request.set_params(params);

        let mut response = self
            .client
            .sign_and_dispatch(request)
            .await
            .map_err(RusotoError::from)?;
        if response.status.as_u16() == 204 {
            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            let result = ::std::mem::drop(response);

            Ok(result)
        } else {
            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
            Err(UntagResourceError::from_response(response))
        }
    }
}


text:
<?php namespace Arx\classes;

use Arx;

/**
 * Class Request
 *
 * Request mockup for testing
 *
 * @package Arx\classes
 */
class Request {

	public static function __callStatic($name, $args){
		$app = Arx::getInstance()['request'];
		return call_user_func_array(array($app, $name), $args);
	}

	public function onlyNotEmpty($array){
		return $this->only(array_filter($array));
	}
}

redpajama_set_name: RedPajamaGithub


text:
import {ensureDirSync, existsSync, readFileSync, writeFileSync} from "fs-extra";
import {JWK, JWKS, KeyParameters} from "jose2";
import {dirname} from "path";

export interface JwksKeyParameters extends KeyParameters {
  path: string;
}

export interface JwksOptions {
  path: string;
  certificates?: JwksKeyParameters[];
}

export function generateJwks(options: Partial<JwksOptions> = {}) {
  const {certificates} = options;
  const keystore = new JWKS.KeyStore();

  if (certificates) {
    certificates.forEach(({path, ...options}) => {
      const content = readFileSync(path, {encoding: "utf-8"});
      const isPrivate = content.includes("PRIVATE KEY");

      if (!isPrivate) {
        keystore.add(JWK.asKey(content, options));
      }
    });
  } else {
    keystore.generateSync("RSA", 2048, {use: "sig"});
    keystore.generateSync("EC", "P-256", {use: "sig", alg: "ES256"});
    keystore.generateSync("OKP", "Ed25519", {use: "sig", alg: "EdDSA"});
  }

  return keystore.toJWKS(true);
}

export function getJwks(options: JwksOptions) {
  ensureDirSync(dirname(options.path));

  if (!existsSync(options.path)) {
    const keys = generateJwks(options);
    writeFileSync(options.path, JSON.stringify(keys, null, 2));
  }

  return JSON.parse(readFileSync(options.path, {encoding: "utf-8"}));
}


text:
<?php

declare(strict_types=1);

namespace Railt\Http\Tests\Response;

use PHPUnit\Framework\ExpectationFailedException;
use Railt\Contracts\Http\GraphQLErrorInterface;
use Railt\Http\GraphQLError;
use Railt\Http\Tests\TestCase;

/**
 * Class ExceptionTestCase
 */
class ExceptionTestCase extends TestCase
{
    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testInternalExceptionMessage(): void
    {
        $exception = new GraphQLError('message');
        $exception->hide();

        $this->assertInternal($exception);
    }

    /**
     * @param GraphQLErrorInterface $exception
     * @return void
     * @throws ExpectationFailedException
     */
    private function assertInternal(GraphQLErrorInterface $exception): void
    {
        $this->assertFalse($exception->isPublic());
        $this->assertSame(GraphQLError::INTERNAL_EXCEPTION_MESSAGE, $exception->getMessage());
    }

    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testExceptionCode(): void
    {
        $exception = new GraphQLError('', 42);

        $this->assertSame(42, $exception->getCode());
    }

    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testExceptionPrevious(): void
    {
        $prev = new \InvalidArgumentException('error');

        $exception = new GraphQLError('message', 42, $prev);

        $this->assertSame($prev, $exception->getPrevious());
    }

    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testPublicExceptionMessage(): void
    {
        $exception = new GraphQLError('message');
        $exception->publish();

        $this->assertPublic($exception, 'message');
    }

    /**
     * @param GraphQLErrorInterface $exception
     * @param string $message
     * @return void
     * @throws ExpectationFailedException
     */
    private function assertPublic(GraphQLErrorInterface $exception, string $message): void
    {
        $this->assertTrue($exception->isPublic());
        $this->assertSame($message, $exception->getMessage());
    }

    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testExceptionMessage(): void
    {
        $exception = new GraphQLError('message');

        $this->assertInternal($exception);
    }

    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testExceptionMultipleStateChanges(): void
    {
        $exception = new GraphQLError('message');

        $this->assertInternal($exception);

        $exception->publish();

        $this->assertPublic($exception, 'message');

        $exception->hide();

        $this->assertInternal($exception);
    }

    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testExceptionJsonSerialization(): void
    {
        $expected = '{"message":"Internal Server Error","locations":[{"line":1,"column":1}],"path":[]}';

        $this->assertSame($expected, \json_encode(new GraphQLError('message')));
    }

    /**
     * @return void
     * @throws ExpectationFailedException
     */
    public function testExceptionWithExtensionJsonSerialization(): void
    {
        $expected = '{"message":"Internal Server Error","locations":[{"line":1,"column":1}],"path":[],"extensions":{"name":"value"}}';

        $this->assertSame($expected, \json_encode(
            (new GraphQLError('message'))
                ->withExtension('name', 'value')
        ));
    }
}


text:
package org.apache.hadoop.hive.serde2.objectinspector.primitive;

import java.sql.Date;

import org.apache.hadoop.hive.serde2.io.DateWritable;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;

/**
 * A WritableDateObjectInspector inspects a DateWritable Object.
 */
public class WritableDateObjectInspector extends
    AbstractPrimitiveWritableObjectInspector implements
    SettableDateObjectInspector {

  public WritableDateObjectInspector() {
    super(TypeInfoFactory.dateTypeInfo);
  }

  @Override
  public DateWritable getPrimitiveWritableObject(Object o) {
    return o == null ? null : (DateWritable) o;
  }

  public Date getPrimitiveJavaObject(Object o) {
    return o == null ? null : ((DateWritable) o).get();
  }

  public Object copyObject(Object o) {
    return o == null ? null : new DateWritable((DateWritable) o);
  }

  public Object set(Object o, Date d) {
    if (d == null) {
      return null;
    }
    ((DateWritable) o).set(d);
    return o;
  }

  public Object set(Object o, DateWritable d) {
    if (d == null) {
      return null;
    }
    ((DateWritable) o).set(d);
    return o;
  }

  public Object create(Date d) {
    return new DateWritable(d);
  }
}


text:
'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var cheerio = require('cheerio');
var fs = require('fs');
var path = require('path');
var mime = require('mime');

module.exports = function() {

	// create a stream through which each file will pass
	return through.obj(function(file, enc, callback) {

		if (file.isNull()) {
			this.push(file);
			// do nothing if no contents
			return callback();
		}

		if (file.isStream()) {
			this.emit('error', new gutil.PluginError('gulp-img64', 'Streaming not supported'));
			return callback();
		}

		if (file.isBuffer()) {
			var $ = cheerio.load(String(file.contents));
			$('img').each(function() {
				if (this.attr('src')) {
					var ssrc = this.attr('src');
					var isdata = ssrc.indexOf("data");
					if (ssrc != "" && typeof ssrc != 'undefined' && isdata !== 0) {
						var spath = path.join(file.base, ssrc);
						var mtype = mime.lookup(spath);
						if (mtype != 'application/octet-stream') {
							console.log(mtype);
							var sfile = fs.readFileSync(spath);
							var simg64 = new Buffer(sfile).toString('base64');
							this.attr('src', 'data:' + mtype + ';base64,' + simg64);
						}
					}
				}
			});
			var output = $.html();

			file.contents = new Buffer(output);

			return callback(null, file);
		}
	});
};