本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/ssm.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleSSM_CancelCommand
func ExampleSSM_CancelCommand() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ssm.New(sess)
params := &ssm.CancelCommandInput{
CommandId: aws.String("CommandId"), // Required
InstanceIds: []*string{
aws.String("InstanceId"), // Required
// More values...
},
}
resp, err := svc.CancelCommand(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:28,代码来源:examples_test.go
示例2: ExampleSSM_ListAssociations
func ExampleSSM_ListAssociations() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ssm.New(sess)
params := &ssm.ListAssociationsInput{
AssociationFilterList: []*ssm.AssociationFilter{ // Required
{ // Required
Key: aws.String("AssociationFilterKey"), // Required
Value: aws.String("AssociationFilterValue"), // Required
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListAssociations(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:32,代码来源:examples_test.go
示例3: ExampleSSM_RemoveTagsFromResource
func ExampleSSM_RemoveTagsFromResource() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ssm.New(sess)
params := &ssm.RemoveTagsFromResourceInput{
ResourceId: aws.String("ResourceId"), // Required
ResourceType: aws.String("ResourceTypeForTagging"), // Required
TagKeys: []*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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:29,代码来源:examples_test.go
示例4: ExampleSSM_DescribeDocumentPermission
func ExampleSSM_DescribeDocumentPermission() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ssm.New(sess)
params := &ssm.DescribeDocumentPermissionInput{
Name: aws.String("DocumentName"), // Required
PermissionType: aws.String("DocumentPermissionType"), // Required
}
resp, err := svc.DescribeDocumentPermission(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:25,代码来源:examples_test.go
示例5: ExampleSSM_AddTagsToResource
func ExampleSSM_AddTagsToResource() {
svc := ssm.New(session.New())
params := &ssm.AddTagsToResourceInput{
ResourceId: aws.String("ResourceId"), // Required
ResourceType: aws.String("ResourceTypeForTagging"), // Required
Tags: []*ssm.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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:26,代码来源:examples_test.go
示例6: ExampleSSM_CreateAssociation
func ExampleSSM_CreateAssociation() {
svc := ssm.New(session.New())
params := &ssm.CreateAssociationInput{
InstanceId: aws.String("InstanceId"), // Required
Name: aws.String("DocumentName"), // Required
Parameters: map[string][]*string{
"Key": { // Required
aws.String("ParameterValue"), // Required
// More values...
},
// More values...
},
}
resp, err := svc.CreateAssociation(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:26,代码来源:examples_test.go
示例7: ExampleSSM_DescribeInstanceProperties
func ExampleSSM_DescribeInstanceProperties() {
svc := ssm.New(session.New())
params := &ssm.DescribeInstancePropertiesInput{
InstancePropertyFilterList: []*ssm.InstancePropertyFilter{
{ // Required
Key: aws.String("InstancePropertyFilterKey"), // Required
ValueSet: []*string{ // Required
aws.String("InstancePropertyFilterValue"), // Required
// More values...
},
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeInstanceProperties(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:29,代码来源:examples_test.go
示例8: ExampleSSM_ListDocuments
func ExampleSSM_ListDocuments() {
svc := ssm.New(session.New())
params := &ssm.ListDocumentsInput{
DocumentFilterList: []*ssm.DocumentFilter{
{ // Required
Key: aws.String("DocumentFilterKey"), // Required
Value: aws.String("DocumentFilterValue"), // Required
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListDocuments(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:26,代码来源:examples_test.go
示例9: ExampleSSM_DescribeActivations
func ExampleSSM_DescribeActivations() {
svc := ssm.New(session.New())
params := &ssm.DescribeActivationsInput{
Filters: []*ssm.DescribeActivationsFilter{
{ // Required
FilterKey: aws.String("DescribeActivationsFilterKeys"),
FilterValues: []*string{
aws.String("String"), // Required
// More values...
},
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeActivations(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:29,代码来源:examples_test.go
示例10: ExampleSSM_CreateActivation
func ExampleSSM_CreateActivation() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ssm.New(sess)
params := &ssm.CreateActivationInput{
IamRole: aws.String("IamRole"), // Required
DefaultInstanceName: aws.String("DefaultInstanceName"),
Description: aws.String("ActivationDescription"),
ExpirationDate: aws.Time(time.Now()),
RegistrationLimit: aws.Int64(1),
}
resp, err := svc.CreateActivation(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:28,代码来源:examples_test.go
示例11: ExampleSSM_UpdateAssociationStatus
func ExampleSSM_UpdateAssociationStatus() {
svc := ssm.New(session.New())
params := &ssm.UpdateAssociationStatusInput{
AssociationStatus: &ssm.AssociationStatus{ // Required
Date: aws.Time(time.Now()), // Required
Message: aws.String("StatusMessage"), // Required
Name: aws.String("AssociationStatusName"), // Required
AdditionalInfo: aws.String("StatusAdditionalInfo"),
},
InstanceId: aws.String("InstanceId"), // Required
Name: aws.String("DocumentName"), // Required
}
resp, err := svc.UpdateAssociationStatus(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:25,代码来源:examples_test.go
示例12: ExampleSSM_ModifyDocumentPermission
func ExampleSSM_ModifyDocumentPermission() {
svc := ssm.New(session.New())
params := &ssm.ModifyDocumentPermissionInput{
Name: aws.String("DocumentName"), // Required
PermissionType: aws.String("DocumentPermissionType"), // Required
AccountIdsToAdd: []*string{
aws.String("AccountId"), // Required
// More values...
},
AccountIdsToRemove: []*string{
aws.String("AccountId"), // Required
// More values...
},
}
resp, err := svc.ModifyDocumentPermission(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:27,代码来源:examples_test.go
示例13: ExampleSSM_CreateDocument
func ExampleSSM_CreateDocument() {
svc := ssm.New(nil)
params := &ssm.CreateDocumentInput{
Content: aws.String("DocumentContent"), // Required
Name: aws.String("DocumentName"), // Required
}
resp, err := svc.CreateDocument(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))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例14: ExampleSSM_SendCommand
func ExampleSSM_SendCommand() {
svc := ssm.New(session.New())
params := &ssm.SendCommandInput{
DocumentName: aws.String("DocumentName"), // Required
InstanceIds: []*string{ // Required
aws.String("InstanceId"), // Required
// More values...
},
Comment: aws.String("Comment"),
OutputS3BucketName: aws.String("S3BucketName"),
OutputS3KeyPrefix: aws.String("S3KeyPrefix"),
Parameters: map[string][]*string{
"Key": { // Required
aws.String("ParameterValue"), // Required
// More values...
},
// More values...
},
TimeoutSeconds: aws.Int64(1),
}
resp, err := svc.SendCommand(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)
}
开发者ID:charles-at-linknext,项目名称:aws-sdk-go,代码行数:33,代码来源:examples_test.go
示例15: ExampleSSM_ListDocuments
func ExampleSSM_ListDocuments() {
svc := ssm.New(nil)
params := &ssm.ListDocumentsInput{
DocumentFilterList: []*ssm.DocumentFilter{
{ // Required
Key: aws.String("DocumentFilterKey"), // Required
Value: aws.String("DocumentFilterValue"), // Required
},
// More values...
},
MaxResults: aws.Long(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListDocuments(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))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go
示例16: ExampleSSM_UpdateAssociationStatus
func ExampleSSM_UpdateAssociationStatus() {
svc := ssm.New(nil)
params := &ssm.UpdateAssociationStatusInput{
AssociationStatus: &ssm.AssociationStatus{ // Required
Date: aws.Time(time.Now()), // Required
Message: aws.String("StatusMessage"), // Required
Name: aws.String("AssociationStatusName"), // Required
AdditionalInfo: aws.String("StatusAdditionalInfo"),
},
InstanceID: aws.String("InstanceId"), // Required
Name: aws.String("DocumentName"), // Required
}
resp, err := svc.UpdateAssociationStatus(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))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:33,代码来源:examples_test.go
示例17: ExampleSSM_UpdateInstanceInformation
func ExampleSSM_UpdateInstanceInformation() {
svc := ssm.New(session.New())
params := &ssm.UpdateInstanceInformationInput{
InstanceId: aws.String("InstanceId"), // Required
AgentStatus: aws.String("AgentStatus"),
AgentVersion: aws.String("Version"),
ComputerName: aws.String("String"),
IPAddress: aws.String("IPAddress"),
PlatformName: aws.String("String"),
PlatformType: aws.String("PlatformType"),
PlatformVersion: aws.String("String"),
}
resp, err := svc.UpdateInstanceInformation(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:25,代码来源:examples_test.go
示例18: ExampleSSM_CreateAssociationBatch
func ExampleSSM_CreateAssociationBatch() {
svc := ssm.New(nil)
params := &ssm.CreateAssociationBatchInput{
Entries: []*ssm.CreateAssociationBatchRequestEntry{ // Required
{ // Required
InstanceID: aws.String("InstanceId"),
Name: aws.String("DocumentName"),
},
// More values...
},
}
resp, err := svc.CreateAssociationBatch(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))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:32,代码来源:examples_test.go
示例19: ExampleSSM_UpdateManagedInstanceRole
func ExampleSSM_UpdateManagedInstanceRole() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ssm.New(sess)
params := &ssm.UpdateManagedInstanceRoleInput{
IamRole: aws.String("IamRole"), // Required
InstanceId: aws.String("ManagedInstanceId"), // Required
}
resp, err := svc.UpdateManagedInstanceRole(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:25,代码来源:examples_test.go
示例20: ExampleSSM_ListCommandInvocations
func ExampleSSM_ListCommandInvocations() {
svc := ssm.New(session.New())
params := &ssm.ListCommandInvocationsInput{
CommandId: aws.String("CommandId"),
Details: aws.Bool(true),
Filters: []*ssm.CommandFilter{
{ // Required
Key: aws.String("CommandFilterKey"), // Required
Value: aws.String("CommandFilterValue"), // Required
},
// More values...
},
InstanceId: aws.String("InstanceId"),
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListCommandInvocations(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)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:29,代码来源:examples_test.go
注:本文中的github.com/aws/aws-sdk-go/service/ssm.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论