From 64510d9cfbb3a8540465722ca23717416b800268 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Thu, 25 Aug 2016 09:47:24 +0100 Subject: [PATCH] provider/aws: Adding `aws_ssm_document` resource (#8460) * provider/aws: add `aws_ssm_document` resource * provider/aws: Changes to `aws_ssm_document` post code review The changes are things like using d.Id rather than d.Get("name").(string) and errwrap.Wrapf rather than fmt.Errorf --- builtin/providers/aws/config.go | 3 + builtin/providers/aws/provider.go | 1 + .../aws/resource_aws_ssm_document.go | 309 ++ .../aws/resource_aws_ssm_document_test.go | 248 + .../aws/aws-sdk-go/service/ssm/api.go | 4057 +++++++++++++++++ .../aws/aws-sdk-go/service/ssm/service.go | 204 + vendor/vendor.json | 8 + .../aws/r/ssm_document.html.markdown | 73 + 8 files changed, 4903 insertions(+) create mode 100644 builtin/providers/aws/resource_aws_ssm_document.go create mode 100644 builtin/providers/aws/resource_aws_ssm_document_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ssm/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ssm/service.go create mode 100644 website/source/docs/providers/aws/r/ssm_document.html.markdown diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index 723493063..e67fef103 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -50,6 +50,7 @@ import ( "github.com/aws/aws-sdk-go/service/simpledb" "github.com/aws/aws-sdk-go/service/sns" "github.com/aws/aws-sdk-go/service/sqs" + "github.com/aws/aws-sdk-go/service/ssm" "github.com/aws/aws-sdk-go/service/sts" "github.com/hashicorp/errwrap" "github.com/hashicorp/go-cleanhttp" @@ -127,6 +128,7 @@ type AWSClient struct { glacierconn *glacier.Glacier codedeployconn *codedeploy.CodeDeploy codecommitconn *codecommit.CodeCommit + ssmconn *ssm.SSM } // Client configures and returns a fully initialized AWSClient @@ -269,6 +271,7 @@ func (c *Config) Client() (interface{}, error) { client.sesConn = ses.New(sess) client.snsconn = sns.New(sess) client.sqsconn = sqs.New(sess) + client.ssmconn = ssm.New(sess) } if len(errs) > 0 { diff --git a/builtin/providers/aws/provider.go b/builtin/providers/aws/provider.go index c3049a173..29db928eb 100644 --- a/builtin/providers/aws/provider.go +++ b/builtin/providers/aws/provider.go @@ -312,6 +312,7 @@ func Provider() terraform.ResourceProvider { "aws_security_group": resourceAwsSecurityGroup(), "aws_security_group_rule": resourceAwsSecurityGroupRule(), "aws_simpledb_domain": resourceAwsSimpleDBDomain(), + "aws_ssm_document": resourceAwsSsmDocument(), "aws_spot_instance_request": resourceAwsSpotInstanceRequest(), "aws_spot_fleet_request": resourceAwsSpotFleetRequest(), "aws_sqs_queue": resourceAwsSqsQueue(), diff --git a/builtin/providers/aws/resource_aws_ssm_document.go b/builtin/providers/aws/resource_aws_ssm_document.go new file mode 100644 index 000000000..94dbaa0d3 --- /dev/null +++ b/builtin/providers/aws/resource_aws_ssm_document.go @@ -0,0 +1,309 @@ +package aws + +import ( + "log" + "strings" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ssm" + "github.com/hashicorp/errwrap" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsSsmDocument() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsSsmDocumentCreate, + Read: resourceAwsSsmDocumentRead, + Update: resourceAwsSsmDocumentUpdate, + Delete: resourceAwsSsmDocumentDelete, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + }, + "content": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "hash": { + Type: schema.TypeString, + Computed: true, + }, + "hash_type": { + Type: schema.TypeString, + Computed: true, + }, + "owner": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "platform_type": { + Type: schema.TypeString, + Computed: true, + }, + "parameter": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Optional: true, + }, + "default_value": { + Type: schema.TypeString, + Optional: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "permissions": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Required: true, + }, + "account_ids": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + } +} + +func resourceAwsSsmDocumentCreate(d *schema.ResourceData, meta interface{}) error { + ssmconn := meta.(*AWSClient).ssmconn + + log.Printf("[INFO] Creating SSM Document: %s", d.Get("name").(string)) + + docInput := &ssm.CreateDocumentInput{ + Name: aws.String(d.Get("name").(string)), + Content: aws.String(d.Get("content").(string)), + } + + resp, err := ssmconn.CreateDocument(docInput) + + if err != nil { + return errwrap.Wrapf("[ERROR] Error creating SSM document: {{err}}", err) + } + + d.SetId(*resp.DocumentDescription.Name) + + if v, ok := d.GetOk("permissions"); ok && v != nil { + setDocumentPermissions(d, meta) + } else { + log.Printf("[DEBUG] Not setting permissions for %q", d.Id()) + } + + return resourceAwsSsmDocumentRead(d, meta) +} + +func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error { + ssmconn := meta.(*AWSClient).ssmconn + + log.Printf("[DEBUG] Reading SSM Document: %s", d.Id()) + + docInput := &ssm.DescribeDocumentInput{ + Name: aws.String(d.Get("name").(string)), + } + + resp, err := ssmconn.DescribeDocument(docInput) + + if err != nil { + return errwrap.Wrapf("[ERROR] Error describing SSM document: {{err}}", err) + } + + doc := resp.Document + d.Set("created_date", doc.CreatedDate) + d.Set("description", doc.Description) + d.Set("hash", doc.Hash) + d.Set("hash_type", doc.HashType) + d.Set("name", doc.Name) + d.Set("owner", doc.Owner) + d.Set("platform_type", doc.PlatformTypes[0]) + d.Set("status", doc.Status) + + gp, err := getDocumentPermissions(d, meta) + + if err != nil { + return errwrap.Wrapf("[ERROR] Error reading SSM document permissions: {{err}}", err) + } + + d.Set("permissions", gp) + + params := make([]map[string]interface{}, 0) + for i := 0; i < len(doc.Parameters); i++ { + + dp := doc.Parameters[i] + param := make(map[string]interface{}) + + if dp.DefaultValue != nil { + param["default_value"] = *dp.DefaultValue + } + param["description"] = *dp.Description + param["name"] = *dp.Name + param["type"] = *dp.Type + params = append(params, param) + } + + if len(params) == 0 { + params = make([]map[string]interface{}, 1) + } + + if err := d.Set("parameter", params); err != nil { + return err + } + + return nil +} + +func resourceAwsSsmDocumentUpdate(d *schema.ResourceData, meta interface{}) error { + + if _, ok := d.GetOk("permissions"); ok { + setDocumentPermissions(d, meta) + } else { + log.Printf("[DEBUG] Not setting document permissions on %q", d.Id()) + } + + return resourceAwsSsmDocumentRead(d, meta) +} + +func resourceAwsSsmDocumentDelete(d *schema.ResourceData, meta interface{}) error { + ssmconn := meta.(*AWSClient).ssmconn + + deleteDocumentPermissions(d, meta) + + log.Printf("[INFO] Deleting SSM Document: %s", d.Id()) + + params := &ssm.DeleteDocumentInput{ + Name: aws.String(d.Get("name").(string)), + } + + _, err := ssmconn.DeleteDocument(params) + + if err != nil { + return err + } + + return nil +} + +func setDocumentPermissions(d *schema.ResourceData, meta interface{}) error { + ssmconn := meta.(*AWSClient).ssmconn + + log.Printf("[INFO] Setting permissions for document: %s", d.Id()) + permission := d.Get("permissions").(map[string]interface{}) + + ids := aws.StringSlice([]string{permission["account_ids"].(string)}) + + if strings.Contains(permission["account_ids"].(string), ",") { + ids = aws.StringSlice(strings.Split(permission["account_ids"].(string), ",")) + } + + permInput := &ssm.ModifyDocumentPermissionInput{ + Name: aws.String(d.Get("name").(string)), + PermissionType: aws.String(permission["type"].(string)), + AccountIdsToAdd: ids, + } + + _, err := ssmconn.ModifyDocumentPermission(permInput) + + if err != nil { + return errwrap.Wrapf("[ERROR] Error setting permissions for SSM document: {{err}}", err) + } + + return nil +} + +func getDocumentPermissions(d *schema.ResourceData, meta interface{}) (map[string]interface{}, error) { + ssmconn := meta.(*AWSClient).ssmconn + + log.Printf("[INFO] Getting permissions for document: %s", d.Id()) + + //How to get from nested scheme resource? + permissionType := "Share" + + permInput := &ssm.DescribeDocumentPermissionInput{ + Name: aws.String(d.Get("name").(string)), + PermissionType: aws.String(permissionType), + } + + resp, err := ssmconn.DescribeDocumentPermission(permInput) + + if err != nil { + return nil, errwrap.Wrapf("[ERROR] Error setting permissions for SSM document: {{err}}", err) + } + + var account_ids = make([]string, len(resp.AccountIds)) + for i := 0; i < len(resp.AccountIds); i++ { + account_ids[i] = *resp.AccountIds[i] + } + + var ids = "" + if len(account_ids) == 1 { + ids = account_ids[0] + } else if len(account_ids) > 1 { + ids = strings.Join(account_ids, ",") + } else { + ids = "" + } + + if ids == "" { + return nil, nil + } + + perms := make(map[string]interface{}) + perms["type"] = permissionType + perms["account_ids"] = ids + + return perms, nil +} + +func deleteDocumentPermissions(d *schema.ResourceData, meta interface{}) error { + ssmconn := meta.(*AWSClient).ssmconn + + log.Printf("[INFO] Removing permissions from document: %s", d.Id()) + + permInput := &ssm.ModifyDocumentPermissionInput{ + Name: aws.String(d.Get("name").(string)), + PermissionType: aws.String("Share"), + AccountIdsToRemove: aws.StringSlice(strings.Split("all", ",")), + } + + _, err := ssmconn.ModifyDocumentPermission(permInput) + + if err != nil { + return errwrap.Wrapf("[ERROR] Error removing permissions for SSM document: {{err}}", err) + } + + return nil +} diff --git a/builtin/providers/aws/resource_aws_ssm_document_test.go b/builtin/providers/aws/resource_aws_ssm_document_test.go new file mode 100644 index 000000000..de05198cd --- /dev/null +++ b/builtin/providers/aws/resource_aws_ssm_document_test.go @@ -0,0 +1,248 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/ssm" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAWSSSMDocument_basic(t *testing.T) { + name := acctest.RandString(10) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMDocumentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSSSMDocumentBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMDocumentExists("aws_ssm_document.foo"), + ), + }, + }, + }) +} + +func TestAccAWSSSMDocument_permission(t *testing.T) { + name := acctest.RandString(10) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMDocumentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSSSMDocumentPermissionConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMDocumentExists("aws_ssm_document.foo"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "permissions.type", "Share"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "permissions.account_ids", "all"), + ), + }, + }, + }) +} + +func TestAccAWSSSMDocument_params(t *testing.T) { + name := acctest.RandString(10) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMDocumentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSSSMDocumentParamConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMDocumentExists("aws_ssm_document.foo"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "parameter.0.name", "commands"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "parameter.0.type", "StringList"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "parameter.1.name", "workingDirectory"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "parameter.1.type", "String"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "parameter.2.name", "executionTimeout"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "parameter.2.type", "String"), + ), + }, + }, + }) +} + +func testAccCheckAWSSSMDocumentExists(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No SSM Document ID is set") + } + + conn := testAccProvider.Meta().(*AWSClient).ssmconn + + _, err := conn.DescribeDocument(&ssm.DescribeDocumentInput{ + Name: aws.String(rs.Primary.ID), + }) + if err != nil { + return err + } + + return nil + } +} + +func testAccCheckAWSSSMDocumentDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).ssmconn + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_ssm_document" { + continue + } + + out, err := conn.DescribeDocument(&ssm.DescribeDocumentInput{ + Name: aws.String(rs.Primary.Attributes["name"]), + }) + + if err != nil { + // InvalidDocument means it's gone, this is good + if wserr, ok := err.(awserr.Error); ok && wserr.Code() == "InvalidDocument" { + return nil + } + return err + } + + if out != nil { + return fmt.Errorf("Expected AWS SSM Document to be gone, but was still found") + } + + return nil + } + + return fmt.Errorf("Default error in SSM Document Test") +} + +/* +Based on examples from here: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/create-ssm-doc.html +*/ + +func testAccAWSSSMDocumentBasicConfig(rName string) string { + return fmt.Sprintf(` +resource "aws_ssm_document" "foo" { + name = "test_document-%s" + + content = < 0 { + return invalidParams + } + return nil +} + +type AddTagsToResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s AddTagsToResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AddTagsToResourceOutput) GoString() string { + return s.String() +} + +// Describes an association of an SSM document and an instance. +type Association struct { + _ struct{} `type:"structure"` + + // The ID of the instance. + InstanceId *string `type:"string"` + + // The name of the SSM document. + Name *string `type:"string"` +} + +// String returns the string representation +func (s Association) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Association) GoString() string { + return s.String() +} + +// Describes the parameters for a document. +type AssociationDescription struct { + _ struct{} `type:"structure"` + + // The date when the association was made. + Date *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The ID of the instance. + InstanceId *string `type:"string"` + + // The name of the SSM document. + Name *string `type:"string"` + + // A description of the parameters for a document. + Parameters map[string][]*string `type:"map"` + + // The association status. + Status *AssociationStatus `type:"structure"` +} + +// String returns the string representation +func (s AssociationDescription) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssociationDescription) GoString() string { + return s.String() +} + +// Describes a filter. +type AssociationFilter struct { + _ struct{} `type:"structure"` + + // The name of the filter. + Key *string `locationName:"key" type:"string" required:"true" enum:"AssociationFilterKey"` + + // The filter value. + Value *string `locationName:"value" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s AssociationFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssociationFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssociationFilter) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssociationFilter"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Describes an association status. +type AssociationStatus struct { + _ struct{} `type:"structure"` + + // A user-defined string. + AdditionalInfo *string `type:"string"` + + // The date when the status changed. + Date *time.Time `type:"timestamp" timestampFormat:"unix" required:"true"` + + // The reason for the status. + Message *string `type:"string" required:"true"` + + // The status. + Name *string `type:"string" required:"true" enum:"AssociationStatusName"` +} + +// String returns the string representation +func (s AssociationStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssociationStatus) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssociationStatus) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssociationStatus"} + if s.Date == nil { + invalidParams.Add(request.NewErrParamRequired("Date")) + } + if s.Message == nil { + invalidParams.Add(request.NewErrParamRequired("Message")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type CancelCommandInput struct { + _ struct{} `type:"structure"` + + // The ID of the command you want to cancel. + CommandId *string `min:"36" type:"string" required:"true"` + + // (Optional) A list of instance IDs on which you want to cancel the command. + // If not provided, the command is canceled on every instance on which it was + // requested. + InstanceIds []*string `min:"1" type:"list"` +} + +// String returns the string representation +func (s CancelCommandInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CancelCommandInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelCommandInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelCommandInput"} + if s.CommandId == nil { + invalidParams.Add(request.NewErrParamRequired("CommandId")) + } + if s.CommandId != nil && len(*s.CommandId) < 36 { + invalidParams.Add(request.NewErrParamMinLen("CommandId", 36)) + } + if s.InstanceIds != nil && len(s.InstanceIds) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InstanceIds", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Whether or not the command was successfully canceled. There is no guarantee +// that a request can be canceled. +type CancelCommandOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s CancelCommandOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CancelCommandOutput) GoString() string { + return s.String() +} + +// Describes a command request. +type Command struct { + _ struct{} `type:"structure"` + + // A unique identifier for this command. + CommandId *string `min:"36" type:"string"` + + // User-specified information about the command, such as a brief description + // of what the command should do. + Comment *string `type:"string"` + + // The name of the SSM document requested for execution. + DocumentName *string `type:"string"` + + // If this time is reached and the command has not already started executing, + // it will not execute. Calculated based on the ExpiresAfter user input provided + // as part of the SendCommand API. + ExpiresAfter *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The instance IDs against which this command was requested. + InstanceIds []*string `min:"1" type:"list"` + + // Configurations for sending notifications about command status changes. + NotificationConfig *NotificationConfig `type:"structure"` + + // The S3 bucket where the responses to the command executions should be stored. + // This was requested when issuing the command. + OutputS3BucketName *string `min:"3" type:"string"` + + // The S3 directory path inside the bucket where the responses to the command + // executions should be stored. This was requested when issuing the command. + OutputS3KeyPrefix *string `type:"string"` + + // The parameter values to be inserted in the SSM document when executing the + // command. + Parameters map[string][]*string `type:"map"` + + // The date and time the command was requested. + RequestedDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The IAM service role that SSM uses to act on your behalf when sending notifications + // about command status changes. + ServiceRole *string `type:"string"` + + // The status of the command. + Status *string `type:"string" enum:"CommandStatus"` +} + +// String returns the string representation +func (s Command) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Command) GoString() string { + return s.String() +} + +// Describes a command filter. +type CommandFilter struct { + _ struct{} `type:"structure"` + + // The name of the filter. For example, requested date and time. + Key *string `locationName:"key" type:"string" required:"true" enum:"CommandFilterKey"` + + // The filter value. For example: June 30, 2015. + Value *string `locationName:"value" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CommandFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CommandFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CommandFilter) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CommandFilter"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// An invocation is copy of a command sent to a specific instance. A command +// can apply to one or more instances. A command invocation applies to one instance. +// For example, if a user executes SendCommand against three instances, then +// a command invocation is created for each requested instance ID. A command +// invocation returns status and detail information about a command you executed. +type CommandInvocation struct { + _ struct{} `type:"structure"` + + // The command against which this invocation was requested. + CommandId *string `min:"36" type:"string"` + + CommandPlugins []*CommandPlugin `type:"list"` + + // User-specified information about the command, such as a brief description + // of what the command should do. + Comment *string `type:"string"` + + // The document name that was requested for execution. + DocumentName *string `type:"string"` + + // The instance ID in which this invocation was requested. + InstanceId *string `type:"string"` + + // Configurations for sending notifications about command status changes on + // a per instance basis. + NotificationConfig *NotificationConfig `type:"structure"` + + // The time and date the request was sent to this instance. + RequestedDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The IAM service role that SSM uses to act on your behalf when sending notifications + // about command status changes on a per instance basis. + ServiceRole *string `type:"string"` + + // Whether or not the invocation succeeded, failed, or is pending. + Status *string `type:"string" enum:"CommandInvocationStatus"` + + // Gets the trace output sent by the agent. + TraceOutput *string `type:"string"` +} + +// String returns the string representation +func (s CommandInvocation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CommandInvocation) GoString() string { + return s.String() +} + +// Describes plugin details. +type CommandPlugin struct { + _ struct{} `type:"structure"` + + // The name of the plugin. Must be one of the following: aws:updateAgent, aws:domainjoin, + // aws:applications, aws:runPowerShellScript, aws:psmodule, aws:cloudWatch, + // aws:runShellScript, or aws:updateSSMAgent. + Name *string `min:"4" type:"string"` + + // Output of the plugin execution. + Output *string `type:"string"` + + // The S3 bucket where the responses to the command executions should be stored. + // This was requested when issuing the command. + OutputS3BucketName *string `min:"3" type:"string"` + + // The S3 directory path inside the bucket where the responses to the command + // executions should be stored. This was requested when issuing the command. + OutputS3KeyPrefix *string `type:"string"` + + // A numeric response code generated after executing the plugin. + ResponseCode *int64 `type:"integer"` + + // The time the plugin stopped executing. Could stop prematurely if, for example, + // a cancel command was sent. + ResponseFinishDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The time the plugin started executing. + ResponseStartDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The status of this plugin. You can execute a document with multiple plugins. + Status *string `type:"string" enum:"CommandPluginStatus"` +} + +// String returns the string representation +func (s CommandPlugin) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CommandPlugin) GoString() string { + return s.String() +} + +type CreateActivationInput struct { + _ struct{} `type:"structure"` + + // The name of the registered, managed instance as it will appear in the Amazon + // EC2 console or when you use the AWS command line tools to list EC2 resources. + DefaultInstanceName *string `type:"string"` + + // A user-defined description of the resource that you want to register with + // Amazon EC2. + Description *string `type:"string"` + + // The date by which this activation request should expire. The default value + // is 24 hours. + ExpirationDate *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The Amazon Identity and Access Management (IAM) role that you want to assign + // to the managed instance. + IamRole *string `type:"string" required:"true"` + + // Specify the maximum number of managed instances you want to register. The + // default value is 1 instance. + RegistrationLimit *int64 `min:"1" type:"integer"` +} + +// String returns the string representation +func (s CreateActivationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateActivationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateActivationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateActivationInput"} + if s.IamRole == nil { + invalidParams.Add(request.NewErrParamRequired("IamRole")) + } + if s.RegistrationLimit != nil && *s.RegistrationLimit < 1 { + invalidParams.Add(request.NewErrParamMinValue("RegistrationLimit", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type CreateActivationOutput struct { + _ struct{} `type:"structure"` + + // The code the system generates when it processes the activation. The activation + // code functions like a password to validate the activation ID. + ActivationCode *string `min:"20" type:"string"` + + // The ID number generated by the system when it processed the activation. The + // activation ID functions like a user name. + ActivationId *string `type:"string"` +} + +// String returns the string representation +func (s CreateActivationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateActivationOutput) GoString() string { + return s.String() +} + +type CreateAssociationBatchInput struct { + _ struct{} `type:"structure"` + + // One or more associations. + Entries []*CreateAssociationBatchRequestEntry `locationNameList:"entries" type:"list" required:"true"` +} + +// String returns the string representation +func (s CreateAssociationBatchInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateAssociationBatchInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateAssociationBatchInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateAssociationBatchInput"} + if s.Entries == nil { + invalidParams.Add(request.NewErrParamRequired("Entries")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type CreateAssociationBatchOutput struct { + _ struct{} `type:"structure"` + + // Information about the associations that failed. + Failed []*FailedCreateAssociation `locationNameList:"FailedCreateAssociationEntry" type:"list"` + + // Information about the associations that succeeded. + Successful []*AssociationDescription `locationNameList:"AssociationDescription" type:"list"` +} + +// String returns the string representation +func (s CreateAssociationBatchOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateAssociationBatchOutput) GoString() string { + return s.String() +} + +// Describes the association of an SSM document and an instance. +type CreateAssociationBatchRequestEntry struct { + _ struct{} `type:"structure"` + + // The ID of the instance. + InstanceId *string `type:"string"` + + // The name of the configuration document. + Name *string `type:"string"` + + // A description of the parameters for a document. + Parameters map[string][]*string `type:"map"` +} + +// String returns the string representation +func (s CreateAssociationBatchRequestEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateAssociationBatchRequestEntry) GoString() string { + return s.String() +} + +type CreateAssociationInput struct { + _ struct{} `type:"structure"` + + // The instance ID. + InstanceId *string `type:"string" required:"true"` + + // The name of the SSM document. + Name *string `type:"string" required:"true"` + + // The parameters for the documents runtime configuration. + Parameters map[string][]*string `type:"map"` +} + +// String returns the string representation +func (s CreateAssociationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateAssociationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateAssociationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateAssociationInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type CreateAssociationOutput struct { + _ struct{} `type:"structure"` + + // Information about the association. + AssociationDescription *AssociationDescription `type:"structure"` +} + +// String returns the string representation +func (s CreateAssociationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateAssociationOutput) GoString() string { + return s.String() +} + +type CreateDocumentInput struct { + _ struct{} `type:"structure"` + + // A valid JSON string. + Content *string `min:"1" type:"string" required:"true"` + + // A name for the SSM document. + Name *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateDocumentInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateDocumentInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateDocumentInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateDocumentInput"} + if s.Content == nil { + invalidParams.Add(request.NewErrParamRequired("Content")) + } + if s.Content != nil && len(*s.Content) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Content", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type CreateDocumentOutput struct { + _ struct{} `type:"structure"` + + // Information about the SSM document. + DocumentDescription *DocumentDescription `type:"structure"` +} + +// String returns the string representation +func (s CreateDocumentOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateDocumentOutput) GoString() string { + return s.String() +} + +type DeleteActivationInput struct { + _ struct{} `type:"structure"` + + // The ID of the activation that you want to delete. + ActivationId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteActivationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteActivationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteActivationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteActivationInput"} + if s.ActivationId == nil { + invalidParams.Add(request.NewErrParamRequired("ActivationId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DeleteActivationOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteActivationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteActivationOutput) GoString() string { + return s.String() +} + +type DeleteAssociationInput struct { + _ struct{} `type:"structure"` + + // The ID of the instance. + InstanceId *string `type:"string" required:"true"` + + // The name of the SSM document. + Name *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteAssociationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteAssociationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteAssociationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteAssociationInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DeleteAssociationOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteAssociationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteAssociationOutput) GoString() string { + return s.String() +} + +type DeleteDocumentInput struct { + _ struct{} `type:"structure"` + + // The name of the SSM document. + Name *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteDocumentInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteDocumentInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDocumentInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDocumentInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DeleteDocumentOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteDocumentOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteDocumentOutput) GoString() string { + return s.String() +} + +type DeregisterManagedInstanceInput struct { + _ struct{} `type:"structure"` + + // The ID assigned to the managed instance when you registered it using the + // activation process. + InstanceId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeregisterManagedInstanceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeregisterManagedInstanceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeregisterManagedInstanceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeregisterManagedInstanceInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DeregisterManagedInstanceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeregisterManagedInstanceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeregisterManagedInstanceOutput) GoString() string { + return s.String() +} + +// Filter for the DescribeActivation API. +type DescribeActivationsFilter struct { + _ struct{} `type:"structure"` + + // The name of the filter. + FilterKey *string `type:"string" enum:"DescribeActivationsFilterKeys"` + + // The filter values. + FilterValues []*string `type:"list"` +} + +// String returns the string representation +func (s DescribeActivationsFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeActivationsFilter) GoString() string { + return s.String() +} + +type DescribeActivationsInput struct { + _ struct{} `type:"structure"` + + // A filter to view information about your activations. + Filters []*DescribeActivationsFilter `type:"list"` + + // The maximum number of items to return for this call. The call also returns + // a token that you can specify in a subsequent call to get the next set of + // results. + MaxResults *int64 `min:"1" type:"integer"` + + // A token to start the list. Use this token to get the next set of results. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeActivationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeActivationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeActivationsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeActivationsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeActivationsOutput struct { + _ struct{} `type:"structure"` + + // A list of activations for your AWS account. + ActivationList []*Activation `type:"list"` + + // The token for the next set of items to return. Use this token to get the + // next set of results. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeActivationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeActivationsOutput) GoString() string { + return s.String() +} + +type DescribeAssociationInput struct { + _ struct{} `type:"structure"` + + // The instance ID. + InstanceId *string `type:"string" required:"true"` + + // The name of the SSM document. + Name *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeAssociationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeAssociationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAssociationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeAssociationInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeAssociationOutput struct { + _ struct{} `type:"structure"` + + // Information about the association. + AssociationDescription *AssociationDescription `type:"structure"` +} + +// String returns the string representation +func (s DescribeAssociationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeAssociationOutput) GoString() string { + return s.String() +} + +type DescribeDocumentInput struct { + _ struct{} `type:"structure"` + + // The name of the SSM document. + Name *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeDocumentInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeDocumentInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDocumentInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeDocumentInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeDocumentOutput struct { + _ struct{} `type:"structure"` + + // Information about the SSM document. + Document *DocumentDescription `type:"structure"` +} + +// String returns the string representation +func (s DescribeDocumentOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeDocumentOutput) GoString() string { + return s.String() +} + +type DescribeDocumentPermissionInput struct { + _ struct{} `type:"structure"` + + // The name of the document for which you are the owner. + Name *string `type:"string" required:"true"` + + // The permission type for the document. The permission type can be Share. + PermissionType *string `type:"string" required:"true" enum:"DocumentPermissionType"` +} + +// String returns the string representation +func (s DescribeDocumentPermissionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeDocumentPermissionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDocumentPermissionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeDocumentPermissionInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.PermissionType == nil { + invalidParams.Add(request.NewErrParamRequired("PermissionType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeDocumentPermissionOutput struct { + _ struct{} `type:"structure"` + + // The account IDs that have permission to use this document. The ID can be + // either an AWS account or All. + AccountIds []*string `locationNameList:"AccountId" type:"list"` +} + +// String returns the string representation +func (s DescribeDocumentPermissionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeDocumentPermissionOutput) GoString() string { + return s.String() +} + +type DescribeInstanceInformationInput struct { + _ struct{} `type:"structure"` + + // One or more filters. Use a filter to return a more specific list of instances. + InstanceInformationFilterList []*InstanceInformationFilter `locationNameList:"InstanceInformationFilter" min:"1" type:"list"` + + // The maximum number of items to return for this call. The call also returns + // a token that you can specify in a subsequent call to get the next set of + // results. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeInstanceInformationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeInstanceInformationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeInstanceInformationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeInstanceInformationInput"} + if s.InstanceInformationFilterList != nil && len(s.InstanceInformationFilterList) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InstanceInformationFilterList", 1)) + } + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + if s.InstanceInformationFilterList != nil { + for i, v := range s.InstanceInformationFilterList { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "InstanceInformationFilterList", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeInstanceInformationOutput struct { + _ struct{} `type:"structure"` + + // The instance information list. + InstanceInformationList []*InstanceInformation `locationNameList:"InstanceInformation" type:"list"` + + // The token to use when requesting the next set of items. If there are no additional + // items to return, the string is empty. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeInstanceInformationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeInstanceInformationOutput) GoString() string { + return s.String() +} + +// Describes an SSM document. +type DocumentDescription struct { + _ struct{} `type:"structure"` + + // The date when the SSM document was created. + CreatedDate *time.Time `type:"timestamp" timestampFormat:"unix"` + + // A description of the document. + Description *string `type:"string"` + + // The Sha256 or Sha1 hash created by the system when the document was created. + // + // Sha1 hashes have been deprecated. + Hash *string `type:"string"` + + // Sha256 or Sha1. + // + // Sha1 hashes have been deprecated. + HashType *string `type:"string" enum:"DocumentHashType"` + + // The name of the SSM document. + Name *string `type:"string"` + + // The AWS user account of the person who created the document. + Owner *string `type:"string"` + + // A description of the parameters for a document. + Parameters []*DocumentParameter `locationNameList:"DocumentParameter" type:"list"` + + // The list of OS platforms compatible with this SSM document. + PlatformTypes []*string `locationNameList:"PlatformType" type:"list"` + + // The SHA1 hash of the document, which you can use for verification purposes. + Sha1 *string `type:"string"` + + // The status of the SSM document. + Status *string `type:"string" enum:"DocumentStatus"` +} + +// String returns the string representation +func (s DocumentDescription) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DocumentDescription) GoString() string { + return s.String() +} + +// Describes a filter. +type DocumentFilter struct { + _ struct{} `type:"structure"` + + // The name of the filter. + Key *string `locationName:"key" type:"string" required:"true" enum:"DocumentFilterKey"` + + // The value of the filter. + Value *string `locationName:"value" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DocumentFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DocumentFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DocumentFilter) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DocumentFilter"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Describes the name of an SSM document. +type DocumentIdentifier struct { + _ struct{} `type:"structure"` + + // The name of the SSM document. + Name *string `type:"string"` + + // The AWS user account of the person who created the document. + Owner *string `type:"string"` + + // The operating system platform. + PlatformTypes []*string `locationNameList:"PlatformType" type:"list"` +} + +// String returns the string representation +func (s DocumentIdentifier) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DocumentIdentifier) GoString() string { + return s.String() +} + +// Parameters specified in the SSM document that execute on the server when +// the command is run. +type DocumentParameter struct { + _ struct{} `type:"structure"` + + // If specified, the default values for the parameters. Parameters without a + // default value are required. Parameters with a default value are optional. + DefaultValue *string `type:"string"` + + // A description of what the parameter does, how to use it, the default value, + // and whether or not the parameter is optional. + Description *string `type:"string"` + + // The name of the parameter. + Name *string `type:"string"` + + // The type of parameter. The type can be either “String” or “StringList”. + Type *string `type:"string" enum:"DocumentParameterType"` +} + +// String returns the string representation +func (s DocumentParameter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DocumentParameter) GoString() string { + return s.String() +} + +// Describes a failed association. +type FailedCreateAssociation struct { + _ struct{} `type:"structure"` + + // The association. + Entry *CreateAssociationBatchRequestEntry `type:"structure"` + + // The source of the failure. + Fault *string `type:"string" enum:"Fault"` + + // A description of the failure. + Message *string `type:"string"` +} + +// String returns the string representation +func (s FailedCreateAssociation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FailedCreateAssociation) GoString() string { + return s.String() +} + +type GetDocumentInput struct { + _ struct{} `type:"structure"` + + // The name of the SSM document. + Name *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s GetDocumentInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetDocumentInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDocumentInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDocumentInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type GetDocumentOutput struct { + _ struct{} `type:"structure"` + + // The contents of the SSM document. + Content *string `min:"1" type:"string"` + + // The name of the SSM document. + Name *string `type:"string"` +} + +// String returns the string representation +func (s GetDocumentOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetDocumentOutput) GoString() string { + return s.String() +} + +// Describes a filter for a specific list of instances. +type InstanceInformation struct { + _ struct{} `type:"structure"` + + // The activation ID created by SSM when the server or VM was registered. + ActivationId *string `type:"string"` + + // The version of the SSM agent running on your instance. + AgentVersion *string `type:"string"` + + // The fully qualified host name of the managed instance. + ComputerName *string `min:"1" type:"string"` + + // The IP address of the managed instance. + IPAddress *string `min:"1" type:"string"` + + // The Amazon Identity and Access Management (IAM) role assigned to EC2 instances + // or managed instances. + IamRole *string `type:"string"` + + // The instance ID. + InstanceId *string `type:"string"` + + // Indicates whether latest version of the SSM agent is running on your instance. + IsLatestVersion *bool `type:"boolean"` + + // The date and time when agent last pinged SSM service. + LastPingDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The name of the managed instance. + Name *string `type:"string"` + + // Connection status of the SSM agent. + PingStatus *string `type:"string" enum:"PingStatus"` + + // The name of the operating system platform running on your instance. + PlatformName *string `type:"string"` + + // The operating system platform type. + PlatformType *string `type:"string" enum:"PlatformType"` + + // The version of the OS platform running on your instance. + PlatformVersion *string `type:"string"` + + // The date the server or VM was registered with AWS as a managed instance. + RegistrationDate *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The type of instance. Instances are either EC2 instances or managed instances. + ResourceType *string `type:"string" enum:"ResourceType"` +} + +// String returns the string representation +func (s InstanceInformation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceInformation) GoString() string { + return s.String() +} + +// Describes a filter for a specific list of instances. +type InstanceInformationFilter struct { + _ struct{} `type:"structure"` + + // The name of the filter. + Key *string `locationName:"key" type:"string" required:"true" enum:"InstanceInformationFilterKey"` + + // The filter values. + ValueSet []*string `locationName:"valueSet" locationNameList:"InstanceInformationFilterValue" min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s InstanceInformationFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceInformationFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InstanceInformationFilter) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InstanceInformationFilter"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.ValueSet == nil { + invalidParams.Add(request.NewErrParamRequired("ValueSet")) + } + if s.ValueSet != nil && len(s.ValueSet) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ValueSet", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListAssociationsInput struct { + _ struct{} `type:"structure"` + + // One or more filters. Use a filter to return a more specific list of results. + AssociationFilterList []*AssociationFilter `locationNameList:"AssociationFilter" min:"1" type:"list" required:"true"` + + // The maximum number of items to return for this call. The call also returns + // a token that you can specify in a subsequent call to get the next set of + // results. + MaxResults *int64 `min:"1" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListAssociationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListAssociationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListAssociationsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListAssociationsInput"} + if s.AssociationFilterList == nil { + invalidParams.Add(request.NewErrParamRequired("AssociationFilterList")) + } + if s.AssociationFilterList != nil && len(s.AssociationFilterList) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AssociationFilterList", 1)) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.AssociationFilterList != nil { + for i, v := range s.AssociationFilterList { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "AssociationFilterList", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListAssociationsOutput struct { + _ struct{} `type:"structure"` + + // The associations. + Associations []*Association `locationNameList:"Association" type:"list"` + + // The token to use when requesting the next set of items. If there are no additional + // items to return, the string is empty. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListAssociationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListAssociationsOutput) GoString() string { + return s.String() +} + +type ListCommandInvocationsInput struct { + _ struct{} `type:"structure"` + + // (Optional) The invocations for a specific command ID. + CommandId *string `min:"36" type:"string"` + + // (Optional) If set this returns the response of the command executions and + // any command output. By default this is set to False. + Details *bool `type:"boolean"` + + // (Optional) One or more filters. Use a filter to return a more specific list + // of results. + Filters []*CommandFilter `min:"1" type:"list"` + + // (Optional) The command execution details for a specific instance ID. + InstanceId *string `type:"string"` + + // (Optional) The maximum number of items to return for this call. The call + // also returns a token that you can specify in a subsequent call to get the + // next set of results. + MaxResults *int64 `min:"1" type:"integer"` + + // (Optional) The token for the next set of items to return. (You received this + // token from a previous call.) + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListCommandInvocationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCommandInvocationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListCommandInvocationsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListCommandInvocationsInput"} + if s.CommandId != nil && len(*s.CommandId) < 36 { + invalidParams.Add(request.NewErrParamMinLen("CommandId", 36)) + } + if s.Filters != nil && len(s.Filters) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Filters", 1)) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.Filters != nil { + for i, v := range s.Filters { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Filters", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListCommandInvocationsOutput struct { + _ struct{} `type:"structure"` + + // (Optional) A list of all invocations. + CommandInvocations []*CommandInvocation `type:"list"` + + // (Optional) The token for the next set of items to return. (You received this + // token from a previous call.) + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListCommandInvocationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCommandInvocationsOutput) GoString() string { + return s.String() +} + +type ListCommandsInput struct { + _ struct{} `type:"structure"` + + // (Optional) If provided, lists only the specified command. + CommandId *string `min:"36" type:"string"` + + // (Optional) One or more filters. Use a filter to return a more specific list + // of results. + Filters []*CommandFilter `min:"1" type:"list"` + + // (Optional) Lists commands issued against this instance ID. + InstanceId *string `type:"string"` + + // (Optional) The maximum number of items to return for this call. The call + // also returns a token that you can specify in a subsequent call to get the + // next set of results. + MaxResults *int64 `min:"1" type:"integer"` + + // (Optional) The token for the next set of items to return. (You received this + // token from a previous call.) + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListCommandsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCommandsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListCommandsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListCommandsInput"} + if s.CommandId != nil && len(*s.CommandId) < 36 { + invalidParams.Add(request.NewErrParamMinLen("CommandId", 36)) + } + if s.Filters != nil && len(s.Filters) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Filters", 1)) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.Filters != nil { + for i, v := range s.Filters { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Filters", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListCommandsOutput struct { + _ struct{} `type:"structure"` + + // (Optional) The list of commands requested by the user. + Commands []*Command `type:"list"` + + // (Optional) The token for the next set of items to return. (You received this + // token from a previous call.) + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListCommandsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCommandsOutput) GoString() string { + return s.String() +} + +type ListDocumentsInput struct { + _ struct{} `type:"structure"` + + // One or more filters. Use a filter to return a more specific list of results. + DocumentFilterList []*DocumentFilter `locationNameList:"DocumentFilter" min:"1" type:"list"` + + // The maximum number of items to return for this call. The call also returns + // a token that you can specify in a subsequent call to get the next set of + // results. + MaxResults *int64 `min:"1" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListDocumentsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListDocumentsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListDocumentsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListDocumentsInput"} + if s.DocumentFilterList != nil && len(s.DocumentFilterList) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DocumentFilterList", 1)) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.DocumentFilterList != nil { + for i, v := range s.DocumentFilterList { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "DocumentFilterList", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListDocumentsOutput struct { + _ struct{} `type:"structure"` + + // The names of the SSM documents. + DocumentIdentifiers []*DocumentIdentifier `locationNameList:"DocumentIdentifier" type:"list"` + + // The token to use when requesting the next set of items. If there are no additional + // items to return, the string is empty. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListDocumentsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListDocumentsOutput) GoString() string { + return s.String() +} + +type ListTagsForResourceInput struct { + _ struct{} `type:"structure"` + + // The resource ID for which you want to see a list of tags. + ResourceId *string `type:"string" required:"true"` + + // Returns a list of tags for a specific resource type. + ResourceType *string `type:"string" required:"true" enum:"ResourceTypeForTagging"` +} + +// String returns the string representation +func (s ListTagsForResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsForResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsForResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListTagsForResourceInput"} + if s.ResourceId == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceId")) + } + if s.ResourceType == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListTagsForResourceOutput struct { + _ struct{} `type:"structure"` + + // A list of tags. + TagList []*Tag `type:"list"` +} + +// String returns the string representation +func (s ListTagsForResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsForResourceOutput) GoString() string { + return s.String() +} + +type ModifyDocumentPermissionInput struct { + _ struct{} `type:"structure"` + + // The AWS user accounts that should have access to the document. The account + // IDs can either be a group of account IDs or All. + AccountIdsToAdd []*string `locationNameList:"AccountId" type:"list"` + + // The AWS user accounts that should no longer have access to the document. + // The AWS user account can either be a group of account IDs or All. This action + // has a higher priority than AccountIdsToAdd. If you specify an account ID + // to add and the same ID to remove, the system removes access to the document. + AccountIdsToRemove []*string `locationNameList:"AccountId" type:"list"` + + // The name of the document that you want to share. + Name *string `type:"string" required:"true"` + + // The permission type for the document. The permission type can be Share. + PermissionType *string `type:"string" required:"true" enum:"DocumentPermissionType"` +} + +// String returns the string representation +func (s ModifyDocumentPermissionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyDocumentPermissionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyDocumentPermissionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyDocumentPermissionInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.PermissionType == nil { + invalidParams.Add(request.NewErrParamRequired("PermissionType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ModifyDocumentPermissionOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ModifyDocumentPermissionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyDocumentPermissionOutput) GoString() string { + return s.String() +} + +// Configurations for sending notifications. +type NotificationConfig struct { + _ struct{} `type:"structure"` + + // An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. + // SSM pushes notifications about command status changes to this topic. + NotificationArn *string `type:"string"` + + // The different events for which you can receive notifications. These events + // include the following: All (events), InProgress, Success, TimedOut, Cancelled, + // Failed. To learn more about these events, see Monitoring Commands (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitor-commands.html) + // in the Amazon Elastic Compute Cloud User Guide . + NotificationEvents []*string `type:"list"` + + // Command: Receive notification when the status of a command changes. Invocation: + // For commands sent to multiple instances, receive notification on a per-instance + // basis when the status of a command changes. + NotificationType *string `type:"string" enum:"NotificationType"` +} + +// String returns the string representation +func (s NotificationConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s NotificationConfig) GoString() string { + return s.String() +} + +type RemoveTagsFromResourceInput struct { + _ struct{} `type:"structure"` + + // The resource ID for which you want to remove tags. + ResourceId *string `type:"string" required:"true"` + + // The type of resource of which you want to remove a tag. + ResourceType *string `type:"string" required:"true" enum:"ResourceTypeForTagging"` + + // Tag keys that you want to remove from the specified resource. + TagKeys []*string `type:"list" required:"true"` +} + +// String returns the string representation +func (s RemoveTagsFromResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RemoveTagsFromResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RemoveTagsFromResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RemoveTagsFromResourceInput"} + if s.ResourceId == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceId")) + } + if s.ResourceType == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceType")) + } + if s.TagKeys == nil { + invalidParams.Add(request.NewErrParamRequired("TagKeys")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type RemoveTagsFromResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s RemoveTagsFromResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RemoveTagsFromResourceOutput) GoString() string { + return s.String() +} + +type SendCommandInput struct { + _ struct{} `type:"structure"` + + // User-specified information about the command, such as a brief description + // of what the command should do. + Comment *string `type:"string"` + + // The Sha256 or Sha1 hash created by the system when the document was created. + // + // Sha1 hashes have been deprecated. + DocumentHash *string `type:"string"` + + // Sha256 or Sha1. + // + // Sha1 hashes have been deprecated. + DocumentHashType *string `type:"string" enum:"DocumentHashType"` + + // Required. The name of the SSM document to execute. This can be an SSM public + // document or a custom document. + DocumentName *string `type:"string" required:"true"` + + // Required. The instance IDs where the command should execute. You can specify + // a maximum of 50 IDs. + InstanceIds []*string `min:"1" type:"list" required:"true"` + + // Configurations for sending notifications. + NotificationConfig *NotificationConfig `type:"structure"` + + // The name of the S3 bucket where command execution responses should be stored. + OutputS3BucketName *string `min:"3" type:"string"` + + // The directory structure within the S3 bucket where the responses should be + // stored. + OutputS3KeyPrefix *string `type:"string"` + + // The required and optional parameters specified in the SSM document being + // executed. + Parameters map[string][]*string `type:"map"` + + // The IAM role that SSM uses to send notifications. + ServiceRoleArn *string `type:"string"` + + // If this time is reached and the command has not already started executing, + // it will not execute. + TimeoutSeconds *int64 `min:"30" type:"integer"` +} + +// String returns the string representation +func (s SendCommandInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SendCommandInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SendCommandInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SendCommandInput"} + if s.DocumentName == nil { + invalidParams.Add(request.NewErrParamRequired("DocumentName")) + } + if s.InstanceIds == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceIds")) + } + if s.InstanceIds != nil && len(s.InstanceIds) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InstanceIds", 1)) + } + if s.OutputS3BucketName != nil && len(*s.OutputS3BucketName) < 3 { + invalidParams.Add(request.NewErrParamMinLen("OutputS3BucketName", 3)) + } + if s.TimeoutSeconds != nil && *s.TimeoutSeconds < 30 { + invalidParams.Add(request.NewErrParamMinValue("TimeoutSeconds", 30)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type SendCommandOutput struct { + _ struct{} `type:"structure"` + + // The request as it was received by SSM. Also provides the command ID which + // can be used future references to this request. + Command *Command `type:"structure"` +} + +// String returns the string representation +func (s SendCommandOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SendCommandOutput) GoString() string { + return s.String() +} + +// Metadata that you assign to your managed instances. Tags enable you to categorize +// your managed instances in different ways, for example, by purpose, owner, +// or environment. +type Tag struct { + _ struct{} `type:"structure"` + + // The name of the tag. + Key *string `min:"1" type:"string" required:"true"` + + // The value of the tag. + Value *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s Tag) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Tag) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tag) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Tag"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type UpdateAssociationStatusInput struct { + _ struct{} `type:"structure"` + + // The association status. + AssociationStatus *AssociationStatus `type:"structure" required:"true"` + + // The ID of the instance. + InstanceId *string `type:"string" required:"true"` + + // The name of the SSM document. + Name *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateAssociationStatusInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateAssociationStatusInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateAssociationStatusInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateAssociationStatusInput"} + if s.AssociationStatus == nil { + invalidParams.Add(request.NewErrParamRequired("AssociationStatus")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.AssociationStatus != nil { + if err := s.AssociationStatus.Validate(); err != nil { + invalidParams.AddNested("AssociationStatus", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type UpdateAssociationStatusOutput struct { + _ struct{} `type:"structure"` + + // Information about the association. + AssociationDescription *AssociationDescription `type:"structure"` +} + +// String returns the string representation +func (s UpdateAssociationStatusOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateAssociationStatusOutput) GoString() string { + return s.String() +} + +type UpdateManagedInstanceRoleInput struct { + _ struct{} `type:"structure"` + + // The IAM role you want to assign or change. + IamRole *string `type:"string" required:"true"` + + // The ID of the managed instance where you want to update the role. + InstanceId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateManagedInstanceRoleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateManagedInstanceRoleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateManagedInstanceRoleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateManagedInstanceRoleInput"} + if s.IamRole == nil { + invalidParams.Add(request.NewErrParamRequired("IamRole")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type UpdateManagedInstanceRoleOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s UpdateManagedInstanceRoleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateManagedInstanceRoleOutput) GoString() string { + return s.String() +} + +const ( + // @enum AssociationFilterKey + AssociationFilterKeyInstanceId = "InstanceId" + // @enum AssociationFilterKey + AssociationFilterKeyName = "Name" +) + +const ( + // @enum AssociationStatusName + AssociationStatusNamePending = "Pending" + // @enum AssociationStatusName + AssociationStatusNameSuccess = "Success" + // @enum AssociationStatusName + AssociationStatusNameFailed = "Failed" +) + +const ( + // @enum CommandFilterKey + CommandFilterKeyInvokedAfter = "InvokedAfter" + // @enum CommandFilterKey + CommandFilterKeyInvokedBefore = "InvokedBefore" + // @enum CommandFilterKey + CommandFilterKeyStatus = "Status" +) + +const ( + // @enum CommandInvocationStatus + CommandInvocationStatusPending = "Pending" + // @enum CommandInvocationStatus + CommandInvocationStatusInProgress = "InProgress" + // @enum CommandInvocationStatus + CommandInvocationStatusCancelling = "Cancelling" + // @enum CommandInvocationStatus + CommandInvocationStatusSuccess = "Success" + // @enum CommandInvocationStatus + CommandInvocationStatusTimedOut = "TimedOut" + // @enum CommandInvocationStatus + CommandInvocationStatusCancelled = "Cancelled" + // @enum CommandInvocationStatus + CommandInvocationStatusFailed = "Failed" +) + +const ( + // @enum CommandPluginStatus + CommandPluginStatusPending = "Pending" + // @enum CommandPluginStatus + CommandPluginStatusInProgress = "InProgress" + // @enum CommandPluginStatus + CommandPluginStatusSuccess = "Success" + // @enum CommandPluginStatus + CommandPluginStatusTimedOut = "TimedOut" + // @enum CommandPluginStatus + CommandPluginStatusCancelled = "Cancelled" + // @enum CommandPluginStatus + CommandPluginStatusFailed = "Failed" +) + +const ( + // @enum CommandStatus + CommandStatusPending = "Pending" + // @enum CommandStatus + CommandStatusInProgress = "InProgress" + // @enum CommandStatus + CommandStatusCancelling = "Cancelling" + // @enum CommandStatus + CommandStatusSuccess = "Success" + // @enum CommandStatus + CommandStatusTimedOut = "TimedOut" + // @enum CommandStatus + CommandStatusCancelled = "Cancelled" + // @enum CommandStatus + CommandStatusFailed = "Failed" +) + +const ( + // @enum DescribeActivationsFilterKeys + DescribeActivationsFilterKeysActivationIds = "ActivationIds" + // @enum DescribeActivationsFilterKeys + DescribeActivationsFilterKeysDefaultInstanceName = "DefaultInstanceName" + // @enum DescribeActivationsFilterKeys + DescribeActivationsFilterKeysIamRole = "IamRole" +) + +const ( + // @enum DocumentFilterKey + DocumentFilterKeyName = "Name" + // @enum DocumentFilterKey + DocumentFilterKeyOwner = "Owner" + // @enum DocumentFilterKey + DocumentFilterKeyPlatformTypes = "PlatformTypes" +) + +const ( + // @enum DocumentHashType + DocumentHashTypeSha256 = "Sha256" + // @enum DocumentHashType + DocumentHashTypeSha1 = "Sha1" +) + +const ( + // @enum DocumentParameterType + DocumentParameterTypeString = "String" + // @enum DocumentParameterType + DocumentParameterTypeStringList = "StringList" +) + +const ( + // @enum DocumentPermissionType + DocumentPermissionTypeShare = "Share" +) + +const ( + // @enum DocumentStatus + DocumentStatusCreating = "Creating" + // @enum DocumentStatus + DocumentStatusActive = "Active" + // @enum DocumentStatus + DocumentStatusDeleting = "Deleting" +) + +const ( + // @enum Fault + FaultClient = "Client" + // @enum Fault + FaultServer = "Server" + // @enum Fault + FaultUnknown = "Unknown" +) + +const ( + // @enum InstanceInformationFilterKey + InstanceInformationFilterKeyInstanceIds = "InstanceIds" + // @enum InstanceInformationFilterKey + InstanceInformationFilterKeyAgentVersion = "AgentVersion" + // @enum InstanceInformationFilterKey + InstanceInformationFilterKeyPingStatus = "PingStatus" + // @enum InstanceInformationFilterKey + InstanceInformationFilterKeyPlatformTypes = "PlatformTypes" + // @enum InstanceInformationFilterKey + InstanceInformationFilterKeyActivationIds = "ActivationIds" + // @enum InstanceInformationFilterKey + InstanceInformationFilterKeyIamRole = "IamRole" + // @enum InstanceInformationFilterKey + InstanceInformationFilterKeyResourceType = "ResourceType" +) + +const ( + // @enum NotificationEvent + NotificationEventAll = "All" + // @enum NotificationEvent + NotificationEventInProgress = "InProgress" + // @enum NotificationEvent + NotificationEventSuccess = "Success" + // @enum NotificationEvent + NotificationEventTimedOut = "TimedOut" + // @enum NotificationEvent + NotificationEventCancelled = "Cancelled" + // @enum NotificationEvent + NotificationEventFailed = "Failed" +) + +const ( + // @enum NotificationType + NotificationTypeCommand = "Command" + // @enum NotificationType + NotificationTypeInvocation = "Invocation" +) + +const ( + // @enum PingStatus + PingStatusOnline = "Online" + // @enum PingStatus + PingStatusConnectionLost = "ConnectionLost" + // @enum PingStatus + PingStatusInactive = "Inactive" +) + +const ( + // @enum PlatformType + PlatformTypeWindows = "Windows" + // @enum PlatformType + PlatformTypeLinux = "Linux" +) + +const ( + // @enum ResourceType + ResourceTypeManagedInstance = "ManagedInstance" + // @enum ResourceType + ResourceTypeDocument = "Document" + // @enum ResourceType + ResourceTypeEc2instance = "EC2Instance" +) + +const ( + // @enum ResourceTypeForTagging + ResourceTypeForTaggingManagedInstance = "ManagedInstance" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/ssm/service.go b/vendor/github.com/aws/aws-sdk-go/service/ssm/service.go new file mode 100644 index 000000000..26672eed2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/ssm/service.go @@ -0,0 +1,204 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +package ssm + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +// This is the Amazon EC2 Simple Systems Manager (SSM) API Reference. SSM enables +// you to remotely manage the configuration of your Amazon EC2 instances, virtual +// machines (VMs), or servers in your on-premises environment or in an environment +// provided by other cloud providers using scripts, commands, or the Amazon +// EC2 console. SSM includes an on-demand solution called Amazon EC2 Run Command +// and a lightweight instance configuration solution called SSM Config. +// +// This references is intended to be used with the EC2 Run Command User Guide +// for Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/execute-remote-commands.html) +// or Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/execute-remote-commands.html). +// +// You must register your on-premises servers and VMs through an activation +// process before you can configure them using Run Command. Registered servers +// and VMs are called managed instances. For more information, see Setting Up +// Run Command On Managed Instances (On-Premises Servers and VMs) on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managed-instances.html) +// or Setting Up Run Command On Managed Instances (On-Premises Servers and VMs) +// on Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/managed-instances.html). +// +// Run Command +// +// Run Command provides an on-demand experience for executing commands. You +// can use pre-defined SSM documents to perform the actions listed later in +// this section, or you can create your own documents. With these documents, +// you can remotely configure your instances by sending commands using the Commands +// page in the Amazon EC2 console (http://console.aws.amazon.com/ec2/), AWS +// Tools for Windows PowerShell (http://docs.aws.amazon.com/powershell/latest/reference/items/Amazon_Simple_Systems_Management_cmdlets.html), +// the AWS CLI (http://docs.aws.amazon.com/cli/latest/reference/ssm/index.html), +// or AWS SDKs. +// +// Run Command reports the status of the command execution for each instance +// targeted by a command. You can also audit the command execution to understand +// who executed commands, when, and what changes were made. By switching between +// different SSM documents, you can quickly configure your instances with different +// types of commands. To get started with Run Command, verify that your environment +// meets the prerequisites for remotely running commands on EC2 instances (Linux +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/remote-commands-prereq.html) +// or Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/remote-commands-prereq.html)). +// +// SSM Config +// +// SSM Config is a lightweight instance configuration solution. SSM Config +// is currently only available for Windows instances. With SSM Config, you can +// specify a setup configuration for your instances. SSM Config is similar to +// EC2 User Data, which is another way of running one-time scripts or applying +// settings during instance launch. SSM Config is an extension of this capability. +// Using SSM documents, you can specify which actions the system should perform +// on your instances, including which applications to install, which AWS Directory +// Service directory to join, which Microsoft PowerShell modules to install, +// etc. If an instance is missing one or more of these configurations, the system +// makes those changes. By default, the system checks every five minutes to +// see if there is a new configuration to apply as defined in a new SSM document. +// If so, the system updates the instances accordingly. In this way, you can +// remotely maintain a consistent configuration baseline on your instances. +// SSM Config is available using the AWS CLI or the AWS Tools for Windows PowerShell. +// For more information, see Managing Windows Instance Configuration (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-configuration-manage.html). +// +// SSM Config and Run Command include the following pre-defined documents. +// +// Linux +// +// AWS-RunShellScript to run shell scripts +// +// AWS-UpdateSSMAgent to update the Amazon SSM agent +// +// Windows +// +// AWS-JoinDirectoryServiceDomain to join an AWS Directory +// +// AWS-RunPowerShellScript to run PowerShell commands or scripts +// +// AWS-UpdateEC2Config to update the EC2Config service +// +// AWS-ConfigureWindowsUpdate to configure Windows Update settings +// +// AWS-InstallApplication to install, repair, or uninstall software using +// an MSI package +// +// AWS-InstallPowerShellModule to install PowerShell modules +// +// AWS-ConfigureCloudWatch to configure Amazon CloudWatch Logs to monitor +// applications and systems +// +// AWS-ListWindowsInventory to collect information about an EC2 instance +// running in Windows. +// +// AWS-FindWindowsUpdates to scan an instance and determines which updates +// are missing. +// +// AWS-InstallMissingWindowsUpdates to install missing updates on your EC2 +// instance. +// +// AWS-InstallSpecificWindowsUpdates to install one or more specific updates. +// +// The commands or scripts specified in SSM documents run with administrative +// privilege on your instances because the Amazon SSM agent runs as root on +// Linux and the EC2Config service runs in the Local System account on Windows. +// If a user has permission to execute any of the pre-defined SSM documents +// (any document that begins with AWS-*) then that user also has administrator +// access to the instance. Delegate access to Run Command and SSM Config judiciously. +// This becomes extremely important if you create your own SSM documents. Amazon +// Web Services does not provide guidance about how to create secure SSM documents. +// You create SSM documents and delegate access to Run Command at your own risk. +// As a security best practice, we recommend that you assign access to "AWS-*" +// documents, especially the AWS-RunShellScript document on Linux and the AWS-RunPowerShellScript +// document on Windows, to trusted administrators only. You can create SSM documents +// for specific tasks and delegate access to non-administrators. +// +// For information about creating and sharing SSM documents, see the following +// topics in the SSM User Guide: +// +// Creating SSM Documents (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-ssm-doc.html) +// and Sharing SSM Documents (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssm-sharing.html) +// (Linux) +// +// Creating SSM Documents (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/create-ssm-doc.html) +// and Sharing SSM Documents (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ssm-sharing.html) +// (Windows) +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type SSM struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// A ServiceName is the name of the service the client will make API calls to. +const ServiceName = "ssm" + +// New creates a new instance of the SSM client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a SSM client from just a session. +// svc := ssm.New(mySession) +// +// // Create a SSM client with additional configuration +// svc := ssm.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *SSM { + c := p.ClientConfig(ServiceName, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *SSM { + svc := &SSM{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-11-06", + JSONVersion: "1.1", + TargetPrefix: "AmazonSSM", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a SSM operation and runs any +// custom request initialization. +func (c *SSM) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/vendor/vendor.json b/vendor/vendor.json index 492df3541..f4e3dab85 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -888,6 +888,14 @@ "version": "v1.4.2", "versionExact": "v1.4.2" }, + { + "checksumSHA1": "bKDsdoxo5Mxft1f1UsGmTNhXRw8=", + "path": "github.com/aws/aws-sdk-go/service/ssm", + "revision": "565027b24171359f23f883d0fc48c228cdde301d", + "revisionTime": "2016-07-21T22:15:38Z", + "version": "v1.2.7", + "versionExact": "v1.2.7" + }, { "checksumSHA1": "nH/itbdeFHpl4ysegdtgww9bFSA=", "path": "github.com/aws/aws-sdk-go/service/sts", diff --git a/website/source/docs/providers/aws/r/ssm_document.html.markdown b/website/source/docs/providers/aws/r/ssm_document.html.markdown new file mode 100644 index 000000000..5a5dd061c --- /dev/null +++ b/website/source/docs/providers/aws/r/ssm_document.html.markdown @@ -0,0 +1,73 @@ +--- +layout: "aws" +page_title: "AWS: aws_ssm_document" +sidebar_current: "docs-aws-resource-ssm-document" +description: |- + Provides an SSM Document resource +--- + +# aws\_ssm\_document + +Provides an SSM Document resource + +## Example Usage + +``` +resource "aws_ssm_document" "foo" { + name = "test_document", + content = <