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

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package storagegateway_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/storagegateway"
    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 activate the gateway
    29  //
    30  // Activates the gateway you previously deployed on your host.
    31  func ExampleStorageGateway_ActivateGateway_shared00() {
    32  	svc := storagegateway.New(session.New())
    33  	input := &storagegateway.ActivateGatewayInput{
    34  		ActivationKey:     aws.String("29AV1-3OFV9-VVIUB-NKT0I-LRO6V"),
    35  		GatewayName:       aws.String("My_Gateway"),
    36  		GatewayRegion:     aws.String("us-east-1"),
    37  		GatewayTimezone:   aws.String("GMT-12:00"),
    38  		GatewayType:       aws.String("STORED"),
    39  		MediumChangerType: aws.String("AWS-Gateway-VTL"),
    40  		TapeDriveType:     aws.String("IBM-ULT3580-TD5"),
    41  	}
    42  
    43  	result, err := svc.ActivateGateway(input)
    44  	if err != nil {
    45  		if aerr, ok := err.(awserr.Error); ok {
    46  			switch aerr.Code() {
    47  			case storagegateway.ErrCodeInvalidGatewayRequestException:
    48  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
    49  			case storagegateway.ErrCodeInternalServerError:
    50  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
    51  			default:
    52  				fmt.Println(aerr.Error())
    53  			}
    54  		} else {
    55  			// Print the error, cast err to awserr.Error to get the Code and
    56  			// Message from an error.
    57  			fmt.Println(err.Error())
    58  		}
    59  		return
    60  	}
    61  
    62  	fmt.Println(result)
    63  }
    64  
    65  // To add a cache
    66  //
    67  // The following example shows a request that activates a gateway-stored volume.
    68  func ExampleStorageGateway_AddCache_shared00() {
    69  	svc := storagegateway.New(session.New())
    70  	input := &storagegateway.AddCacheInput{
    71  		DiskIds: []*string{
    72  			aws.String("pci-0000:03:00.0-scsi-0:0:0:0"),
    73  			aws.String("pci-0000:03:00.0-scsi-0:0:1:0"),
    74  		},
    75  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
    76  	}
    77  
    78  	result, err := svc.AddCache(input)
    79  	if err != nil {
    80  		if aerr, ok := err.(awserr.Error); ok {
    81  			switch aerr.Code() {
    82  			case storagegateway.ErrCodeInvalidGatewayRequestException:
    83  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
    84  			case storagegateway.ErrCodeInternalServerError:
    85  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
    86  			default:
    87  				fmt.Println(aerr.Error())
    88  			}
    89  		} else {
    90  			// Print the error, cast err to awserr.Error to get the Code and
    91  			// Message from an error.
    92  			fmt.Println(err.Error())
    93  		}
    94  		return
    95  	}
    96  
    97  	fmt.Println(result)
    98  }
    99  
   100  // To add tags to resource
   101  //
   102  // Adds one or more tags to the specified resource.
   103  func ExampleStorageGateway_AddTagsToResource_shared00() {
   104  	svc := storagegateway.New(session.New())
   105  	input := &storagegateway.AddTagsToResourceInput{
   106  		ResourceARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B"),
   107  		Tags: []*storagegateway.Tag{
   108  			{
   109  				Key:   aws.String("Dev Gatgeway Region"),
   110  				Value: aws.String("East Coast"),
   111  			},
   112  		},
   113  	}
   114  
   115  	result, err := svc.AddTagsToResource(input)
   116  	if err != nil {
   117  		if aerr, ok := err.(awserr.Error); ok {
   118  			switch aerr.Code() {
   119  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   120  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   121  			case storagegateway.ErrCodeInternalServerError:
   122  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   123  			default:
   124  				fmt.Println(aerr.Error())
   125  			}
   126  		} else {
   127  			// Print the error, cast err to awserr.Error to get the Code and
   128  			// Message from an error.
   129  			fmt.Println(err.Error())
   130  		}
   131  		return
   132  	}
   133  
   134  	fmt.Println(result)
   135  }
   136  
   137  // To add upload buffer on local disk
   138  //
   139  // Configures one or more gateway local disks as upload buffer for a specified gateway.
   140  func ExampleStorageGateway_AddUploadBuffer_shared00() {
   141  	svc := storagegateway.New(session.New())
   142  	input := &storagegateway.AddUploadBufferInput{
   143  		DiskIds: []*string{
   144  			aws.String("pci-0000:03:00.0-scsi-0:0:0:0"),
   145  			aws.String("pci-0000:03:00.0-scsi-0:0:1:0"),
   146  		},
   147  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   148  	}
   149  
   150  	result, err := svc.AddUploadBuffer(input)
   151  	if err != nil {
   152  		if aerr, ok := err.(awserr.Error); ok {
   153  			switch aerr.Code() {
   154  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   155  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   156  			case storagegateway.ErrCodeInternalServerError:
   157  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   158  			default:
   159  				fmt.Println(aerr.Error())
   160  			}
   161  		} else {
   162  			// Print the error, cast err to awserr.Error to get the Code and
   163  			// Message from an error.
   164  			fmt.Println(err.Error())
   165  		}
   166  		return
   167  	}
   168  
   169  	fmt.Println(result)
   170  }
   171  
   172  // To add storage on local disk
   173  //
   174  // Configures one or more gateway local disks as working storage for a gateway. (Working
   175  // storage is also referred to as upload buffer.)
   176  func ExampleStorageGateway_AddWorkingStorage_shared00() {
   177  	svc := storagegateway.New(session.New())
   178  	input := &storagegateway.AddWorkingStorageInput{
   179  		DiskIds: []*string{
   180  			aws.String("pci-0000:03:00.0-scsi-0:0:0:0"),
   181  			aws.String("pci-0000:03:00.0-scsi-0:0:1:0"),
   182  		},
   183  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   184  	}
   185  
   186  	result, err := svc.AddWorkingStorage(input)
   187  	if err != nil {
   188  		if aerr, ok := err.(awserr.Error); ok {
   189  			switch aerr.Code() {
   190  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   191  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   192  			case storagegateway.ErrCodeInternalServerError:
   193  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   194  			default:
   195  				fmt.Println(aerr.Error())
   196  			}
   197  		} else {
   198  			// Print the error, cast err to awserr.Error to get the Code and
   199  			// Message from an error.
   200  			fmt.Println(err.Error())
   201  		}
   202  		return
   203  	}
   204  
   205  	fmt.Println(result)
   206  }
   207  
   208  // To cancel virtual tape archiving
   209  //
   210  // Cancels archiving of a virtual tape to the virtual tape shelf (VTS) after the archiving
   211  // process is initiated.
   212  func ExampleStorageGateway_CancelArchival_shared00() {
   213  	svc := storagegateway.New(session.New())
   214  	input := &storagegateway.CancelArchivalInput{
   215  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   216  		TapeARN:    aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4"),
   217  	}
   218  
   219  	result, err := svc.CancelArchival(input)
   220  	if err != nil {
   221  		if aerr, ok := err.(awserr.Error); ok {
   222  			switch aerr.Code() {
   223  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   224  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   225  			case storagegateway.ErrCodeInternalServerError:
   226  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   227  			default:
   228  				fmt.Println(aerr.Error())
   229  			}
   230  		} else {
   231  			// Print the error, cast err to awserr.Error to get the Code and
   232  			// Message from an error.
   233  			fmt.Println(err.Error())
   234  		}
   235  		return
   236  	}
   237  
   238  	fmt.Println(result)
   239  }
   240  
   241  // To cancel virtual tape retrieval
   242  //
   243  // Cancels retrieval of a virtual tape from the virtual tape shelf (VTS) to a gateway
   244  // after the retrieval process is initiated.
   245  func ExampleStorageGateway_CancelRetrieval_shared00() {
   246  	svc := storagegateway.New(session.New())
   247  	input := &storagegateway.CancelRetrievalInput{
   248  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   249  		TapeARN:    aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4"),
   250  	}
   251  
   252  	result, err := svc.CancelRetrieval(input)
   253  	if err != nil {
   254  		if aerr, ok := err.(awserr.Error); ok {
   255  			switch aerr.Code() {
   256  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   257  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   258  			case storagegateway.ErrCodeInternalServerError:
   259  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   260  			default:
   261  				fmt.Println(aerr.Error())
   262  			}
   263  		} else {
   264  			// Print the error, cast err to awserr.Error to get the Code and
   265  			// Message from an error.
   266  			fmt.Println(err.Error())
   267  		}
   268  		return
   269  	}
   270  
   271  	fmt.Println(result)
   272  }
   273  
   274  // To create a cached iSCSI volume
   275  //
   276  // Creates a cached volume on a specified cached gateway.
   277  func ExampleStorageGateway_CreateCachediSCSIVolume_shared00() {
   278  	svc := storagegateway.New(session.New())
   279  	input := &storagegateway.CreateCachediSCSIVolumeInput{
   280  		ClientToken:        aws.String("cachedvol112233"),
   281  		GatewayARN:         aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   282  		NetworkInterfaceId: aws.String("10.1.1.1"),
   283  		SnapshotId:         aws.String("snap-f47b7b94"),
   284  		TargetName:         aws.String("my-volume"),
   285  		VolumeSizeInBytes:  aws.Int64(536870912000),
   286  	}
   287  
   288  	result, err := svc.CreateCachediSCSIVolume(input)
   289  	if err != nil {
   290  		if aerr, ok := err.(awserr.Error); ok {
   291  			switch aerr.Code() {
   292  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   293  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   294  			case storagegateway.ErrCodeInternalServerError:
   295  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   296  			default:
   297  				fmt.Println(aerr.Error())
   298  			}
   299  		} else {
   300  			// Print the error, cast err to awserr.Error to get the Code and
   301  			// Message from an error.
   302  			fmt.Println(err.Error())
   303  		}
   304  		return
   305  	}
   306  
   307  	fmt.Println(result)
   308  }
   309  
   310  // To create a snapshot of a gateway volume
   311  //
   312  // Initiates an ad-hoc snapshot of a gateway volume.
   313  func ExampleStorageGateway_CreateSnapshot_shared00() {
   314  	svc := storagegateway.New(session.New())
   315  	input := &storagegateway.CreateSnapshotInput{
   316  		SnapshotDescription: aws.String("My root volume snapshot as of 10/03/2017"),
   317  		VolumeARN:           aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
   318  	}
   319  
   320  	result, err := svc.CreateSnapshot(input)
   321  	if err != nil {
   322  		if aerr, ok := err.(awserr.Error); ok {
   323  			switch aerr.Code() {
   324  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   325  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   326  			case storagegateway.ErrCodeInternalServerError:
   327  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   328  			case storagegateway.ErrCodeServiceUnavailableError:
   329  				fmt.Println(storagegateway.ErrCodeServiceUnavailableError, aerr.Error())
   330  			default:
   331  				fmt.Println(aerr.Error())
   332  			}
   333  		} else {
   334  			// Print the error, cast err to awserr.Error to get the Code and
   335  			// Message from an error.
   336  			fmt.Println(err.Error())
   337  		}
   338  		return
   339  	}
   340  
   341  	fmt.Println(result)
   342  }
   343  
   344  // To create a snapshot of a gateway volume
   345  //
   346  // Initiates a snapshot of a gateway from a volume recovery point.
   347  func ExampleStorageGateway_CreateSnapshotFromVolumeRecoveryPoint_shared00() {
   348  	svc := storagegateway.New(session.New())
   349  	input := &storagegateway.CreateSnapshotFromVolumeRecoveryPointInput{
   350  		SnapshotDescription: aws.String("My root volume snapshot as of 2017-06-30T10:10:10.000Z"),
   351  		VolumeARN:           aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
   352  	}
   353  
   354  	result, err := svc.CreateSnapshotFromVolumeRecoveryPoint(input)
   355  	if err != nil {
   356  		if aerr, ok := err.(awserr.Error); ok {
   357  			switch aerr.Code() {
   358  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   359  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   360  			case storagegateway.ErrCodeInternalServerError:
   361  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   362  			case storagegateway.ErrCodeServiceUnavailableError:
   363  				fmt.Println(storagegateway.ErrCodeServiceUnavailableError, aerr.Error())
   364  			default:
   365  				fmt.Println(aerr.Error())
   366  			}
   367  		} else {
   368  			// Print the error, cast err to awserr.Error to get the Code and
   369  			// Message from an error.
   370  			fmt.Println(err.Error())
   371  		}
   372  		return
   373  	}
   374  
   375  	fmt.Println(result)
   376  }
   377  
   378  // To create a stored iSCSI volume
   379  //
   380  // Creates a stored volume on a specified stored gateway.
   381  func ExampleStorageGateway_CreateStorediSCSIVolume_shared00() {
   382  	svc := storagegateway.New(session.New())
   383  	input := &storagegateway.CreateStorediSCSIVolumeInput{
   384  		DiskId:               aws.String("pci-0000:03:00.0-scsi-0:0:0:0"),
   385  		GatewayARN:           aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   386  		NetworkInterfaceId:   aws.String("10.1.1.1"),
   387  		PreserveExistingData: aws.Bool(true),
   388  		SnapshotId:           aws.String("snap-f47b7b94"),
   389  		TargetName:           aws.String("my-volume"),
   390  	}
   391  
   392  	result, err := svc.CreateStorediSCSIVolume(input)
   393  	if err != nil {
   394  		if aerr, ok := err.(awserr.Error); ok {
   395  			switch aerr.Code() {
   396  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   397  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   398  			case storagegateway.ErrCodeInternalServerError:
   399  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   400  			default:
   401  				fmt.Println(aerr.Error())
   402  			}
   403  		} else {
   404  			// Print the error, cast err to awserr.Error to get the Code and
   405  			// Message from an error.
   406  			fmt.Println(err.Error())
   407  		}
   408  		return
   409  	}
   410  
   411  	fmt.Println(result)
   412  }
   413  
   414  // To create a virtual tape using a barcode
   415  //
   416  // Creates a virtual tape by using your own barcode.
   417  func ExampleStorageGateway_CreateTapeWithBarcode_shared00() {
   418  	svc := storagegateway.New(session.New())
   419  	input := &storagegateway.CreateTapeWithBarcodeInput{
   420  		GatewayARN:      aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
   421  		TapeBarcode:     aws.String("TEST12345"),
   422  		TapeSizeInBytes: aws.Int64(107374182400),
   423  	}
   424  
   425  	result, err := svc.CreateTapeWithBarcode(input)
   426  	if err != nil {
   427  		if aerr, ok := err.(awserr.Error); ok {
   428  			switch aerr.Code() {
   429  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   430  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   431  			case storagegateway.ErrCodeInternalServerError:
   432  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   433  			default:
   434  				fmt.Println(aerr.Error())
   435  			}
   436  		} else {
   437  			// Print the error, cast err to awserr.Error to get the Code and
   438  			// Message from an error.
   439  			fmt.Println(err.Error())
   440  		}
   441  		return
   442  	}
   443  
   444  	fmt.Println(result)
   445  }
   446  
   447  // To create a virtual tape
   448  //
   449  // Creates one or more virtual tapes.
   450  func ExampleStorageGateway_CreateTapes_shared00() {
   451  	svc := storagegateway.New(session.New())
   452  	input := &storagegateway.CreateTapesInput{
   453  		ClientToken:       aws.String("77777"),
   454  		GatewayARN:        aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
   455  		NumTapesToCreate:  aws.Int64(3),
   456  		TapeBarcodePrefix: aws.String("TEST"),
   457  		TapeSizeInBytes:   aws.Int64(107374182400),
   458  	}
   459  
   460  	result, err := svc.CreateTapes(input)
   461  	if err != nil {
   462  		if aerr, ok := err.(awserr.Error); ok {
   463  			switch aerr.Code() {
   464  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   465  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   466  			case storagegateway.ErrCodeInternalServerError:
   467  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   468  			default:
   469  				fmt.Println(aerr.Error())
   470  			}
   471  		} else {
   472  			// Print the error, cast err to awserr.Error to get the Code and
   473  			// Message from an error.
   474  			fmt.Println(err.Error())
   475  		}
   476  		return
   477  	}
   478  
   479  	fmt.Println(result)
   480  }
   481  
   482  // To delete bandwidth rate limits of gateway
   483  //
   484  // Deletes the bandwidth rate limits of a gateway; either the upload or download limit,
   485  // or both.
   486  func ExampleStorageGateway_DeleteBandwidthRateLimit_shared00() {
   487  	svc := storagegateway.New(session.New())
   488  	input := &storagegateway.DeleteBandwidthRateLimitInput{
   489  		BandwidthType: aws.String("All"),
   490  		GatewayARN:    aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   491  	}
   492  
   493  	result, err := svc.DeleteBandwidthRateLimit(input)
   494  	if err != nil {
   495  		if aerr, ok := err.(awserr.Error); ok {
   496  			switch aerr.Code() {
   497  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   498  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   499  			case storagegateway.ErrCodeInternalServerError:
   500  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   501  			default:
   502  				fmt.Println(aerr.Error())
   503  			}
   504  		} else {
   505  			// Print the error, cast err to awserr.Error to get the Code and
   506  			// Message from an error.
   507  			fmt.Println(err.Error())
   508  		}
   509  		return
   510  	}
   511  
   512  	fmt.Println(result)
   513  }
   514  
   515  // To delete CHAP credentials
   516  //
   517  // Deletes Challenge-Handshake Authentication Protocol (CHAP) credentials for a specified
   518  // iSCSI target and initiator pair.
   519  func ExampleStorageGateway_DeleteChapCredentials_shared00() {
   520  	svc := storagegateway.New(session.New())
   521  	input := &storagegateway.DeleteChapCredentialsInput{
   522  		InitiatorName: aws.String("iqn.1991-05.com.microsoft:computername.domain.example.com"),
   523  		TargetARN:     aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume"),
   524  	}
   525  
   526  	result, err := svc.DeleteChapCredentials(input)
   527  	if err != nil {
   528  		if aerr, ok := err.(awserr.Error); ok {
   529  			switch aerr.Code() {
   530  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   531  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   532  			case storagegateway.ErrCodeInternalServerError:
   533  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   534  			default:
   535  				fmt.Println(aerr.Error())
   536  			}
   537  		} else {
   538  			// Print the error, cast err to awserr.Error to get the Code and
   539  			// Message from an error.
   540  			fmt.Println(err.Error())
   541  		}
   542  		return
   543  	}
   544  
   545  	fmt.Println(result)
   546  }
   547  
   548  // To delete a gatgeway
   549  //
   550  // This operation deletes the gateway, but not the gateway's VM from the host computer.
   551  func ExampleStorageGateway_DeleteGateway_shared00() {
   552  	svc := storagegateway.New(session.New())
   553  	input := &storagegateway.DeleteGatewayInput{
   554  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   555  	}
   556  
   557  	result, err := svc.DeleteGateway(input)
   558  	if err != nil {
   559  		if aerr, ok := err.(awserr.Error); ok {
   560  			switch aerr.Code() {
   561  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   562  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   563  			case storagegateway.ErrCodeInternalServerError:
   564  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   565  			default:
   566  				fmt.Println(aerr.Error())
   567  			}
   568  		} else {
   569  			// Print the error, cast err to awserr.Error to get the Code and
   570  			// Message from an error.
   571  			fmt.Println(err.Error())
   572  		}
   573  		return
   574  	}
   575  
   576  	fmt.Println(result)
   577  }
   578  
   579  // To delete a snapshot of a volume
   580  //
   581  // This action enables you to delete a snapshot schedule for a volume.
   582  func ExampleStorageGateway_DeleteSnapshotSchedule_shared00() {
   583  	svc := storagegateway.New(session.New())
   584  	input := &storagegateway.DeleteSnapshotScheduleInput{
   585  		VolumeARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
   586  	}
   587  
   588  	result, err := svc.DeleteSnapshotSchedule(input)
   589  	if err != nil {
   590  		if aerr, ok := err.(awserr.Error); ok {
   591  			switch aerr.Code() {
   592  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   593  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   594  			case storagegateway.ErrCodeInternalServerError:
   595  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   596  			default:
   597  				fmt.Println(aerr.Error())
   598  			}
   599  		} else {
   600  			// Print the error, cast err to awserr.Error to get the Code and
   601  			// Message from an error.
   602  			fmt.Println(err.Error())
   603  		}
   604  		return
   605  	}
   606  
   607  	fmt.Println(result)
   608  }
   609  
   610  // To delete a virtual tape
   611  //
   612  // This example deletes the specified virtual tape.
   613  func ExampleStorageGateway_DeleteTape_shared00() {
   614  	svc := storagegateway.New(session.New())
   615  	input := &storagegateway.DeleteTapeInput{
   616  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:204469490176:gateway/sgw-12A3456B"),
   617  		TapeARN:    aws.String("arn:aws:storagegateway:us-east-1:204469490176:tape/TEST05A2A0"),
   618  	}
   619  
   620  	result, err := svc.DeleteTape(input)
   621  	if err != nil {
   622  		if aerr, ok := err.(awserr.Error); ok {
   623  			switch aerr.Code() {
   624  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   625  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   626  			case storagegateway.ErrCodeInternalServerError:
   627  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   628  			default:
   629  				fmt.Println(aerr.Error())
   630  			}
   631  		} else {
   632  			// Print the error, cast err to awserr.Error to get the Code and
   633  			// Message from an error.
   634  			fmt.Println(err.Error())
   635  		}
   636  		return
   637  	}
   638  
   639  	fmt.Println(result)
   640  }
   641  
   642  // To delete a virtual tape from the shelf (VTS)
   643  //
   644  // Deletes the specified virtual tape from the virtual tape shelf (VTS).
   645  func ExampleStorageGateway_DeleteTapeArchive_shared00() {
   646  	svc := storagegateway.New(session.New())
   647  	input := &storagegateway.DeleteTapeArchiveInput{
   648  		TapeARN: aws.String("arn:aws:storagegateway:us-east-1:204469490176:tape/TEST05A2A0"),
   649  	}
   650  
   651  	result, err := svc.DeleteTapeArchive(input)
   652  	if err != nil {
   653  		if aerr, ok := err.(awserr.Error); ok {
   654  			switch aerr.Code() {
   655  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   656  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   657  			case storagegateway.ErrCodeInternalServerError:
   658  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   659  			default:
   660  				fmt.Println(aerr.Error())
   661  			}
   662  		} else {
   663  			// Print the error, cast err to awserr.Error to get the Code and
   664  			// Message from an error.
   665  			fmt.Println(err.Error())
   666  		}
   667  		return
   668  	}
   669  
   670  	fmt.Println(result)
   671  }
   672  
   673  // To delete a gateway volume
   674  //
   675  // Deletes the specified gateway volume that you previously created using the CreateCachediSCSIVolume
   676  // or CreateStorediSCSIVolume API.
   677  func ExampleStorageGateway_DeleteVolume_shared00() {
   678  	svc := storagegateway.New(session.New())
   679  	input := &storagegateway.DeleteVolumeInput{
   680  		VolumeARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
   681  	}
   682  
   683  	result, err := svc.DeleteVolume(input)
   684  	if err != nil {
   685  		if aerr, ok := err.(awserr.Error); ok {
   686  			switch aerr.Code() {
   687  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   688  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   689  			case storagegateway.ErrCodeInternalServerError:
   690  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   691  			default:
   692  				fmt.Println(aerr.Error())
   693  			}
   694  		} else {
   695  			// Print the error, cast err to awserr.Error to get the Code and
   696  			// Message from an error.
   697  			fmt.Println(err.Error())
   698  		}
   699  		return
   700  	}
   701  
   702  	fmt.Println(result)
   703  }
   704  
   705  // To describe the bandwidth rate limits of a gateway
   706  //
   707  // Returns a value for a bandwidth rate limit if set. If not set, then only the gateway
   708  // ARN is returned.
   709  func ExampleStorageGateway_DescribeBandwidthRateLimit_shared00() {
   710  	svc := storagegateway.New(session.New())
   711  	input := &storagegateway.DescribeBandwidthRateLimitInput{
   712  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   713  	}
   714  
   715  	result, err := svc.DescribeBandwidthRateLimit(input)
   716  	if err != nil {
   717  		if aerr, ok := err.(awserr.Error); ok {
   718  			switch aerr.Code() {
   719  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   720  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   721  			case storagegateway.ErrCodeInternalServerError:
   722  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   723  			default:
   724  				fmt.Println(aerr.Error())
   725  			}
   726  		} else {
   727  			// Print the error, cast err to awserr.Error to get the Code and
   728  			// Message from an error.
   729  			fmt.Println(err.Error())
   730  		}
   731  		return
   732  	}
   733  
   734  	fmt.Println(result)
   735  }
   736  
   737  // To describe cache information
   738  //
   739  // Returns information about the cache of a gateway.
   740  func ExampleStorageGateway_DescribeCache_shared00() {
   741  	svc := storagegateway.New(session.New())
   742  	input := &storagegateway.DescribeCacheInput{
   743  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   744  	}
   745  
   746  	result, err := svc.DescribeCache(input)
   747  	if err != nil {
   748  		if aerr, ok := err.(awserr.Error); ok {
   749  			switch aerr.Code() {
   750  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   751  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   752  			case storagegateway.ErrCodeInternalServerError:
   753  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   754  			default:
   755  				fmt.Println(aerr.Error())
   756  			}
   757  		} else {
   758  			// Print the error, cast err to awserr.Error to get the Code and
   759  			// Message from an error.
   760  			fmt.Println(err.Error())
   761  		}
   762  		return
   763  	}
   764  
   765  	fmt.Println(result)
   766  }
   767  
   768  // To describe gateway cached iSCSI volumes
   769  //
   770  // Returns a description of the gateway cached iSCSI volumes specified in the request.
   771  func ExampleStorageGateway_DescribeCachediSCSIVolumes_shared00() {
   772  	svc := storagegateway.New(session.New())
   773  	input := &storagegateway.DescribeCachediSCSIVolumesInput{
   774  		VolumeARNs: []*string{
   775  			aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
   776  		},
   777  	}
   778  
   779  	result, err := svc.DescribeCachediSCSIVolumes(input)
   780  	if err != nil {
   781  		if aerr, ok := err.(awserr.Error); ok {
   782  			switch aerr.Code() {
   783  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   784  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   785  			case storagegateway.ErrCodeInternalServerError:
   786  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   787  			default:
   788  				fmt.Println(aerr.Error())
   789  			}
   790  		} else {
   791  			// Print the error, cast err to awserr.Error to get the Code and
   792  			// Message from an error.
   793  			fmt.Println(err.Error())
   794  		}
   795  		return
   796  	}
   797  
   798  	fmt.Println(result)
   799  }
   800  
   801  // To describe CHAP credetnitals for an iSCSI
   802  //
   803  // Returns an array of Challenge-Handshake Authentication Protocol (CHAP) credentials
   804  // information for a specified iSCSI target, one for each target-initiator pair.
   805  func ExampleStorageGateway_DescribeChapCredentials_shared00() {
   806  	svc := storagegateway.New(session.New())
   807  	input := &storagegateway.DescribeChapCredentialsInput{
   808  		TargetARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume"),
   809  	}
   810  
   811  	result, err := svc.DescribeChapCredentials(input)
   812  	if err != nil {
   813  		if aerr, ok := err.(awserr.Error); ok {
   814  			switch aerr.Code() {
   815  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   816  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   817  			case storagegateway.ErrCodeInternalServerError:
   818  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   819  			default:
   820  				fmt.Println(aerr.Error())
   821  			}
   822  		} else {
   823  			// Print the error, cast err to awserr.Error to get the Code and
   824  			// Message from an error.
   825  			fmt.Println(err.Error())
   826  		}
   827  		return
   828  	}
   829  
   830  	fmt.Println(result)
   831  }
   832  
   833  // To describe metadata about the gateway
   834  //
   835  // Returns metadata about a gateway such as its name, network interfaces, configured
   836  // time zone, and the state (whether the gateway is running or not).
   837  func ExampleStorageGateway_DescribeGatewayInformation_shared00() {
   838  	svc := storagegateway.New(session.New())
   839  	input := &storagegateway.DescribeGatewayInformationInput{
   840  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   841  	}
   842  
   843  	result, err := svc.DescribeGatewayInformation(input)
   844  	if err != nil {
   845  		if aerr, ok := err.(awserr.Error); ok {
   846  			switch aerr.Code() {
   847  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   848  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   849  			case storagegateway.ErrCodeInternalServerError:
   850  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   851  			default:
   852  				fmt.Println(aerr.Error())
   853  			}
   854  		} else {
   855  			// Print the error, cast err to awserr.Error to get the Code and
   856  			// Message from an error.
   857  			fmt.Println(err.Error())
   858  		}
   859  		return
   860  	}
   861  
   862  	fmt.Println(result)
   863  }
   864  
   865  // To describe gateway's maintenance start time
   866  //
   867  // Returns your gateway's weekly maintenance start time including the day and time of
   868  // the week.
   869  func ExampleStorageGateway_DescribeMaintenanceStartTime_shared00() {
   870  	svc := storagegateway.New(session.New())
   871  	input := &storagegateway.DescribeMaintenanceStartTimeInput{
   872  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
   873  	}
   874  
   875  	result, err := svc.DescribeMaintenanceStartTime(input)
   876  	if err != nil {
   877  		if aerr, ok := err.(awserr.Error); ok {
   878  			switch aerr.Code() {
   879  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   880  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   881  			case storagegateway.ErrCodeInternalServerError:
   882  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   883  			default:
   884  				fmt.Println(aerr.Error())
   885  			}
   886  		} else {
   887  			// Print the error, cast err to awserr.Error to get the Code and
   888  			// Message from an error.
   889  			fmt.Println(err.Error())
   890  		}
   891  		return
   892  	}
   893  
   894  	fmt.Println(result)
   895  }
   896  
   897  // To describe snapshot schedule for gateway volume
   898  //
   899  // Describes the snapshot schedule for the specified gateway volume including intervals
   900  // at which snapshots are automatically initiated.
   901  func ExampleStorageGateway_DescribeSnapshotSchedule_shared00() {
   902  	svc := storagegateway.New(session.New())
   903  	input := &storagegateway.DescribeSnapshotScheduleInput{
   904  		VolumeARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
   905  	}
   906  
   907  	result, err := svc.DescribeSnapshotSchedule(input)
   908  	if err != nil {
   909  		if aerr, ok := err.(awserr.Error); ok {
   910  			switch aerr.Code() {
   911  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   912  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   913  			case storagegateway.ErrCodeInternalServerError:
   914  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   915  			default:
   916  				fmt.Println(aerr.Error())
   917  			}
   918  		} else {
   919  			// Print the error, cast err to awserr.Error to get the Code and
   920  			// Message from an error.
   921  			fmt.Println(err.Error())
   922  		}
   923  		return
   924  	}
   925  
   926  	fmt.Println(result)
   927  }
   928  
   929  // To describe the volumes of a gateway
   930  //
   931  // Returns the description of the gateway volumes specified in the request belonging
   932  // to the same gateway.
   933  func ExampleStorageGateway_DescribeStorediSCSIVolumes_shared00() {
   934  	svc := storagegateway.New(session.New())
   935  	input := &storagegateway.DescribeStorediSCSIVolumesInput{
   936  		VolumeARNs: []*string{
   937  			aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
   938  		},
   939  	}
   940  
   941  	result, err := svc.DescribeStorediSCSIVolumes(input)
   942  	if err != nil {
   943  		if aerr, ok := err.(awserr.Error); ok {
   944  			switch aerr.Code() {
   945  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   946  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   947  			case storagegateway.ErrCodeInternalServerError:
   948  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   949  			default:
   950  				fmt.Println(aerr.Error())
   951  			}
   952  		} else {
   953  			// Print the error, cast err to awserr.Error to get the Code and
   954  			// Message from an error.
   955  			fmt.Println(err.Error())
   956  		}
   957  		return
   958  	}
   959  
   960  	fmt.Println(result)
   961  }
   962  
   963  // To describe virtual tapes in the VTS
   964  //
   965  // Returns a description of specified virtual tapes in the virtual tape shelf (VTS).
   966  func ExampleStorageGateway_DescribeTapeArchives_shared00() {
   967  	svc := storagegateway.New(session.New())
   968  	input := &storagegateway.DescribeTapeArchivesInput{
   969  		Limit:  aws.Int64(123),
   970  		Marker: aws.String("1"),
   971  		TapeARNs: []*string{
   972  			aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/AM08A1AD"),
   973  			aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4"),
   974  		},
   975  	}
   976  
   977  	result, err := svc.DescribeTapeArchives(input)
   978  	if err != nil {
   979  		if aerr, ok := err.(awserr.Error); ok {
   980  			switch aerr.Code() {
   981  			case storagegateway.ErrCodeInvalidGatewayRequestException:
   982  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
   983  			case storagegateway.ErrCodeInternalServerError:
   984  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
   985  			default:
   986  				fmt.Println(aerr.Error())
   987  			}
   988  		} else {
   989  			// Print the error, cast err to awserr.Error to get the Code and
   990  			// Message from an error.
   991  			fmt.Println(err.Error())
   992  		}
   993  		return
   994  	}
   995  
   996  	fmt.Println(result)
   997  }
   998  
   999  // To describe virtual tape recovery points
  1000  //
  1001  // Returns a list of virtual tape recovery points that are available for the specified
  1002  // gateway-VTL.
  1003  func ExampleStorageGateway_DescribeTapeRecoveryPoints_shared00() {
  1004  	svc := storagegateway.New(session.New())
  1005  	input := &storagegateway.DescribeTapeRecoveryPointsInput{
  1006  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1007  		Limit:      aws.Int64(1),
  1008  		Marker:     aws.String("1"),
  1009  	}
  1010  
  1011  	result, err := svc.DescribeTapeRecoveryPoints(input)
  1012  	if err != nil {
  1013  		if aerr, ok := err.(awserr.Error); ok {
  1014  			switch aerr.Code() {
  1015  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1016  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1017  			case storagegateway.ErrCodeInternalServerError:
  1018  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1019  			default:
  1020  				fmt.Println(aerr.Error())
  1021  			}
  1022  		} else {
  1023  			// Print the error, cast err to awserr.Error to get the Code and
  1024  			// Message from an error.
  1025  			fmt.Println(err.Error())
  1026  		}
  1027  		return
  1028  	}
  1029  
  1030  	fmt.Println(result)
  1031  }
  1032  
  1033  // To describe virtual tape(s) associated with gateway
  1034  //
  1035  // Returns a description of the specified Amazon Resource Name (ARN) of virtual tapes.
  1036  // If a TapeARN is not specified, returns a description of all virtual tapes.
  1037  func ExampleStorageGateway_DescribeTapes_shared00() {
  1038  	svc := storagegateway.New(session.New())
  1039  	input := &storagegateway.DescribeTapesInput{
  1040  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
  1041  		Limit:      aws.Int64(2),
  1042  		Marker:     aws.String("1"),
  1043  		TapeARNs: []*string{
  1044  			aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/TEST04A2A1"),
  1045  			aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/TEST05A2A0"),
  1046  		},
  1047  	}
  1048  
  1049  	result, err := svc.DescribeTapes(input)
  1050  	if err != nil {
  1051  		if aerr, ok := err.(awserr.Error); ok {
  1052  			switch aerr.Code() {
  1053  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1054  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1055  			case storagegateway.ErrCodeInternalServerError:
  1056  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1057  			default:
  1058  				fmt.Println(aerr.Error())
  1059  			}
  1060  		} else {
  1061  			// Print the error, cast err to awserr.Error to get the Code and
  1062  			// Message from an error.
  1063  			fmt.Println(err.Error())
  1064  		}
  1065  		return
  1066  	}
  1067  
  1068  	fmt.Println(result)
  1069  }
  1070  
  1071  // To describe upload buffer of gateway
  1072  //
  1073  // Returns information about the upload buffer of a gateway including disk IDs and the
  1074  // amount of upload buffer space allocated/used.
  1075  func ExampleStorageGateway_DescribeUploadBuffer_shared00() {
  1076  	svc := storagegateway.New(session.New())
  1077  	input := &storagegateway.DescribeUploadBufferInput{
  1078  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1079  	}
  1080  
  1081  	result, err := svc.DescribeUploadBuffer(input)
  1082  	if err != nil {
  1083  		if aerr, ok := err.(awserr.Error); ok {
  1084  			switch aerr.Code() {
  1085  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1086  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1087  			case storagegateway.ErrCodeInternalServerError:
  1088  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1089  			default:
  1090  				fmt.Println(aerr.Error())
  1091  			}
  1092  		} else {
  1093  			// Print the error, cast err to awserr.Error to get the Code and
  1094  			// Message from an error.
  1095  			fmt.Println(err.Error())
  1096  		}
  1097  		return
  1098  	}
  1099  
  1100  	fmt.Println(result)
  1101  }
  1102  
  1103  // To describe upload buffer of a gateway
  1104  //
  1105  // Returns information about the upload buffer of a gateway including disk IDs and the
  1106  // amount of upload buffer space allocated and used.
  1107  func ExampleStorageGateway_DescribeUploadBuffer_shared01() {
  1108  	svc := storagegateway.New(session.New())
  1109  	input := &storagegateway.DescribeUploadBufferInput{
  1110  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1111  	}
  1112  
  1113  	result, err := svc.DescribeUploadBuffer(input)
  1114  	if err != nil {
  1115  		if aerr, ok := err.(awserr.Error); ok {
  1116  			switch aerr.Code() {
  1117  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1118  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1119  			case storagegateway.ErrCodeInternalServerError:
  1120  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1121  			default:
  1122  				fmt.Println(aerr.Error())
  1123  			}
  1124  		} else {
  1125  			// Print the error, cast err to awserr.Error to get the Code and
  1126  			// Message from an error.
  1127  			fmt.Println(err.Error())
  1128  		}
  1129  		return
  1130  	}
  1131  
  1132  	fmt.Println(result)
  1133  }
  1134  
  1135  // To describe virtual tape library (VTL) devices of a single gateway
  1136  //
  1137  // Returns a description of virtual tape library (VTL) devices for the specified gateway.
  1138  func ExampleStorageGateway_DescribeVTLDevices_shared00() {
  1139  	svc := storagegateway.New(session.New())
  1140  	input := &storagegateway.DescribeVTLDevicesInput{
  1141  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
  1142  		Limit:      aws.Int64(123),
  1143  		Marker:     aws.String("1"),
  1144  	}
  1145  
  1146  	result, err := svc.DescribeVTLDevices(input)
  1147  	if err != nil {
  1148  		if aerr, ok := err.(awserr.Error); ok {
  1149  			switch aerr.Code() {
  1150  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1151  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1152  			case storagegateway.ErrCodeInternalServerError:
  1153  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1154  			default:
  1155  				fmt.Println(aerr.Error())
  1156  			}
  1157  		} else {
  1158  			// Print the error, cast err to awserr.Error to get the Code and
  1159  			// Message from an error.
  1160  			fmt.Println(err.Error())
  1161  		}
  1162  		return
  1163  	}
  1164  
  1165  	fmt.Println(result)
  1166  }
  1167  
  1168  // To describe the working storage of a gateway [Depreciated]
  1169  //
  1170  // This operation is supported only for the gateway-stored volume architecture. This
  1171  // operation is deprecated in cached-volumes API version (20120630). Use DescribeUploadBuffer
  1172  // instead.
  1173  func ExampleStorageGateway_DescribeWorkingStorage_shared00() {
  1174  	svc := storagegateway.New(session.New())
  1175  	input := &storagegateway.DescribeWorkingStorageInput{
  1176  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1177  	}
  1178  
  1179  	result, err := svc.DescribeWorkingStorage(input)
  1180  	if err != nil {
  1181  		if aerr, ok := err.(awserr.Error); ok {
  1182  			switch aerr.Code() {
  1183  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1184  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1185  			case storagegateway.ErrCodeInternalServerError:
  1186  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1187  			default:
  1188  				fmt.Println(aerr.Error())
  1189  			}
  1190  		} else {
  1191  			// Print the error, cast err to awserr.Error to get the Code and
  1192  			// Message from an error.
  1193  			fmt.Println(err.Error())
  1194  		}
  1195  		return
  1196  	}
  1197  
  1198  	fmt.Println(result)
  1199  }
  1200  
  1201  // To disable a gateway when it is no longer functioning
  1202  //
  1203  // Disables a gateway when the gateway is no longer functioning. Use this operation
  1204  // for a gateway-VTL that is not reachable or not functioning.
  1205  func ExampleStorageGateway_DisableGateway_shared00() {
  1206  	svc := storagegateway.New(session.New())
  1207  	input := &storagegateway.DisableGatewayInput{
  1208  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1209  	}
  1210  
  1211  	result, err := svc.DisableGateway(input)
  1212  	if err != nil {
  1213  		if aerr, ok := err.(awserr.Error); ok {
  1214  			switch aerr.Code() {
  1215  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1216  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1217  			case storagegateway.ErrCodeInternalServerError:
  1218  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1219  			default:
  1220  				fmt.Println(aerr.Error())
  1221  			}
  1222  		} else {
  1223  			// Print the error, cast err to awserr.Error to get the Code and
  1224  			// Message from an error.
  1225  			fmt.Println(err.Error())
  1226  		}
  1227  		return
  1228  	}
  1229  
  1230  	fmt.Println(result)
  1231  }
  1232  
  1233  // To lists region specific gateways per AWS account
  1234  //
  1235  // Lists gateways owned by an AWS account in a specified region as requested. Results
  1236  // are sorted by gateway ARN up to a maximum of 100 gateways.
  1237  func ExampleStorageGateway_ListGateways_shared00() {
  1238  	svc := storagegateway.New(session.New())
  1239  	input := &storagegateway.ListGatewaysInput{
  1240  		Limit:  aws.Int64(2),
  1241  		Marker: aws.String("1"),
  1242  	}
  1243  
  1244  	result, err := svc.ListGateways(input)
  1245  	if err != nil {
  1246  		if aerr, ok := err.(awserr.Error); ok {
  1247  			switch aerr.Code() {
  1248  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1249  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1250  			case storagegateway.ErrCodeInternalServerError:
  1251  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1252  			default:
  1253  				fmt.Println(aerr.Error())
  1254  			}
  1255  		} else {
  1256  			// Print the error, cast err to awserr.Error to get the Code and
  1257  			// Message from an error.
  1258  			fmt.Println(err.Error())
  1259  		}
  1260  		return
  1261  	}
  1262  
  1263  	fmt.Println(result)
  1264  }
  1265  
  1266  // To list the gateway's local disks
  1267  //
  1268  // The request returns a list of all disks, specifying which are configured as working
  1269  // storage, cache storage, or stored volume or not configured at all.
  1270  func ExampleStorageGateway_ListLocalDisks_shared00() {
  1271  	svc := storagegateway.New(session.New())
  1272  	input := &storagegateway.ListLocalDisksInput{
  1273  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1274  	}
  1275  
  1276  	result, err := svc.ListLocalDisks(input)
  1277  	if err != nil {
  1278  		if aerr, ok := err.(awserr.Error); ok {
  1279  			switch aerr.Code() {
  1280  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1281  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1282  			case storagegateway.ErrCodeInternalServerError:
  1283  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1284  			default:
  1285  				fmt.Println(aerr.Error())
  1286  			}
  1287  		} else {
  1288  			// Print the error, cast err to awserr.Error to get the Code and
  1289  			// Message from an error.
  1290  			fmt.Println(err.Error())
  1291  		}
  1292  		return
  1293  	}
  1294  
  1295  	fmt.Println(result)
  1296  }
  1297  
  1298  // To list tags that have been added to a resource
  1299  //
  1300  // Lists the tags that have been added to the specified resource.
  1301  func ExampleStorageGateway_ListTagsForResource_shared00() {
  1302  	svc := storagegateway.New(session.New())
  1303  	input := &storagegateway.ListTagsForResourceInput{
  1304  		Limit:       aws.Int64(1),
  1305  		Marker:      aws.String("1"),
  1306  		ResourceARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B"),
  1307  	}
  1308  
  1309  	result, err := svc.ListTagsForResource(input)
  1310  	if err != nil {
  1311  		if aerr, ok := err.(awserr.Error); ok {
  1312  			switch aerr.Code() {
  1313  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1314  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1315  			case storagegateway.ErrCodeInternalServerError:
  1316  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1317  			default:
  1318  				fmt.Println(aerr.Error())
  1319  			}
  1320  		} else {
  1321  			// Print the error, cast err to awserr.Error to get the Code and
  1322  			// Message from an error.
  1323  			fmt.Println(err.Error())
  1324  		}
  1325  		return
  1326  	}
  1327  
  1328  	fmt.Println(result)
  1329  }
  1330  
  1331  // To list recovery points for a gateway
  1332  //
  1333  // Lists the recovery points for a specified gateway in which all data of the volume
  1334  // is consistent and can be used to create a snapshot.
  1335  func ExampleStorageGateway_ListVolumeRecoveryPoints_shared00() {
  1336  	svc := storagegateway.New(session.New())
  1337  	input := &storagegateway.ListVolumeRecoveryPointsInput{
  1338  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1339  	}
  1340  
  1341  	result, err := svc.ListVolumeRecoveryPoints(input)
  1342  	if err != nil {
  1343  		if aerr, ok := err.(awserr.Error); ok {
  1344  			switch aerr.Code() {
  1345  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1346  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1347  			case storagegateway.ErrCodeInternalServerError:
  1348  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1349  			default:
  1350  				fmt.Println(aerr.Error())
  1351  			}
  1352  		} else {
  1353  			// Print the error, cast err to awserr.Error to get the Code and
  1354  			// Message from an error.
  1355  			fmt.Println(err.Error())
  1356  		}
  1357  		return
  1358  	}
  1359  
  1360  	fmt.Println(result)
  1361  }
  1362  
  1363  // To list the iSCSI stored volumes of a gateway
  1364  //
  1365  // Lists the iSCSI stored volumes of a gateway. Results are sorted by volume ARN up
  1366  // to a maximum of 100 volumes.
  1367  func ExampleStorageGateway_ListVolumes_shared00() {
  1368  	svc := storagegateway.New(session.New())
  1369  	input := &storagegateway.ListVolumesInput{
  1370  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1371  		Limit:      aws.Int64(2),
  1372  		Marker:     aws.String("1"),
  1373  	}
  1374  
  1375  	result, err := svc.ListVolumes(input)
  1376  	if err != nil {
  1377  		if aerr, ok := err.(awserr.Error); ok {
  1378  			switch aerr.Code() {
  1379  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1380  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1381  			case storagegateway.ErrCodeInternalServerError:
  1382  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1383  			default:
  1384  				fmt.Println(aerr.Error())
  1385  			}
  1386  		} else {
  1387  			// Print the error, cast err to awserr.Error to get the Code and
  1388  			// Message from an error.
  1389  			fmt.Println(err.Error())
  1390  		}
  1391  		return
  1392  	}
  1393  
  1394  	fmt.Println(result)
  1395  }
  1396  
  1397  // To remove tags from a resource
  1398  //
  1399  // Lists the iSCSI stored volumes of a gateway. Removes one or more tags from the specified
  1400  // resource.
  1401  func ExampleStorageGateway_RemoveTagsFromResource_shared00() {
  1402  	svc := storagegateway.New(session.New())
  1403  	input := &storagegateway.RemoveTagsFromResourceInput{
  1404  		ResourceARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B"),
  1405  		TagKeys: []*string{
  1406  			aws.String("Dev Gatgeway Region"),
  1407  			aws.String("East Coast"),
  1408  		},
  1409  	}
  1410  
  1411  	result, err := svc.RemoveTagsFromResource(input)
  1412  	if err != nil {
  1413  		if aerr, ok := err.(awserr.Error); ok {
  1414  			switch aerr.Code() {
  1415  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1416  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1417  			case storagegateway.ErrCodeInternalServerError:
  1418  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1419  			default:
  1420  				fmt.Println(aerr.Error())
  1421  			}
  1422  		} else {
  1423  			// Print the error, cast err to awserr.Error to get the Code and
  1424  			// Message from an error.
  1425  			fmt.Println(err.Error())
  1426  		}
  1427  		return
  1428  	}
  1429  
  1430  	fmt.Println(result)
  1431  }
  1432  
  1433  // To reset cache disks in error status
  1434  //
  1435  // Resets all cache disks that have encountered a error and makes the disks available
  1436  // for reconfiguration as cache storage.
  1437  func ExampleStorageGateway_ResetCache_shared00() {
  1438  	svc := storagegateway.New(session.New())
  1439  	input := &storagegateway.ResetCacheInput{
  1440  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-13B4567C"),
  1441  	}
  1442  
  1443  	result, err := svc.ResetCache(input)
  1444  	if err != nil {
  1445  		if aerr, ok := err.(awserr.Error); ok {
  1446  			switch aerr.Code() {
  1447  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1448  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1449  			case storagegateway.ErrCodeInternalServerError:
  1450  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1451  			default:
  1452  				fmt.Println(aerr.Error())
  1453  			}
  1454  		} else {
  1455  			// Print the error, cast err to awserr.Error to get the Code and
  1456  			// Message from an error.
  1457  			fmt.Println(err.Error())
  1458  		}
  1459  		return
  1460  	}
  1461  
  1462  	fmt.Println(result)
  1463  }
  1464  
  1465  // To retrieve an archived tape from the VTS
  1466  //
  1467  // Retrieves an archived virtual tape from the virtual tape shelf (VTS) to a gateway-VTL.
  1468  // Virtual tapes archived in the VTS are not associated with any gateway.
  1469  func ExampleStorageGateway_RetrieveTapeArchive_shared00() {
  1470  	svc := storagegateway.New(session.New())
  1471  	input := &storagegateway.RetrieveTapeArchiveInput{
  1472  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
  1473  		TapeARN:    aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/TEST0AA2AF"),
  1474  	}
  1475  
  1476  	result, err := svc.RetrieveTapeArchive(input)
  1477  	if err != nil {
  1478  		if aerr, ok := err.(awserr.Error); ok {
  1479  			switch aerr.Code() {
  1480  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1481  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1482  			case storagegateway.ErrCodeInternalServerError:
  1483  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1484  			default:
  1485  				fmt.Println(aerr.Error())
  1486  			}
  1487  		} else {
  1488  			// Print the error, cast err to awserr.Error to get the Code and
  1489  			// Message from an error.
  1490  			fmt.Println(err.Error())
  1491  		}
  1492  		return
  1493  	}
  1494  
  1495  	fmt.Println(result)
  1496  }
  1497  
  1498  // To retrieve the recovery point of a virtual tape
  1499  //
  1500  // Retrieves the recovery point for the specified virtual tape.
  1501  func ExampleStorageGateway_RetrieveTapeRecoveryPoint_shared00() {
  1502  	svc := storagegateway.New(session.New())
  1503  	input := &storagegateway.RetrieveTapeRecoveryPointInput{
  1504  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
  1505  		TapeARN:    aws.String("arn:aws:storagegateway:us-east-1:999999999999:tape/TEST0AA2AF"),
  1506  	}
  1507  
  1508  	result, err := svc.RetrieveTapeRecoveryPoint(input)
  1509  	if err != nil {
  1510  		if aerr, ok := err.(awserr.Error); ok {
  1511  			switch aerr.Code() {
  1512  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1513  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1514  			case storagegateway.ErrCodeInternalServerError:
  1515  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1516  			default:
  1517  				fmt.Println(aerr.Error())
  1518  			}
  1519  		} else {
  1520  			// Print the error, cast err to awserr.Error to get the Code and
  1521  			// Message from an error.
  1522  			fmt.Println(err.Error())
  1523  		}
  1524  		return
  1525  	}
  1526  
  1527  	fmt.Println(result)
  1528  }
  1529  
  1530  // To set a password for your VM
  1531  //
  1532  // Sets the password for your VM local console.
  1533  func ExampleStorageGateway_SetLocalConsolePassword_shared00() {
  1534  	svc := storagegateway.New(session.New())
  1535  	input := &storagegateway.SetLocalConsolePasswordInput{
  1536  		GatewayARN:           aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
  1537  		LocalConsolePassword: aws.String("PassWordMustBeAtLeast6Chars."),
  1538  	}
  1539  
  1540  	result, err := svc.SetLocalConsolePassword(input)
  1541  	if err != nil {
  1542  		if aerr, ok := err.(awserr.Error); ok {
  1543  			switch aerr.Code() {
  1544  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1545  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1546  			case storagegateway.ErrCodeInternalServerError:
  1547  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1548  			default:
  1549  				fmt.Println(aerr.Error())
  1550  			}
  1551  		} else {
  1552  			// Print the error, cast err to awserr.Error to get the Code and
  1553  			// Message from an error.
  1554  			fmt.Println(err.Error())
  1555  		}
  1556  		return
  1557  	}
  1558  
  1559  	fmt.Println(result)
  1560  }
  1561  
  1562  // To shut down a gateway service
  1563  //
  1564  // This operation shuts down the gateway service component running in the storage gateway's
  1565  // virtual machine (VM) and not the VM.
  1566  func ExampleStorageGateway_ShutdownGateway_shared00() {
  1567  	svc := storagegateway.New(session.New())
  1568  	input := &storagegateway.ShutdownGatewayInput{
  1569  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
  1570  	}
  1571  
  1572  	result, err := svc.ShutdownGateway(input)
  1573  	if err != nil {
  1574  		if aerr, ok := err.(awserr.Error); ok {
  1575  			switch aerr.Code() {
  1576  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1577  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1578  			case storagegateway.ErrCodeInternalServerError:
  1579  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1580  			default:
  1581  				fmt.Println(aerr.Error())
  1582  			}
  1583  		} else {
  1584  			// Print the error, cast err to awserr.Error to get the Code and
  1585  			// Message from an error.
  1586  			fmt.Println(err.Error())
  1587  		}
  1588  		return
  1589  	}
  1590  
  1591  	fmt.Println(result)
  1592  }
  1593  
  1594  // To start a gateway service
  1595  //
  1596  // Starts a gateway service that was previously shut down.
  1597  func ExampleStorageGateway_StartGateway_shared00() {
  1598  	svc := storagegateway.New(session.New())
  1599  	input := &storagegateway.StartGatewayInput{
  1600  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B"),
  1601  	}
  1602  
  1603  	result, err := svc.StartGateway(input)
  1604  	if err != nil {
  1605  		if aerr, ok := err.(awserr.Error); ok {
  1606  			switch aerr.Code() {
  1607  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1608  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1609  			case storagegateway.ErrCodeInternalServerError:
  1610  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1611  			default:
  1612  				fmt.Println(aerr.Error())
  1613  			}
  1614  		} else {
  1615  			// Print the error, cast err to awserr.Error to get the Code and
  1616  			// Message from an error.
  1617  			fmt.Println(err.Error())
  1618  		}
  1619  		return
  1620  	}
  1621  
  1622  	fmt.Println(result)
  1623  }
  1624  
  1625  // To update the bandwidth rate limits of a gateway
  1626  //
  1627  // Updates the bandwidth rate limits of a gateway. Both the upload and download bandwidth
  1628  // rate limit can be set, or either one of the two. If a new limit is not set, the existing
  1629  // rate limit remains.
  1630  func ExampleStorageGateway_UpdateBandwidthRateLimit_shared00() {
  1631  	svc := storagegateway.New(session.New())
  1632  	input := &storagegateway.UpdateBandwidthRateLimitInput{
  1633  		AverageDownloadRateLimitInBitsPerSec: aws.Int64(102400),
  1634  		AverageUploadRateLimitInBitsPerSec:   aws.Int64(51200),
  1635  		GatewayARN:                           aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1636  	}
  1637  
  1638  	result, err := svc.UpdateBandwidthRateLimit(input)
  1639  	if err != nil {
  1640  		if aerr, ok := err.(awserr.Error); ok {
  1641  			switch aerr.Code() {
  1642  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1643  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1644  			case storagegateway.ErrCodeInternalServerError:
  1645  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1646  			default:
  1647  				fmt.Println(aerr.Error())
  1648  			}
  1649  		} else {
  1650  			// Print the error, cast err to awserr.Error to get the Code and
  1651  			// Message from an error.
  1652  			fmt.Println(err.Error())
  1653  		}
  1654  		return
  1655  	}
  1656  
  1657  	fmt.Println(result)
  1658  }
  1659  
  1660  // To update CHAP credentials for an iSCSI target
  1661  //
  1662  // Updates the Challenge-Handshake Authentication Protocol (CHAP) credentials for a
  1663  // specified iSCSI target.
  1664  func ExampleStorageGateway_UpdateChapCredentials_shared00() {
  1665  	svc := storagegateway.New(session.New())
  1666  	input := &storagegateway.UpdateChapCredentialsInput{
  1667  		InitiatorName:                 aws.String("iqn.1991-05.com.microsoft:computername.domain.example.com"),
  1668  		SecretToAuthenticateInitiator: aws.String("111111111111"),
  1669  		SecretToAuthenticateTarget:    aws.String("222222222222"),
  1670  		TargetARN:                     aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume"),
  1671  	}
  1672  
  1673  	result, err := svc.UpdateChapCredentials(input)
  1674  	if err != nil {
  1675  		if aerr, ok := err.(awserr.Error); ok {
  1676  			switch aerr.Code() {
  1677  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1678  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1679  			case storagegateway.ErrCodeInternalServerError:
  1680  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1681  			default:
  1682  				fmt.Println(aerr.Error())
  1683  			}
  1684  		} else {
  1685  			// Print the error, cast err to awserr.Error to get the Code and
  1686  			// Message from an error.
  1687  			fmt.Println(err.Error())
  1688  		}
  1689  		return
  1690  	}
  1691  
  1692  	fmt.Println(result)
  1693  }
  1694  
  1695  // To update a gateway's metadata
  1696  //
  1697  // Updates a gateway's metadata, which includes the gateway's name and time zone.
  1698  func ExampleStorageGateway_UpdateGatewayInformation_shared00() {
  1699  	svc := storagegateway.New(session.New())
  1700  	input := &storagegateway.UpdateGatewayInformationInput{
  1701  		GatewayARN:      aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1702  		GatewayName:     aws.String("MyGateway2"),
  1703  		GatewayTimezone: aws.String("GMT-12:00"),
  1704  	}
  1705  
  1706  	result, err := svc.UpdateGatewayInformation(input)
  1707  	if err != nil {
  1708  		if aerr, ok := err.(awserr.Error); ok {
  1709  			switch aerr.Code() {
  1710  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1711  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1712  			case storagegateway.ErrCodeInternalServerError:
  1713  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1714  			default:
  1715  				fmt.Println(aerr.Error())
  1716  			}
  1717  		} else {
  1718  			// Print the error, cast err to awserr.Error to get the Code and
  1719  			// Message from an error.
  1720  			fmt.Println(err.Error())
  1721  		}
  1722  		return
  1723  	}
  1724  
  1725  	fmt.Println(result)
  1726  }
  1727  
  1728  // To update a gateway's VM software
  1729  //
  1730  // Updates the gateway virtual machine (VM) software. The request immediately triggers
  1731  // the software update.
  1732  func ExampleStorageGateway_UpdateGatewaySoftwareNow_shared00() {
  1733  	svc := storagegateway.New(session.New())
  1734  	input := &storagegateway.UpdateGatewaySoftwareNowInput{
  1735  		GatewayARN: aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1736  	}
  1737  
  1738  	result, err := svc.UpdateGatewaySoftwareNow(input)
  1739  	if err != nil {
  1740  		if aerr, ok := err.(awserr.Error); ok {
  1741  			switch aerr.Code() {
  1742  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1743  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1744  			case storagegateway.ErrCodeInternalServerError:
  1745  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1746  			default:
  1747  				fmt.Println(aerr.Error())
  1748  			}
  1749  		} else {
  1750  			// Print the error, cast err to awserr.Error to get the Code and
  1751  			// Message from an error.
  1752  			fmt.Println(err.Error())
  1753  		}
  1754  		return
  1755  	}
  1756  
  1757  	fmt.Println(result)
  1758  }
  1759  
  1760  // To update a gateway's maintenance start time
  1761  //
  1762  // Updates a gateway's weekly maintenance start time information, including day and
  1763  // time of the week. The maintenance time is in your gateway's time zone.
  1764  func ExampleStorageGateway_UpdateMaintenanceStartTime_shared00() {
  1765  	svc := storagegateway.New(session.New())
  1766  	input := &storagegateway.UpdateMaintenanceStartTimeInput{
  1767  		DayOfWeek:    aws.Int64(2),
  1768  		GatewayARN:   aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B"),
  1769  		HourOfDay:    aws.Int64(0),
  1770  		MinuteOfHour: aws.Int64(30),
  1771  	}
  1772  
  1773  	result, err := svc.UpdateMaintenanceStartTime(input)
  1774  	if err != nil {
  1775  		if aerr, ok := err.(awserr.Error); ok {
  1776  			switch aerr.Code() {
  1777  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1778  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1779  			case storagegateway.ErrCodeInternalServerError:
  1780  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1781  			default:
  1782  				fmt.Println(aerr.Error())
  1783  			}
  1784  		} else {
  1785  			// Print the error, cast err to awserr.Error to get the Code and
  1786  			// Message from an error.
  1787  			fmt.Println(err.Error())
  1788  		}
  1789  		return
  1790  	}
  1791  
  1792  	fmt.Println(result)
  1793  }
  1794  
  1795  // To update a volume snapshot schedule
  1796  //
  1797  // Updates a snapshot schedule configured for a gateway volume.
  1798  func ExampleStorageGateway_UpdateSnapshotSchedule_shared00() {
  1799  	svc := storagegateway.New(session.New())
  1800  	input := &storagegateway.UpdateSnapshotScheduleInput{
  1801  		Description:       aws.String("Hourly snapshot"),
  1802  		RecurrenceInHours: aws.Int64(1),
  1803  		StartAt:           aws.Int64(0),
  1804  		VolumeARN:         aws.String("arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB"),
  1805  	}
  1806  
  1807  	result, err := svc.UpdateSnapshotSchedule(input)
  1808  	if err != nil {
  1809  		if aerr, ok := err.(awserr.Error); ok {
  1810  			switch aerr.Code() {
  1811  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1812  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1813  			case storagegateway.ErrCodeInternalServerError:
  1814  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1815  			default:
  1816  				fmt.Println(aerr.Error())
  1817  			}
  1818  		} else {
  1819  			// Print the error, cast err to awserr.Error to get the Code and
  1820  			// Message from an error.
  1821  			fmt.Println(err.Error())
  1822  		}
  1823  		return
  1824  	}
  1825  
  1826  	fmt.Println(result)
  1827  }
  1828  
  1829  // To update a VTL device type
  1830  //
  1831  // Updates the type of medium changer in a gateway-VTL after a gateway-VTL is activated.
  1832  func ExampleStorageGateway_UpdateVTLDeviceType_shared00() {
  1833  	svc := storagegateway.New(session.New())
  1834  	input := &storagegateway.UpdateVTLDeviceTypeInput{
  1835  		DeviceType:   aws.String("Medium Changer"),
  1836  		VTLDeviceARN: aws.String("arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/device/AMZN_SGW-1FAD4876_MEDIACHANGER_00001"),
  1837  	}
  1838  
  1839  	result, err := svc.UpdateVTLDeviceType(input)
  1840  	if err != nil {
  1841  		if aerr, ok := err.(awserr.Error); ok {
  1842  			switch aerr.Code() {
  1843  			case storagegateway.ErrCodeInvalidGatewayRequestException:
  1844  				fmt.Println(storagegateway.ErrCodeInvalidGatewayRequestException, aerr.Error())
  1845  			case storagegateway.ErrCodeInternalServerError:
  1846  				fmt.Println(storagegateway.ErrCodeInternalServerError, aerr.Error())
  1847  			default:
  1848  				fmt.Println(aerr.Error())
  1849  			}
  1850  		} else {
  1851  			// Print the error, cast err to awserr.Error to get the Code and
  1852  			// Message from an error.
  1853  			fmt.Println(err.Error())
  1854  		}
  1855  		return
  1856  	}
  1857  
  1858  	fmt.Println(result)
  1859  }