Esempio n. 1
0
func ExampleElasticTranscoder_TestRole() {
	svc := elastictranscoder.New(nil)

	params := &elastictranscoder.TestRoleInput{
		InputBucket:  aws.String("BucketName"), // Required
		OutputBucket: aws.String("BucketName"), // Required
		Role:         aws.String("Role"),       // Required
		Topics: []*string{ // Required
			aws.String("SnsTopic"), // Required
			// More values...
		},
	}
	resp, err := svc.TestRole(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Esempio n. 2
0
func ExampleElasticTranscoder_UpdatePipelineNotifications() {
	svc := elastictranscoder.New(nil)

	params := &elastictranscoder.UpdatePipelineNotificationsInput{
		ID: aws.String("Id"), // Required
		Notifications: &elastictranscoder.Notifications{ // Required
			Completed:   aws.String("SnsTopic"),
			Error:       aws.String("SnsTopic"),
			Progressing: aws.String("SnsTopic"),
			Warning:     aws.String("SnsTopic"),
		},
	}
	resp, err := svc.UpdatePipelineNotifications(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Esempio n. 3
0
func ExampleElasticTranscoder_UpdatePipeline() {
	svc := elastictranscoder.New(nil)

	params := &elastictranscoder.UpdatePipelineInput{
		ID:           aws.String("Id"), // Required
		AWSKMSKeyARN: aws.String("KeyArn"),
		ContentConfig: &elastictranscoder.PipelineOutputConfig{
			Bucket: aws.String("BucketName"),
			Permissions: []*elastictranscoder.Permission{
				&elastictranscoder.Permission{ // Required
					Access: []*string{
						aws.String("AccessControl"), // Required
						// More values...
					},
					Grantee:     aws.String("Grantee"),
					GranteeType: aws.String("GranteeType"),
				},
				// More values...
			},
			StorageClass: aws.String("StorageClass"),
		},
		InputBucket: aws.String("BucketName"),
		Name:        aws.String("Name"),
		Notifications: &elastictranscoder.Notifications{
			Completed:   aws.String("SnsTopic"),
			Error:       aws.String("SnsTopic"),
			Progressing: aws.String("SnsTopic"),
			Warning:     aws.String("SnsTopic"),
		},
		Role: aws.String("Role"),
		ThumbnailConfig: &elastictranscoder.PipelineOutputConfig{
			Bucket: aws.String("BucketName"),
			Permissions: []*elastictranscoder.Permission{
				&elastictranscoder.Permission{ // Required
					Access: []*string{
						aws.String("AccessControl"), // Required
						// More values...
					},
					Grantee:     aws.String("Grantee"),
					GranteeType: aws.String("GranteeType"),
				},
				// More values...
			},
			StorageClass: aws.String("StorageClass"),
		},
	}
	resp, err := svc.UpdatePipeline(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Esempio n. 4
0
func TestMakingABasicRequest(t *testing.T) {
	client := elastictranscoder.New(nil)
	resp, e := client.ListPresets(&elastictranscoder.ListPresetsInput{})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NoError(t, nil, err)

}
Esempio n. 5
0
func TestErrorHandling(t *testing.T) {
	client := elastictranscoder.New(nil)
	resp, e := client.ReadJob(&elastictranscoder.ReadJobInput{
		ID: aws.String("fake_job"),
	})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NotEqual(t, nil, err)
	assert.Equal(t, "ValidationException", err.Code)
	utilassert.Match(t, "Value 'fake_job' at 'id' failed to satisfy constraint", err.Message)

}
Esempio n. 6
0
func ExampleElasticTranscoder_ReadPreset() {
	svc := elastictranscoder.New(nil)

	params := &elastictranscoder.ReadPresetInput{
		ID: aws.String("Id"), // Required
	}
	resp, err := svc.ReadPreset(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Esempio n. 7
0
func ExampleElasticTranscoder_ListPresets() {
	svc := elastictranscoder.New(nil)

	params := &elastictranscoder.ListPresetsInput{
		Ascending: aws.String("Ascending"),
		PageToken: aws.String("Id"),
	}
	resp, err := svc.ListPresets(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Esempio n. 8
0
func ExampleElasticTranscoder_CreateJob() {
	svc := elastictranscoder.New(nil)

	params := &elastictranscoder.CreateJobInput{
		Input: &elastictranscoder.JobInput{ // Required
			AspectRatio: aws.String("AspectRatio"),
			Container:   aws.String("JobContainer"),
			Encryption: &elastictranscoder.Encryption{
				InitializationVector: aws.String("ZeroTo255String"),
				Key:                  aws.String("Base64EncodedString"),
				KeyMD5:               aws.String("Base64EncodedString"),
				Mode:                 aws.String("EncryptionMode"),
			},
			FrameRate:  aws.String("FrameRate"),
			Interlaced: aws.String("Interlaced"),
			Key:        aws.String("Key"),
			Resolution: aws.String("Resolution"),
		},
		PipelineID: aws.String("Id"), // Required
		Output: &elastictranscoder.CreateJobOutput{
			AlbumArt: &elastictranscoder.JobAlbumArt{
				Artwork: []*elastictranscoder.Artwork{
					&elastictranscoder.Artwork{ // Required
						AlbumArtFormat: aws.String("JpgOrPng"),
						Encryption: &elastictranscoder.Encryption{
							InitializationVector: aws.String("ZeroTo255String"),
							Key:                  aws.String("Base64EncodedString"),
							KeyMD5:               aws.String("Base64EncodedString"),
							Mode:                 aws.String("EncryptionMode"),
						},
						InputKey:      aws.String("WatermarkKey"),
						MaxHeight:     aws.String("DigitsOrAuto"),
						MaxWidth:      aws.String("DigitsOrAuto"),
						PaddingPolicy: aws.String("PaddingPolicy"),
						SizingPolicy:  aws.String("SizingPolicy"),
					},
					// More values...
				},
				MergePolicy: aws.String("MergePolicy"),
			},
			Captions: &elastictranscoder.Captions{
				CaptionFormats: []*elastictranscoder.CaptionFormat{
					&elastictranscoder.CaptionFormat{ // Required
						Encryption: &elastictranscoder.Encryption{
							InitializationVector: aws.String("ZeroTo255String"),
							Key:                  aws.String("Base64EncodedString"),
							KeyMD5:               aws.String("Base64EncodedString"),
							Mode:                 aws.String("EncryptionMode"),
						},
						Format:  aws.String("CaptionFormatFormat"),
						Pattern: aws.String("CaptionFormatPattern"),
					},
					// More values...
				},
				CaptionSources: []*elastictranscoder.CaptionSource{
					&elastictranscoder.CaptionSource{ // Required
						Encryption: &elastictranscoder.Encryption{
							InitializationVector: aws.String("ZeroTo255String"),
							Key:                  aws.String("Base64EncodedString"),
							KeyMD5:               aws.String("Base64EncodedString"),
							Mode:                 aws.String("EncryptionMode"),
						},
						Key:        aws.String("Key"),
						Label:      aws.String("Name"),
						Language:   aws.String("Key"),
						TimeOffset: aws.String("TimeOffset"),
					},
					// More values...
				},
				MergePolicy: aws.String("CaptionMergePolicy"),
			},
			Composition: []*elastictranscoder.Clip{
				&elastictranscoder.Clip{ // Required
					TimeSpan: &elastictranscoder.TimeSpan{
						Duration:  aws.String("Time"),
						StartTime: aws.String("Time"),
					},
				},
				// More values...
			},
			Encryption: &elastictranscoder.Encryption{
				InitializationVector: aws.String("ZeroTo255String"),
				Key:                  aws.String("Base64EncodedString"),
				KeyMD5:               aws.String("Base64EncodedString"),
				Mode:                 aws.String("EncryptionMode"),
			},
			Key:             aws.String("Key"),
			PresetID:        aws.String("Id"),
			Rotate:          aws.String("Rotate"),
			SegmentDuration: aws.String("Float"),
			ThumbnailEncryption: &elastictranscoder.Encryption{
				InitializationVector: aws.String("ZeroTo255String"),
				Key:                  aws.String("Base64EncodedString"),
				KeyMD5:               aws.String("Base64EncodedString"),
				Mode:                 aws.String("EncryptionMode"),
			},
			ThumbnailPattern: aws.String("ThumbnailPattern"),
			Watermarks: []*elastictranscoder.JobWatermark{
				&elastictranscoder.JobWatermark{ // Required
					Encryption: &elastictranscoder.Encryption{
						InitializationVector: aws.String("ZeroTo255String"),
						Key:                  aws.String("Base64EncodedString"),
						KeyMD5:               aws.String("Base64EncodedString"),
						Mode:                 aws.String("EncryptionMode"),
					},
					InputKey:          aws.String("WatermarkKey"),
					PresetWatermarkID: aws.String("PresetWatermarkId"),
				},
				// More values...
			},
		},
		OutputKeyPrefix: aws.String("Key"),
		Outputs: []*elastictranscoder.CreateJobOutput{
			&elastictranscoder.CreateJobOutput{ // Required
				AlbumArt: &elastictranscoder.JobAlbumArt{
					Artwork: []*elastictranscoder.Artwork{
						&elastictranscoder.Artwork{ // Required
							AlbumArtFormat: aws.String("JpgOrPng"),
							Encryption: &elastictranscoder.Encryption{
								InitializationVector: aws.String("ZeroTo255String"),
								Key:                  aws.String("Base64EncodedString"),
								KeyMD5:               aws.String("Base64EncodedString"),
								Mode:                 aws.String("EncryptionMode"),
							},
							InputKey:      aws.String("WatermarkKey"),
							MaxHeight:     aws.String("DigitsOrAuto"),
							MaxWidth:      aws.String("DigitsOrAuto"),
							PaddingPolicy: aws.String("PaddingPolicy"),
							SizingPolicy:  aws.String("SizingPolicy"),
						},
						// More values...
					},
					MergePolicy: aws.String("MergePolicy"),
				},
				Captions: &elastictranscoder.Captions{
					CaptionFormats: []*elastictranscoder.CaptionFormat{
						&elastictranscoder.CaptionFormat{ // Required
							Encryption: &elastictranscoder.Encryption{
								InitializationVector: aws.String("ZeroTo255String"),
								Key:                  aws.String("Base64EncodedString"),
								KeyMD5:               aws.String("Base64EncodedString"),
								Mode:                 aws.String("EncryptionMode"),
							},
							Format:  aws.String("CaptionFormatFormat"),
							Pattern: aws.String("CaptionFormatPattern"),
						},
						// More values...
					},
					CaptionSources: []*elastictranscoder.CaptionSource{
						&elastictranscoder.CaptionSource{ // Required
							Encryption: &elastictranscoder.Encryption{
								InitializationVector: aws.String("ZeroTo255String"),
								Key:                  aws.String("Base64EncodedString"),
								KeyMD5:               aws.String("Base64EncodedString"),
								Mode:                 aws.String("EncryptionMode"),
							},
							Key:        aws.String("Key"),
							Label:      aws.String("Name"),
							Language:   aws.String("Key"),
							TimeOffset: aws.String("TimeOffset"),
						},
						// More values...
					},
					MergePolicy: aws.String("CaptionMergePolicy"),
				},
				Composition: []*elastictranscoder.Clip{
					&elastictranscoder.Clip{ // Required
						TimeSpan: &elastictranscoder.TimeSpan{
							Duration:  aws.String("Time"),
							StartTime: aws.String("Time"),
						},
					},
					// More values...
				},
				Encryption: &elastictranscoder.Encryption{
					InitializationVector: aws.String("ZeroTo255String"),
					Key:                  aws.String("Base64EncodedString"),
					KeyMD5:               aws.String("Base64EncodedString"),
					Mode:                 aws.String("EncryptionMode"),
				},
				Key:             aws.String("Key"),
				PresetID:        aws.String("Id"),
				Rotate:          aws.String("Rotate"),
				SegmentDuration: aws.String("Float"),
				ThumbnailEncryption: &elastictranscoder.Encryption{
					InitializationVector: aws.String("ZeroTo255String"),
					Key:                  aws.String("Base64EncodedString"),
					KeyMD5:               aws.String("Base64EncodedString"),
					Mode:                 aws.String("EncryptionMode"),
				},
				ThumbnailPattern: aws.String("ThumbnailPattern"),
				Watermarks: []*elastictranscoder.JobWatermark{
					&elastictranscoder.JobWatermark{ // Required
						Encryption: &elastictranscoder.Encryption{
							InitializationVector: aws.String("ZeroTo255String"),
							Key:                  aws.String("Base64EncodedString"),
							KeyMD5:               aws.String("Base64EncodedString"),
							Mode:                 aws.String("EncryptionMode"),
						},
						InputKey:          aws.String("WatermarkKey"),
						PresetWatermarkID: aws.String("PresetWatermarkId"),
					},
					// More values...
				},
			},
			// More values...
		},
		Playlists: []*elastictranscoder.CreateJobPlaylist{
			&elastictranscoder.CreateJobPlaylist{ // Required
				Format: aws.String("PlaylistFormat"),
				HLSContentProtection: &elastictranscoder.HLSContentProtection{
					InitializationVector:  aws.String("ZeroTo255String"),
					Key:                   aws.String("Base64EncodedString"),
					KeyMD5:                aws.String("Base64EncodedString"),
					KeyStoragePolicy:      aws.String("KeyStoragePolicy"),
					LicenseAcquisitionURL: aws.String("ZeroTo512String"),
					Method:                aws.String("HlsContentProtectionMethod"),
				},
				Name: aws.String("Filename"),
				OutputKeys: []*string{
					aws.String("Key"), // Required
					// More values...
				},
			},
			// More values...
		},
		UserMetadata: &map[string]*string{
			"Key": aws.String("String"), // Required
			// More values...
		},
	}
	resp, err := svc.CreateJob(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Esempio n. 9
0
func ExampleElasticTranscoder_CreatePreset() {
	svc := elastictranscoder.New(nil)

	params := &elastictranscoder.CreatePresetInput{
		Container: aws.String("PresetContainer"), // Required
		Name:      aws.String("Name"),            // Required
		Audio: &elastictranscoder.AudioParameters{
			BitRate:  aws.String("AudioBitRate"),
			Channels: aws.String("AudioChannels"),
			Codec:    aws.String("AudioCodec"),
			CodecOptions: &elastictranscoder.AudioCodecOptions{
				Profile: aws.String("AudioCodecProfile"),
			},
			SampleRate: aws.String("AudioSampleRate"),
		},
		Description: aws.String("Description"),
		Thumbnails: &elastictranscoder.Thumbnails{
			AspectRatio:   aws.String("AspectRatio"),
			Format:        aws.String("JpgOrPng"),
			Interval:      aws.String("Digits"),
			MaxHeight:     aws.String("DigitsOrAuto"),
			MaxWidth:      aws.String("DigitsOrAuto"),
			PaddingPolicy: aws.String("PaddingPolicy"),
			Resolution:    aws.String("ThumbnailResolution"),
			SizingPolicy:  aws.String("SizingPolicy"),
		},
		Video: &elastictranscoder.VideoParameters{
			AspectRatio: aws.String("AspectRatio"),
			BitRate:     aws.String("VideoBitRate"),
			Codec:       aws.String("VideoCodec"),
			CodecOptions: &map[string]*string{
				"Key": aws.String("CodecOption"), // Required
				// More values...
			},
			DisplayAspectRatio: aws.String("AspectRatio"),
			FixedGOP:           aws.String("FixedGOP"),
			FrameRate:          aws.String("FrameRate"),
			KeyframesMaxDist:   aws.String("KeyframesMaxDist"),
			MaxFrameRate:       aws.String("MaxFrameRate"),
			MaxHeight:          aws.String("DigitsOrAuto"),
			MaxWidth:           aws.String("DigitsOrAuto"),
			PaddingPolicy:      aws.String("PaddingPolicy"),
			Resolution:         aws.String("Resolution"),
			SizingPolicy:       aws.String("SizingPolicy"),
			Watermarks: []*elastictranscoder.PresetWatermark{
				&elastictranscoder.PresetWatermark{ // Required
					HorizontalAlign:  aws.String("HorizontalAlign"),
					HorizontalOffset: aws.String("PixelsOrPercent"),
					ID:               aws.String("PresetWatermarkId"),
					MaxHeight:        aws.String("PixelsOrPercent"),
					MaxWidth:         aws.String("PixelsOrPercent"),
					Opacity:          aws.String("Opacity"),
					SizingPolicy:     aws.String("WatermarkSizingPolicy"),
					Target:           aws.String("Target"),
					VerticalAlign:    aws.String("VerticalAlign"),
					VerticalOffset:   aws.String("PixelsOrPercent"),
				},
				// More values...
			},
		},
	}
	resp, err := svc.CreatePreset(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}