本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/cloudfront.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleCloudFront_DeleteStreamingDistribution
func ExampleCloudFront_DeleteStreamingDistribution() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudfront.New(sess)
params := &cloudfront.DeleteStreamingDistributionInput{
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.DeleteStreamingDistribution(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:roman-vynar,项目名称:grafana,代码行数:25,代码来源:examples_test.go
示例2: ExampleCloudFront_ListInvalidations
func ExampleCloudFront_ListInvalidations() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudfront.New(sess)
params := &cloudfront.ListInvalidationsInput{
DistributionId: aws.String("string"), // Required
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListInvalidations(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:roman-vynar,项目名称:grafana,代码行数:26,代码来源:examples_test.go
示例3: ExampleCloudFront_ListStreamingDistributions
func ExampleCloudFront_ListStreamingDistributions() {
svc := cloudfront.New(nil)
params := &cloudfront.ListStreamingDistributionsInput{
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListStreamingDistributions(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:strife25,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例4: ExampleCloudFront_CreateCloudFrontOriginAccessIdentity
func ExampleCloudFront_CreateCloudFrontOriginAccessIdentity() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudfront.New(sess)
params := &cloudfront.CreateCloudFrontOriginAccessIdentityInput{
CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
},
}
resp, err := svc.CreateCloudFrontOriginAccessIdentity(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:roman-vynar,项目名称:grafana,代码行数:27,代码来源:examples_test.go
示例5: ExampleCloudFront_UntagResource
func ExampleCloudFront_UntagResource() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudfront.New(sess)
params := &cloudfront.UntagResourceInput{
Resource: aws.String("ResourceARN"), // Required
TagKeys: &cloudfront.TagKeys{ // Required
Items: []*string{
aws.String("TagKey"), // Required
// More values...
},
},
}
resp, err := svc.UntagResource(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:roman-vynar,项目名称:grafana,代码行数:30,代码来源:examples_test.go
示例6: ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity
func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() {
svc := cloudfront.New(nil)
params := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{
CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
},
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateCloudFrontOriginAccessIdentity(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:strife25,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例7: ExampleCloudFront_CreateInvalidation
func ExampleCloudFront_CreateInvalidation() {
svc := cloudfront.New(session.New())
params := &cloudfront.CreateInvalidationInput{
DistributionId: aws.String("string"), // Required
InvalidationBatch: &cloudfront.InvalidationBatch{ // Required
CallerReference: aws.String("string"), // Required
Paths: &cloudfront.Paths{ // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
}
resp, err := svc.CreateInvalidation(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:charles-at-linknext,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例8: ExampleCloudFront_GetInvalidation
func ExampleCloudFront_GetInvalidation() {
svc := cloudfront.New(nil)
params := &cloudfront.GetInvalidationInput{
DistributionID: aws.String("string"), // Required
ID: aws.String("string"), // Required
}
resp, err := svc.GetInvalidation(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:reyco,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例9: ExampleCloudFront_UpdateStreamingDistribution
func ExampleCloudFront_UpdateStreamingDistribution() {
svc := cloudfront.New(nil)
params := &cloudfront.UpdateStreamingDistributionInput{
Id: aws.String("string"), // Required
StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
S3Origin: &cloudfront.S3Origin{ // Required
DomainName: aws.String("string"), // Required
OriginAccessIdentity: aws.String("string"), // Required
},
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Logging: &cloudfront.StreamingLoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
Prefix: aws.String("string"), // Required
},
PriceClass: aws.String("PriceClass"),
},
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateStreamingDistribution(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:strife25,项目名称:aws-sdk-go,代码行数:57,代码来源:examples_test.go
示例10: ExampleCloudFront_UpdateStreamingDistribution
func ExampleCloudFront_UpdateStreamingDistribution() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudfront.New(sess)
params := &cloudfront.UpdateStreamingDistributionInput{
Id: aws.String("string"), // Required
StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
S3Origin: &cloudfront.S3Origin{ // Required
DomainName: aws.String("string"), // Required
OriginAccessIdentity: aws.String("string"), // Required
},
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Logging: &cloudfront.StreamingLoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
Prefix: aws.String("string"), // Required
},
PriceClass: aws.String("PriceClass"),
},
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateStreamingDistribution(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:roman-vynar,项目名称:grafana,代码行数:55,代码来源:examples_test.go
示例11: NewAWS
func NewAWS(p *Plugin) AWS {
sess := session.New(&aws.Config{
Credentials: credentials.NewStaticCredentials(p.Key, p.Secret, ""),
Region: aws.String(p.Region),
})
c := s3.New(sess)
cf := cloudfront.New(sess)
r := make([]string, 1, 1)
l := make([]string, 1, 1)
return AWS{c, cf, r, l, p}
}
开发者ID:drone-plugins,项目名称:drone-s3-sync,代码行数:12,代码来源:aws.go
示例12: ExampleCloudFront_GetCloudFrontOriginAccessIdentity
func ExampleCloudFront_GetCloudFrontOriginAccessIdentity() {
svc := cloudfront.New(nil)
params := &cloudfront.GetCloudFrontOriginAccessIdentityInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetCloudFrontOriginAccessIdentity(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,代码行数:18,代码来源:examples_test.go
示例13: ExampleCloudFront_GetStreamingDistributionConfig
func ExampleCloudFront_GetStreamingDistributionConfig() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetStreamingDistributionConfigInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetStreamingDistributionConfig(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:charles-at-linknext,项目名称:aws-sdk-go,代码行数:18,代码来源:examples_test.go
示例14: ExampleCloudFront_ListStreamingDistributions
func ExampleCloudFront_ListStreamingDistributions() {
svc := cloudfront.New(session.New())
params := &cloudfront.ListStreamingDistributionsInput{
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListStreamingDistributions(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:charles-at-linknext,项目名称:aws-sdk-go,代码行数:19,代码来源:examples_test.go
示例15: ExampleCloudFront_ListDistributionsByWebACLId
func ExampleCloudFront_ListDistributionsByWebACLId() {
svc := cloudfront.New(nil)
params := &cloudfront.ListDistributionsByWebACLIdInput{
WebACLId: aws.String("string"), // Required
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListDistributionsByWebACLId(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:skion,项目名称:amazon-ecs-cli,代码行数:20,代码来源:examples_test.go
示例16: ConfigureAWS
func ConfigureAWS(cfg Config) {
awsCredentials = credentials.NewChainCredentials(
[]credentials.Provider{
&credentials.StaticProvider{Value: credentials.Value{
AccessKeyID: AWSAccessKeyID,
SecretAccessKey: AWSSecretAccessKey,
SessionToken: AWSSessionToken,
}},
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{},
})
s3Client = s3.New(&aws.Config{
Region: cfg.S3Region,
Credentials: awsCredentials,
// LogLevel: 1,
})
cfClient = cloudfront.New(&aws.Config{
Credentials: awsCredentials,
// LogLevel: 1,
})
}
开发者ID:michaeldwan,项目名称:static,代码行数:23,代码来源:aws.go
示例17: ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity
func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() {
svc := cloudfront.New(nil)
params := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{
CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
},
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateCloudFrontOriginAccessIdentity(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,代码行数:23,代码来源:examples_test.go
示例18: ExampleCloudFront_ListTagsForResource
func ExampleCloudFront_ListTagsForResource() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudfront.New(sess)
params := &cloudfront.ListTagsForResourceInput{
Resource: aws.String("ResourceARN"), // Required
}
resp, err := svc.ListTagsForResource(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:roman-vynar,项目名称:grafana,代码行数:24,代码来源:examples_test.go
示例19: ExampleCloudFront_CreateInvalidation
func ExampleCloudFront_CreateInvalidation() {
svc := cloudfront.New(nil)
params := &cloudfront.CreateInvalidationInput{
DistributionId: aws.String("string"), // Required
InvalidationBatch: &cloudfront.InvalidationBatch{ // Required
CallerReference: aws.String("string"), // Required
Paths: &cloudfront.Paths{ // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
}
resp, err := svc.CreateInvalidation(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:strife25,项目名称:aws-sdk-go,代码行数:36,代码来源:examples_test.go
示例20: ExampleCloudFront_UpdateDistribution
func ExampleCloudFront_UpdateDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.UpdateDistributionInput{
DistributionConfig: &cloudfront.DistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
ForwardedValues: &cloudfront.ForwardedValues{ // Required
Cookies: &cloudfront.CookiePreference{ // Required
Forward: aws.String("ItemSelection"), // Required
WhitelistedNames: &cloudfront.CookieNames{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
QueryString: aws.Bool(true), // Required
Headers: &cloudfront.Headers{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
MinTTL: aws.Int64(1), // Required
TargetOriginId: aws.String("string"), // Required
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
AllowedMethods: &cloudfront.AllowedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
CachedMethods: &cloudfront.CachedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
},
},
Compress: aws.Bool(true),
DefaultTTL: aws.Int64(1),
MaxTTL: aws.Int64(1),
SmoothStreaming: aws.Bool(true),
},
Enabled: aws.Bool(true), // Required
Origins: &cloudfront.Origins{ // Required
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.Origin{
{ // Required
DomainName: aws.String("string"), // Required
Id: aws.String("string"), // Required
CustomOriginConfig: &cloudfront.CustomOriginConfig{
HTTPPort: aws.Int64(1), // Required
HTTPSPort: aws.Int64(1), // Required
OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
},
OriginPath: aws.String("string"),
S3OriginConfig: &cloudfront.S3OriginConfig{
OriginAccessIdentity: aws.String("string"), // Required
},
},
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
CacheBehaviors: &cloudfront.CacheBehaviors{
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.CacheBehavior{
{ // Required
ForwardedValues: &cloudfront.ForwardedValues{ // Required
Cookies: &cloudfront.CookiePreference{ // Required
Forward: aws.String("ItemSelection"), // Required
WhitelistedNames: &cloudfront.CookieNames{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
//.........这里部分代码省略.........
开发者ID:charles-at-linknext,项目名称:aws-sdk-go,代码行数:101,代码来源:examples_test.go
注:本文中的github.com/aws/aws-sdk-go/service/cloudfront.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论