From 5b94a16fd7733bdb1282a6b4bc94aa8554bed59d Mon Sep 17 00:00:00 2001 From: Su Shi <1684739+metacpp@users.noreply.github.com> Date: Tue, 12 Mar 2019 16:59:58 -0700 Subject: [PATCH 1/9] Init work to add support of API version set. --- azurerm/config.go | 5 + azurerm/provider.go | 1 + ...urce_arm_api_management_api_version_set.go | 170 ++++++++++++++++ ...arm_api_management_api_version_set_test.go | 186 ++++++++++++++++++ go.mod | 4 +- go.sum | 8 + 6 files changed, 373 insertions(+), 1 deletion(-) create mode 100644 azurerm/resource_arm_api_management_api_version_set.go create mode 100644 azurerm/resource_arm_api_management_api_version_set_test.go diff --git a/azurerm/config.go b/azurerm/config.go index afd6610e62a4..d8335cd85ed3 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -127,6 +127,7 @@ type ArmClient struct { redisPatchSchedulesClient redis.PatchSchedulesClient // API Management + apiManagementApiVersionSetClient apimanagement.APIVersionSetClient apiManagementGroupClient apimanagement.GroupClient apiManagementGroupUsersClient apimanagement.GroupUserClient apiManagementProductsClient apimanagement.ProductClient @@ -494,6 +495,10 @@ func getArmClient(c *authentication.Config, skipProviderRegistration bool, partn } func (c *ArmClient) registerApiManagementServiceClients(endpoint, subscriptionId string, auth autorest.Authorizer) { + apiVersionSetClient := apimanagement.NewAPIVersionSetClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&apiVersionSetClient.Client, auth) + c.apiManagementApiVersionSetClient = apiVersionSetClient + groupsClient := apimanagement.NewGroupClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&groupsClient.Client, auth) c.apiManagementGroupClient = groupsClient diff --git a/azurerm/provider.go b/azurerm/provider.go index c3d8a11f9d55..db68f6e60fab 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -168,6 +168,7 @@ func Provider() terraform.ResourceProvider { ResourcesMap: map[string]*schema.Resource{ "azurerm_api_management": resourceArmApiManagementService(), + "azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(), "azurerm_api_management_group": resourceArmApiManagementGroup(), "azurerm_api_management_group_user": resourceArmApiManagementGroupUser(), "azurerm_api_management_product": resourceArmApiManagementProduct(), diff --git a/azurerm/resource_arm_api_management_api_version_set.go b/azurerm/resource_arm_api_management_api_version_set.go new file mode 100644 index 000000000000..ead3653aeb33 --- /dev/null +++ b/azurerm/resource_arm_api_management_api_version_set.go @@ -0,0 +1,170 @@ +package azurerm + +import ( + "fmt" + "github.com/hashicorp/terraform/helper/validation" + "log" + + "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement" + "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmApiManagementApiVersionSet() *schema.Resource { + return &schema.Resource{ + Create: resourceArmApiManagementApiVersionSetCreateUpdate, + Read: resourceArmApiManagementApiVersionSetRead, + Update: resourceArmApiManagementApiVersionSetCreateUpdate, + Delete: resourceArmApiManagementApiVersionSetDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": azure.SchemaApiManagementChildName(), + + "resource_group_name": resourceGroupNameSchema(), + + "api_management_name": azure.SchemaApiManagementName(), + + "description": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.NoEmptyStrings, + }, + + "display_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.NoEmptyStrings, + }, + + "versioning_schema": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(apimanagement.VersioningSchemeHeader), + string(apimanagement.VersioningSchemeQuery), + string(apimanagement.VersioningSchemeSegment), + }, false), + }, + + "version_header_name": { + Type: schema.TypeString, + Computed: true, + }, + + "version_query_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceArmApiManagementApiVersionSetCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).apiManagementApiVersionSetClient + ctx := meta.(*ArmClient).StopContext + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + serviceName := d.Get("api_management_name").(string) + + if requireResourcesToBeImported && d.IsNewResource() { + existing, err := client.Get(ctx, resourceGroup, serviceName, name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("Error checking for presence of existing Api Version Set %q (Api Management Service %q / Resource Group %q): %s", name, serviceName, resourceGroup, err) + } + } + + if existing.ID != nil && *existing.ID != "" { + return tf.ImportAsExistsError("azurerm_api_management_api_version_set", *existing.ID) + } + } + + parameters := apimanagement.APIVersionSetContract{ + APIVersionSetContractProperties: &apimanagement.APIVersionSetContractProperties{ + DisplayName: utils.String(d.Get("display_name").(string)), + VersioningScheme: apimanagement.VersioningScheme(d.Get("versioning_schema").(string)), + Description: utils.String(d.Get("description").(string)), + }, + } + + if _, err := client.CreateOrUpdate(ctx, resourceGroup, serviceName, name, parameters, ""); err != nil { + return fmt.Errorf("Error creating or updating Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", name, resourceGroup, serviceName, err) + } + + resp, err := client.Get(ctx, resourceGroup, serviceName, name) + if err != nil { + return fmt.Errorf("Error retrieving Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", name, resourceGroup, serviceName, err) + } + if resp.ID == nil { + return fmt.Errorf("Cannot read ID for Api Version Set %q (Resource Group %q / Api Management Service %q)", name, resourceGroup, serviceName) + } + d.SetId(*resp.ID) + + return resourceArmApiManagementApiVersionSetRead(d, meta) +} + +func resourceArmApiManagementApiVersionSetRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).apiManagementApiVersionSetClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + serviceName := id.Path["service"] + name := id.Path["api-version-sets"] + + resp, err := client.Get(ctx, resourceGroup, serviceName, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[DEBUG] Api Version Set %q (Resource Group %q / Api Management Service %q) was not found - removing from state!", name, resourceGroup, serviceName) + d.SetId("") + return nil + } + + return fmt.Errorf("Error making Read request for Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", name, resourceGroup, serviceName, err) + } + + d.Set("name", resp.Name) + d.Set("resource_group_name", resourceGroup) + d.Set("api_management_name", serviceName) + + if props := resp.APIVersionSetContractProperties; props != nil { + d.Set("description", props.Description) + d.Set("display_name", props.DisplayName) + d.Set("versioning_schema", props.VersioningScheme) + d.Set("version_header_name", props.VersionHeaderName) + d.Set("version_query_name", props.VersionQueryName) + } + + return nil +} + +func resourceArmApiManagementApiVersionSetDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).apiManagementApiVersionSetClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + serviceName := id.Path["service"] + name := id.Path["api-version-sets"] + + if resp, err := client.Delete(ctx, resourceGroup, serviceName, name, ""); err != nil { + if !utils.ResponseWasNotFound(resp) { + return fmt.Errorf("Error deleting Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", name, resourceGroup, serviceName, err) + } + } + + return nil +} diff --git a/azurerm/resource_arm_api_management_api_version_set_test.go b/azurerm/resource_arm_api_management_api_version_set_test.go new file mode 100644 index 000000000000..f6cc1e1bc9d4 --- /dev/null +++ b/azurerm/resource_arm_api_management_api_version_set_test.go @@ -0,0 +1,186 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func TestAccAzureRMApiManagementApiVersionSet_basic(t *testing.T) { + resourceName := "azurerm_api_management_api_version_set.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMApiManagementApiVersionSet_basic(ri, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementApiVersionSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "description", fmt.Sprintf("TestDescription1")), + resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMApiManagementApiVersionSet_update(t *testing.T) { + resourceName := "azurerm_api_management_api_version_set.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMApiManagementApiVersionSet_basic(ri, testLocation()) + config2 := testAccAzureRMApiManagementApiVersionSet_update(ri, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementApiVersionSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "description", fmt.Sprintf("TestDescription1")), + resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), + ), + }, + { + Config: config2, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementApiVersionSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "description", fmt.Sprintf("TestDescription2")), + resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet2%d", ri)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testCheckAzureRMApiManagementApiVersionSetDestroy(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).apiManagementApiVersionSetClient + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_api_management_api_version_set" { + continue + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + serviceName := rs.Primary.Attributes["api_management_name"] + + ctx := testAccProvider.Meta().(*ArmClient).StopContext + resp, err := client.Get(ctx, resourceGroup, serviceName, name) + + if err != nil { + if !utils.ResponseWasNotFound(resp.Response) { + return err + } + } + + return nil + } + return nil +} + +func testCheckAzureRMApiManagementApiVersionSetExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %s", resourceName) + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + serviceName := rs.Primary.Attributes["api_management_name"] + + client := testAccProvider.Meta().(*ArmClient).apiManagementApiVersionSetClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + resp, err := client.Get(ctx, resourceGroup, serviceName, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Bad: Api Management Api Version Set %q (Resource Group %q / Api Management Service %q) does not exist", name, resourceGroup, serviceName) + } + return fmt.Errorf("Bad: Get on apiManagementApiVersionSetClient: %+v", err) + } + + return nil + } +} + +func testAccAzureRMApiManagementApiVersionSet_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku { + name = "Developer" + capacity = 1 + } +} + +resource "azurerm_api_management_api_version_set" "test" { + name = "acctestAMAVS-%d" + resource_group_name = "${azurerm_api_management.test.resource_group_name}" + api_management_name = "${azurerm_api_management.test.name}" + description = "TestDescription1" + display_name = "TestApiVersionSet1%d" + versioning_schema = "Segment" +} +`, rInt, location, rInt, rInt, rInt) +} + +func testAccAzureRMApiManagementApiVersionSet_update(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku { + name = "Developer" + capacity = 1 + } +} + +resource "azurerm_api_management_api_version_set" "test" { + name = "acctestAMAVS-%d" + resource_group_name = "${azurerm_api_management.test.resource_group_name}" + api_management_name = "${azurerm_api_management.test.name}" + description = "TestDescription2" + display_name = "TestApiVersionSet2%d" + versioning_schema = "Segment" +} +`, rInt, location, rInt, rInt, rInt) +} diff --git a/go.mod b/go.mod index 5ac068c39d66..eb44bbaba2bf 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/davecgh/go-spew v1.1.0 + github.com/dnaeon/go-vcr v1.0.1 // indirect github.com/fsouza/go-dockerclient v0.0.0-20160427172547-1d4f4ae73768 // indirect github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect github.com/go-ini/ini v1.23.1 // indirect @@ -22,7 +23,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.6.3 // indirect github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363 github.com/hashicorp/go-cleanhttp v0.0.0-20170211013415-3573b8b52aa7 // indirect - github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab // indirect + github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab github.com/hashicorp/go-hclog v0.0.0-20170903163258-8105cc0a3736 // indirect github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-plugin v0.0.0-20170816151819-a5174f84d7f8 // indirect @@ -35,6 +36,7 @@ require ( github.com/hashicorp/terraform v0.11.9 github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f // indirect github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/marstr/collection v1.0.1 // indirect github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c // indirect github.com/mitchellh/cli v1.0.0 // indirect diff --git a/go.sum b/go.sum index 58921cf2a39b..f7c321738d9c 100644 --- a/go.sum +++ b/go.sum @@ -47,6 +47,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dimchansky/utfbom v0.0.0-20170328061312-6c6132ff69f0/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/dimchansky/utfbom v1.0.0 h1:fGC2kkf4qOoKqZ4q7iIh+Vef4ubC1c38UDsEyZynZPc= github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= +github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= +github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/fatih/color v0.0.0-20181010231311-3f9d52f7176a/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -104,6 +106,11 @@ github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f/go.mod h1:+NfK9FKe github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 h1:SMvOWPJCES2GdFracYbBQh93GXac8fq7HeN6JnpduB8= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/marstr/collection v1.0.1 h1:j61osRfyny7zxBlLRtoCvOZ2VX7HEyybkZcsLNLJ0z0= github.com/marstr/collection v1.0.1/go.mod h1:HHDXVxjLO3UYCBXJWY+J/ZrxCUOYqrO66ob1AzIsmYA= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY= @@ -213,6 +220,7 @@ google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9M google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.1.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From fd1818e334e78b2ae07e17ca82d34810e0fd9b1b Mon Sep 17 00:00:00 2001 From: Su Shi <1684739+metacpp@users.noreply.github.com> Date: Mon, 18 Mar 2019 22:11:14 -0700 Subject: [PATCH 2/9] Add doc and fix bugs found in test. --- ...urce_arm_api_management_api_version_set.go | 68 +++++++-- ...arm_api_management_api_version_set_test.go | 129 +++++++++++++++++- website/azurerm.erb | 4 + ...i_management_api_version_set.html.markdown | 78 +++++++++++ 4 files changed, 266 insertions(+), 13 deletions(-) create mode 100644 website/docs/r/api_management_api_version_set.html.markdown diff --git a/azurerm/resource_arm_api_management_api_version_set.go b/azurerm/resource_arm_api_management_api_version_set.go index ead3653aeb33..15de868344c3 100644 --- a/azurerm/resource_arm_api_management_api_version_set.go +++ b/azurerm/resource_arm_api_management_api_version_set.go @@ -2,9 +2,10 @@ package azurerm import ( "fmt" - "github.com/hashicorp/terraform/helper/validation" "log" + "github.com/hashicorp/terraform/helper/validation" + "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" @@ -23,6 +24,36 @@ func resourceArmApiManagementApiVersionSet() *schema.Resource { State: schema.ImportStatePassthrough, }, + CustomizeDiff: func(diff *schema.ResourceDiff, v interface{}) error { + switch schema := diff.Get("versioning_schema").(string); schema { + case string(apimanagement.VersioningSchemeSegment): + if _, ok := diff.GetOk("version_header_name"); ok { + return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Segment`") + } + if _, ok := diff.GetOk("version_query_name"); ok { + return fmt.Errorf("`version_query_name` can not be set if `versioning_schema` is `Segment`") + } + + case string(apimanagement.VersioningSchemeHeader): + if _, ok := diff.GetOk("version_header_name"); !ok { + return fmt.Errorf("`version_header_name` must be set if `versioning_schema` is `Header`") + } + if _, ok := diff.GetOk("version_query_name"); ok { + return fmt.Errorf("`version_query_name` can not be set if `versioning_schema` is `Header`") + } + + case string(apimanagement.VersioningSchemeQuery): + if _, ok := diff.GetOk("version_query_name"); !ok { + return fmt.Errorf("`version_query_name` must be set if `versioning_schema` is `Query`") + } + if _, ok := diff.GetOk("version_header_name"); ok { + return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Query`") + } + } + + return nil + }, + Schema: map[string]*schema.Schema{ "name": azure.SchemaApiManagementChildName(), @@ -53,13 +84,15 @@ func resourceArmApiManagementApiVersionSet() *schema.Resource { }, "version_header_name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validate.NoEmptyStrings, }, "version_query_name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validate.NoEmptyStrings, }, }, } @@ -86,11 +119,21 @@ func resourceArmApiManagementApiVersionSetCreateUpdate(d *schema.ResourceData, m } } + var vHeaderName, vQueryName *string + if v, ok := d.GetOk("version_header_name"); ok { + vHeaderName = utils.String(v.(string)) + } + if v, ok := d.GetOk("version_query_name"); ok { + vQueryName = utils.String(v.(string)) + } + parameters := apimanagement.APIVersionSetContract{ APIVersionSetContractProperties: &apimanagement.APIVersionSetContractProperties{ - DisplayName: utils.String(d.Get("display_name").(string)), - VersioningScheme: apimanagement.VersioningScheme(d.Get("versioning_schema").(string)), - Description: utils.String(d.Get("description").(string)), + DisplayName: utils.String(d.Get("display_name").(string)), + VersioningScheme: apimanagement.VersioningScheme(d.Get("versioning_schema").(string)), + Description: utils.String(d.Get("description").(string)), + VersionHeaderName: vHeaderName, + VersionQueryName: vQueryName, }, } @@ -141,8 +184,13 @@ func resourceArmApiManagementApiVersionSetRead(d *schema.ResourceData, meta inte d.Set("description", props.Description) d.Set("display_name", props.DisplayName) d.Set("versioning_schema", props.VersioningScheme) - d.Set("version_header_name", props.VersionHeaderName) - d.Set("version_query_name", props.VersionQueryName) + + if v := props.VersionHeaderName; v != nil { + d.Set("version_header_name", v) + } + if v := props.VersionQueryName; v != nil { + d.Set("version_query_name", v) + } } return nil diff --git a/azurerm/resource_arm_api_management_api_version_set_test.go b/azurerm/resource_arm_api_management_api_version_set_test.go index f6cc1e1bc9d4..c8cf428165d9 100644 --- a/azurerm/resource_arm_api_management_api_version_set_test.go +++ b/azurerm/resource_arm_api_management_api_version_set_test.go @@ -24,8 +24,67 @@ func TestAccAzureRMApiManagementApiVersionSet_basic(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "description", fmt.Sprintf("TestDescription1")), + resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), + resource.TestCheckResourceAttr(resourceName, "versioning_schema", "Segment"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMApiManagementApiVersionSet_header(t *testing.T) { + resourceName := "azurerm_api_management_api_version_set.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMApiManagementApiVersionSet_header(ri, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementApiVersionSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), + resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), + resource.TestCheckResourceAttr(resourceName, "versioning_schema", "Header"), + resource.TestCheckResourceAttr(resourceName, "version_header_name", "Header1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMApiManagementApiVersionSet_query(t *testing.T) { + resourceName := "azurerm_api_management_api_version_set.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMApiManagementApiVersionSet_query(ri, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementApiVersionSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), + resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), + resource.TestCheckResourceAttr(resourceName, "versioning_schema", "Query"), + resource.TestCheckResourceAttr(resourceName, "version_query_name", "Query1"), ), }, { @@ -52,7 +111,7 @@ func TestAccAzureRMApiManagementApiVersionSet_update(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "description", fmt.Sprintf("TestDescription1")), + resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), ), }, @@ -60,7 +119,7 @@ func TestAccAzureRMApiManagementApiVersionSet_update(t *testing.T) { Config: config2, Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "description", fmt.Sprintf("TestDescription2")), + resource.TestCheckResourceAttr(resourceName, "description", "TestDescription2"), resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet2%d", ri)), ), }, @@ -154,6 +213,70 @@ resource "azurerm_api_management_api_version_set" "test" { `, rInt, location, rInt, rInt, rInt) } +func testAccAzureRMApiManagementApiVersionSet_header(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku { + name = "Developer" + capacity = 1 + } +} + +resource "azurerm_api_management_api_version_set" "test" { + name = "acctestAMAVS-%d" + resource_group_name = "${azurerm_api_management.test.resource_group_name}" + api_management_name = "${azurerm_api_management.test.name}" + description = "TestDescription1" + display_name = "TestApiVersionSet1%d" + versioning_schema = "Header" + version_header_name = "Header1" +} +`, rInt, location, rInt, rInt, rInt) +} + +func testAccAzureRMApiManagementApiVersionSet_query(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku { + name = "Developer" + capacity = 1 + } +} + +resource "azurerm_api_management_api_version_set" "test" { + name = "acctestAMAVS-%d" + resource_group_name = "${azurerm_api_management.test.resource_group_name}" + api_management_name = "${azurerm_api_management.test.name}" + description = "TestDescription1" + display_name = "TestApiVersionSet1%d" + versioning_schema = "Query" + version_query_name = "Query1" +} +`, rInt, location, rInt, rInt, rInt) +} + func testAccAzureRMApiManagementApiVersionSet_update(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/website/azurerm.erb b/website/azurerm.erb index acedd3ca1a41..2ee8e17a735f 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -334,6 +334,10 @@ azurerm_api_management + > + azurerm_api_management_version_set + + > azurerm_api_management_group diff --git a/website/docs/r/api_management_api_version_set.html.markdown b/website/docs/r/api_management_api_version_set.html.markdown new file mode 100644 index 000000000000..71be7077abd7 --- /dev/null +++ b/website/docs/r/api_management_api_version_set.html.markdown @@ -0,0 +1,78 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_api_management_version_set" +sidebar_current: "docs-azurerm-resource-api-management-api-version-set" +description: |- + Manages an API Management API Version Set. +--- + +# azurerm_api_management_version_set + +Manages an API Management API Version Set. + + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West US" +} + +resource "azurerm_api_management" "example" { + name = "example-apim" + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku { + name = "Developer" + capacity = 1 + } +} + +resource "azurerm_api_management_version_set" "example" { + name = "example-apimapivs" + resource_group_name = "${azurerm_resource_group.example.name}" + api_management_name = "${azurerm_api_management.example.name}" + description = "ExampleAPIVersionSetDescription" + display_name = "ExampleAPIVersionSet" + versioning_schema = "Segment" +} +``` + + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the API Version Set. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group in which the API Version Set should exist. Changing this forces a new resource to be created. + +* `api_management_name` - (Required) The name of the [API Management Service](api_management.html) in which the API Version Set should exist. Changing this forces a new resource to be created. + +* `description` - (Required) The description of API Version Set. + +* `display_name` - (Required) The display name of this API Version Set. + +* `versioning_schema` - (Required) A value that determines where the API Version identifier will be located in a HTTP request. Allowed values include: `Segment`, `Header`, `Query`. + +* `version_header_name` - (Optional) Name of HTTP header parameter that indicates the API Version if `versioning_schema` is set to `Header`. + +* `version_query_name` - (Optional) Name of query parameter that indicates the API Version if `versioning_schema` is set to `Query`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - The ID of the API Version Set. + +## Import + +API Version Set can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_api_management_version_set.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.ApiManagement/service/example-apim/api-version-sets/example-apimp +``` From 933614f43cb35f192e3d2ca4e6dd0163bda30226 Mon Sep 17 00:00:00 2001 From: Su Shi <1684739+metacpp@users.noreply.github.com> Date: Mon, 18 Mar 2019 22:29:15 -0700 Subject: [PATCH 3/9] Revert changes to `go.mod` and `go.sum`. --- go.mod | 4 +--- go.sum | 8 -------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/go.mod b/go.mod index eb44bbaba2bf..5ac068c39d66 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/davecgh/go-spew v1.1.0 - github.com/dnaeon/go-vcr v1.0.1 // indirect github.com/fsouza/go-dockerclient v0.0.0-20160427172547-1d4f4ae73768 // indirect github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect github.com/go-ini/ini v1.23.1 // indirect @@ -23,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.6.3 // indirect github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363 github.com/hashicorp/go-cleanhttp v0.0.0-20170211013415-3573b8b52aa7 // indirect - github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab + github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab // indirect github.com/hashicorp/go-hclog v0.0.0-20170903163258-8105cc0a3736 // indirect github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-plugin v0.0.0-20170816151819-a5174f84d7f8 // indirect @@ -36,7 +35,6 @@ require ( github.com/hashicorp/terraform v0.11.9 github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f // indirect github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 // indirect - github.com/kr/pretty v0.1.0 // indirect github.com/marstr/collection v1.0.1 // indirect github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c // indirect github.com/mitchellh/cli v1.0.0 // indirect diff --git a/go.sum b/go.sum index f7c321738d9c..58921cf2a39b 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dimchansky/utfbom v0.0.0-20170328061312-6c6132ff69f0/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/dimchansky/utfbom v1.0.0 h1:fGC2kkf4qOoKqZ4q7iIh+Vef4ubC1c38UDsEyZynZPc= github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/fatih/color v0.0.0-20181010231311-3f9d52f7176a/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -106,11 +104,6 @@ github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f/go.mod h1:+NfK9FKe github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 h1:SMvOWPJCES2GdFracYbBQh93GXac8fq7HeN6JnpduB8= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/marstr/collection v1.0.1 h1:j61osRfyny7zxBlLRtoCvOZ2VX7HEyybkZcsLNLJ0z0= github.com/marstr/collection v1.0.1/go.mod h1:HHDXVxjLO3UYCBXJWY+J/ZrxCUOYqrO66ob1AzIsmYA= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY= @@ -220,7 +213,6 @@ google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9M google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.1.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From d7dd8d61952dc8e6c0e0b330da88f87feb7a8ff5 Mon Sep 17 00:00:00 2001 From: Su Shi <1684739+metacpp@users.noreply.github.com> Date: Mon, 18 Mar 2019 22:31:06 -0700 Subject: [PATCH 4/9] Remove indirect for go-getter. --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 5ac068c39d66..0175e8451e76 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.6.3 // indirect github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363 github.com/hashicorp/go-cleanhttp v0.0.0-20170211013415-3573b8b52aa7 // indirect - github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab // indirect + github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab github.com/hashicorp/go-hclog v0.0.0-20170903163258-8105cc0a3736 // indirect github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-plugin v0.0.0-20170816151819-a5174f84d7f8 // indirect From ac5b7d8d5260e135ba25c12f6a62b93e428a2301 Mon Sep 17 00:00:00 2001 From: Su Shi <1684739+metacpp@users.noreply.github.com> Date: Mon, 18 Mar 2019 22:51:24 -0700 Subject: [PATCH 5/9] Fix broken link issue. --- go.mod | 2 ++ go.sum | 8 ++++++++ website/azurerm.erb | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0175e8451e76..eb44bbaba2bf 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/davecgh/go-spew v1.1.0 + github.com/dnaeon/go-vcr v1.0.1 // indirect github.com/fsouza/go-dockerclient v0.0.0-20160427172547-1d4f4ae73768 // indirect github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect github.com/go-ini/ini v1.23.1 // indirect @@ -35,6 +36,7 @@ require ( github.com/hashicorp/terraform v0.11.9 github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f // indirect github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/marstr/collection v1.0.1 // indirect github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c // indirect github.com/mitchellh/cli v1.0.0 // indirect diff --git a/go.sum b/go.sum index 58921cf2a39b..f7c321738d9c 100644 --- a/go.sum +++ b/go.sum @@ -47,6 +47,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dimchansky/utfbom v0.0.0-20170328061312-6c6132ff69f0/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/dimchansky/utfbom v1.0.0 h1:fGC2kkf4qOoKqZ4q7iIh+Vef4ubC1c38UDsEyZynZPc= github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= +github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= +github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/fatih/color v0.0.0-20181010231311-3f9d52f7176a/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -104,6 +106,11 @@ github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f/go.mod h1:+NfK9FKe github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 h1:SMvOWPJCES2GdFracYbBQh93GXac8fq7HeN6JnpduB8= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/marstr/collection v1.0.1 h1:j61osRfyny7zxBlLRtoCvOZ2VX7HEyybkZcsLNLJ0z0= github.com/marstr/collection v1.0.1/go.mod h1:HHDXVxjLO3UYCBXJWY+J/ZrxCUOYqrO66ob1AzIsmYA= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY= @@ -213,6 +220,7 @@ google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9M google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.1.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/website/azurerm.erb b/website/azurerm.erb index 28d2c98c4cce..834f0ee62c5c 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -343,7 +343,7 @@ > - azurerm_api_management_version_set + azurerm_api_management_version_set > From aca434b54b162f1705f415d6336c0792915db421 Mon Sep 17 00:00:00 2001 From: Su Shi <1684739+metacpp@users.noreply.github.com> Date: Tue, 2 Apr 2019 12:15:59 -0700 Subject: [PATCH 6/9] Fix the gofmt issue. --- azurerm/config.go | 6 +++--- azurerm/provider.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azurerm/config.go b/azurerm/config.go index 05edfa998f9b..e142a2735992 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -129,7 +129,7 @@ type ArmClient struct { // API Management apiManagementApiClient apimanagement.APIClient apiManagementApiOperationsClient apimanagement.APIOperationClient - apiManagementApiVersionSetClient apimanagement.APIVersionSetClient + apiManagementApiVersionSetClient apimanagement.APIVersionSetClient apiManagementAuthorizationServersClient apimanagement.AuthorizationServerClient apiManagementCertificatesClient apimanagement.CertificateClient apiManagementGroupClient apimanagement.GroupClient @@ -510,8 +510,8 @@ func (c *ArmClient) registerApiManagementServiceClients(endpoint, subscriptionId apiOperationsClient := apimanagement.NewAPIOperationClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&apiOperationsClient.Client, auth) c.apiManagementApiOperationsClient = apiOperationsClient - - apiVersionSetClient := apimanagement.NewAPIVersionSetClientWithBaseURI(endpoint, subscriptionId) + + apiVersionSetClient := apimanagement.NewAPIVersionSetClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&apiVersionSetClient.Client, auth) c.apiManagementApiVersionSetClient = apiVersionSetClient diff --git a/azurerm/provider.go b/azurerm/provider.go index 4741666c842e..20faba118a66 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -171,7 +171,7 @@ func Provider() terraform.ResourceProvider { "azurerm_api_management": resourceArmApiManagementService(), "azurerm_api_management_api": resourceArmApiManagementApi(), "azurerm_api_management_api_operation": resourceArmApiManagementApiOperation(), - "azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(), + "azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(), "azurerm_api_management_authorization_server": resourceArmApiManagementAuthorizationServer(), "azurerm_api_management_certificate": resourceArmApiManagementCertificate(), "azurerm_api_management_group": resourceArmApiManagementGroup(), From d41a178fb363bee673b68844e0a58db31222b9b8 Mon Sep 17 00:00:00 2001 From: Su Shi <1684739+metacpp@users.noreply.github.com> Date: Tue, 2 Apr 2019 16:48:45 -0700 Subject: [PATCH 7/9] Resolve the comments in PR. --- ...urce_arm_api_management_api_version_set.go | 25 ++++++++----------- ...i_management_api_version_set.html.markdown | 15 +++++------ 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/azurerm/resource_arm_api_management_api_version_set.go b/azurerm/resource_arm_api_management_api_version_set.go index 15de868344c3..ff84d3c65d0d 100644 --- a/azurerm/resource_arm_api_management_api_version_set.go +++ b/azurerm/resource_arm_api_management_api_version_set.go @@ -63,7 +63,7 @@ func resourceArmApiManagementApiVersionSet() *schema.Resource { "description": { Type: schema.TypeString, - Required: true, + Optional: true, ValidateFunc: validate.NoEmptyStrings, }, @@ -84,15 +84,17 @@ func resourceArmApiManagementApiVersionSet() *schema.Resource { }, "version_header_name": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validate.NoEmptyStrings, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validate.NoEmptyStrings, + ConflictsWith: []string{"version_query_name"}, }, "version_query_name": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validate.NoEmptyStrings, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validate.NoEmptyStrings, + ConflictsWith: []string{"version_header_name"}, }, }, } @@ -184,13 +186,8 @@ func resourceArmApiManagementApiVersionSetRead(d *schema.ResourceData, meta inte d.Set("description", props.Description) d.Set("display_name", props.DisplayName) d.Set("versioning_schema", props.VersioningScheme) - - if v := props.VersionHeaderName; v != nil { - d.Set("version_header_name", v) - } - if v := props.VersionQueryName; v != nil { - d.Set("version_query_name", v) - } + d.Set("version_header_name", props.VersionHeaderName) + d.Set("version_query_name", props.VersionQueryName) } return nil diff --git a/website/docs/r/api_management_api_version_set.html.markdown b/website/docs/r/api_management_api_version_set.html.markdown index 71be7077abd7..9a2507946a78 100644 --- a/website/docs/r/api_management_api_version_set.html.markdown +++ b/website/docs/r/api_management_api_version_set.html.markdown @@ -3,13 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_api_management_version_set" sidebar_current: "docs-azurerm-resource-api-management-api-version-set" description: |- - Manages an API Management API Version Set. + Manages an API Version Set within a API Management Service. --- # azurerm_api_management_version_set -Manages an API Management API Version Set. - +Manages an API Version Set within a API Management Service. ## Example Usage @@ -33,10 +32,9 @@ resource "azurerm_api_management" "example" { } resource "azurerm_api_management_version_set" "example" { - name = "example-apimapivs" + name = "example-apimapi-1.0.0" resource_group_name = "${azurerm_resource_group.example.name}" api_management_name = "${azurerm_api_management.example.name}" - description = "ExampleAPIVersionSetDescription" display_name = "ExampleAPIVersionSet" versioning_schema = "Segment" } @@ -53,16 +51,15 @@ The following arguments are supported: * `api_management_name` - (Required) The name of the [API Management Service](api_management.html) in which the API Version Set should exist. Changing this forces a new resource to be created. -* `description` - (Required) The description of API Version Set. +* `description` - (Optional) The description of API Version Set. * `display_name` - (Required) The display name of this API Version Set. * `versioning_schema` - (Required) A value that determines where the API Version identifier will be located in a HTTP request. Allowed values include: `Segment`, `Header`, `Query`. -* `version_header_name` - (Optional) Name of HTTP header parameter that indicates the API Version if `versioning_schema` is set to `Header`. - -* `version_query_name` - (Optional) Name of query parameter that indicates the API Version if `versioning_schema` is set to `Query`. +* `version_header_name` - (Optional) The name of HTTP header parameter value to read in Inbound Requests which defines the API Version. +* `version_query_name` - (Optional) The name of the Query String value to read in Inbound Requests which defines the API Version. ## Attributes Reference In addition to all arguments above, the following attributes are exported: From 9c6dd12ac536f51fe6ebf34d017d3478214e3e34 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 3 Apr 2019 12:13:41 +0200 Subject: [PATCH 8/9] Changes from code review --- ...urce_arm_api_management_api_version_set.go | 97 +++++----- ...arm_api_management_api_version_set_test.go | 169 +++++++++--------- ...i_management_api_version_set.html.markdown | 21 ++- 3 files changed, 143 insertions(+), 144 deletions(-) diff --git a/azurerm/resource_arm_api_management_api_version_set.go b/azurerm/resource_arm_api_management_api_version_set.go index ff84d3c65d0d..37f3bb7c7f9a 100644 --- a/azurerm/resource_arm_api_management_api_version_set.go +++ b/azurerm/resource_arm_api_management_api_version_set.go @@ -24,36 +24,6 @@ func resourceArmApiManagementApiVersionSet() *schema.Resource { State: schema.ImportStatePassthrough, }, - CustomizeDiff: func(diff *schema.ResourceDiff, v interface{}) error { - switch schema := diff.Get("versioning_schema").(string); schema { - case string(apimanagement.VersioningSchemeSegment): - if _, ok := diff.GetOk("version_header_name"); ok { - return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Segment`") - } - if _, ok := diff.GetOk("version_query_name"); ok { - return fmt.Errorf("`version_query_name` can not be set if `versioning_schema` is `Segment`") - } - - case string(apimanagement.VersioningSchemeHeader): - if _, ok := diff.GetOk("version_header_name"); !ok { - return fmt.Errorf("`version_header_name` must be set if `versioning_schema` is `Header`") - } - if _, ok := diff.GetOk("version_query_name"); ok { - return fmt.Errorf("`version_query_name` can not be set if `versioning_schema` is `Header`") - } - - case string(apimanagement.VersioningSchemeQuery): - if _, ok := diff.GetOk("version_query_name"); !ok { - return fmt.Errorf("`version_query_name` must be set if `versioning_schema` is `Query`") - } - if _, ok := diff.GetOk("version_header_name"); ok { - return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Query`") - } - } - - return nil - }, - Schema: map[string]*schema.Schema{ "name": azure.SchemaApiManagementChildName(), @@ -61,19 +31,13 @@ func resourceArmApiManagementApiVersionSet() *schema.Resource { "api_management_name": azure.SchemaApiManagementName(), - "description": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validate.NoEmptyStrings, - }, - "display_name": { Type: schema.TypeString, Required: true, ValidateFunc: validate.NoEmptyStrings, }, - "versioning_schema": { + "versioning_scheme": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ @@ -83,6 +47,12 @@ func resourceArmApiManagementApiVersionSet() *schema.Resource { }, false), }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validate.NoEmptyStrings, + }, + "version_header_name": { Type: schema.TypeString, Optional: true, @@ -121,26 +91,53 @@ func resourceArmApiManagementApiVersionSetCreateUpdate(d *schema.ResourceData, m } } - var vHeaderName, vQueryName *string + versioningScheme := apimanagement.VersioningScheme(d.Get("versioning_scheme").(string)) + parameters := apimanagement.APIVersionSetContract{ + APIVersionSetContractProperties: &apimanagement.APIVersionSetContractProperties{ + DisplayName: utils.String(d.Get("display_name").(string)), + VersioningScheme: versioningScheme, + Description: utils.String(d.Get("description").(string)), + }, + } + + var headerSet, querySet bool if v, ok := d.GetOk("version_header_name"); ok { - vHeaderName = utils.String(v.(string)) + headerSet = v.(string) != "" + parameters.APIVersionSetContractProperties.VersionHeaderName = utils.String(v.(string)) } if v, ok := d.GetOk("version_query_name"); ok { - vQueryName = utils.String(v.(string)) + querySet = v.(string) != "" + parameters.APIVersionSetContractProperties.VersionQueryName = utils.String(v.(string)) } - parameters := apimanagement.APIVersionSetContract{ - APIVersionSetContractProperties: &apimanagement.APIVersionSetContractProperties{ - DisplayName: utils.String(d.Get("display_name").(string)), - VersioningScheme: apimanagement.VersioningScheme(d.Get("versioning_schema").(string)), - Description: utils.String(d.Get("description").(string)), - VersionHeaderName: vHeaderName, - VersionQueryName: vQueryName, - }, + switch schema := versioningScheme; schema { + case apimanagement.VersioningSchemeHeader: + if !headerSet { + return fmt.Errorf("`version_header_name` must be set if `versioning_schema` is `Header`") + } + if querySet { + return fmt.Errorf("`version_query_name` can not be set if `versioning_schema` is `Header`") + } + + case apimanagement.VersioningSchemeQuery: + if headerSet { + return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Query`") + } + if !querySet { + return fmt.Errorf("`version_query_name` must be set if `versioning_schema` is `Query`") + } + + case apimanagement.VersioningSchemeSegment: + if headerSet { + return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Segment`") + } + if querySet { + return fmt.Errorf("`version_query_name` can not be set if `versioning_schema` is `Segment`") + } } if _, err := client.CreateOrUpdate(ctx, resourceGroup, serviceName, name, parameters, ""); err != nil { - return fmt.Errorf("Error creating or updating Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", name, resourceGroup, serviceName, err) + return fmt.Errorf("Error creating/updating Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", name, resourceGroup, serviceName, err) } resp, err := client.Get(ctx, resourceGroup, serviceName, name) @@ -185,7 +182,7 @@ func resourceArmApiManagementApiVersionSetRead(d *schema.ResourceData, meta inte if props := resp.APIVersionSetContractProperties; props != nil { d.Set("description", props.Description) d.Set("display_name", props.DisplayName) - d.Set("versioning_schema", props.VersioningScheme) + d.Set("versioning_scheme", string(props.VersioningScheme)) d.Set("version_header_name", props.VersionHeaderName) d.Set("version_query_name", props.VersionQueryName) } diff --git a/azurerm/resource_arm_api_management_api_version_set_test.go b/azurerm/resource_arm_api_management_api_version_set_test.go index c8cf428165d9..7c09360da6f5 100644 --- a/azurerm/resource_arm_api_management_api_version_set_test.go +++ b/azurerm/resource_arm_api_management_api_version_set_test.go @@ -13,7 +13,7 @@ import ( func TestAccAzureRMApiManagementApiVersionSet_basic(t *testing.T) { resourceName := "azurerm_api_management_api_version_set.test" ri := tf.AccRandTimeInt() - config := testAccAzureRMApiManagementApiVersionSet_basic(ri, testLocation()) + location := testLocation() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -21,12 +21,9 @@ func TestAccAzureRMApiManagementApiVersionSet_basic(t *testing.T) { CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMApiManagementApiVersionSet_basic(ri, location), Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), - resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), - resource.TestCheckResourceAttr(resourceName, "versioning_schema", "Segment"), ), }, { @@ -38,10 +35,39 @@ func TestAccAzureRMApiManagementApiVersionSet_basic(t *testing.T) { }) } +func TestAccAzureRMApiManagementApiVersionSet_requiresImport(t *testing.T) { + if !requireResourcesToBeImported { + t.Skip("Skipping since resources aren't required to be imported") + return + } + + resourceName := "azurerm_api_management_api_version_set.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMApiManagementApiVersionSet_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementApiVersionSetExists(resourceName), + ), + }, + { + Config: testAccAzureRMApiManagementApiVersionSet_requiresImport(ri, location), + ExpectError: testRequiresImportError("azurerm_api_management_api_version_set"), + }, + }, + }) +} + func TestAccAzureRMApiManagementApiVersionSet_header(t *testing.T) { resourceName := "azurerm_api_management_api_version_set.test" ri := tf.AccRandTimeInt() - config := testAccAzureRMApiManagementApiVersionSet_header(ri, testLocation()) + location := testLocation() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -49,13 +75,9 @@ func TestAccAzureRMApiManagementApiVersionSet_header(t *testing.T) { CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMApiManagementApiVersionSet_header(ri, location), Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), - resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), - resource.TestCheckResourceAttr(resourceName, "versioning_schema", "Header"), - resource.TestCheckResourceAttr(resourceName, "version_header_name", "Header1"), ), }, { @@ -70,7 +92,7 @@ func TestAccAzureRMApiManagementApiVersionSet_header(t *testing.T) { func TestAccAzureRMApiManagementApiVersionSet_query(t *testing.T) { resourceName := "azurerm_api_management_api_version_set.test" ri := tf.AccRandTimeInt() - config := testAccAzureRMApiManagementApiVersionSet_query(ri, testLocation()) + location := testLocation() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -78,13 +100,9 @@ func TestAccAzureRMApiManagementApiVersionSet_query(t *testing.T) { CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMApiManagementApiVersionSet_query(ri, location), Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), - resource.TestCheckResourceAttr(resourceName, "display_name", fmt.Sprintf("TestApiVersionSet1%d", ri)), - resource.TestCheckResourceAttr(resourceName, "versioning_schema", "Query"), - resource.TestCheckResourceAttr(resourceName, "version_query_name", "Query1"), ), }, { @@ -99,8 +117,7 @@ func TestAccAzureRMApiManagementApiVersionSet_query(t *testing.T) { func TestAccAzureRMApiManagementApiVersionSet_update(t *testing.T) { resourceName := "azurerm_api_management_api_version_set.test" ri := tf.AccRandTimeInt() - config := testAccAzureRMApiManagementApiVersionSet_basic(ri, testLocation()) - config2 := testAccAzureRMApiManagementApiVersionSet_update(ri, testLocation()) + location := testLocation() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -108,7 +125,7 @@ func TestAccAzureRMApiManagementApiVersionSet_update(t *testing.T) { CheckDestroy: testCheckAzureRMApiManagementApiVersionSetDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMApiManagementApiVersionSet_basic(ri, location), Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), resource.TestCheckResourceAttr(resourceName, "description", "TestDescription1"), @@ -116,7 +133,7 @@ func TestAccAzureRMApiManagementApiVersionSet_update(t *testing.T) { ), }, { - Config: config2, + Config: testAccAzureRMApiManagementApiVersionSet_update(ri, location), Check: resource.ComposeTestCheckFunc( testCheckAzureRMApiManagementApiVersionSetExists(resourceName), resource.TestCheckResourceAttr(resourceName, "description", "TestDescription2"), @@ -183,24 +200,9 @@ func testCheckAzureRMApiManagementApiVersionSetExists(resourceName string) resou } func testAccAzureRMApiManagementApiVersionSet_basic(rInt int, location string) string { + template := testAccAzureRMApiManagementApiVersionSet_template(rInt, location) return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" -} - -resource "azurerm_api_management" "test" { - name = "acctestAM-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - publisher_name = "pub1" - publisher_email = "pub1@email.com" - - sku { - name = "Developer" - capacity = 1 - } -} +%s resource "azurerm_api_management_api_version_set" "test" { name = "acctestAMAVS-%d" @@ -208,62 +210,48 @@ resource "azurerm_api_management_api_version_set" "test" { api_management_name = "${azurerm_api_management.test.name}" description = "TestDescription1" display_name = "TestApiVersionSet1%d" - versioning_schema = "Segment" + versioning_scheme = "Segment" } -`, rInt, location, rInt, rInt, rInt) +`, template, rInt, rInt) } -func testAccAzureRMApiManagementApiVersionSet_header(rInt int, location string) string { +func testAccAzureRMApiManagementApiVersionSet_requiresImport(rInt int, location string) string { + template := testAccAzureRMApiManagementApiVersionSet_basic(rInt, location) return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" +%s + +resource "azurerm_api_management_api_version_set" "import" { + name = "${azurerm_api_management_api_version_set.test.name}" + resource_group_name = "${azurerm_api_management_api_version_set.test.resource_group_name}" + api_management_name = "${azurerm_api_management_api_version_set.test.api_management_name}" + description = "${azurerm_api_management_api_version_set.test.description}" + display_name = "${azurerm_api_management_api_version_set.test.display_name}" + versioning_scheme = "${azurerm_api_management_api_version_set.test.versioning_scheme}" } - -resource "azurerm_api_management" "test" { - name = "acctestAM-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - publisher_name = "pub1" - publisher_email = "pub1@email.com" - - sku { - name = "Developer" - capacity = 1 - } +`, template) } +func testAccAzureRMApiManagementApiVersionSet_header(rInt int, location string) string { + template := testAccAzureRMApiManagementApiVersionSet_template(rInt, location) + return fmt.Sprintf(` +%s + resource "azurerm_api_management_api_version_set" "test" { name = "acctestAMAVS-%d" resource_group_name = "${azurerm_api_management.test.resource_group_name}" api_management_name = "${azurerm_api_management.test.name}" description = "TestDescription1" display_name = "TestApiVersionSet1%d" - versioning_schema = "Header" + versioning_scheme = "Header" version_header_name = "Header1" } -`, rInt, location, rInt, rInt, rInt) +`, template, rInt, rInt) } func testAccAzureRMApiManagementApiVersionSet_query(rInt int, location string) string { + template := testAccAzureRMApiManagementApiVersionSet_template(rInt, location) return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" -} - -resource "azurerm_api_management" "test" { - name = "acctestAM-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - publisher_name = "pub1" - publisher_email = "pub1@email.com" - - sku { - name = "Developer" - capacity = 1 - } -} +%s resource "azurerm_api_management_api_version_set" "test" { name = "acctestAMAVS-%d" @@ -271,13 +259,29 @@ resource "azurerm_api_management_api_version_set" "test" { api_management_name = "${azurerm_api_management.test.name}" description = "TestDescription1" display_name = "TestApiVersionSet1%d" - versioning_schema = "Query" + versioning_scheme = "Query" version_query_name = "Query1" } -`, rInt, location, rInt, rInt, rInt) +`, template, rInt, rInt) } func testAccAzureRMApiManagementApiVersionSet_update(rInt int, location string) string { + template := testAccAzureRMApiManagementApiVersionSet_template(rInt, location) + return fmt.Sprintf(` +%s + +resource "azurerm_api_management_api_version_set" "test" { + name = "acctestAMAVS-%d" + resource_group_name = "${azurerm_api_management.test.resource_group_name}" + api_management_name = "${azurerm_api_management.test.name}" + description = "TestDescription2" + display_name = "TestApiVersionSet2%d" + versioning_scheme = "Segment" +} +`, template, rInt, rInt) +} + +func testAccAzureRMApiManagementApiVersionSet_template(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -296,14 +300,5 @@ resource "azurerm_api_management" "test" { capacity = 1 } } - -resource "azurerm_api_management_api_version_set" "test" { - name = "acctestAMAVS-%d" - resource_group_name = "${azurerm_api_management.test.resource_group_name}" - api_management_name = "${azurerm_api_management.test.name}" - description = "TestDescription2" - display_name = "TestApiVersionSet2%d" - versioning_schema = "Segment" -} -`, rInt, location, rInt, rInt, rInt) +`, rInt, location, rInt) } diff --git a/website/docs/r/api_management_api_version_set.html.markdown b/website/docs/r/api_management_api_version_set.html.markdown index 9a2507946a78..49eb2e18c5a4 100644 --- a/website/docs/r/api_management_api_version_set.html.markdown +++ b/website/docs/r/api_management_api_version_set.html.markdown @@ -36,7 +36,7 @@ resource "azurerm_api_management_version_set" "example" { resource_group_name = "${azurerm_resource_group.example.name}" api_management_name = "${azurerm_api_management.example.name}" display_name = "ExampleAPIVersionSet" - versioning_schema = "Segment" + versioning_scheme = "Segment" } ``` @@ -47,19 +47,26 @@ The following arguments are supported: * `name` - (Required) The name of the API Version Set. Changing this forces a new resource to be created. -* `resource_group_name` - (Required) The name of the Resource Group in which the API Version Set should exist. Changing this forces a new resource to be created. - * `api_management_name` - (Required) The name of the [API Management Service](api_management.html) in which the API Version Set should exist. Changing this forces a new resource to be created. -* `description` - (Optional) The description of API Version Set. +* `resource_group_name` - (Required) The name of the Resource Group in which the parent API Management Service exists. Changing this forces a new resource to be created. * `display_name` - (Required) The display name of this API Version Set. -* `versioning_schema` - (Required) A value that determines where the API Version identifier will be located in a HTTP request. Allowed values include: `Segment`, `Header`, `Query`. +* `versioning_scheme` - (Required) Specifies where in an Inbound HTTP Request that the API Version should be read from. Possible values are `Header`, `Query` and `Segment`. + +--- + +* `description` - (Optional) The description of API Version Set. + +* `version_header_name` - (Optional) The name of the Header which should be read from Inbound Requests which defines the API Version. + +-> **NOTE:** This must be specified when `versioning_scheme` is set to `Header`. + +* `version_query_name` - (Optional) The name of the Query String which should be read from Inbound Requests which defines the API Version. -* `version_header_name` - (Optional) The name of HTTP header parameter value to read in Inbound Requests which defines the API Version. +-> **NOTE:** This must be specified when `versioning_scheme` is set to `Query`. -* `version_query_name` - (Optional) The name of the Query String value to read in Inbound Requests which defines the API Version. ## Attributes Reference In addition to all arguments above, the following attributes are exported: From 87fd7b6aa7b6d95a86afc07043ddd6a088476b7a Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 3 Apr 2019 12:31:53 +0200 Subject: [PATCH 9/9] Fixing the vendoring --- go.mod | 30 +- go.sum | 91 +- vendor/golang.org/x/crypto/blowfish/cipher.go | 8 + vendor/golang.org/x/crypto/cast5/cast5.go | 11 +- .../x/crypto/curve25519/curve25519.go | 2 +- .../x/crypto/internal/chacha20/asm_arm64.s | 308 +++ .../crypto/internal/chacha20/chacha_arm64.go | 31 + .../crypto/internal/chacha20/chacha_noasm.go | 2 +- .../crypto/internal/chacha20/chacha_s390x.go | 11 +- .../x/crypto/internal/chacha20/chacha_s390x.s | 23 - vendor/golang.org/x/crypto/openpgp/write.go | 2 + vendor/golang.org/x/crypto/pkcs12/pkcs12.go | 7 +- .../golang.org/x/crypto/poly1305/mac_noasm.go | 11 + .../golang.org/x/crypto/poly1305/poly1305.go | 80 +- .../golang.org/x/crypto/poly1305/sum_amd64.go | 58 +- .../golang.org/x/crypto/poly1305/sum_amd64.s | 63 +- .../poly1305/{sum_ref.go => sum_generic.go} | 121 +- .../golang.org/x/crypto/poly1305/sum_noasm.go | 4 +- .../golang.org/x/crypto/poly1305/sum_s390x.go | 17 +- .../golang.org/x/crypto/poly1305/sum_s390x.s | 22 - .../x/crypto/poly1305/sum_vmsl_s390x.s | 22 - vendor/golang.org/x/net/html/node.go | 2 +- vendor/golang.org/x/net/html/parse.go | 31 +- vendor/golang.org/x/net/http2/frame.go | 2 +- vendor/golang.org/x/net/http2/server.go | 6 - vendor/golang.org/x/net/trace/trace.go | 14 +- vendor/golang.org/x/sys/cpu/byteorder.go | 30 + vendor/golang.org/x/sys/cpu/cpu.go | 89 + vendor/golang.org/x/sys/cpu/cpu_arm.go | 9 + vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 16 + vendor/golang.org/x/sys/cpu/cpu_gccgo.c | 43 + vendor/golang.org/x/sys/cpu/cpu_gccgo.go | 26 + vendor/golang.org/x/sys/cpu/cpu_linux.go | 55 + .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 67 + vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 11 + vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 11 + .../golang.org/x/sys/cpu/cpu_other_arm64.go | 11 + vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 32 + vendor/golang.org/x/sys/cpu/cpu_s390x.go | 9 + vendor/golang.org/x/sys/cpu/cpu_x86.go | 57 + vendor/golang.org/x/sys/cpu/cpu_x86.s | 27 + vendor/golang.org/x/sys/unix/README.md | 16 +- .../golang.org/x/sys/unix/asm_freebsd_arm64.s | 29 + .../golang.org/x/sys/unix/asm_netbsd_arm64.s | 29 + vendor/golang.org/x/sys/unix/fcntl.go | 2 +- vendor/golang.org/x/sys/unix/fcntl_darwin.go | 18 + vendor/golang.org/x/sys/unix/mkall.sh | 39 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 17 +- vendor/golang.org/x/sys/unix/mksyscall.go | 4 + .../x/sys/unix/mksyscall_aix_ppc.go | 404 ++++ .../x/sys/unix/mksyscall_aix_ppc.pl | 384 ---- .../x/sys/unix/mksyscall_aix_ppc64.go | 602 +++++ .../x/sys/unix/mksyscall_aix_ppc64.pl | 579 ----- .../x/sys/unix/mksyscall_solaris.go | 335 +++ .../x/sys/unix/mksyscall_solaris.pl | 294 --- vendor/golang.org/x/sys/unix/mksysnum.go | 190 ++ .../golang.org/x/sys/unix/mksysnum_darwin.pl | 39 - .../x/sys/unix/mksysnum_dragonfly.pl | 50 - .../golang.org/x/sys/unix/mksysnum_freebsd.pl | 50 - .../golang.org/x/sys/unix/mksysnum_netbsd.pl | 58 - .../golang.org/x/sys/unix/mksysnum_openbsd.pl | 50 - vendor/golang.org/x/sys/unix/syscall_aix.go | 2 +- .../golang.org/x/sys/unix/syscall_darwin.go | 1 + .../x/sys/unix/syscall_dragonfly.go | 1 + .../x/sys/unix/syscall_freebsd_arm64.go | 52 + vendor/golang.org/x/sys/unix/syscall_linux.go | 17 +- .../x/sys/unix/syscall_linux_386.go | 1 + .../x/sys/unix/syscall_linux_amd64.go | 1 + .../x/sys/unix/syscall_linux_arm.go | 1 + .../x/sys/unix/syscall_linux_arm64.go | 1 + .../x/sys/unix/syscall_linux_mips64x.go | 10 +- .../x/sys/unix/syscall_linux_mipsx.go | 1 + .../x/sys/unix/syscall_linux_ppc64x.go | 1 + .../x/sys/unix/syscall_linux_riscv64.go | 4 + .../x/sys/unix/syscall_linux_s390x.go | 1 + .../x/sys/unix/syscall_linux_sparc64.go | 1 + .../x/sys/unix/syscall_netbsd_arm64.go | 33 + .../x/sys/unix/zerrors_freebsd_arm64.go | 1794 +++++++++++++++ .../x/sys/unix/zerrors_linux_386.go | 50 +- .../x/sys/unix/zerrors_linux_amd64.go | 50 +- .../x/sys/unix/zerrors_linux_arm.go | 50 +- .../x/sys/unix/zerrors_linux_arm64.go | 50 +- .../x/sys/unix/zerrors_linux_mips.go | 50 +- .../x/sys/unix/zerrors_linux_mips64.go | 50 +- .../x/sys/unix/zerrors_linux_mips64le.go | 50 +- .../x/sys/unix/zerrors_linux_mipsle.go | 50 +- .../x/sys/unix/zerrors_linux_ppc64.go | 52 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 52 +- .../x/sys/unix/zerrors_linux_riscv64.go | 50 +- .../x/sys/unix/zerrors_linux_s390x.go | 50 +- .../x/sys/unix/zerrors_linux_sparc64.go | 50 +- .../x/sys/unix/zerrors_netbsd_arm64.go | 1762 ++++++++++++++ .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 2 +- .../x/sys/unix/zsyscall_aix_ppc64.go | 2 +- .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 2 +- .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 2 +- .../x/sys/unix/zsyscall_darwin_amd64.go | 15 + .../x/sys/unix/zsyscall_darwin_amd64.s | 2 + .../x/sys/unix/zsyscall_dragonfly_amd64.go | 20 + .../x/sys/unix/zsyscall_freebsd_arm64.go | 2015 +++++++++++++++++ .../x/sys/unix/zsyscall_linux_386.go | 57 +- .../x/sys/unix/zsyscall_linux_amd64.go | 57 +- .../x/sys/unix/zsyscall_linux_arm.go | 57 +- .../x/sys/unix/zsyscall_linux_arm64.go | 57 +- .../x/sys/unix/zsyscall_linux_mips.go | 57 +- .../x/sys/unix/zsyscall_linux_mips64.go | 87 +- .../x/sys/unix/zsyscall_linux_mips64le.go | 87 +- .../x/sys/unix/zsyscall_linux_mipsle.go | 57 +- .../x/sys/unix/zsyscall_linux_ppc64.go | 57 +- .../x/sys/unix/zsyscall_linux_ppc64le.go | 57 +- .../x/sys/unix/zsyscall_linux_riscv64.go | 37 +- .../x/sys/unix/zsyscall_linux_s390x.go | 57 +- .../x/sys/unix/zsyscall_linux_sparc64.go | 57 +- .../x/sys/unix/zsyscall_netbsd_arm64.go | 1826 +++++++++++++++ .../x/sys/unix/zsyscall_solaris_amd64.go | 2 +- .../x/sys/unix/zsysnum_darwin_386.go | 2 +- .../x/sys/unix/zsysnum_darwin_amd64.go | 6 +- .../x/sys/unix/zsysnum_darwin_arm.go | 2 +- .../x/sys/unix/zsysnum_darwin_arm64.go | 2 +- .../x/sys/unix/zsysnum_dragonfly_amd64.go | 176 +- .../x/sys/unix/zsysnum_freebsd_386.go | 452 ++-- .../x/sys/unix/zsysnum_freebsd_amd64.go | 452 ++-- .../x/sys/unix/zsysnum_freebsd_arm.go | 452 ++-- .../x/sys/unix/zsysnum_freebsd_arm64.go | 395 ++++ .../x/sys/unix/zsysnum_netbsd_386.go | 4 +- .../x/sys/unix/zsysnum_netbsd_amd64.go | 4 +- .../x/sys/unix/zsysnum_netbsd_arm.go | 4 +- .../x/sys/unix/zsysnum_netbsd_arm64.go | 274 +++ .../x/sys/unix/zsysnum_openbsd_386.go | 216 +- .../x/sys/unix/zsysnum_openbsd_amd64.go | 216 +- .../x/sys/unix/zsysnum_openbsd_arm.go | 216 +- .../x/sys/unix/ztypes_freebsd_arm64.go | 602 +++++ .../golang.org/x/sys/unix/ztypes_linux_386.go | 45 +- .../x/sys/unix/ztypes_linux_amd64.go | 45 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 45 +- .../x/sys/unix/ztypes_linux_arm64.go | 45 +- .../x/sys/unix/ztypes_linux_mips.go | 45 +- .../x/sys/unix/ztypes_linux_mips64.go | 45 +- .../x/sys/unix/ztypes_linux_mips64le.go | 45 +- .../x/sys/unix/ztypes_linux_mipsle.go | 45 +- .../x/sys/unix/ztypes_linux_ppc64.go | 45 +- .../x/sys/unix/ztypes_linux_ppc64le.go | 45 +- .../x/sys/unix/ztypes_linux_riscv64.go | 47 +- .../x/sys/unix/ztypes_linux_s390x.go | 45 +- .../x/sys/unix/ztypes_linux_sparc64.go | 45 +- .../x/sys/unix/ztypes_netbsd_arm64.go | 472 ++++ vendor/modules.txt | 7 +- 147 files changed, 14925 insertions(+), 3284 deletions(-) create mode 100644 vendor/golang.org/x/crypto/internal/chacha20/asm_arm64.s create mode 100644 vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go create mode 100644 vendor/golang.org/x/crypto/poly1305/mac_noasm.go rename vendor/golang.org/x/crypto/poly1305/{sum_ref.go => sum_generic.go} (54%) create mode 100644 vendor/golang.org/x/sys/cpu/byteorder.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.c create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_mips64x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_mipsx.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_other_arm64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_ppc64x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_s390x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.s create mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s create mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s create mode 100644 vendor/golang.org/x/sys/unix/fcntl_darwin.go create mode 100644 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.pl create mode 100644 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.pl create mode 100644 vendor/golang.org/x/sys/unix/mksyscall_solaris.go delete mode 100644 vendor/golang.org/x/sys/unix/mksyscall_solaris.pl create mode 100644 vendor/golang.org/x/sys/unix/mksysnum.go delete mode 100644 vendor/golang.org/x/sys/unix/mksysnum_darwin.pl delete mode 100644 vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl delete mode 100644 vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl delete mode 100644 vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl delete mode 100644 vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl create mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go diff --git a/go.mod b/go.mod index eb44bbaba2bf..ddaa6028fd4c 100644 --- a/go.mod +++ b/go.mod @@ -1,26 +1,20 @@ module github.com/terraform-providers/terraform-provider-azurerm require ( - cloud.google.com/go v0.34.0 // indirect contrib.go.opencensus.io/exporter/ocagent v0.4.1 // indirect - git.apache.org/thrift.git v0.0.0-20181218151757-9b75e4fe745a // indirect github.com/Azure/azure-sdk-for-go v25.1.0+incompatible github.com/Azure/go-autorest v11.4.0+incompatible github.com/agext/levenshtein v1.2.1 // indirect github.com/apparentlymart/go-cidr v0.0.0-20170418151526-7e4b007599d4 // indirect - github.com/apparentlymart/go-rundeck-api v0.0.0-20160826143032-f6af74d34d1e // indirect github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331 // indirect github.com/aws/aws-sdk-go v1.8.34 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/davecgh/go-spew v1.1.0 github.com/dnaeon/go-vcr v1.0.1 // indirect - github.com/fsouza/go-dockerclient v0.0.0-20160427172547-1d4f4ae73768 // indirect - github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect github.com/go-ini/ini v1.23.1 // indirect - github.com/golang/mock v1.2.0 // indirect + github.com/go-test/deep v1.0.1 // indirect github.com/google/uuid v0.0.0-20170814143639-7e072fc3a7be - github.com/grpc-ecosystem/grpc-gateway v1.6.3 // indirect github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363 github.com/hashicorp/go-cleanhttp v0.0.0-20170211013415-3573b8b52aa7 // indirect github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab @@ -37,7 +31,7 @@ require ( github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f // indirect github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 // indirect github.com/kr/pretty v0.1.0 // indirect - github.com/marstr/collection v1.0.1 // indirect + github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 // indirect github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c // indirect github.com/mitchellh/cli v1.0.0 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect @@ -45,30 +39,18 @@ require ( github.com/mitchellh/go-wordwrap v1.0.0 // indirect github.com/mitchellh/hashstructure v1.0.0 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect - github.com/openzipkin/zipkin-go v0.1.3 // indirect - github.com/pkg/errors v0.8.1 // indirect - github.com/prometheus/client_golang v0.9.2 // indirect - github.com/prometheus/common v0.0.0-20181218105931-67670fe90761 // indirect github.com/satori/go.uuid v0.0.0-20160927100844-b061729afc07 github.com/satori/uuid v0.0.0-20160927100844-b061729afc07 - github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect - github.com/spf13/cobra v0.0.3 // indirect - github.com/spf13/pflag v1.0.3 // indirect + github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect + github.com/stretchr/testify v1.3.0 // indirect github.com/ulikunitz/xz v0.5.4 // indirect github.com/zclconf/go-cty v0.0.0-20180227163247-7166230c635f // indirect - golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869 - golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 // indirect - golang.org/x/net v0.0.0-20181217023233-e147a9138326 - golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 // indirect + golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 + golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect - golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6 // indirect - golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e // indirect google.golang.org/api v0.0.0-20181221000618-65a46cafb132 // indirect - google.golang.org/appengine v1.3.0 // indirect google.golang.org/genproto v0.0.0-20181221175505-bd9b4fb69e2f // indirect google.golang.org/grpc v1.17.0 // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/yaml.v2 v2.2.2 - honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3 // indirect - k8s.io/kubernetes v1.6.1 // indirect ) diff --git a/go.sum b/go.sum index f7c321738d9c..cbb26605db95 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,19 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= contrib.go.opencensus.io/exporter/ocagent v0.4.1 h1:1lyr7duzSVn3G9skLcA4Ym15ufvQLOjNq+Mvg7eK70g= contrib.go.opencensus.io/exporter/ocagent v0.4.1/go.mod h1:b6YwD5Q3Yvj4yk0CDK5vGXexygNzI09aXUdDEakQBgA= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -git.apache.org/thrift.git v0.0.0-20181218151757-9b75e4fe745a/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/Azure/azure-sdk-for-go v21.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v24.0.0+incompatible h1:GdF0ozHojCPSZH1LPWA2+XHQ3G/mapn0G+PCIlMVZg4= -github.com/Azure/azure-sdk-for-go v24.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v25.1.0+incompatible h1:bA8mqsHUc9RbzHG64A6r7KnpvLFHJdxrpI75FrFln2M= github.com/Azure/azure-sdk-for-go v25.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v10.15.4+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v11.2.8+incompatible h1:Q2feRPMlcfVcqz3pF87PJzkm5lZrL+x6BDtzhODzNJM= -github.com/Azure/go-autorest v11.2.8+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v11.3.2+incompatible h1:2bRmoaLvtIXW5uWpZVoIkc0C1z7c84rVGnP+3mpyCRg= -github.com/Azure/go-autorest v11.3.2+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v11.4.0+incompatible h1:z3Yr6KYqs0nhSNwqGXEBpWK977hxVqsLv2n9PVYcixY= github.com/Azure/go-autorest v11.4.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-cidr v0.0.0-20170418151526-7e4b007599d4 h1:bpmA3CCh0K829XIR5kfcV+YDt+Gwi7SEYPCcYEVKWUo= github.com/apparentlymart/go-cidr v0.0.0-20170418151526-7e4b007599d4/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= -github.com/apparentlymart/go-rundeck-api v0.0.0-20160826143032-f6af74d34d1e/go.mod h1:U6OjNHcY3edY04ILn+KNrWZm3j15cPzW7PyjtIQOh1Y= github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331 h1:AIKxo1t7QE7MAqADwrmzMiaFC+QfHfXOk8lrmibN5Lk= github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/armon/go-radix v0.0.0-20170727155443-1fca145dffbc/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.8.34 h1:zDNBtR25rYYUi7aEh2HRa2f2WTm6LSHWSAMCNY2WdXA= @@ -35,43 +25,37 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/census-instrumentation/opencensus-proto v0.0.0-20181214143942-ba49f56771b8/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.1.0 h1:VwZ9smxzX8u14/125wHIX7ARV+YhR+L4JADswwxWK0Y= github.com/census-instrumentation/opencensus-proto v0.1.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v0.0.0-20160617170158-f0777076321a/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dimchansky/utfbom v0.0.0-20170328061312-6c6132ff69f0/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/dimchansky/utfbom v1.0.0 h1:fGC2kkf4qOoKqZ4q7iIh+Vef4ubC1c38UDsEyZynZPc= github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/fatih/color v0.0.0-20181010231311-3f9d52f7176a/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsouza/go-dockerclient v0.0.0-20160427172547-1d4f4ae73768/go.mod h1:KpcjM623fQYE9MZiTGzKhjfxXAV9wbyX2C1cyRHfhl0= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/go-ini/ini v1.23.1 h1:amNPHl+tCb4BolL2NAIQaKLY+ZiL1Ju7OqZ9Fx6PTBQ= github.com/go-ini/ini v1.23.1/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg= +github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v0.0.0-20181128192352-1d3f30b51784/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/uuid v0.0.0-20170814143639-7e072fc3a7be h1:JX31ns0WPRsUGmZXMlMoJta76MW+0UM7+JnCmqxDUVs= github.com/google/uuid v0.0.0-20170814143639-7e072fc3a7be/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.6.2/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.6.3/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363 h1:9d0jVlMpgfMTdL/QSsRDQsLenOQZIHp5cEBiWSYc8w4= @@ -82,7 +66,6 @@ github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab h1:ap3umB+Fouf github.com/hashicorp/go-getter v0.0.0-20180226183729-64040d90d4ab/go.mod h1:6rdJFnhkXnzGOJbvkrdv4t9nLwKcVA+tmbQeUlkIzrU= github.com/hashicorp/go-hclog v0.0.0-20170903163258-8105cc0a3736 h1:o62AOlCZLFgztwH3h06WnKRL9OrxVEn+fqPDQC26f68= github.com/hashicorp/go-hclog v0.0.0-20170903163258-8105cc0a3736/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-multierror v0.0.0-20150916205742-d30f09973e19/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-plugin v0.0.0-20170816151819-a5174f84d7f8 h1:1M/vS848XLVjNyE7waQYdRErztf5MU33jo5IPBfzLag= @@ -105,20 +88,20 @@ github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f h1:K4RDeor/qhbs5ET github.com/hashicorp/yamux v0.0.0-20160720233140-d1caa6c97c9f/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 h1:SMvOWPJCES2GdFracYbBQh93GXac8fq7HeN6JnpduB8= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/marstr/collection v1.0.1 h1:j61osRfyny7zxBlLRtoCvOZ2VX7HEyybkZcsLNLJ0z0= -github.com/marstr/collection v1.0.1/go.mod h1:HHDXVxjLO3UYCBXJWY+J/ZrxCUOYqrO66ob1AzIsmYA= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/mattn/go-colorable v0.0.0-20180310133214-efa589957cd0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.0-20170925054904-a5cdd64afdee/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -139,81 +122,64 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/posener/complete v0.0.0-20170908125245-88e59760adad/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181218105931-67670fe90761/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/satori/go.uuid v0.0.0-20160927100844-b061729afc07 h1:DEZDfcCVq3xDJrjqdCgyN/dHYVoqR92MCsdqCdxmnhM= github.com/satori/go.uuid v0.0.0-20160927100844-b061729afc07/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/satori/uuid v0.0.0-20160927100844-b061729afc07 h1:81vvGlnI/AZ1/TxGDirw3ofUoS64TyjmPQt5C9XODTw= github.com/satori/uuid v0.0.0-20160927100844-b061729afc07/go.mod h1:B8HLsPLik/YNn6KKWVMDJ8nzCL8RP5WyfsnmvnAEwIU= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/ulikunitz/xz v0.5.4 h1:zATC2OoZ8H1TZll3FpbX+ikwmadbO699PE06cIkm9oU= github.com/ulikunitz/xz v0.5.4/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/zclconf/go-cty v0.0.0-20180227163247-7166230c635f h1:OkKoSRyYPHTuUJcbnjUPsuW+qzkxkqQxd8zJjZcsTc0= github.com/zclconf/go-cty v0.0.0-20180227163247-7166230c635f/go.mod h1:LnDKxj8gN4aatfXUqmUNooaDjvmDcLPbAN3hYBIVoJE= -go.opencensus.io v0.0.0-20181220193849-950a67f393d8/go.mod h1:AYeH0+ZxYyghG8diqaaIq/9P3VgCCt5GF2ldCY4dkFg= go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b h1:6ayHMBPtdP3jNuk+Sfhso+PTB7ZJQ5E1FBo403m2H8w= go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869 h1:kkXA53yGe04D0adEYJwEVQjeBppL01Exg+fnMjfUraU= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/net v0.0.0-20170927055102-0a9397675ba3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181217023233-e147a9138326 h1:iCzOf0xz39Tstp+Tu/WwyGjUXCk34QhQORRxBeXXTA4= -golang.org/x/net v0.0.0-20181217023233-e147a9138326/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6 h1:IcgEB62HYgAhX0Nd/QrVgZlxlcyxbGQHElLUhW2X4Fo= -golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e h1:XEcLGV2fKy3FrsoJVCkX+lMhqc9Suj7J5L/wldA1wu4= -golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181221000618-65a46cafb132 h1:SLcC5l+3o5vwvXAbdm936WwLkHteUZpo1RULZD7YvQ4= google.golang.org/api v0.0.0-20181221000618-65a46cafb132/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/genproto v0.0.0-20181221175505-bd9b4fb69e2f h1:eT3B0O2ghdSPzjAOznr3oOLyN1HFeYUncYl7FRwg4VI= google.golang.org/genproto v0.0.0-20181221175505-bd9b4fb69e2f/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/grpc v0.0.0-20181222005549-25de51fc024f/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.15.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -222,10 +188,7 @@ google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.1.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/kubernetes v1.6.1/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= diff --git a/vendor/golang.org/x/crypto/blowfish/cipher.go b/vendor/golang.org/x/crypto/blowfish/cipher.go index 2641dadd6494..213bf204afea 100644 --- a/vendor/golang.org/x/crypto/blowfish/cipher.go +++ b/vendor/golang.org/x/crypto/blowfish/cipher.go @@ -3,6 +3,14 @@ // license that can be found in the LICENSE file. // Package blowfish implements Bruce Schneier's Blowfish encryption algorithm. +// +// Blowfish is a legacy cipher and its short block size makes it vulnerable to +// birthday bound attacks (see https://sweet32.info). It should only be used +// where compatibility with legacy systems, not security, is the goal. +// +// Deprecated: any new system should use AES (from crypto/aes, if necessary in +// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from +// golang.org/x/crypto/chacha20poly1305). package blowfish // import "golang.org/x/crypto/blowfish" // The code is a port of Bruce Schneier's C implementation. diff --git a/vendor/golang.org/x/crypto/cast5/cast5.go b/vendor/golang.org/x/crypto/cast5/cast5.go index 0b4af37bdc29..ddcbeb6f2ad1 100644 --- a/vendor/golang.org/x/crypto/cast5/cast5.go +++ b/vendor/golang.org/x/crypto/cast5/cast5.go @@ -2,8 +2,15 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package cast5 implements CAST5, as defined in RFC 2144. CAST5 is a common -// OpenPGP cipher. +// Package cast5 implements CAST5, as defined in RFC 2144. +// +// CAST5 is a legacy cipher and its short block size makes it vulnerable to +// birthday bound attacks (see https://sweet32.info). It should only be used +// where compatibility with legacy systems, not security, is the goal. +// +// Deprecated: any new system should use AES (from crypto/aes, if necessary in +// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from +// golang.org/x/crypto/chacha20poly1305). package cast5 // import "golang.org/x/crypto/cast5" import "errors" diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go index cb8fbc57b97a..75f24babb694 100644 --- a/vendor/golang.org/x/crypto/curve25519/curve25519.go +++ b/vendor/golang.org/x/crypto/curve25519/curve25519.go @@ -86,7 +86,7 @@ func feFromBytes(dst *fieldElement, src *[32]byte) { h6 := load3(src[20:]) << 7 h7 := load3(src[23:]) << 5 h8 := load3(src[26:]) << 4 - h9 := load3(src[29:]) << 2 + h9 := (load3(src[29:]) & 0x7fffff) << 2 var carry [10]int64 carry[9] = (h9 + 1<<24) >> 25 diff --git a/vendor/golang.org/x/crypto/internal/chacha20/asm_arm64.s b/vendor/golang.org/x/crypto/internal/chacha20/asm_arm64.s new file mode 100644 index 000000000000..b3a16ef751a6 --- /dev/null +++ b/vendor/golang.org/x/crypto/internal/chacha20/asm_arm64.s @@ -0,0 +1,308 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.11 +// +build !gccgo,!appengine + +#include "textflag.h" + +#define NUM_ROUNDS 10 + +// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32) +TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0 + MOVD dst+0(FP), R1 + MOVD src+24(FP), R2 + MOVD src_len+32(FP), R3 + MOVD key+48(FP), R4 + MOVD nonce+56(FP), R6 + MOVD counter+64(FP), R7 + + MOVD $·constants(SB), R10 + MOVD $·incRotMatrix(SB), R11 + + MOVW (R7), R20 + + AND $~255, R3, R13 + ADD R2, R13, R12 // R12 for block end + AND $255, R3, R13 +loop: + MOVD $NUM_ROUNDS, R21 + VLD1 (R11), [V30.S4, V31.S4] + + // load contants + // VLD4R (R10), [V0.S4, V1.S4, V2.S4, V3.S4] + WORD $0x4D60E940 + + // load keys + // VLD4R 16(R4), [V4.S4, V5.S4, V6.S4, V7.S4] + WORD $0x4DFFE884 + // VLD4R 16(R4), [V8.S4, V9.S4, V10.S4, V11.S4] + WORD $0x4DFFE888 + SUB $32, R4 + + // load counter + nonce + // VLD1R (R7), [V12.S4] + WORD $0x4D40C8EC + + // VLD3R (R6), [V13.S4, V14.S4, V15.S4] + WORD $0x4D40E8CD + + // update counter + VADD V30.S4, V12.S4, V12.S4 + +chacha: + // V0..V3 += V4..V7 + // V12..V15 <<<= ((V12..V15 XOR V0..V3), 16) + VADD V0.S4, V4.S4, V0.S4 + VADD V1.S4, V5.S4, V1.S4 + VADD V2.S4, V6.S4, V2.S4 + VADD V3.S4, V7.S4, V3.S4 + VEOR V12.B16, V0.B16, V12.B16 + VEOR V13.B16, V1.B16, V13.B16 + VEOR V14.B16, V2.B16, V14.B16 + VEOR V15.B16, V3.B16, V15.B16 + VREV32 V12.H8, V12.H8 + VREV32 V13.H8, V13.H8 + VREV32 V14.H8, V14.H8 + VREV32 V15.H8, V15.H8 + // V8..V11 += V12..V15 + // V4..V7 <<<= ((V4..V7 XOR V8..V11), 12) + VADD V8.S4, V12.S4, V8.S4 + VADD V9.S4, V13.S4, V9.S4 + VADD V10.S4, V14.S4, V10.S4 + VADD V11.S4, V15.S4, V11.S4 + VEOR V8.B16, V4.B16, V16.B16 + VEOR V9.B16, V5.B16, V17.B16 + VEOR V10.B16, V6.B16, V18.B16 + VEOR V11.B16, V7.B16, V19.B16 + VSHL $12, V16.S4, V4.S4 + VSHL $12, V17.S4, V5.S4 + VSHL $12, V18.S4, V6.S4 + VSHL $12, V19.S4, V7.S4 + VSRI $20, V16.S4, V4.S4 + VSRI $20, V17.S4, V5.S4 + VSRI $20, V18.S4, V6.S4 + VSRI $20, V19.S4, V7.S4 + + // V0..V3 += V4..V7 + // V12..V15 <<<= ((V12..V15 XOR V0..V3), 8) + VADD V0.S4, V4.S4, V0.S4 + VADD V1.S4, V5.S4, V1.S4 + VADD V2.S4, V6.S4, V2.S4 + VADD V3.S4, V7.S4, V3.S4 + VEOR V12.B16, V0.B16, V12.B16 + VEOR V13.B16, V1.B16, V13.B16 + VEOR V14.B16, V2.B16, V14.B16 + VEOR V15.B16, V3.B16, V15.B16 + VTBL V31.B16, [V12.B16], V12.B16 + VTBL V31.B16, [V13.B16], V13.B16 + VTBL V31.B16, [V14.B16], V14.B16 + VTBL V31.B16, [V15.B16], V15.B16 + + // V8..V11 += V12..V15 + // V4..V7 <<<= ((V4..V7 XOR V8..V11), 7) + VADD V12.S4, V8.S4, V8.S4 + VADD V13.S4, V9.S4, V9.S4 + VADD V14.S4, V10.S4, V10.S4 + VADD V15.S4, V11.S4, V11.S4 + VEOR V8.B16, V4.B16, V16.B16 + VEOR V9.B16, V5.B16, V17.B16 + VEOR V10.B16, V6.B16, V18.B16 + VEOR V11.B16, V7.B16, V19.B16 + VSHL $7, V16.S4, V4.S4 + VSHL $7, V17.S4, V5.S4 + VSHL $7, V18.S4, V6.S4 + VSHL $7, V19.S4, V7.S4 + VSRI $25, V16.S4, V4.S4 + VSRI $25, V17.S4, V5.S4 + VSRI $25, V18.S4, V6.S4 + VSRI $25, V19.S4, V7.S4 + + // V0..V3 += V5..V7, V4 + // V15,V12-V14 <<<= ((V15,V12-V14 XOR V0..V3), 16) + VADD V0.S4, V5.S4, V0.S4 + VADD V1.S4, V6.S4, V1.S4 + VADD V2.S4, V7.S4, V2.S4 + VADD V3.S4, V4.S4, V3.S4 + VEOR V15.B16, V0.B16, V15.B16 + VEOR V12.B16, V1.B16, V12.B16 + VEOR V13.B16, V2.B16, V13.B16 + VEOR V14.B16, V3.B16, V14.B16 + VREV32 V12.H8, V12.H8 + VREV32 V13.H8, V13.H8 + VREV32 V14.H8, V14.H8 + VREV32 V15.H8, V15.H8 + + // V10 += V15; V5 <<<= ((V10 XOR V5), 12) + // ... + VADD V15.S4, V10.S4, V10.S4 + VADD V12.S4, V11.S4, V11.S4 + VADD V13.S4, V8.S4, V8.S4 + VADD V14.S4, V9.S4, V9.S4 + VEOR V10.B16, V5.B16, V16.B16 + VEOR V11.B16, V6.B16, V17.B16 + VEOR V8.B16, V7.B16, V18.B16 + VEOR V9.B16, V4.B16, V19.B16 + VSHL $12, V16.S4, V5.S4 + VSHL $12, V17.S4, V6.S4 + VSHL $12, V18.S4, V7.S4 + VSHL $12, V19.S4, V4.S4 + VSRI $20, V16.S4, V5.S4 + VSRI $20, V17.S4, V6.S4 + VSRI $20, V18.S4, V7.S4 + VSRI $20, V19.S4, V4.S4 + + // V0 += V5; V15 <<<= ((V0 XOR V15), 8) + // ... + VADD V5.S4, V0.S4, V0.S4 + VADD V6.S4, V1.S4, V1.S4 + VADD V7.S4, V2.S4, V2.S4 + VADD V4.S4, V3.S4, V3.S4 + VEOR V0.B16, V15.B16, V15.B16 + VEOR V1.B16, V12.B16, V12.B16 + VEOR V2.B16, V13.B16, V13.B16 + VEOR V3.B16, V14.B16, V14.B16 + VTBL V31.B16, [V12.B16], V12.B16 + VTBL V31.B16, [V13.B16], V13.B16 + VTBL V31.B16, [V14.B16], V14.B16 + VTBL V31.B16, [V15.B16], V15.B16 + + // V10 += V15; V5 <<<= ((V10 XOR V5), 7) + // ... + VADD V15.S4, V10.S4, V10.S4 + VADD V12.S4, V11.S4, V11.S4 + VADD V13.S4, V8.S4, V8.S4 + VADD V14.S4, V9.S4, V9.S4 + VEOR V10.B16, V5.B16, V16.B16 + VEOR V11.B16, V6.B16, V17.B16 + VEOR V8.B16, V7.B16, V18.B16 + VEOR V9.B16, V4.B16, V19.B16 + VSHL $7, V16.S4, V5.S4 + VSHL $7, V17.S4, V6.S4 + VSHL $7, V18.S4, V7.S4 + VSHL $7, V19.S4, V4.S4 + VSRI $25, V16.S4, V5.S4 + VSRI $25, V17.S4, V6.S4 + VSRI $25, V18.S4, V7.S4 + VSRI $25, V19.S4, V4.S4 + + SUB $1, R21 + CBNZ R21, chacha + + // VLD4R (R10), [V16.S4, V17.S4, V18.S4, V19.S4] + WORD $0x4D60E950 + + // VLD4R 16(R4), [V20.S4, V21.S4, V22.S4, V23.S4] + WORD $0x4DFFE894 + VADD V30.S4, V12.S4, V12.S4 + VADD V16.S4, V0.S4, V0.S4 + VADD V17.S4, V1.S4, V1.S4 + VADD V18.S4, V2.S4, V2.S4 + VADD V19.S4, V3.S4, V3.S4 + // VLD4R 16(R4), [V24.S4, V25.S4, V26.S4, V27.S4] + WORD $0x4DFFE898 + // restore R4 + SUB $32, R4 + + // load counter + nonce + // VLD1R (R7), [V28.S4] + WORD $0x4D40C8FC + // VLD3R (R6), [V29.S4, V30.S4, V31.S4] + WORD $0x4D40E8DD + + VADD V20.S4, V4.S4, V4.S4 + VADD V21.S4, V5.S4, V5.S4 + VADD V22.S4, V6.S4, V6.S4 + VADD V23.S4, V7.S4, V7.S4 + VADD V24.S4, V8.S4, V8.S4 + VADD V25.S4, V9.S4, V9.S4 + VADD V26.S4, V10.S4, V10.S4 + VADD V27.S4, V11.S4, V11.S4 + VADD V28.S4, V12.S4, V12.S4 + VADD V29.S4, V13.S4, V13.S4 + VADD V30.S4, V14.S4, V14.S4 + VADD V31.S4, V15.S4, V15.S4 + + VZIP1 V1.S4, V0.S4, V16.S4 + VZIP2 V1.S4, V0.S4, V17.S4 + VZIP1 V3.S4, V2.S4, V18.S4 + VZIP2 V3.S4, V2.S4, V19.S4 + VZIP1 V5.S4, V4.S4, V20.S4 + VZIP2 V5.S4, V4.S4, V21.S4 + VZIP1 V7.S4, V6.S4, V22.S4 + VZIP2 V7.S4, V6.S4, V23.S4 + VZIP1 V9.S4, V8.S4, V24.S4 + VZIP2 V9.S4, V8.S4, V25.S4 + VZIP1 V11.S4, V10.S4, V26.S4 + VZIP2 V11.S4, V10.S4, V27.S4 + VZIP1 V13.S4, V12.S4, V28.S4 + VZIP2 V13.S4, V12.S4, V29.S4 + VZIP1 V15.S4, V14.S4, V30.S4 + VZIP2 V15.S4, V14.S4, V31.S4 + VZIP1 V18.D2, V16.D2, V0.D2 + VZIP2 V18.D2, V16.D2, V4.D2 + VZIP1 V19.D2, V17.D2, V8.D2 + VZIP2 V19.D2, V17.D2, V12.D2 + VLD1.P 64(R2), [V16.B16, V17.B16, V18.B16, V19.B16] + + VZIP1 V22.D2, V20.D2, V1.D2 + VZIP2 V22.D2, V20.D2, V5.D2 + VZIP1 V23.D2, V21.D2, V9.D2 + VZIP2 V23.D2, V21.D2, V13.D2 + VLD1.P 64(R2), [V20.B16, V21.B16, V22.B16, V23.B16] + VZIP1 V26.D2, V24.D2, V2.D2 + VZIP2 V26.D2, V24.D2, V6.D2 + VZIP1 V27.D2, V25.D2, V10.D2 + VZIP2 V27.D2, V25.D2, V14.D2 + VLD1.P 64(R2), [V24.B16, V25.B16, V26.B16, V27.B16] + VZIP1 V30.D2, V28.D2, V3.D2 + VZIP2 V30.D2, V28.D2, V7.D2 + VZIP1 V31.D2, V29.D2, V11.D2 + VZIP2 V31.D2, V29.D2, V15.D2 + VLD1.P 64(R2), [V28.B16, V29.B16, V30.B16, V31.B16] + VEOR V0.B16, V16.B16, V16.B16 + VEOR V1.B16, V17.B16, V17.B16 + VEOR V2.B16, V18.B16, V18.B16 + VEOR V3.B16, V19.B16, V19.B16 + VST1.P [V16.B16, V17.B16, V18.B16, V19.B16], 64(R1) + VEOR V4.B16, V20.B16, V20.B16 + VEOR V5.B16, V21.B16, V21.B16 + VEOR V6.B16, V22.B16, V22.B16 + VEOR V7.B16, V23.B16, V23.B16 + VST1.P [V20.B16, V21.B16, V22.B16, V23.B16], 64(R1) + VEOR V8.B16, V24.B16, V24.B16 + VEOR V9.B16, V25.B16, V25.B16 + VEOR V10.B16, V26.B16, V26.B16 + VEOR V11.B16, V27.B16, V27.B16 + VST1.P [V24.B16, V25.B16, V26.B16, V27.B16], 64(R1) + VEOR V12.B16, V28.B16, V28.B16 + VEOR V13.B16, V29.B16, V29.B16 + VEOR V14.B16, V30.B16, V30.B16 + VEOR V15.B16, V31.B16, V31.B16 + VST1.P [V28.B16, V29.B16, V30.B16, V31.B16], 64(R1) + + ADD $4, R20 + MOVW R20, (R7) // update counter + + CMP R2, R12 + BGT loop + + RET + + +DATA ·constants+0x00(SB)/4, $0x61707865 +DATA ·constants+0x04(SB)/4, $0x3320646e +DATA ·constants+0x08(SB)/4, $0x79622d32 +DATA ·constants+0x0c(SB)/4, $0x6b206574 +GLOBL ·constants(SB), NOPTR|RODATA, $32 + +DATA ·incRotMatrix+0x00(SB)/4, $0x00000000 +DATA ·incRotMatrix+0x04(SB)/4, $0x00000001 +DATA ·incRotMatrix+0x08(SB)/4, $0x00000002 +DATA ·incRotMatrix+0x0c(SB)/4, $0x00000003 +DATA ·incRotMatrix+0x10(SB)/4, $0x02010003 +DATA ·incRotMatrix+0x14(SB)/4, $0x06050407 +DATA ·incRotMatrix+0x18(SB)/4, $0x0A09080B +DATA ·incRotMatrix+0x1c(SB)/4, $0x0E0D0C0F +GLOBL ·incRotMatrix(SB), NOPTR|RODATA, $32 diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go new file mode 100644 index 000000000000..ad74e23aef48 --- /dev/null +++ b/vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go @@ -0,0 +1,31 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.11 +// +build !gccgo + +package chacha20 + +const ( + haveAsm = true + bufSize = 256 +) + +//go:noescape +func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32) + +func (c *Cipher) xorKeyStreamAsm(dst, src []byte) { + + if len(src) >= bufSize { + xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter) + } + + if len(src)%bufSize != 0 { + i := len(src) - len(src)%bufSize + c.buf = [bufSize]byte{} + copy(c.buf[:], src[i:]) + xorKeyStreamVX(c.buf[:], c.buf[:], &c.key, &c.nonce, &c.counter) + c.len = bufSize - copy(dst[i:], c.buf[:len(src)%bufSize]) + } +} diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go index 91520d1de079..47eac0314c9d 100644 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go +++ b/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !s390x gccgo appengine +// +build !arm64,!s390x arm64,!go1.11 gccgo appengine package chacha20 diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go index 0c1c671c40b7..aad645b44762 100644 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go +++ b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go @@ -6,14 +6,13 @@ package chacha20 -var haveAsm = hasVectorFacility() +import ( + "golang.org/x/sys/cpu" +) -const bufSize = 256 +var haveAsm = cpu.S390X.HasVX -// hasVectorFacility reports whether the machine supports the vector -// facility (vx). -// Implementation in asm_s390x.s. -func hasVectorFacility() bool +const bufSize = 256 // xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only // be called when the vector facility is available. diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s index 98427c5e222a..57df404465c2 100644 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s +++ b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s @@ -258,26 +258,3 @@ tail: MOVD R8, R3 MOVD $0, R4 JMP continue - -// func hasVectorFacility() bool -TEXT ·hasVectorFacility(SB), NOSPLIT, $24-1 - MOVD $x-24(SP), R1 - XC $24, 0(R1), 0(R1) // clear the storage - MOVD $2, R0 // R0 is the number of double words stored -1 - WORD $0xB2B01000 // STFLE 0(R1) - XOR R0, R0 // reset the value of R0 - MOVBZ z-8(SP), R1 - AND $0x40, R1 - BEQ novector - -vectorinstalled: - // check if the vector instruction has been enabled - VLEIB $0, $0xF, V16 - VLGVB $0, V16, R1 - CMPBNE R1, $0xF, novector - MOVB $1, ret+0(FP) // have vx - RET - -novector: - MOVB $0, ret+0(FP) // no vx - RET diff --git a/vendor/golang.org/x/crypto/openpgp/write.go b/vendor/golang.org/x/crypto/openpgp/write.go index d6dede74e97c..4ee71784ebe0 100644 --- a/vendor/golang.org/x/crypto/openpgp/write.go +++ b/vendor/golang.org/x/crypto/openpgp/write.go @@ -271,6 +271,7 @@ func Encrypt(ciphertext io.Writer, to []*Entity, signed *Entity, hints *FileHint // These are the possible hash functions that we'll use for the signature. candidateHashes := []uint8{ hashToHashId(crypto.SHA256), + hashToHashId(crypto.SHA384), hashToHashId(crypto.SHA512), hashToHashId(crypto.SHA1), hashToHashId(crypto.RIPEMD160), @@ -349,6 +350,7 @@ func Sign(output io.Writer, signed *Entity, hints *FileHints, config *packet.Con // These are the possible hash functions that we'll use for the signature. candidateHashes := []uint8{ hashToHashId(crypto.SHA256), + hashToHashId(crypto.SHA384), hashToHashId(crypto.SHA512), hashToHashId(crypto.SHA1), hashToHashId(crypto.RIPEMD160), diff --git a/vendor/golang.org/x/crypto/pkcs12/pkcs12.go b/vendor/golang.org/x/crypto/pkcs12/pkcs12.go index eff9ad3a98f8..55f7691d48d9 100644 --- a/vendor/golang.org/x/crypto/pkcs12/pkcs12.go +++ b/vendor/golang.org/x/crypto/pkcs12/pkcs12.go @@ -7,6 +7,9 @@ // This implementation is distilled from https://tools.ietf.org/html/rfc7292 // and referenced documents. It is intended for decoding P12/PFX-stored // certificates and keys for use with the crypto/tls package. +// +// This package is frozen. If it's missing functionality you need, consider +// an alternative like software.sslmate.com/src/go-pkcs12. package pkcs12 import ( @@ -100,7 +103,7 @@ func unmarshal(in []byte, out interface{}) error { return nil } -// ConvertToPEM converts all "safe bags" contained in pfxData to PEM blocks. +// ToPEM converts all "safe bags" contained in pfxData to PEM blocks. func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) { encodedPassword, err := bmpString(password) if err != nil { @@ -208,7 +211,7 @@ func convertAttribute(attribute *pkcs12Attribute) (key, value string, err error) // Decode extracts a certificate and private key from pfxData. This function // assumes that there is only one certificate and only one private key in the -// pfxData. +// pfxData; if there are more use ToPEM instead. func Decode(pfxData []byte, password string) (privateKey interface{}, certificate *x509.Certificate, err error) { encodedPassword, err := bmpString(password) if err != nil { diff --git a/vendor/golang.org/x/crypto/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/poly1305/mac_noasm.go new file mode 100644 index 000000000000..8387d29998fe --- /dev/null +++ b/vendor/golang.org/x/crypto/poly1305/mac_noasm.go @@ -0,0 +1,11 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !amd64 gccgo appengine + +package poly1305 + +type mac struct{ macGeneric } + +func newMAC(key *[32]byte) mac { return mac{newMACGeneric(key)} } diff --git a/vendor/golang.org/x/crypto/poly1305/poly1305.go b/vendor/golang.org/x/crypto/poly1305/poly1305.go index f562fa5712ba..d076a562351f 100644 --- a/vendor/golang.org/x/crypto/poly1305/poly1305.go +++ b/vendor/golang.org/x/crypto/poly1305/poly1305.go @@ -2,21 +2,19 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -/* -Package poly1305 implements Poly1305 one-time message authentication code as -specified in https://cr.yp.to/mac/poly1305-20050329.pdf. - -Poly1305 is a fast, one-time authentication function. It is infeasible for an -attacker to generate an authenticator for a message without the key. However, a -key must only be used for a single message. Authenticating two different -messages with the same key allows an attacker to forge authenticators for other -messages with the same key. - -Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was -used with a fixed key in order to generate one-time keys from an nonce. -However, in this package AES isn't used and the one-time key is specified -directly. -*/ +// Package poly1305 implements Poly1305 one-time message authentication code as +// specified in https://cr.yp.to/mac/poly1305-20050329.pdf. +// +// Poly1305 is a fast, one-time authentication function. It is infeasible for an +// attacker to generate an authenticator for a message without the key. However, a +// key must only be used for a single message. Authenticating two different +// messages with the same key allows an attacker to forge authenticators for other +// messages with the same key. +// +// Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was +// used with a fixed key in order to generate one-time keys from an nonce. +// However, in this package AES isn't used and the one-time key is specified +// directly. package poly1305 // import "golang.org/x/crypto/poly1305" import "crypto/subtle" @@ -31,3 +29,55 @@ func Verify(mac *[16]byte, m []byte, key *[32]byte) bool { Sum(&tmp, m, key) return subtle.ConstantTimeCompare(tmp[:], mac[:]) == 1 } + +// New returns a new MAC computing an authentication +// tag of all data written to it with the given key. +// This allows writing the message progressively instead +// of passing it as a single slice. Common users should use +// the Sum function instead. +// +// The key must be unique for each message, as authenticating +// two different messages with the same key allows an attacker +// to forge messages at will. +func New(key *[32]byte) *MAC { + return &MAC{ + mac: newMAC(key), + finalized: false, + } +} + +// MAC is an io.Writer computing an authentication tag +// of the data written to it. +// +// MAC cannot be used like common hash.Hash implementations, +// because using a poly1305 key twice breaks its security. +// Therefore writing data to a running MAC after calling +// Sum causes it to panic. +type MAC struct { + mac // platform-dependent implementation + + finalized bool +} + +// Size returns the number of bytes Sum will return. +func (h *MAC) Size() int { return TagSize } + +// Write adds more data to the running message authentication code. +// It never returns an error. +// +// It must not be called after the first call of Sum. +func (h *MAC) Write(p []byte) (n int, err error) { + if h.finalized { + panic("poly1305: write to MAC after Sum") + } + return h.mac.Write(p) +} + +// Sum computes the authenticator of all data written to the +// message authentication code. +func (h *MAC) Sum(b []byte) []byte { + var mac [TagSize]byte + h.mac.Sum(&mac) + h.finalized = true + return append(b, mac[:]...) +} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.go b/vendor/golang.org/x/crypto/poly1305/sum_amd64.go index 4dd72fe799b2..2dbf42aa537a 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_amd64.go +++ b/vendor/golang.org/x/crypto/poly1305/sum_amd64.go @@ -6,17 +6,63 @@ package poly1305 -// This function is implemented in sum_amd64.s //go:noescape -func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]byte) +func initialize(state *[7]uint64, key *[32]byte) + +//go:noescape +func update(state *[7]uint64, msg []byte) + +//go:noescape +func finalize(tag *[TagSize]byte, state *[7]uint64) // Sum generates an authenticator for m using a one-time key and puts the // 16-byte result into out. Authenticating two different messages with the same // key allows an attacker to forge messages at will. func Sum(out *[16]byte, m []byte, key *[32]byte) { - var mPtr *byte - if len(m) > 0 { - mPtr = &m[0] + h := newMAC(key) + h.Write(m) + h.Sum(out) +} + +func newMAC(key *[32]byte) (h mac) { + initialize(&h.state, key) + return +} + +type mac struct { + state [7]uint64 // := uint64{ h0, h1, h2, r0, r1, pad0, pad1 } + + buffer [TagSize]byte + offset int +} + +func (h *mac) Write(p []byte) (n int, err error) { + n = len(p) + if h.offset > 0 { + remaining := TagSize - h.offset + if n < remaining { + h.offset += copy(h.buffer[h.offset:], p) + return n, nil + } + copy(h.buffer[h.offset:], p[:remaining]) + p = p[remaining:] + h.offset = 0 + update(&h.state, h.buffer[:]) + } + if nn := len(p) - (len(p) % TagSize); nn > 0 { + update(&h.state, p[:nn]) + p = p[nn:] + } + if len(p) > 0 { + h.offset += copy(h.buffer[h.offset:], p) + } + return n, nil +} + +func (h *mac) Sum(out *[16]byte) { + state := h.state + if h.offset > 0 { + update(&state, h.buffer[:h.offset]) } - poly1305(out, mPtr, uint64(len(m)), key) + finalize(out, &state) } diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/poly1305/sum_amd64.s index 2edae63828a5..7d600f13cc87 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s +++ b/vendor/golang.org/x/crypto/poly1305/sum_amd64.s @@ -58,20 +58,17 @@ DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC GLOBL ·poly1305Mask<>(SB), RODATA, $16 -// func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]key) -TEXT ·poly1305(SB), $0-32 - MOVQ out+0(FP), DI - MOVQ m+8(FP), SI - MOVQ mlen+16(FP), R15 - MOVQ key+24(FP), AX - - MOVQ 0(AX), R11 - MOVQ 8(AX), R12 - ANDQ ·poly1305Mask<>(SB), R11 // r0 - ANDQ ·poly1305Mask<>+8(SB), R12 // r1 - XORQ R8, R8 // h0 - XORQ R9, R9 // h1 - XORQ R10, R10 // h2 +// func update(state *[7]uint64, msg []byte) +TEXT ·update(SB), $0-32 + MOVQ state+0(FP), DI + MOVQ msg_base+8(FP), SI + MOVQ msg_len+16(FP), R15 + + MOVQ 0(DI), R8 // h0 + MOVQ 8(DI), R9 // h1 + MOVQ 16(DI), R10 // h2 + MOVQ 24(DI), R11 // r0 + MOVQ 32(DI), R12 // r1 CMPQ R15, $16 JB bytes_between_0_and_15 @@ -109,16 +106,42 @@ flush_buffer: JMP multiply done: - MOVQ R8, AX - MOVQ R9, BX + MOVQ R8, 0(DI) + MOVQ R9, 8(DI) + MOVQ R10, 16(DI) + RET + +// func initialize(state *[7]uint64, key *[32]byte) +TEXT ·initialize(SB), $0-16 + MOVQ state+0(FP), DI + MOVQ key+8(FP), SI + + // state[0...7] is initialized with zero + MOVOU 0(SI), X0 + MOVOU 16(SI), X1 + MOVOU ·poly1305Mask<>(SB), X2 + PAND X2, X0 + MOVOU X0, 24(DI) + MOVOU X1, 40(DI) + RET + +// func finalize(tag *[TagSize]byte, state *[7]uint64) +TEXT ·finalize(SB), $0-16 + MOVQ tag+0(FP), DI + MOVQ state+8(FP), SI + + MOVQ 0(SI), AX + MOVQ 8(SI), BX + MOVQ 16(SI), CX + MOVQ AX, R8 + MOVQ BX, R9 SUBQ $0xFFFFFFFFFFFFFFFB, AX SBBQ $0xFFFFFFFFFFFFFFFF, BX - SBBQ $3, R10 + SBBQ $3, CX CMOVQCS R8, AX CMOVQCS R9, BX - MOVQ key+24(FP), R8 - ADDQ 16(R8), AX - ADCQ 24(R8), BX + ADDQ 40(SI), AX + ADCQ 48(SI), BX MOVQ AX, 0(DI) MOVQ BX, 8(DI) diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ref.go b/vendor/golang.org/x/crypto/poly1305/sum_generic.go similarity index 54% rename from vendor/golang.org/x/crypto/poly1305/sum_ref.go rename to vendor/golang.org/x/crypto/poly1305/sum_generic.go index c4d59bd09874..bab76ef0d83b 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_ref.go +++ b/vendor/golang.org/x/crypto/poly1305/sum_generic.go @@ -1,4 +1,4 @@ -// Copyright 2012 The Go Authors. All rights reserved. +// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -6,21 +6,79 @@ package poly1305 import "encoding/binary" +const ( + msgBlock = uint32(1 << 24) + finalBlock = uint32(0) +) + // sumGeneric generates an authenticator for msg using a one-time key and // puts the 16-byte result into out. This is the generic implementation of // Sum and should be called if no assembly implementation is available. func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) { - var ( - h0, h1, h2, h3, h4 uint32 // the hash accumulators - r0, r1, r2, r3, r4 uint64 // the r part of the key - ) + h := newMACGeneric(key) + h.Write(msg) + h.Sum(out) +} + +func newMACGeneric(key *[32]byte) (h macGeneric) { + h.r[0] = binary.LittleEndian.Uint32(key[0:]) & 0x3ffffff + h.r[1] = (binary.LittleEndian.Uint32(key[3:]) >> 2) & 0x3ffff03 + h.r[2] = (binary.LittleEndian.Uint32(key[6:]) >> 4) & 0x3ffc0ff + h.r[3] = (binary.LittleEndian.Uint32(key[9:]) >> 6) & 0x3f03fff + h.r[4] = (binary.LittleEndian.Uint32(key[12:]) >> 8) & 0x00fffff + + h.s[0] = binary.LittleEndian.Uint32(key[16:]) + h.s[1] = binary.LittleEndian.Uint32(key[20:]) + h.s[2] = binary.LittleEndian.Uint32(key[24:]) + h.s[3] = binary.LittleEndian.Uint32(key[28:]) + return +} + +type macGeneric struct { + h, r [5]uint32 + s [4]uint32 + + buffer [TagSize]byte + offset int +} + +func (h *macGeneric) Write(p []byte) (n int, err error) { + n = len(p) + if h.offset > 0 { + remaining := TagSize - h.offset + if n < remaining { + h.offset += copy(h.buffer[h.offset:], p) + return n, nil + } + copy(h.buffer[h.offset:], p[:remaining]) + p = p[remaining:] + h.offset = 0 + updateGeneric(h.buffer[:], msgBlock, &(h.h), &(h.r)) + } + if nn := len(p) - (len(p) % TagSize); nn > 0 { + updateGeneric(p, msgBlock, &(h.h), &(h.r)) + p = p[nn:] + } + if len(p) > 0 { + h.offset += copy(h.buffer[h.offset:], p) + } + return n, nil +} - r0 = uint64(binary.LittleEndian.Uint32(key[0:]) & 0x3ffffff) - r1 = uint64((binary.LittleEndian.Uint32(key[3:]) >> 2) & 0x3ffff03) - r2 = uint64((binary.LittleEndian.Uint32(key[6:]) >> 4) & 0x3ffc0ff) - r3 = uint64((binary.LittleEndian.Uint32(key[9:]) >> 6) & 0x3f03fff) - r4 = uint64((binary.LittleEndian.Uint32(key[12:]) >> 8) & 0x00fffff) +func (h *macGeneric) Sum(out *[16]byte) { + H, R := h.h, h.r + if h.offset > 0 { + var buffer [TagSize]byte + copy(buffer[:], h.buffer[:h.offset]) + buffer[h.offset] = 1 // invariant: h.offset < TagSize + updateGeneric(buffer[:], finalBlock, &H, &R) + } + finalizeGeneric(out, &H, &(h.s)) +} +func updateGeneric(msg []byte, flag uint32, h, r *[5]uint32) { + h0, h1, h2, h3, h4 := h[0], h[1], h[2], h[3], h[4] + r0, r1, r2, r3, r4 := uint64(r[0]), uint64(r[1]), uint64(r[2]), uint64(r[3]), uint64(r[4]) R1, R2, R3, R4 := r1*5, r2*5, r3*5, r4*5 for len(msg) >= TagSize { @@ -29,7 +87,7 @@ func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) { h1 += (binary.LittleEndian.Uint32(msg[3:]) >> 2) & 0x3ffffff h2 += (binary.LittleEndian.Uint32(msg[6:]) >> 4) & 0x3ffffff h3 += (binary.LittleEndian.Uint32(msg[9:]) >> 6) & 0x3ffffff - h4 += (binary.LittleEndian.Uint32(msg[12:]) >> 8) | (1 << 24) + h4 += (binary.LittleEndian.Uint32(msg[12:]) >> 8) | flag // h *= r d0 := (uint64(h0) * r0) + (uint64(h1) * R4) + (uint64(h2) * R3) + (uint64(h3) * R2) + (uint64(h4) * R1) @@ -52,36 +110,11 @@ func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) { msg = msg[TagSize:] } - if len(msg) > 0 { - var block [TagSize]byte - off := copy(block[:], msg) - block[off] = 0x01 - - // h += msg - h0 += binary.LittleEndian.Uint32(block[0:]) & 0x3ffffff - h1 += (binary.LittleEndian.Uint32(block[3:]) >> 2) & 0x3ffffff - h2 += (binary.LittleEndian.Uint32(block[6:]) >> 4) & 0x3ffffff - h3 += (binary.LittleEndian.Uint32(block[9:]) >> 6) & 0x3ffffff - h4 += (binary.LittleEndian.Uint32(block[12:]) >> 8) - - // h *= r - d0 := (uint64(h0) * r0) + (uint64(h1) * R4) + (uint64(h2) * R3) + (uint64(h3) * R2) + (uint64(h4) * R1) - d1 := (d0 >> 26) + (uint64(h0) * r1) + (uint64(h1) * r0) + (uint64(h2) * R4) + (uint64(h3) * R3) + (uint64(h4) * R2) - d2 := (d1 >> 26) + (uint64(h0) * r2) + (uint64(h1) * r1) + (uint64(h2) * r0) + (uint64(h3) * R4) + (uint64(h4) * R3) - d3 := (d2 >> 26) + (uint64(h0) * r3) + (uint64(h1) * r2) + (uint64(h2) * r1) + (uint64(h3) * r0) + (uint64(h4) * R4) - d4 := (d3 >> 26) + (uint64(h0) * r4) + (uint64(h1) * r3) + (uint64(h2) * r2) + (uint64(h3) * r1) + (uint64(h4) * r0) - - // h %= p - h0 = uint32(d0) & 0x3ffffff - h1 = uint32(d1) & 0x3ffffff - h2 = uint32(d2) & 0x3ffffff - h3 = uint32(d3) & 0x3ffffff - h4 = uint32(d4) & 0x3ffffff + h[0], h[1], h[2], h[3], h[4] = h0, h1, h2, h3, h4 +} - h0 += uint32(d4>>26) * 5 - h1 += h0 >> 26 - h0 = h0 & 0x3ffffff - } +func finalizeGeneric(out *[TagSize]byte, h *[5]uint32, s *[4]uint32) { + h0, h1, h2, h3, h4 := h[0], h[1], h[2], h[3], h[4] // h %= p reduction h2 += h1 >> 26 @@ -123,13 +156,13 @@ func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) { // s: the s part of the key // tag = (h + s) % (2^128) - t := uint64(h0) + uint64(binary.LittleEndian.Uint32(key[16:])) + t := uint64(h0) + uint64(s[0]) h0 = uint32(t) - t = uint64(h1) + uint64(binary.LittleEndian.Uint32(key[20:])) + (t >> 32) + t = uint64(h1) + uint64(s[1]) + (t >> 32) h1 = uint32(t) - t = uint64(h2) + uint64(binary.LittleEndian.Uint32(key[24:])) + (t >> 32) + t = uint64(h2) + uint64(s[2]) + (t >> 32) h2 = uint32(t) - t = uint64(h3) + uint64(binary.LittleEndian.Uint32(key[28:])) + (t >> 32) + t = uint64(h3) + uint64(s[3]) + (t >> 32) h3 = uint32(t) binary.LittleEndian.PutUint32(out[0:], h0) diff --git a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go b/vendor/golang.org/x/crypto/poly1305/sum_noasm.go index 751eec52743c..fcdef46ab6e7 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go +++ b/vendor/golang.org/x/crypto/poly1305/sum_noasm.go @@ -10,5 +10,7 @@ package poly1305 // 16-byte result into out. Authenticating two different messages with the same // key allows an attacker to forge messages at will. func Sum(out *[TagSize]byte, msg []byte, key *[32]byte) { - sumGeneric(out, msg, key) + h := newMAC(key) + h.Write(msg) + h.Sum(out) } diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.go b/vendor/golang.org/x/crypto/poly1305/sum_s390x.go index 7a266cece46a..ec99e07e9fb4 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_s390x.go +++ b/vendor/golang.org/x/crypto/poly1305/sum_s390x.go @@ -6,16 +6,9 @@ package poly1305 -// hasVectorFacility reports whether the machine supports -// the vector facility (vx). -func hasVectorFacility() bool - -// hasVMSLFacility reports whether the machine supports -// Vector Multiply Sum Logical (VMSL). -func hasVMSLFacility() bool - -var hasVX = hasVectorFacility() -var hasVMSL = hasVMSLFacility() +import ( + "golang.org/x/sys/cpu" +) // poly1305vx is an assembly implementation of Poly1305 that uses vector // instructions. It must only be called if the vector facility (vx) is @@ -33,12 +26,12 @@ func poly1305vmsl(out *[16]byte, m *byte, mlen uint64, key *[32]byte) // 16-byte result into out. Authenticating two different messages with the same // key allows an attacker to forge messages at will. func Sum(out *[16]byte, m []byte, key *[32]byte) { - if hasVX { + if cpu.S390X.HasVX { var mPtr *byte if len(m) > 0 { mPtr = &m[0] } - if hasVMSL && len(m) > 256 { + if cpu.S390X.HasVXE && len(m) > 256 { poly1305vmsl(out, mPtr, uint64(len(m)), key) } else { poly1305vx(out, mPtr, uint64(len(m)), key) diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s b/vendor/golang.org/x/crypto/poly1305/sum_s390x.s index 356c07a6c2b1..ca5a309d8672 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s +++ b/vendor/golang.org/x/crypto/poly1305/sum_s390x.s @@ -376,25 +376,3 @@ b1: MOVD $0, R3 BR multiply - -TEXT ·hasVectorFacility(SB), NOSPLIT, $24-1 - MOVD $x-24(SP), R1 - XC $24, 0(R1), 0(R1) // clear the storage - MOVD $2, R0 // R0 is the number of double words stored -1 - WORD $0xB2B01000 // STFLE 0(R1) - XOR R0, R0 // reset the value of R0 - MOVBZ z-8(SP), R1 - AND $0x40, R1 - BEQ novector - -vectorinstalled: - // check if the vector instruction has been enabled - VLEIB $0, $0xF, V16 - VLGVB $0, V16, R1 - CMPBNE R1, $0xF, novector - MOVB $1, ret+0(FP) // have vx - RET - -novector: - MOVB $0, ret+0(FP) // no vx - RET diff --git a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s b/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s index e548020b14e1..e60bbc1d7f89 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s +++ b/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s @@ -907,25 +907,3 @@ square: MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) BR next - -TEXT ·hasVMSLFacility(SB), NOSPLIT, $24-1 - MOVD $x-24(SP), R1 - XC $24, 0(R1), 0(R1) // clear the storage - MOVD $2, R0 // R0 is the number of double words stored -1 - WORD $0xB2B01000 // STFLE 0(R1) - XOR R0, R0 // reset the value of R0 - MOVBZ z-8(SP), R1 - AND $0x01, R1 - BEQ novmsl - -vectorinstalled: - // check if the vector instruction has been enabled - VLEIB $0, $0xF, V16 - VLGVB $0, V16, R1 - CMPBNE R1, $0xF, novmsl - MOVB $1, ret+0(FP) // have vx - RET - -novmsl: - MOVB $0, ret+0(FP) // no vx - RET diff --git a/vendor/golang.org/x/net/html/node.go b/vendor/golang.org/x/net/html/node.go index 2c1cade6070d..633ee15dc55b 100644 --- a/vendor/golang.org/x/net/html/node.go +++ b/vendor/golang.org/x/net/html/node.go @@ -177,7 +177,7 @@ func (s *nodeStack) index(n *Node) int { // contains returns whether a is within s. func (s *nodeStack) contains(a atom.Atom) bool { for _, n := range *s { - if n.DataAtom == a { + if n.DataAtom == a && n.Namespace == "" { return true } } diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 64a5793725b9..ca2cb5875b23 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -439,9 +439,6 @@ func (p *parser) resetInsertionMode() { case a.Select: if !last { for ancestor, first := n, p.oe[0]; ancestor != first; { - if ancestor == first { - break - } ancestor = p.oe[p.oe.index(ancestor)-1] switch ancestor.DataAtom { case a.Template: @@ -1719,8 +1716,12 @@ func inSelectIM(p *parser) bool { } p.addElement() case a.Select: - p.tok.Type = EndTagToken - return false + if p.popUntil(selectScope, a.Select) { + p.resetInsertionMode() + } else { + // Ignore the token. + return true + } case a.Input, a.Keygen, a.Textarea: if p.elementInScope(selectScope, a.Select) { p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) @@ -1750,6 +1751,9 @@ func inSelectIM(p *parser) bool { case a.Select: if p.popUntil(selectScope, a.Select) { p.resetInsertionMode() + } else { + // Ignore the token. + return true } case a.Template: return inHeadIM(p) @@ -1775,13 +1779,22 @@ func inSelectInTableIM(p *parser) bool { case StartTagToken, EndTagToken: switch p.tok.DataAtom { case a.Caption, a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr, a.Td, a.Th: - if p.tok.Type == StartTagToken || p.elementInScope(tableScope, p.tok.DataAtom) { - p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) - return false - } else { + if p.tok.Type == EndTagToken && !p.elementInScope(tableScope, p.tok.DataAtom) { // Ignore the token. return true } + // This is like p.popUntil(selectScope, a.Select), but it also + // matches , not just