本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/elastictranscoder.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleElasticTranscoder_TestRole
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 err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:32,代码来源:examples_test.go
示例2: ExampleElasticTranscoder_UpdatePipelineNotifications
func ExampleElasticTranscoder_UpdatePipelineNotifications() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elastictranscoder.New(sess)
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 err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:30,代码来源:examples_test.go
示例3: ExampleElasticTranscoder_UpdatePipelineStatus
func ExampleElasticTranscoder_UpdatePipelineStatus() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elastictranscoder.New(sess)
params := &elastictranscoder.UpdatePipelineStatusInput{
Id: aws.String("Id"), // Required
Status: aws.String("PipelineStatus"), // Required
}
resp, err := svc.UpdatePipelineStatus(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:25,代码来源:examples_test.go
示例4: ExampleElasticTranscoder_TestRole
func ExampleElasticTranscoder_TestRole() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elastictranscoder.New(sess)
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 err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:30,代码来源:examples_test.go
示例5: ExampleElasticTranscoder_ListPresets
func ExampleElasticTranscoder_ListPresets() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elastictranscoder.New(sess)
params := &elastictranscoder.ListPresetsInput{
Ascending: aws.String("Ascending"),
PageToken: aws.String("Id"),
}
resp, err := svc.ListPresets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:25,代码来源:examples_test.go
示例6: ExampleElasticTranscoder_UpdatePipelineStatus
func ExampleElasticTranscoder_UpdatePipelineStatus() {
svc := elastictranscoder.New(nil)
params := &elastictranscoder.UpdatePipelineStatusInput{
ID: aws.String("Id"), // Required
Status: aws.String("PipelineStatus"), // Required
}
resp, err := svc.UpdatePipelineStatus(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例7: ExampleElasticTranscoder_ListPresets
func ExampleElasticTranscoder_ListPresets() {
svc := elastictranscoder.New(nil)
params := &elastictranscoder.ListPresetsInput{
Ascending: aws.String("Ascending"),
PageToken: aws.String("Id"),
}
resp, err := svc.ListPresets(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例8: ExampleElasticTranscoder_UpdatePipeline
func ExampleElasticTranscoder_UpdatePipeline() {
svc := elastictranscoder.New(session.New())
params := &elastictranscoder.UpdatePipelineInput{
Id: aws.String("Id"), // Required
AwsKmsKeyArn: aws.String("KeyArn"),
ContentConfig: &elastictranscoder.PipelineOutputConfig{
Bucket: aws.String("BucketName"),
Permissions: []*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{
{ // 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 err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:58,代码来源:examples_test.go
示例9: processVideo
func processVideo(src io.Reader, mime string, bucket string) (*url.URL, *url.URL, error) {
raw, err := ioutil.ReadAll(src)
if err != nil {
return nil, nil, err
}
data := bytes.NewReader(raw)
length := int64(data.Len())
key := fileKey(bucket, 0, 0, "")
video_bucket := "trunq-video-uploads"
err = storage.PutReader(video_bucket, key, data, length, mime)
if err != nil {
return nil, nil, err
}
orig_uri := fileUri(bucket, key)
svc := elastictranscoder.New(nil) // Use DefaultConfig
params := &elastictranscoder.CreateJobInput{
Input: &elastictranscoder.JobInput{
AspectRatio: aws.String("auto"),
Container: aws.String("auto"),
FrameRate: aws.String("auto"),
Interlaced: aws.String("auto"),
Key: aws.String(key),
Resolution: aws.String("auto"),
},
PipelineID: aws.String("1427912207362-9tmupe"), // Set pipeline ids via ENV?
Output: &elastictranscoder.CreateJobOutput{
Key: aws.String(key + ".mp4"),
PresetID: aws.String("1433884957052-6rh021"), // Trunq 720p H.264
Rotate: aws.String("auto"),
ThumbnailPattern: aws.String(key + "{count}-{resolution}"), // Can we add res later?
},
}
_, err = svc.CreateJob(params)
if err != nil {
return orig_uri, &url.URL{}, err
}
uri := fileUri(bucket, key+".mp4")
previewUri := fileUri(bucket, key+"00001-1280x720.jpg") // Assume 1280x720 because preset ensures it
return uri, previewUri, nil
}
开发者ID:danrjohnson,项目名称:media-proxy,代码行数:47,代码来源:handler.go
示例10: ExampleElasticTranscoder_ReadPreset
func ExampleElasticTranscoder_ReadPreset() {
svc := elastictranscoder.New(session.New())
params := &elastictranscoder.ReadPresetInput{
Id: aws.String("Id"), // Required
}
resp, err := svc.ReadPreset(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:18,代码来源:examples_test.go
示例11: processAudio
func processAudio(src io.Reader, mime string, bucket string) (*url.URL, *url.URL, error) {
raw, err := ioutil.ReadAll(src)
if err != nil {
return nil, nil, err
}
data := bytes.NewReader(raw)
length := int64(data.Len())
key := fileKey(bucket, 0, 0, "")
audio_bucket := "trunq-audio-uploads"
err = storage.PutReader(audio_bucket, key, data, length, mime)
if err != nil {
return nil, nil, err
}
orig_uri := fileUri(bucket, key)
svc := elastictranscoder.New(nil) // Use DefaultConfig
params := &elastictranscoder.CreateJobInput{
Input: &elastictranscoder.JobInput{
AspectRatio: aws.String("auto"),
Container: aws.String("auto"),
FrameRate: aws.String("auto"),
Interlaced: aws.String("auto"),
Key: aws.String(key),
Resolution: aws.String("auto"),
},
PipelineID: aws.String("1427912254873-1sf1w9"), // Set pipeline ids via ENV?
Output: &elastictranscoder.CreateJobOutput{
Key: aws.String(key + ".mp3"),
PresetID: aws.String("1351620000001-300040"), // 128k MP3
},
}
_, err = svc.CreateJob(params)
if err != nil {
return orig_uri, &url.URL{}, err
}
uri := fileUri(bucket, key+".mp3")
return uri, &url.URL{}, nil
}
开发者ID:danrjohnson,项目名称:media-proxy,代码行数:44,代码来源:handler.go
示例12: ExampleElasticTranscoder_ListPipelines
func ExampleElasticTranscoder_ListPipelines() {
svc := elastictranscoder.New(nil)
params := &elastictranscoder.ListPipelinesInput{
Ascending: aws.String("Ascending"),
PageToken: aws.String("Id"),
}
resp, err := svc.ListPipelines(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:jloper3,项目名称:amazon-ecs-cli,代码行数:19,代码来源:examples_test.go
示例13: ExampleElasticTranscoder_ListJobsByStatus
func ExampleElasticTranscoder_ListJobsByStatus() {
svc := elastictranscoder.New(session.New())
params := &elastictranscoder.ListJobsByStatusInput{
Status: aws.String("JobStatus"), // Required
Ascending: aws.String("Ascending"),
PageToken: aws.String("Id"),
}
resp, err := svc.ListJobsByStatus(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:20,代码来源:examples_test.go
示例14: Client
// Client configures and returns a fully initialized AWSClient
func (c *Config) Client() (interface{}, error) {
// Get the auth and region. This can fail if keys/regions were not
// specified and we're attempting to use the environment.
var errs []error
log.Println("[INFO] Building AWS region structure")
err := c.ValidateRegion()
if err != nil {
errs = append(errs, err)
}
var client AWSClient
if len(errs) == 0 {
// store AWS region in client struct, for region specific operations such as
// bucket storage in S3
client.region = c.Region
log.Println("[INFO] Building AWS auth structure")
creds := GetCredentials(c.AccessKey, c.SecretKey, c.Token, c.Profile, c.CredsFilename)
// Call Get to check for credential provider. If nothing found, we'll get an
// error, and we can present it nicely to the user
cp, err := creds.Get()
if err != nil {
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NoCredentialProviders" {
errs = append(errs, fmt.Errorf(`No valid credential sources found for AWS Provider.
Please see https://terraform.io/docs/providers/aws/index.html for more information on
providing credentials for the AWS Provider`))
} else {
errs = append(errs, fmt.Errorf("Error loading credentials for AWS Provider: %s", err))
}
return nil, &multierror.Error{Errors: errs}
}
log.Printf("[INFO] AWS Auth provider used: %q", cp.ProviderName)
awsConfig := &aws.Config{
Credentials: creds,
Region: aws.String(c.Region),
MaxRetries: aws.Int(c.MaxRetries),
HTTPClient: cleanhttp.DefaultClient(),
}
if logging.IsDebugOrHigher() {
awsConfig.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody)
awsConfig.Logger = awsLogger{}
}
if c.Insecure {
transport := awsConfig.HTTPClient.Transport.(*http.Transport)
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
}
// Set up base session
sess := session.New(awsConfig)
sess.Handlers.Build.PushFrontNamed(addTerraformVersionToUserAgent)
// Some services exist only in us-east-1, e.g. because they manage
// resources that can span across multiple regions, or because
// signature format v4 requires region to be us-east-1 for global
// endpoints:
// http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html
usEast1Sess := sess.Copy(&aws.Config{Region: aws.String("us-east-1")})
// Some services have user-configurable endpoints
awsEc2Sess := sess.Copy(&aws.Config{Endpoint: aws.String(c.Ec2Endpoint)})
awsElbSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.ElbEndpoint)})
awsIamSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.IamEndpoint)})
dynamoSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.DynamoDBEndpoint)})
kinesisSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.KinesisEndpoint)})
// These two services need to be set up early so we can check on AccountID
client.iamconn = iam.New(awsIamSess)
client.stsconn = sts.New(sess)
err = c.ValidateCredentials(client.stsconn)
if err != nil {
errs = append(errs, err)
return nil, &multierror.Error{Errors: errs}
}
accountId, err := GetAccountId(client.iamconn, client.stsconn, cp.ProviderName)
if err == nil {
client.accountid = accountId
}
authErr := c.ValidateAccountId(client.accountid)
if authErr != nil {
errs = append(errs, authErr)
}
client.apigateway = apigateway.New(sess)
client.autoscalingconn = autoscaling.New(sess)
client.cfconn = cloudformation.New(sess)
client.cloudfrontconn = cloudfront.New(sess)
client.cloudtrailconn = cloudtrail.New(sess)
client.cloudwatchconn = cloudwatch.New(sess)
client.cloudwatcheventsconn = cloudwatchevents.New(sess)
client.cloudwatchlogsconn = cloudwatchlogs.New(sess)
//.........这里部分代码省略.........
开发者ID:yonatanp,项目名称:terraform,代码行数:101,代码来源:config.go
示例15: Client
// Client configures and returns a fully initialized AWSClient
func (c *Config) Client() (interface{}, error) {
// Get the auth and region. This can fail if keys/regions were not
// specified and we're attempting to use the environment.
log.Println("[INFO] Building AWS region structure")
err := c.ValidateRegion()
if err != nil {
return nil, err
}
var client AWSClient
// store AWS region in client struct, for region specific operations such as
// bucket storage in S3
client.region = c.Region
log.Println("[INFO] Building AWS auth structure")
creds, err := GetCredentials(c)
if err != nil {
return nil, err
}
// Call Get to check for credential provider. If nothing found, we'll get an
// error, and we can present it nicely to the user
cp, err := creds.Get()
if err != nil {
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NoCredentialProviders" {
return nil, errors.New(`No valid credential sources found for AWS Provider.
Please see https://terraform.io/docs/providers/aws/index.html for more information on
providing credentials for the AWS Provider`)
}
return nil, fmt.Errorf("Error loading credentials for AWS Provider: %s", err)
}
log.Printf("[INFO] AWS Auth provider used: %q", cp.ProviderName)
awsConfig := &aws.Config{
Credentials: creds,
Region: aws.String(c.Region),
MaxRetries: aws.Int(c.MaxRetries),
HTTPClient: cleanhttp.DefaultClient(),
S3ForcePathStyle: aws.Bool(c.S3ForcePathStyle),
}
if logging.IsDebugOrHigher() {
awsConfig.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody)
awsConfig.Logger = awsLogger{}
}
if c.Insecure {
transport := awsConfig.HTTPClient.Transport.(*http.Transport)
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
}
// Set up base session
sess, err := session.NewSession(awsConfig)
if err != nil {
return nil, errwrap.Wrapf("Error creating AWS session: {{err}}", err)
}
// Removes the SDK Version handler, so we only have the provider User-Agent
// Ex: "User-Agent: APN/1.0 HashiCorp/1.0 Terraform/0.7.9-dev"
sess.Handlers.Build.Remove(request.NamedHandler{Name: "core.SDKVersionUserAgentHandler"})
sess.Handlers.Build.PushFrontNamed(addTerraformVersionToUserAgent)
if extraDebug := os.Getenv("TERRAFORM_AWS_AUTHFAILURE_DEBUG"); extraDebug != "" {
sess.Handlers.UnmarshalError.PushFrontNamed(debugAuthFailure)
}
// Some services exist only in us-east-1, e.g. because they manage
// resources that can span across multiple regions, or because
// signature format v4 requires region to be us-east-1 for global
// endpoints:
// http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html
usEast1Sess := sess.Copy(&aws.Config{Region: aws.String("us-east-1")})
// Some services have user-configurable endpoints
awsEc2Sess := sess.Copy(&aws.Config{Endpoint: aws.String(c.Ec2Endpoint)})
awsElbSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.ElbEndpoint)})
awsIamSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.IamEndpoint)})
awsS3Sess := sess.Copy(&aws.Config{Endpoint: aws.String(c.S3Endpoint)})
dynamoSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.DynamoDBEndpoint)})
kinesisSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.KinesisEndpoint)})
// These two services need to be set up early so we can check on AccountID
client.iamconn = iam.New(awsIamSess)
client.stsconn = sts.New(sess)
if !c.SkipCredsValidation {
err = c.ValidateCredentials(client.stsconn)
if err != nil {
return nil, err
}
}
if !c.SkipRequestingAccountId {
partition, accountId, err := GetAccountInfo(client.iamconn, client.stsconn, cp.ProviderName)
if err == nil {
client.partition = partition
//.........这里部分代码省略.........
开发者ID:hooklift,项目名称:terraform,代码行数:101,代码来源:config.go
示例16: ExampleElasticTranscoder_UpdatePipeline
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{
{ // 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{
{ // 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 err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:66,代码来源:examples_test.go
示例17: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*elastictranscoderiface.ElasticTranscoderAPI)(nil), elastictranscoder.New(nil))
}
开发者ID:jloper3,项目名称:amazon-ecs-cli,代码行数:3,代码来源:interface_test.go
示例18: ExampleElasticTranscoder_CreateJob
func ExampleElasticTranscoder_CreateJob() {
svc := elastictranscoder.New(nil)
params := &elastictranscoder.CreateJobInput{
Input: &elastictranscoder.JobInput{ // Required
AspectRatio: aws.String("AspectRatio"),
Container: aws.String("JobContainer"),
DetectedProperties: &elastictranscoder.DetectedProperties{
DurationMillis: aws.Int64(1),
FileSize: aws.Int64(1),
FrameRate: aws.String("FloatString"),
Height: aws.Int64(1),
Width: aws.Int64(1),
},
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{
{ // 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{
{ // 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{
{ // 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{
{ // 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("FloatString"),
ThumbnailEncryption: &elastictranscoder.Encryption{
InitializationVector: aws.String("ZeroTo255String"),
Key: aws.String("Base64EncodedString"),
//.........这里部分代码省略.........
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:101,代码来源:examples_test.go
示例19: ExampleElasticTranscoder_CreatePreset
func ExampleElasticTranscoder_CreatePreset() {
svc := elastictranscoder.New(nil)
params := &elastictranscoder.CreatePresetInput{
Container: aws.String("PresetContainer"), // Required
Name: aws.String("Name"), // Required
Audio: &elastictranscoder.AudioParameters{
AudioPackingMode: aws.String("AudioPackingMode"),
BitRate: aws.String("AudioBitRate"),
Channels: aws.String("AudioChannels"),
Codec: aws.String("AudioCodec"),
CodecOptions: &elastictranscoder.AudioCodecOptions{
BitDepth: aws.String("AudioBitDepth"),
BitOrder: aws.String("AudioBitOrder"),
Profile: aws.String("AudioCodecProfile"),
Signed: aws.String("AudioSigned"),
},
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{
{ // 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 err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:85,代码来源:examples_test.go
示例20: init
func init() {
Before("@elastictranscoder", func() {
World["client"] = elastictranscoder.New(nil)
})
}
开发者ID:rifflock,项目名称:aws-sdk-go,代码行数:5,代码来源:client.go
注:本文中的github.com/aws/aws-sdk-go/service/elastictranscoder.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论