本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/cloudhsm.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了New函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExampleCloudHSM_ModifyHapg
func ExampleCloudHSM_ModifyHapg() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudhsm.New(sess)
params := &cloudhsm.ModifyHapgInput{
HapgArn: aws.String("HapgArn"), // Required
Label: aws.String("Label"),
PartitionSerialList: []*string{
aws.String("PartitionSerial"), // Required
// More values...
},
}
resp, err := svc.ModifyHapg(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例2: ExampleCloudHSM_GetConfig
func ExampleCloudHSM_GetConfig() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudhsm.New(sess)
params := &cloudhsm.GetConfigInput{
ClientArn: aws.String("ClientArn"), // Required
ClientVersion: aws.String("ClientVersion"), // Required
HapgList: []*string{ // Required
aws.String("HapgArn"), // Required
// More values...
},
}
resp, err := svc.GetConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例3: ExampleCloudHSM_ListHsms
func ExampleCloudHSM_ListHsms() {
svc := cloudhsm.New(nil)
params := &cloudhsm.ListHsmsInput{
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListHsms(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 always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例4: ExampleCloudHSM_DescribeHsm
func ExampleCloudHSM_DescribeHsm() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudhsm.New(sess)
params := &cloudhsm.DescribeHsmInput{
HsmArn: aws.String("HsmArn"),
HsmSerialNumber: aws.String("HsmSerialNumber"),
}
resp, err := svc.DescribeHsm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例5: ExampleCloudHSM_ModifyHapg
func ExampleCloudHSM_ModifyHapg() {
svc := cloudhsm.New(nil)
params := &cloudhsm.ModifyHapgInput{
HapgArn: aws.String("HapgArn"), // Required
Label: aws.String("Label"),
PartitionSerialList: []*string{
aws.String("PartitionSerial"), // Required
// More values...
},
}
resp, err := svc.ModifyHapg(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 always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例6: ExampleCloudHSM_CreateHsm
func ExampleCloudHSM_CreateHsm() {
svc := cloudhsm.New(nil)
params := &cloudhsm.CreateHsmInput{
IamRoleArn: aws.String("IamRoleArn"), // Required
SshKey: aws.String("SshKey"), // Required
SubnetId: aws.String("SubnetId"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
ClientToken: aws.String("ClientToken"),
EniIp: aws.String("IpAddress"),
ExternalId: aws.String("ExternalId"),
SyslogIp: aws.String("IpAddress"),
}
resp, err := svc.CreateHsm(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 always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例7: ExampleCloudHSM_ModifyHsm
func ExampleCloudHSM_ModifyHsm() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudhsm.New(sess)
params := &cloudhsm.ModifyHsmInput{
HsmArn: aws.String("HsmArn"), // Required
EniIp: aws.String("IpAddress"),
ExternalId: aws.String("ExternalId"),
IamRoleArn: aws.String("IamRoleArn"),
SubnetId: aws.String("SubnetId"),
SyslogIp: aws.String("IpAddress"),
}
resp, err := svc.ModifyHsm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例8: ExampleCloudHSM_ModifyLunaClient
func ExampleCloudHSM_ModifyLunaClient() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudhsm.New(sess)
params := &cloudhsm.ModifyLunaClientInput{
Certificate: aws.String("Certificate"), // Required
ClientArn: aws.String("ClientArn"), // Required
}
resp, err := svc.ModifyLunaClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例9: ExampleCloudHSM_CreateLunaClient
func ExampleCloudHSM_CreateLunaClient() {
svc := cloudhsm.New(nil)
params := &cloudhsm.CreateLunaClientInput{
Certificate: aws.String("Certificate"), // Required
Label: aws.String("ClientLabel"),
}
resp, err := svc.CreateLunaClient(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 always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例10: ExampleCloudHSM_CreateHsm
func ExampleCloudHSM_CreateHsm() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.CreateHsmInput{
IamRoleArn: aws.String("IamRoleArn"), // Required
SshKey: aws.String("SshKey"), // Required
SubnetId: aws.String("SubnetId"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
ClientToken: aws.String("ClientToken"),
EniIp: aws.String("IpAddress"),
ExternalId: aws.String("ExternalId"),
SyslogIp: aws.String("IpAddress"),
}
resp, err := svc.CreateHsm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例11: ExampleCloudHSM_AddTagsToResource
func ExampleCloudHSM_AddTagsToResource() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.AddTagsToResourceInput{
ResourceArn: aws.String("String"), // Required
TagList: []*cloudhsm.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"), // Required
},
// More values...
},
}
resp, err := svc.AddTagsToResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例12: ExampleCloudHSM_DescribeHSM
func ExampleCloudHSM_DescribeHSM() {
svc := cloudhsm.New(nil)
params := &cloudhsm.DescribeHSMInput{
HSMARN: aws.String("HsmArn"),
HSMSerialNumber: aws.String("HsmSerialNumber"),
}
resp, err := svc.DescribeHSM(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 always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例13: ExampleCloudHSM_GetConfig
func ExampleCloudHSM_GetConfig() {
svc := cloudhsm.New(nil)
params := &cloudhsm.GetConfigInput{
ClientARN: aws.String("ClientArn"), // Required
ClientVersion: aws.String("ClientVersion"), // Required
HAPGList: []*string{ // Required
aws.String("HapgArn"), // Required
// More values...
},
}
resp, err := svc.GetConfig(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 always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例14: ExampleCloudHSM_ModifyHSM
func ExampleCloudHSM_ModifyHSM() {
svc := cloudhsm.New(nil)
params := &cloudhsm.ModifyHSMInput{
HSMARN: aws.String("HsmArn"), // Required
ENIIP: aws.String("IpAddress"),
ExternalID: aws.String("ExternalId"),
IAMRoleARN: aws.String("IamRoleArn"),
SubnetID: aws.String("SubnetId"),
SyslogIP: aws.String("IpAddress"),
}
resp, err := svc.ModifyHSM(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 always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例15: ExampleCloudHSM_RemoveTagsFromResource
func ExampleCloudHSM_RemoveTagsFromResource() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudhsm.New(sess)
params := &cloudhsm.RemoveTagsFromResourceInput{
ResourceArn: aws.String("String"), // Required
TagKeyList: []*string{ // Required
aws.String("TagKey"), // Required
// More values...
},
}
resp, err := svc.RemoveTagsFromResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}