本文整理汇总了Golang中github.com/convox/kernel/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ecs.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleECS_ListTasks
func ExampleECS_ListTasks() {
svc := ecs.New(nil)
params := &ecs.ListTasksInput{
Cluster: aws.String("String"),
ContainerInstance: aws.String("String"),
Family: aws.String("String"),
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
ServiceName: aws.String("String"),
StartedBy: aws.String("String"),
}
resp, err := svc.ListTasks(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例2: ExampleECS_UpdateService
func ExampleECS_UpdateService() {
svc := ecs.New(nil)
params := &ecs.UpdateServiceInput{
Service: aws.String("String"), // Required
Cluster: aws.String("String"),
DesiredCount: aws.Long(1),
TaskDefinition: aws.String("String"),
}
resp, err := svc.UpdateService(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例3: ExampleECS_DescribeContainerInstances
func ExampleECS_DescribeContainerInstances() {
svc := ecs.New(nil)
params := &ecs.DescribeContainerInstancesInput{
ContainerInstances: []*string{ // Required
aws.String("String"), // Required
// More values...
},
Cluster: aws.String("String"),
}
resp, err := svc.DescribeContainerInstances(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例4: ExampleECS_RegisterContainerInstance
func ExampleECS_RegisterContainerInstance() {
svc := ecs.New(nil)
params := &ecs.RegisterContainerInstanceInput{
Cluster: aws.String("String"),
InstanceIdentityDocument: aws.String("String"),
InstanceIdentityDocumentSignature: aws.String("String"),
TotalResources: []*ecs.Resource{
&ecs.Resource{ // Required
DoubleValue: aws.Double(1.0),
IntegerValue: aws.Long(1),
LongValue: aws.Long(1),
Name: aws.String("String"),
StringSetValue: []*string{
aws.String("String"), // Required
// More values...
},
Type: aws.String("String"),
},
// More values...
},
VersionInfo: &ecs.VersionInfo{
AgentHash: aws.String("String"),
AgentVersion: aws.String("String"),
DockerVersion: aws.String("String"),
},
}
resp, err := svc.RegisterContainerInstance(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例5: ExampleECS_RunTask
func ExampleECS_RunTask() {
svc := ecs.New(nil)
params := &ecs.RunTaskInput{
TaskDefinition: aws.String("String"), // Required
Cluster: aws.String("String"),
Count: aws.Long(1),
Overrides: &ecs.TaskOverride{
ContainerOverrides: []*ecs.ContainerOverride{
&ecs.ContainerOverride{ // Required
Command: []*string{
aws.String("String"), // Required
// More values...
},
Name: aws.String("String"),
},
// More values...
},
},
StartedBy: aws.String("String"),
}
resp, err := svc.RunTask(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例6: ExampleECS_SubmitContainerStateChange
func ExampleECS_SubmitContainerStateChange() {
svc := ecs.New(nil)
params := &ecs.SubmitContainerStateChangeInput{
Cluster: aws.String("String"),
ContainerName: aws.String("String"),
ExitCode: aws.Long(1),
NetworkBindings: []*ecs.NetworkBinding{
&ecs.NetworkBinding{ // Required
BindIP: aws.String("String"),
ContainerPort: aws.Long(1),
HostPort: aws.Long(1),
},
// More values...
},
Reason: aws.String("String"),
Status: aws.String("String"),
Task: aws.String("String"),
}
resp, err := svc.SubmitContainerStateChange(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例7: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*ecsiface.ECSAPI)(nil), ecs.New(nil))
}
示例8: ExampleECS_RegisterTaskDefinition
func ExampleECS_RegisterTaskDefinition() {
svc := ecs.New(nil)
params := &ecs.RegisterTaskDefinitionInput{
ContainerDefinitions: []*ecs.ContainerDefinition{ // Required
&ecs.ContainerDefinition{ // Required
CPU: aws.Long(1),
Command: []*string{
aws.String("String"), // Required
// More values...
},
EntryPoint: []*string{
aws.String("String"), // Required
// More values...
},
Environment: []*ecs.KeyValuePair{
&ecs.KeyValuePair{ // Required
Name: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
Essential: aws.Boolean(true),
Image: aws.String("String"),
Links: []*string{
aws.String("String"), // Required
// More values...
},
Memory: aws.Long(1),
MountPoints: []*ecs.MountPoint{
&ecs.MountPoint{ // Required
ContainerPath: aws.String("String"),
ReadOnly: aws.Boolean(true),
SourceVolume: aws.String("String"),
},
// More values...
},
Name: aws.String("String"),
PortMappings: []*ecs.PortMapping{
&ecs.PortMapping{ // Required
ContainerPort: aws.Long(1),
HostPort: aws.Long(1),
},
// More values...
},
VolumesFrom: []*ecs.VolumeFrom{
&ecs.VolumeFrom{ // Required
ReadOnly: aws.Boolean(true),
SourceContainer: aws.String("String"),
},
// More values...
},
},
// More values...
},
Family: aws.String("String"), // Required
Volumes: []*ecs.Volume{
&ecs.Volume{ // Required
Host: &ecs.HostVolumeProperties{
SourcePath: aws.String("String"),
},
Name: aws.String("String"),
},
// More values...
},
}
resp, err := svc.RegisterTaskDefinition(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例9: ECS
func ECS(req Request) *ecs.ECS {
return ecs.New(&aws.Config{
Credentials: Credentials(&req),
Region: Region(&req),
})
}
示例10: ECS
func ECS() *ecs.ECS {
return ecs.New(&aws.Config{
Credentials: credentials.NewCredentials(&AwsCredentials{}),
Region: os.Getenv("AWS_REGION"),
})
}