本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/service/storagegateway.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleStorageGateway_DescribeTapeArchives
func ExampleStorageGateway_DescribeTapeArchives() {
svc := storagegateway.New(nil)
params := &storagegateway.DescribeTapeArchivesInput{
Limit: aws.Long(1),
Marker: aws.String("Marker"),
TapeARNs: []*string{
aws.String("TapeARN"), // Required
// More values...
},
}
resp, err := svc.DescribeTapeArchives(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例2: ExampleStorageGateway_ListLocalDisks
func ExampleStorageGateway_ListLocalDisks() {
svc := storagegateway.New(nil)
params := &storagegateway.ListLocalDisksInput{
GatewayARN: aws.String("GatewayARN"), // Required
}
resp, err := svc.ListLocalDisks(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例3: ExampleStorageGateway_CreateTapes
func ExampleStorageGateway_CreateTapes() {
svc := storagegateway.New(nil)
params := &storagegateway.CreateTapesInput{
ClientToken: aws.String("ClientToken"), // Required
GatewayARN: aws.String("GatewayARN"), // Required
NumTapesToCreate: aws.Long(1), // Required
TapeBarcodePrefix: aws.String("TapeBarcodePrefix"), // Required
TapeSizeInBytes: aws.Long(1), // Required
}
resp, err := svc.CreateTapes(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例4: ExampleStorageGateway_CreateStorediSCSIVolume
func ExampleStorageGateway_CreateStorediSCSIVolume() {
svc := storagegateway.New(nil)
params := &storagegateway.CreateStorediSCSIVolumeInput{
DiskID: aws.String("DiskId"), // Required
GatewayARN: aws.String("GatewayARN"), // Required
NetworkInterfaceID: aws.String("NetworkInterfaceId"), // Required
PreserveExistingData: aws.Boolean(true), // Required
TargetName: aws.String("TargetName"), // Required
SnapshotID: aws.String("SnapshotId"),
}
resp, err := svc.CreateStorediSCSIVolume(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例5: ExampleStorageGateway_ActivateGateway
func ExampleStorageGateway_ActivateGateway() {
svc := storagegateway.New(nil)
params := &storagegateway.ActivateGatewayInput{
ActivationKey: aws.String("ActivationKey"), // Required
GatewayName: aws.String("GatewayName"), // Required
GatewayRegion: aws.String("RegionId"), // Required
GatewayTimezone: aws.String("GatewayTimezone"), // Required
GatewayType: aws.String("GatewayType"),
MediumChangerType: aws.String("MediumChangerType"),
TapeDriveType: aws.String("TapeDriveType"),
}
resp, err := svc.ActivateGateway(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例6: ExampleStorageGateway_UpdateSnapshotSchedule
func ExampleStorageGateway_UpdateSnapshotSchedule() {
svc := storagegateway.New(nil)
params := &storagegateway.UpdateSnapshotScheduleInput{
RecurrenceInHours: aws.Long(1), // Required
StartAt: aws.Long(1), // Required
VolumeARN: aws.String("VolumeARN"), // Required
Description: aws.String("Description"),
}
resp, err := svc.UpdateSnapshotSchedule(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例7: ExampleStorageGateway_UpdateChapCredentials
func ExampleStorageGateway_UpdateChapCredentials() {
svc := storagegateway.New(nil)
params := &storagegateway.UpdateChapCredentialsInput{
InitiatorName: aws.String("IqnName"), // Required
SecretToAuthenticateInitiator: aws.String("ChapSecret"), // Required
TargetARN: aws.String("TargetARN"), // Required
SecretToAuthenticateTarget: aws.String("ChapSecret"),
}
resp, err := svc.UpdateChapCredentials(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例8: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*storagegatewayiface.StorageGatewayAPI)(nil), storagegateway.New(nil))
}
示例9: init
func init() {
Before("@storagegateway", func() {
World["client"] = storagegateway.New(nil)
})
}