Vendor aws-sdk-go (dep ensure) (#178)
This commit is contained in:
5013
vendor/github.com/aws/aws-sdk-go/service/batch/api.go
generated
vendored
Normal file
5013
vendor/github.com/aws/aws-sdk-go/service/batch/api.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
128
vendor/github.com/aws/aws-sdk-go/service/batch/batchiface/interface.go
generated
vendored
Normal file
128
vendor/github.com/aws/aws-sdk-go/service/batch/batchiface/interface.go
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package batchiface provides an interface to enable mocking the AWS Batch service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.
|
||||
package batchiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/service/batch"
|
||||
)
|
||||
|
||||
// BatchAPI provides an interface to enable mocking the
|
||||
// batch.Batch service client's API operation,
|
||||
// paginators, and waiters. This make unit testing your code that calls out
|
||||
// to the SDK's service client's calls easier.
|
||||
//
|
||||
// The best way to use this interface is so the SDK's service client's calls
|
||||
// can be stubbed out for unit testing your code with the SDK without needing
|
||||
// to inject custom request handlers into the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // AWS Batch.
|
||||
// func myFunc(svc batchiface.BatchAPI) bool {
|
||||
// // Make svc.CancelJob request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := batch.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockBatchClient struct {
|
||||
// batchiface.BatchAPI
|
||||
// }
|
||||
// func (m *mockBatchClient) CancelJob(input *batch.CancelJobInput) (*batch.CancelJobOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockBatchClient{}
|
||||
//
|
||||
// myfunc(mockSvc)
|
||||
//
|
||||
// // Verify myFunc's functionality
|
||||
// }
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type BatchAPI interface {
|
||||
CancelJob(*batch.CancelJobInput) (*batch.CancelJobOutput, error)
|
||||
CancelJobWithContext(aws.Context, *batch.CancelJobInput, ...request.Option) (*batch.CancelJobOutput, error)
|
||||
CancelJobRequest(*batch.CancelJobInput) (*request.Request, *batch.CancelJobOutput)
|
||||
|
||||
CreateComputeEnvironment(*batch.CreateComputeEnvironmentInput) (*batch.CreateComputeEnvironmentOutput, error)
|
||||
CreateComputeEnvironmentWithContext(aws.Context, *batch.CreateComputeEnvironmentInput, ...request.Option) (*batch.CreateComputeEnvironmentOutput, error)
|
||||
CreateComputeEnvironmentRequest(*batch.CreateComputeEnvironmentInput) (*request.Request, *batch.CreateComputeEnvironmentOutput)
|
||||
|
||||
CreateJobQueue(*batch.CreateJobQueueInput) (*batch.CreateJobQueueOutput, error)
|
||||
CreateJobQueueWithContext(aws.Context, *batch.CreateJobQueueInput, ...request.Option) (*batch.CreateJobQueueOutput, error)
|
||||
CreateJobQueueRequest(*batch.CreateJobQueueInput) (*request.Request, *batch.CreateJobQueueOutput)
|
||||
|
||||
DeleteComputeEnvironment(*batch.DeleteComputeEnvironmentInput) (*batch.DeleteComputeEnvironmentOutput, error)
|
||||
DeleteComputeEnvironmentWithContext(aws.Context, *batch.DeleteComputeEnvironmentInput, ...request.Option) (*batch.DeleteComputeEnvironmentOutput, error)
|
||||
DeleteComputeEnvironmentRequest(*batch.DeleteComputeEnvironmentInput) (*request.Request, *batch.DeleteComputeEnvironmentOutput)
|
||||
|
||||
DeleteJobQueue(*batch.DeleteJobQueueInput) (*batch.DeleteJobQueueOutput, error)
|
||||
DeleteJobQueueWithContext(aws.Context, *batch.DeleteJobQueueInput, ...request.Option) (*batch.DeleteJobQueueOutput, error)
|
||||
DeleteJobQueueRequest(*batch.DeleteJobQueueInput) (*request.Request, *batch.DeleteJobQueueOutput)
|
||||
|
||||
DeregisterJobDefinition(*batch.DeregisterJobDefinitionInput) (*batch.DeregisterJobDefinitionOutput, error)
|
||||
DeregisterJobDefinitionWithContext(aws.Context, *batch.DeregisterJobDefinitionInput, ...request.Option) (*batch.DeregisterJobDefinitionOutput, error)
|
||||
DeregisterJobDefinitionRequest(*batch.DeregisterJobDefinitionInput) (*request.Request, *batch.DeregisterJobDefinitionOutput)
|
||||
|
||||
DescribeComputeEnvironments(*batch.DescribeComputeEnvironmentsInput) (*batch.DescribeComputeEnvironmentsOutput, error)
|
||||
DescribeComputeEnvironmentsWithContext(aws.Context, *batch.DescribeComputeEnvironmentsInput, ...request.Option) (*batch.DescribeComputeEnvironmentsOutput, error)
|
||||
DescribeComputeEnvironmentsRequest(*batch.DescribeComputeEnvironmentsInput) (*request.Request, *batch.DescribeComputeEnvironmentsOutput)
|
||||
|
||||
DescribeJobDefinitions(*batch.DescribeJobDefinitionsInput) (*batch.DescribeJobDefinitionsOutput, error)
|
||||
DescribeJobDefinitionsWithContext(aws.Context, *batch.DescribeJobDefinitionsInput, ...request.Option) (*batch.DescribeJobDefinitionsOutput, error)
|
||||
DescribeJobDefinitionsRequest(*batch.DescribeJobDefinitionsInput) (*request.Request, *batch.DescribeJobDefinitionsOutput)
|
||||
|
||||
DescribeJobQueues(*batch.DescribeJobQueuesInput) (*batch.DescribeJobQueuesOutput, error)
|
||||
DescribeJobQueuesWithContext(aws.Context, *batch.DescribeJobQueuesInput, ...request.Option) (*batch.DescribeJobQueuesOutput, error)
|
||||
DescribeJobQueuesRequest(*batch.DescribeJobQueuesInput) (*request.Request, *batch.DescribeJobQueuesOutput)
|
||||
|
||||
DescribeJobs(*batch.DescribeJobsInput) (*batch.DescribeJobsOutput, error)
|
||||
DescribeJobsWithContext(aws.Context, *batch.DescribeJobsInput, ...request.Option) (*batch.DescribeJobsOutput, error)
|
||||
DescribeJobsRequest(*batch.DescribeJobsInput) (*request.Request, *batch.DescribeJobsOutput)
|
||||
|
||||
ListJobs(*batch.ListJobsInput) (*batch.ListJobsOutput, error)
|
||||
ListJobsWithContext(aws.Context, *batch.ListJobsInput, ...request.Option) (*batch.ListJobsOutput, error)
|
||||
ListJobsRequest(*batch.ListJobsInput) (*request.Request, *batch.ListJobsOutput)
|
||||
|
||||
RegisterJobDefinition(*batch.RegisterJobDefinitionInput) (*batch.RegisterJobDefinitionOutput, error)
|
||||
RegisterJobDefinitionWithContext(aws.Context, *batch.RegisterJobDefinitionInput, ...request.Option) (*batch.RegisterJobDefinitionOutput, error)
|
||||
RegisterJobDefinitionRequest(*batch.RegisterJobDefinitionInput) (*request.Request, *batch.RegisterJobDefinitionOutput)
|
||||
|
||||
SubmitJob(*batch.SubmitJobInput) (*batch.SubmitJobOutput, error)
|
||||
SubmitJobWithContext(aws.Context, *batch.SubmitJobInput, ...request.Option) (*batch.SubmitJobOutput, error)
|
||||
SubmitJobRequest(*batch.SubmitJobInput) (*request.Request, *batch.SubmitJobOutput)
|
||||
|
||||
TerminateJob(*batch.TerminateJobInput) (*batch.TerminateJobOutput, error)
|
||||
TerminateJobWithContext(aws.Context, *batch.TerminateJobInput, ...request.Option) (*batch.TerminateJobOutput, error)
|
||||
TerminateJobRequest(*batch.TerminateJobInput) (*request.Request, *batch.TerminateJobOutput)
|
||||
|
||||
UpdateComputeEnvironment(*batch.UpdateComputeEnvironmentInput) (*batch.UpdateComputeEnvironmentOutput, error)
|
||||
UpdateComputeEnvironmentWithContext(aws.Context, *batch.UpdateComputeEnvironmentInput, ...request.Option) (*batch.UpdateComputeEnvironmentOutput, error)
|
||||
UpdateComputeEnvironmentRequest(*batch.UpdateComputeEnvironmentInput) (*request.Request, *batch.UpdateComputeEnvironmentOutput)
|
||||
|
||||
UpdateJobQueue(*batch.UpdateJobQueueInput) (*batch.UpdateJobQueueOutput, error)
|
||||
UpdateJobQueueWithContext(aws.Context, *batch.UpdateJobQueueInput, ...request.Option) (*batch.UpdateJobQueueOutput, error)
|
||||
UpdateJobQueueRequest(*batch.UpdateJobQueueInput) (*request.Request, *batch.UpdateJobQueueOutput)
|
||||
}
|
||||
|
||||
var _ BatchAPI = (*batch.Batch)(nil)
|
||||
44
vendor/github.com/aws/aws-sdk-go/service/batch/doc.go
generated
vendored
Normal file
44
vendor/github.com/aws/aws-sdk-go/service/batch/doc.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package batch provides the client and types for making API
|
||||
// requests to AWS Batch.
|
||||
//
|
||||
// AWS Batch enables you to run batch computing workloads on the AWS Cloud.
|
||||
// Batch computing is a common way for developers, scientists, and engineers
|
||||
// to access large amounts of compute resources, and AWS Batch removes the undifferentiated
|
||||
// heavy lifting of configuring and managing the required infrastructure. AWS
|
||||
// Batch will be familiar to users of traditional batch computing software.
|
||||
// This service can efficiently provision resources in response to jobs submitted
|
||||
// in order to eliminate capacity constraints, reduce compute costs, and deliver
|
||||
// results quickly.
|
||||
//
|
||||
// As a fully managed service, AWS Batch enables developers, scientists, and
|
||||
// engineers to run batch computing workloads of any scale. AWS Batch automatically
|
||||
// provisions compute resources and optimizes the workload distribution based
|
||||
// on the quantity and scale of the workloads. With AWS Batch, there is no need
|
||||
// to install or manage batch computing software, which allows you to focus
|
||||
// on analyzing results and solving problems. AWS Batch reduces operational
|
||||
// complexities, saves time, and reduces costs, which makes it easy for developers,
|
||||
// scientists, and engineers to run their batch jobs in the AWS Cloud.
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10 for more information on this service.
|
||||
//
|
||||
// See batch package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/batch/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To contact AWS Batch with the SDK use the New function to create
|
||||
// a new service client. With that client you can make API requests to the service.
|
||||
// These clients are safe to use concurrently.
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws.Config documentation for more information on configuring SDK clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the AWS Batch client Batch for more
|
||||
// information on creating client for this service.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/batch/#New
|
||||
package batch
|
||||
20
vendor/github.com/aws/aws-sdk-go/service/batch/errors.go
generated
vendored
Normal file
20
vendor/github.com/aws/aws-sdk-go/service/batch/errors.go
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package batch
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeClientException for service response error code
|
||||
// "ClientException".
|
||||
//
|
||||
// These errors are usually caused by a client action, such as using an action
|
||||
// or resource on behalf of a user that doesn't have permissions to use the
|
||||
// action or resource, or specifying an identifier that is not valid.
|
||||
ErrCodeClientException = "ClientException"
|
||||
|
||||
// ErrCodeServerException for service response error code
|
||||
// "ServerException".
|
||||
//
|
||||
// These errors are usually caused by a server issue.
|
||||
ErrCodeServerException = "ServerException"
|
||||
)
|
||||
722
vendor/github.com/aws/aws-sdk-go/service/batch/examples_test.go
generated
vendored
Normal file
722
vendor/github.com/aws/aws-sdk-go/service/batch/examples_test.go
generated
vendored
Normal file
@@ -0,0 +1,722 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package batch_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/batch"
|
||||
)
|
||||
|
||||
var _ time.Duration
|
||||
var _ strings.Reader
|
||||
var _ aws.Config
|
||||
|
||||
func parseTime(layout, value string) *time.Time {
|
||||
t, err := time.Parse(layout, value)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return &t
|
||||
}
|
||||
|
||||
// To cancel a job
|
||||
//
|
||||
// This example cancels a job with the specified job ID.
|
||||
func ExampleBatch_CancelJob_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.CancelJobInput{
|
||||
JobId: aws.String("1d828f65-7a4d-42e8-996d-3b900ed59dc4"),
|
||||
Reason: aws.String("Cancelling job."),
|
||||
}
|
||||
|
||||
result, err := svc.CancelJob(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To create a managed EC2 compute environment
|
||||
//
|
||||
// This example creates a managed compute environment with specific C4 instance types
|
||||
// that are launched on demand. The compute environment is called C4OnDemand.
|
||||
func ExampleBatch_CreateComputeEnvironment_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.CreateComputeEnvironmentInput{
|
||||
ComputeEnvironmentName: aws.String("C4OnDemand"),
|
||||
ComputeResources: &batch.ComputeResource{
|
||||
DesiredvCpus: aws.Int64(48),
|
||||
Ec2KeyPair: aws.String("id_rsa"),
|
||||
InstanceRole: aws.String("ecsInstanceRole"),
|
||||
InstanceTypes: []*string{
|
||||
aws.String("c4.large"),
|
||||
aws.String("c4.xlarge"),
|
||||
aws.String("c4.2xlarge"),
|
||||
aws.String("c4.4xlarge"),
|
||||
aws.String("c4.8xlarge"),
|
||||
},
|
||||
MaxvCpus: aws.Int64(128),
|
||||
MinvCpus: aws.Int64(0),
|
||||
SecurityGroupIds: []*string{
|
||||
aws.String("sg-cf5093b2"),
|
||||
},
|
||||
Subnets: []*string{
|
||||
aws.String("subnet-220c0e0a"),
|
||||
aws.String("subnet-1a95556d"),
|
||||
aws.String("subnet-978f6dce"),
|
||||
},
|
||||
Tags: map[string]*string{
|
||||
"Name": aws.String("Batch Instance - C4OnDemand"),
|
||||
},
|
||||
Type: aws.String("EC2"),
|
||||
},
|
||||
ServiceRole: aws.String("arn:aws:iam::012345678910:role/AWSBatchServiceRole"),
|
||||
State: aws.String("ENABLED"),
|
||||
Type: aws.String("MANAGED"),
|
||||
}
|
||||
|
||||
result, err := svc.CreateComputeEnvironment(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To create a managed EC2 Spot compute environment
|
||||
//
|
||||
// This example creates a managed compute environment with the M4 instance type that
|
||||
// is launched when the Spot bid price is at or below 20% of the On-Demand price for
|
||||
// the instance type. The compute environment is called M4Spot.
|
||||
func ExampleBatch_CreateComputeEnvironment_shared01() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.CreateComputeEnvironmentInput{
|
||||
ComputeEnvironmentName: aws.String("M4Spot"),
|
||||
ComputeResources: &batch.ComputeResource{
|
||||
BidPercentage: aws.Int64(20),
|
||||
DesiredvCpus: aws.Int64(4),
|
||||
Ec2KeyPair: aws.String("id_rsa"),
|
||||
InstanceRole: aws.String("ecsInstanceRole"),
|
||||
InstanceTypes: []*string{
|
||||
aws.String("m4"),
|
||||
},
|
||||
MaxvCpus: aws.Int64(128),
|
||||
MinvCpus: aws.Int64(0),
|
||||
SecurityGroupIds: []*string{
|
||||
aws.String("sg-cf5093b2"),
|
||||
},
|
||||
SpotIamFleetRole: aws.String("arn:aws:iam::012345678910:role/aws-ec2-spot-fleet-role"),
|
||||
Subnets: []*string{
|
||||
aws.String("subnet-220c0e0a"),
|
||||
aws.String("subnet-1a95556d"),
|
||||
aws.String("subnet-978f6dce"),
|
||||
},
|
||||
Tags: map[string]*string{
|
||||
"Name": aws.String("Batch Instance - M4Spot"),
|
||||
},
|
||||
Type: aws.String("SPOT"),
|
||||
},
|
||||
ServiceRole: aws.String("arn:aws:iam::012345678910:role/AWSBatchServiceRole"),
|
||||
State: aws.String("ENABLED"),
|
||||
Type: aws.String("MANAGED"),
|
||||
}
|
||||
|
||||
result, err := svc.CreateComputeEnvironment(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To create a job queue with a single compute environment
|
||||
//
|
||||
// This example creates a job queue called LowPriority that uses the M4Spot compute
|
||||
// environment.
|
||||
func ExampleBatch_CreateJobQueue_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.CreateJobQueueInput{
|
||||
ComputeEnvironmentOrder: []*batch.ComputeEnvironmentOrder{
|
||||
{
|
||||
ComputeEnvironment: aws.String("M4Spot"),
|
||||
Order: aws.Int64(1),
|
||||
},
|
||||
},
|
||||
JobQueueName: aws.String("LowPriority"),
|
||||
Priority: aws.Int64(1),
|
||||
State: aws.String("ENABLED"),
|
||||
}
|
||||
|
||||
result, err := svc.CreateJobQueue(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To create a job queue with multiple compute environments
|
||||
//
|
||||
// This example creates a job queue called HighPriority that uses the C4OnDemand compute
|
||||
// environment with an order of 1 and the M4Spot compute environment with an order of
|
||||
// 2.
|
||||
func ExampleBatch_CreateJobQueue_shared01() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.CreateJobQueueInput{
|
||||
ComputeEnvironmentOrder: []*batch.ComputeEnvironmentOrder{
|
||||
{
|
||||
ComputeEnvironment: aws.String("C4OnDemand"),
|
||||
Order: aws.Int64(1),
|
||||
},
|
||||
{
|
||||
ComputeEnvironment: aws.String("M4Spot"),
|
||||
Order: aws.Int64(2),
|
||||
},
|
||||
},
|
||||
JobQueueName: aws.String("HighPriority"),
|
||||
Priority: aws.Int64(10),
|
||||
State: aws.String("ENABLED"),
|
||||
}
|
||||
|
||||
result, err := svc.CreateJobQueue(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To delete a compute environment
|
||||
//
|
||||
// This example deletes the P2OnDemand compute environment.
|
||||
func ExampleBatch_DeleteComputeEnvironment_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.DeleteComputeEnvironmentInput{
|
||||
ComputeEnvironment: aws.String("P2OnDemand"),
|
||||
}
|
||||
|
||||
result, err := svc.DeleteComputeEnvironment(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To delete a job queue
|
||||
//
|
||||
// This example deletes the GPGPU job queue.
|
||||
func ExampleBatch_DeleteJobQueue_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.DeleteJobQueueInput{
|
||||
JobQueue: aws.String("GPGPU"),
|
||||
}
|
||||
|
||||
result, err := svc.DeleteJobQueue(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To deregister a job definition
|
||||
//
|
||||
// This example deregisters a job definition called sleep10.
|
||||
func ExampleBatch_DeregisterJobDefinition_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.DeregisterJobDefinitionInput{
|
||||
JobDefinition: aws.String("sleep10"),
|
||||
}
|
||||
|
||||
result, err := svc.DeregisterJobDefinition(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To describe a compute environment
|
||||
//
|
||||
// This example describes the P2OnDemand compute environment.
|
||||
func ExampleBatch_DescribeComputeEnvironments_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.DescribeComputeEnvironmentsInput{
|
||||
ComputeEnvironments: []*string{
|
||||
aws.String("P2OnDemand"),
|
||||
},
|
||||
}
|
||||
|
||||
result, err := svc.DescribeComputeEnvironments(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To describe active job definitions
|
||||
//
|
||||
// This example describes all of your active job definitions.
|
||||
func ExampleBatch_DescribeJobDefinitions_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.DescribeJobDefinitionsInput{
|
||||
Status: aws.String("ACTIVE"),
|
||||
}
|
||||
|
||||
result, err := svc.DescribeJobDefinitions(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To describe a job queue
|
||||
//
|
||||
// This example describes the HighPriority job queue.
|
||||
func ExampleBatch_DescribeJobQueues_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.DescribeJobQueuesInput{
|
||||
JobQueues: []*string{
|
||||
aws.String("HighPriority"),
|
||||
},
|
||||
}
|
||||
|
||||
result, err := svc.DescribeJobQueues(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To describe a specific job
|
||||
//
|
||||
// This example describes a job with the specified job ID.
|
||||
func ExampleBatch_DescribeJobs_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.DescribeJobsInput{
|
||||
Jobs: []*string{
|
||||
aws.String("24fa2d7a-64c4-49d2-8b47-f8da4fbde8e9"),
|
||||
},
|
||||
}
|
||||
|
||||
result, err := svc.DescribeJobs(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To list running jobs
|
||||
//
|
||||
// This example lists the running jobs in the HighPriority job queue.
|
||||
func ExampleBatch_ListJobs_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.ListJobsInput{
|
||||
JobQueue: aws.String("HighPriority"),
|
||||
}
|
||||
|
||||
result, err := svc.ListJobs(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To list submitted jobs
|
||||
//
|
||||
// This example lists jobs in the HighPriority job queue that are in the SUBMITTED job
|
||||
// status.
|
||||
func ExampleBatch_ListJobs_shared01() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.ListJobsInput{
|
||||
JobQueue: aws.String("HighPriority"),
|
||||
JobStatus: aws.String("SUBMITTED"),
|
||||
}
|
||||
|
||||
result, err := svc.ListJobs(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To register a job definition
|
||||
//
|
||||
// This example registers a job definition for a simple container job.
|
||||
func ExampleBatch_RegisterJobDefinition_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.RegisterJobDefinitionInput{
|
||||
ContainerProperties: &batch.ContainerProperties{
|
||||
Command: []*string{
|
||||
aws.String("sleep"),
|
||||
aws.String("10"),
|
||||
},
|
||||
Image: aws.String("busybox"),
|
||||
Memory: aws.Int64(128),
|
||||
Vcpus: aws.Int64(1),
|
||||
},
|
||||
JobDefinitionName: aws.String("sleep10"),
|
||||
Type: aws.String("container"),
|
||||
}
|
||||
|
||||
result, err := svc.RegisterJobDefinition(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To submit a job to a queue
|
||||
//
|
||||
// This example submits a simple container job called example to the HighPriority job
|
||||
// queue.
|
||||
func ExampleBatch_SubmitJob_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.SubmitJobInput{
|
||||
JobDefinition: aws.String("sleep60"),
|
||||
JobName: aws.String("example"),
|
||||
JobQueue: aws.String("HighPriority"),
|
||||
}
|
||||
|
||||
result, err := svc.SubmitJob(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To terminate a job
|
||||
//
|
||||
// This example terminates a job with the specified job ID.
|
||||
func ExampleBatch_TerminateJob_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.TerminateJobInput{
|
||||
JobId: aws.String("61e743ed-35e4-48da-b2de-5c8333821c84"),
|
||||
Reason: aws.String("Terminating job."),
|
||||
}
|
||||
|
||||
result, err := svc.TerminateJob(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To update a compute environment
|
||||
//
|
||||
// This example disables the P2OnDemand compute environment so it can be deleted.
|
||||
func ExampleBatch_UpdateComputeEnvironment_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.UpdateComputeEnvironmentInput{
|
||||
ComputeEnvironment: aws.String("P2OnDemand"),
|
||||
State: aws.String("DISABLED"),
|
||||
}
|
||||
|
||||
result, err := svc.UpdateComputeEnvironment(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To update a job queue
|
||||
//
|
||||
// This example disables a job queue so that it can be deleted.
|
||||
func ExampleBatch_UpdateJobQueue_shared00() {
|
||||
svc := batch.New(session.New())
|
||||
input := &batch.UpdateJobQueueInput{
|
||||
JobQueue: aws.String("GPGPU"),
|
||||
State: aws.String("DISABLED"),
|
||||
}
|
||||
|
||||
result, err := svc.UpdateJobQueue(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case batch.ErrCodeClientException:
|
||||
fmt.Println(batch.ErrCodeClientException, aerr.Error())
|
||||
case batch.ErrCodeServerException:
|
||||
fmt.Println(batch.ErrCodeServerException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
94
vendor/github.com/aws/aws-sdk-go/service/batch/service.go
generated
vendored
Normal file
94
vendor/github.com/aws/aws-sdk-go/service/batch/service.go
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package batch
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/client"
|
||||
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restjson"
|
||||
)
|
||||
|
||||
// Batch provides the API operation methods for making requests to
|
||||
// AWS Batch. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// Batch methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type Batch struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "batch" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
)
|
||||
|
||||
// New creates a new instance of the Batch client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a Batch client from just a session.
|
||||
// svc := batch.New(mySession)
|
||||
//
|
||||
// // Create a Batch client with additional configuration
|
||||
// svc := batch.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Batch {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Batch {
|
||||
svc := &Batch{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2016-08-10",
|
||||
JSONVersion: "1.1",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a Batch operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *Batch) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
Reference in New Issue
Block a user