github.com/aavshr/aws-sdk-go@v1.41.3/service/snowball/examples_test.go (about)

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package snowball_test
     4  
     5  import (
     6  	"fmt"
     7  	"strings"
     8  	"time"
     9  
    10  	"github.com/aavshr/aws-sdk-go/aws"
    11  	"github.com/aavshr/aws-sdk-go/aws/awserr"
    12  	"github.com/aavshr/aws-sdk-go/aws/session"
    13  	"github.com/aavshr/aws-sdk-go/service/snowball"
    14  )
    15  
    16  var _ time.Duration
    17  var _ strings.Reader
    18  var _ aws.Config
    19  
    20  func parseTime(layout, value string) *time.Time {
    21  	t, err := time.Parse(layout, value)
    22  	if err != nil {
    23  		panic(err)
    24  	}
    25  	return &t
    26  }
    27  
    28  // To cancel a cluster job
    29  //
    30  // This operation cancels a cluster job. You can only cancel a cluster job while it's
    31  // in the AwaitingQuorum status.
    32  func ExampleSnowball_CancelCluster_shared00() {
    33  	svc := snowball.New(session.New())
    34  	input := &snowball.CancelClusterInput{
    35  		ClusterId: aws.String("CID123e4567-e89b-12d3-a456-426655440000"),
    36  	}
    37  
    38  	result, err := svc.CancelCluster(input)
    39  	if err != nil {
    40  		if aerr, ok := err.(awserr.Error); ok {
    41  			switch aerr.Code() {
    42  			case snowball.ErrCodeKMSRequestFailedException:
    43  				fmt.Println(snowball.ErrCodeKMSRequestFailedException, aerr.Error())
    44  			case snowball.ErrCodeInvalidJobStateException:
    45  				fmt.Println(snowball.ErrCodeInvalidJobStateException, aerr.Error())
    46  			case snowball.ErrCodeInvalidResourceException:
    47  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
    48  			default:
    49  				fmt.Println(aerr.Error())
    50  			}
    51  		} else {
    52  			// Print the error, cast err to awserr.Error to get the Code and
    53  			// Message from an error.
    54  			fmt.Println(err.Error())
    55  		}
    56  		return
    57  	}
    58  
    59  	fmt.Println(result)
    60  }
    61  
    62  // To cancel a job for a Snowball device
    63  //
    64  // This operation cancels a job. You can only cancel a job before its JobState value
    65  // changes to PreparingAppliance.
    66  func ExampleSnowball_CancelJob_shared00() {
    67  	svc := snowball.New(session.New())
    68  	input := &snowball.CancelJobInput{
    69  		JobId: aws.String("JID123e4567-e89b-12d3-a456-426655440000"),
    70  	}
    71  
    72  	result, err := svc.CancelJob(input)
    73  	if err != nil {
    74  		if aerr, ok := err.(awserr.Error); ok {
    75  			switch aerr.Code() {
    76  			case snowball.ErrCodeInvalidResourceException:
    77  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
    78  			case snowball.ErrCodeInvalidJobStateException:
    79  				fmt.Println(snowball.ErrCodeInvalidJobStateException, aerr.Error())
    80  			case snowball.ErrCodeKMSRequestFailedException:
    81  				fmt.Println(snowball.ErrCodeKMSRequestFailedException, aerr.Error())
    82  			default:
    83  				fmt.Println(aerr.Error())
    84  			}
    85  		} else {
    86  			// Print the error, cast err to awserr.Error to get the Code and
    87  			// Message from an error.
    88  			fmt.Println(err.Error())
    89  		}
    90  		return
    91  	}
    92  
    93  	fmt.Println(result)
    94  }
    95  
    96  // To create an address for a job
    97  //
    98  // This operation creates an address for a job. Addresses are validated at the time
    99  // of creation. The address you provide must be located within the serviceable area
   100  // of your region. If the address is invalid or unsupported, then an exception is thrown.
   101  func ExampleSnowball_CreateAddress_shared00() {
   102  	svc := snowball.New(session.New())
   103  	input := &snowball.CreateAddressInput{
   104  		Address: &snowball.Address{
   105  			City:            aws.String("Seattle"),
   106  			Company:         aws.String("My Company's Name"),
   107  			Country:         aws.String("USA"),
   108  			Name:            aws.String("My Name"),
   109  			PhoneNumber:     aws.String("425-555-5555"),
   110  			PostalCode:      aws.String("98101"),
   111  			StateOrProvince: aws.String("WA"),
   112  			Street1:         aws.String("123 Main Street"),
   113  		},
   114  	}
   115  
   116  	result, err := svc.CreateAddress(input)
   117  	if err != nil {
   118  		if aerr, ok := err.(awserr.Error); ok {
   119  			switch aerr.Code() {
   120  			case snowball.ErrCodeInvalidAddressException:
   121  				fmt.Println(snowball.ErrCodeInvalidAddressException, aerr.Error())
   122  			case snowball.ErrCodeUnsupportedAddressException:
   123  				fmt.Println(snowball.ErrCodeUnsupportedAddressException, aerr.Error())
   124  			default:
   125  				fmt.Println(aerr.Error())
   126  			}
   127  		} else {
   128  			// Print the error, cast err to awserr.Error to get the Code and
   129  			// Message from an error.
   130  			fmt.Println(err.Error())
   131  		}
   132  		return
   133  	}
   134  
   135  	fmt.Println(result)
   136  }
   137  
   138  // To create a cluster
   139  //
   140  // Creates an empty cluster. Each cluster supports five nodes. You use the CreateJob
   141  // action separately to create the jobs for each of these nodes. The cluster does not
   142  // ship until these five node jobs have been created.
   143  func ExampleSnowball_CreateCluster_shared00() {
   144  	svc := snowball.New(session.New())
   145  	input := &snowball.CreateClusterInput{
   146  		AddressId:   aws.String("ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b"),
   147  		Description: aws.String("MyCluster"),
   148  		JobType:     aws.String("LOCAL_USE"),
   149  		KmsKeyARN:   aws.String("arn:aws:kms:us-east-1:123456789012:key/abcd1234-12ab-34cd-56ef-123456123456"),
   150  		Notification: &snowball.Notification{
   151  			NotifyAll: aws.Bool(false),
   152  		},
   153  		Resources: &snowball.JobResource{
   154  			S3Resources: []*snowball.S3Resource{
   155  				{
   156  					BucketArn: aws.String("arn:aws:s3:::MyBucket"),
   157  					KeyRange:  &snowball.KeyRange{},
   158  				},
   159  			},
   160  		},
   161  		RoleARN:        aws.String("arn:aws:iam::123456789012:role/snowball-import-S3-role"),
   162  		ShippingOption: aws.String("SECOND_DAY"),
   163  		SnowballType:   aws.String("EDGE"),
   164  	}
   165  
   166  	result, err := svc.CreateCluster(input)
   167  	if err != nil {
   168  		if aerr, ok := err.(awserr.Error); ok {
   169  			switch aerr.Code() {
   170  			case snowball.ErrCodeInvalidResourceException:
   171  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   172  			case snowball.ErrCodeKMSRequestFailedException:
   173  				fmt.Println(snowball.ErrCodeKMSRequestFailedException, aerr.Error())
   174  			case snowball.ErrCodeInvalidInputCombinationException:
   175  				fmt.Println(snowball.ErrCodeInvalidInputCombinationException, aerr.Error())
   176  			case snowball.ErrCodeEc2RequestFailedException:
   177  				fmt.Println(snowball.ErrCodeEc2RequestFailedException, aerr.Error())
   178  			default:
   179  				fmt.Println(aerr.Error())
   180  			}
   181  		} else {
   182  			// Print the error, cast err to awserr.Error to get the Code and
   183  			// Message from an error.
   184  			fmt.Println(err.Error())
   185  		}
   186  		return
   187  	}
   188  
   189  	fmt.Println(result)
   190  }
   191  
   192  // To create a job
   193  //
   194  // Creates a job to import or export data between Amazon S3 and your on-premises data
   195  // center. Your AWS account must have the right trust policies and permissions in place
   196  // to create a job for Snowball. If you're creating a job for a node in a cluster, you
   197  // only need to provide the clusterId value; the other job attributes are inherited
   198  // from the cluster.
   199  func ExampleSnowball_CreateJob_shared00() {
   200  	svc := snowball.New(session.New())
   201  	input := &snowball.CreateJobInput{
   202  		AddressId:   aws.String("ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b"),
   203  		Description: aws.String("My Job"),
   204  		JobType:     aws.String("IMPORT"),
   205  		KmsKeyARN:   aws.String("arn:aws:kms:us-east-1:123456789012:key/abcd1234-12ab-34cd-56ef-123456123456"),
   206  		Notification: &snowball.Notification{
   207  			NotifyAll: aws.Bool(false),
   208  		},
   209  		Resources: &snowball.JobResource{
   210  			S3Resources: []*snowball.S3Resource{
   211  				{
   212  					BucketArn: aws.String("arn:aws:s3:::MyBucket"),
   213  					KeyRange:  &snowball.KeyRange{},
   214  				},
   215  			},
   216  		},
   217  		RoleARN:                    aws.String("arn:aws:iam::123456789012:role/snowball-import-S3-role"),
   218  		ShippingOption:             aws.String("SECOND_DAY"),
   219  		SnowballCapacityPreference: aws.String("T80"),
   220  		SnowballType:               aws.String("STANDARD"),
   221  	}
   222  
   223  	result, err := svc.CreateJob(input)
   224  	if err != nil {
   225  		if aerr, ok := err.(awserr.Error); ok {
   226  			switch aerr.Code() {
   227  			case snowball.ErrCodeInvalidResourceException:
   228  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   229  			case snowball.ErrCodeKMSRequestFailedException:
   230  				fmt.Println(snowball.ErrCodeKMSRequestFailedException, aerr.Error())
   231  			case snowball.ErrCodeInvalidInputCombinationException:
   232  				fmt.Println(snowball.ErrCodeInvalidInputCombinationException, aerr.Error())
   233  			case snowball.ErrCodeClusterLimitExceededException:
   234  				fmt.Println(snowball.ErrCodeClusterLimitExceededException, aerr.Error())
   235  			case snowball.ErrCodeEc2RequestFailedException:
   236  				fmt.Println(snowball.ErrCodeEc2RequestFailedException, aerr.Error())
   237  			default:
   238  				fmt.Println(aerr.Error())
   239  			}
   240  		} else {
   241  			// Print the error, cast err to awserr.Error to get the Code and
   242  			// Message from an error.
   243  			fmt.Println(err.Error())
   244  		}
   245  		return
   246  	}
   247  
   248  	fmt.Println(result)
   249  }
   250  
   251  // To describe an address for a job
   252  //
   253  // This operation describes an address for a job.
   254  func ExampleSnowball_DescribeAddress_shared00() {
   255  	svc := snowball.New(session.New())
   256  	input := &snowball.DescribeAddressInput{
   257  		AddressId: aws.String("ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b"),
   258  	}
   259  
   260  	result, err := svc.DescribeAddress(input)
   261  	if err != nil {
   262  		if aerr, ok := err.(awserr.Error); ok {
   263  			switch aerr.Code() {
   264  			case snowball.ErrCodeInvalidResourceException:
   265  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   266  			default:
   267  				fmt.Println(aerr.Error())
   268  			}
   269  		} else {
   270  			// Print the error, cast err to awserr.Error to get the Code and
   271  			// Message from an error.
   272  			fmt.Println(err.Error())
   273  		}
   274  		return
   275  	}
   276  
   277  	fmt.Println(result)
   278  }
   279  
   280  // To describe all the addresses you've created for AWS Snowball
   281  //
   282  // This operation describes all the addresses that you've created for AWS Snowball.
   283  // Calling this API in one of the US regions will return addresses from the list of
   284  // all addresses associated with this account in all US regions.
   285  func ExampleSnowball_DescribeAddresses_shared00() {
   286  	svc := snowball.New(session.New())
   287  	input := &snowball.DescribeAddressesInput{}
   288  
   289  	result, err := svc.DescribeAddresses(input)
   290  	if err != nil {
   291  		if aerr, ok := err.(awserr.Error); ok {
   292  			switch aerr.Code() {
   293  			case snowball.ErrCodeInvalidResourceException:
   294  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   295  			case snowball.ErrCodeInvalidNextTokenException:
   296  				fmt.Println(snowball.ErrCodeInvalidNextTokenException, aerr.Error())
   297  			default:
   298  				fmt.Println(aerr.Error())
   299  			}
   300  		} else {
   301  			// Print the error, cast err to awserr.Error to get the Code and
   302  			// Message from an error.
   303  			fmt.Println(err.Error())
   304  		}
   305  		return
   306  	}
   307  
   308  	fmt.Println(result)
   309  }
   310  
   311  // To describe a cluster
   312  //
   313  // Returns information about a specific cluster including shipping information, cluster
   314  // status, and other important metadata.
   315  func ExampleSnowball_DescribeCluster_shared00() {
   316  	svc := snowball.New(session.New())
   317  	input := &snowball.DescribeClusterInput{
   318  		ClusterId: aws.String("CID123e4567-e89b-12d3-a456-426655440000"),
   319  	}
   320  
   321  	result, err := svc.DescribeCluster(input)
   322  	if err != nil {
   323  		if aerr, ok := err.(awserr.Error); ok {
   324  			switch aerr.Code() {
   325  			case snowball.ErrCodeInvalidResourceException:
   326  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   327  			default:
   328  				fmt.Println(aerr.Error())
   329  			}
   330  		} else {
   331  			// Print the error, cast err to awserr.Error to get the Code and
   332  			// Message from an error.
   333  			fmt.Println(err.Error())
   334  		}
   335  		return
   336  	}
   337  
   338  	fmt.Println(result)
   339  }
   340  
   341  // To describe a job you've created for AWS Snowball
   342  //
   343  // This operation describes a job you've created for AWS Snowball.
   344  func ExampleSnowball_DescribeJob_shared00() {
   345  	svc := snowball.New(session.New())
   346  	input := &snowball.DescribeJobInput{
   347  		JobId: aws.String("JID123e4567-e89b-12d3-a456-426655440000"),
   348  	}
   349  
   350  	result, err := svc.DescribeJob(input)
   351  	if err != nil {
   352  		if aerr, ok := err.(awserr.Error); ok {
   353  			switch aerr.Code() {
   354  			case snowball.ErrCodeInvalidResourceException:
   355  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   356  			default:
   357  				fmt.Println(aerr.Error())
   358  			}
   359  		} else {
   360  			// Print the error, cast err to awserr.Error to get the Code and
   361  			// Message from an error.
   362  			fmt.Println(err.Error())
   363  		}
   364  		return
   365  	}
   366  
   367  	fmt.Println(result)
   368  }
   369  
   370  // To get the manifest for a job you've created for AWS Snowball
   371  //
   372  // Returns a link to an Amazon S3 presigned URL for the manifest file associated with
   373  // the specified JobId value. You can access the manifest file for up to 60 minutes
   374  // after this request has been made. To access the manifest file after 60 minutes have
   375  // passed, you'll have to make another call to the GetJobManifest action.
   376  //
   377  // The manifest is an encrypted file that you can download after your job enters the
   378  // WithCustomer status. The manifest is decrypted by using the UnlockCode code value,
   379  // when you pass both values to the Snowball through the Snowball client when the client
   380  // is started for the first time.
   381  //
   382  // As a best practice, we recommend that you don't save a copy of an UnlockCode value
   383  // in the same location as the manifest file for that job. Saving these separately helps
   384  // prevent unauthorized parties from gaining access to the Snowball associated with
   385  // that job.
   386  //
   387  // The credentials of a given job, including its manifest file and unlock code, expire
   388  // 90 days after the job is created.
   389  func ExampleSnowball_GetJobManifest_shared00() {
   390  	svc := snowball.New(session.New())
   391  	input := &snowball.GetJobManifestInput{
   392  		JobId: aws.String("JID123e4567-e89b-12d3-a456-426655440000"),
   393  	}
   394  
   395  	result, err := svc.GetJobManifest(input)
   396  	if err != nil {
   397  		if aerr, ok := err.(awserr.Error); ok {
   398  			switch aerr.Code() {
   399  			case snowball.ErrCodeInvalidResourceException:
   400  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   401  			case snowball.ErrCodeInvalidJobStateException:
   402  				fmt.Println(snowball.ErrCodeInvalidJobStateException, aerr.Error())
   403  			default:
   404  				fmt.Println(aerr.Error())
   405  			}
   406  		} else {
   407  			// Print the error, cast err to awserr.Error to get the Code and
   408  			// Message from an error.
   409  			fmt.Println(err.Error())
   410  		}
   411  		return
   412  	}
   413  
   414  	fmt.Println(result)
   415  }
   416  
   417  // To get the unlock code for a job you've created for AWS Snowball
   418  //
   419  // Returns the UnlockCode code value for the specified job. A particular UnlockCode
   420  // value can be accessed for up to 90 days after the associated job has been created.
   421  //
   422  // The UnlockCode value is a 29-character code with 25 alphanumeric characters and 4
   423  // hyphens. This code is used to decrypt the manifest file when it is passed along with
   424  // the manifest to the Snowball through the Snowball client when the client is started
   425  // for the first time.
   426  //
   427  // As a best practice, we recommend that you don't save a copy of the UnlockCode in
   428  // the same location as the manifest file for that job. Saving these separately helps
   429  // prevent unauthorized parties from gaining access to the Snowball associated with
   430  // that job.
   431  func ExampleSnowball_GetJobUnlockCode_shared00() {
   432  	svc := snowball.New(session.New())
   433  	input := &snowball.GetJobUnlockCodeInput{
   434  		JobId: aws.String("JID123e4567-e89b-12d3-a456-426655440000"),
   435  	}
   436  
   437  	result, err := svc.GetJobUnlockCode(input)
   438  	if err != nil {
   439  		if aerr, ok := err.(awserr.Error); ok {
   440  			switch aerr.Code() {
   441  			case snowball.ErrCodeInvalidResourceException:
   442  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   443  			case snowball.ErrCodeInvalidJobStateException:
   444  				fmt.Println(snowball.ErrCodeInvalidJobStateException, aerr.Error())
   445  			default:
   446  				fmt.Println(aerr.Error())
   447  			}
   448  		} else {
   449  			// Print the error, cast err to awserr.Error to get the Code and
   450  			// Message from an error.
   451  			fmt.Println(err.Error())
   452  		}
   453  		return
   454  	}
   455  
   456  	fmt.Println(result)
   457  }
   458  
   459  // To see your Snowball service limit and the number of Snowballs you have in use
   460  //
   461  // Returns information about the Snowball service limit for your account, and also the
   462  // number of Snowballs your account has in use.
   463  //
   464  // The default service limit for the number of Snowballs that you can have at one time
   465  // is 1. If you want to increase your service limit, contact AWS Support.
   466  func ExampleSnowball_GetSnowballUsage_shared00() {
   467  	svc := snowball.New(session.New())
   468  	input := &snowball.GetSnowballUsageInput{}
   469  
   470  	result, err := svc.GetSnowballUsage(input)
   471  	if err != nil {
   472  		if aerr, ok := err.(awserr.Error); ok {
   473  			switch aerr.Code() {
   474  			default:
   475  				fmt.Println(aerr.Error())
   476  			}
   477  		} else {
   478  			// Print the error, cast err to awserr.Error to get the Code and
   479  			// Message from an error.
   480  			fmt.Println(err.Error())
   481  		}
   482  		return
   483  	}
   484  
   485  	fmt.Println(result)
   486  }
   487  
   488  // To get a list of jobs in a cluster that you've created for AWS Snowball
   489  //
   490  // Returns an array of JobListEntry objects of the specified length. Each JobListEntry
   491  // object is for a job in the specified cluster and contains a job's state, a job's
   492  // ID, and other information.
   493  func ExampleSnowball_ListClusterJobs_shared00() {
   494  	svc := snowball.New(session.New())
   495  	input := &snowball.ListClusterJobsInput{
   496  		ClusterId: aws.String("CID123e4567-e89b-12d3-a456-426655440000"),
   497  	}
   498  
   499  	result, err := svc.ListClusterJobs(input)
   500  	if err != nil {
   501  		if aerr, ok := err.(awserr.Error); ok {
   502  			switch aerr.Code() {
   503  			case snowball.ErrCodeInvalidResourceException:
   504  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   505  			case snowball.ErrCodeInvalidNextTokenException:
   506  				fmt.Println(snowball.ErrCodeInvalidNextTokenException, aerr.Error())
   507  			default:
   508  				fmt.Println(aerr.Error())
   509  			}
   510  		} else {
   511  			// Print the error, cast err to awserr.Error to get the Code and
   512  			// Message from an error.
   513  			fmt.Println(err.Error())
   514  		}
   515  		return
   516  	}
   517  
   518  	fmt.Println(result)
   519  }
   520  
   521  // To get a list of clusters that you've created for AWS Snowball
   522  //
   523  // Returns an array of ClusterListEntry objects of the specified length. Each ClusterListEntry
   524  // object contains a cluster's state, a cluster's ID, and other important status information.
   525  func ExampleSnowball_ListClusters_shared00() {
   526  	svc := snowball.New(session.New())
   527  	input := &snowball.ListClustersInput{}
   528  
   529  	result, err := svc.ListClusters(input)
   530  	if err != nil {
   531  		if aerr, ok := err.(awserr.Error); ok {
   532  			switch aerr.Code() {
   533  			case snowball.ErrCodeInvalidNextTokenException:
   534  				fmt.Println(snowball.ErrCodeInvalidNextTokenException, aerr.Error())
   535  			default:
   536  				fmt.Println(aerr.Error())
   537  			}
   538  		} else {
   539  			// Print the error, cast err to awserr.Error to get the Code and
   540  			// Message from an error.
   541  			fmt.Println(err.Error())
   542  		}
   543  		return
   544  	}
   545  
   546  	fmt.Println(result)
   547  }
   548  
   549  // To get a list of jobs that you've created for AWS Snowball
   550  //
   551  // Returns an array of JobListEntry objects of the specified length. Each JobListEntry
   552  // object contains a job's state, a job's ID, and a value that indicates whether the
   553  // job is a job part, in the case of export jobs. Calling this API action in one of
   554  // the US regions will return jobs from the list of all jobs associated with this account
   555  // in all US regions.
   556  func ExampleSnowball_ListJobs_shared00() {
   557  	svc := snowball.New(session.New())
   558  	input := &snowball.ListJobsInput{}
   559  
   560  	result, err := svc.ListJobs(input)
   561  	if err != nil {
   562  		if aerr, ok := err.(awserr.Error); ok {
   563  			switch aerr.Code() {
   564  			case snowball.ErrCodeInvalidNextTokenException:
   565  				fmt.Println(snowball.ErrCodeInvalidNextTokenException, aerr.Error())
   566  			default:
   567  				fmt.Println(aerr.Error())
   568  			}
   569  		} else {
   570  			// Print the error, cast err to awserr.Error to get the Code and
   571  			// Message from an error.
   572  			fmt.Println(err.Error())
   573  		}
   574  		return
   575  	}
   576  
   577  	fmt.Println(result)
   578  }
   579  
   580  // To update a cluster
   581  //
   582  // This action allows you to update certain parameters for a cluster. Once the cluster
   583  // changes to a different state, usually within 60 minutes of it being created, this
   584  // action is no longer available.
   585  func ExampleSnowball_UpdateCluster_shared00() {
   586  	svc := snowball.New(session.New())
   587  	input := &snowball.UpdateClusterInput{
   588  		AddressId:   aws.String("ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b"),
   589  		ClusterId:   aws.String("CID123e4567-e89b-12d3-a456-426655440000"),
   590  		Description: aws.String("Updated the address to send this to image processing - RJ"),
   591  	}
   592  
   593  	result, err := svc.UpdateCluster(input)
   594  	if err != nil {
   595  		if aerr, ok := err.(awserr.Error); ok {
   596  			switch aerr.Code() {
   597  			case snowball.ErrCodeInvalidResourceException:
   598  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   599  			case snowball.ErrCodeInvalidJobStateException:
   600  				fmt.Println(snowball.ErrCodeInvalidJobStateException, aerr.Error())
   601  			case snowball.ErrCodeKMSRequestFailedException:
   602  				fmt.Println(snowball.ErrCodeKMSRequestFailedException, aerr.Error())
   603  			case snowball.ErrCodeInvalidInputCombinationException:
   604  				fmt.Println(snowball.ErrCodeInvalidInputCombinationException, aerr.Error())
   605  			case snowball.ErrCodeEc2RequestFailedException:
   606  				fmt.Println(snowball.ErrCodeEc2RequestFailedException, aerr.Error())
   607  			default:
   608  				fmt.Println(aerr.Error())
   609  			}
   610  		} else {
   611  			// Print the error, cast err to awserr.Error to get the Code and
   612  			// Message from an error.
   613  			fmt.Println(err.Error())
   614  		}
   615  		return
   616  	}
   617  
   618  	fmt.Println(result)
   619  }
   620  
   621  // To update a job
   622  //
   623  // This action allows you to update certain parameters for a job. Once the job changes
   624  // to a different job state, usually within 60 minutes of the job being created, this
   625  // action is no longer available.
   626  func ExampleSnowball_UpdateJob_shared00() {
   627  	svc := snowball.New(session.New())
   628  	input := &snowball.UpdateJobInput{
   629  		AddressId:                  aws.String("ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b"),
   630  		Description:                aws.String("Upgraded to Edge, shipped to Finance Dept, and requested faster shipping speed - TS."),
   631  		JobId:                      aws.String("JID123e4567-e89b-12d3-a456-426655440000"),
   632  		ShippingOption:             aws.String("NEXT_DAY"),
   633  		SnowballCapacityPreference: aws.String("T100"),
   634  	}
   635  
   636  	result, err := svc.UpdateJob(input)
   637  	if err != nil {
   638  		if aerr, ok := err.(awserr.Error); ok {
   639  			switch aerr.Code() {
   640  			case snowball.ErrCodeInvalidResourceException:
   641  				fmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())
   642  			case snowball.ErrCodeInvalidJobStateException:
   643  				fmt.Println(snowball.ErrCodeInvalidJobStateException, aerr.Error())
   644  			case snowball.ErrCodeKMSRequestFailedException:
   645  				fmt.Println(snowball.ErrCodeKMSRequestFailedException, aerr.Error())
   646  			case snowball.ErrCodeInvalidInputCombinationException:
   647  				fmt.Println(snowball.ErrCodeInvalidInputCombinationException, aerr.Error())
   648  			case snowball.ErrCodeClusterLimitExceededException:
   649  				fmt.Println(snowball.ErrCodeClusterLimitExceededException, aerr.Error())
   650  			case snowball.ErrCodeEc2RequestFailedException:
   651  				fmt.Println(snowball.ErrCodeEc2RequestFailedException, aerr.Error())
   652  			default:
   653  				fmt.Println(aerr.Error())
   654  			}
   655  		} else {
   656  			// Print the error, cast err to awserr.Error to get the Code and
   657  			// Message from an error.
   658  			fmt.Println(err.Error())
   659  		}
   660  		return
   661  	}
   662  
   663  	fmt.Println(result)
   664  }