From 770b1fc1853c317e71d75b41a2ead77879270600 Mon Sep 17 00:00:00 2001 From: Collin Shoop Date: Thu, 10 Mar 2022 15:57:09 -0500 Subject: [PATCH] docr: add region support (#1118) --- commands/displayers/registry.go | 35 +++++++++++ commands/registry.go | 21 +++++++ commands/registry_test.go | 55 ++++++++++++++---- do/mocks/RegistryService.go | 15 +++++ do/registry.go | 10 ++++ go.mod | 2 +- go.sum | 4 +- integration/registry_create_test.go | 50 ++++++++++++---- integration/registry_get_test.go | 17 ++++-- .../github.com/digitalocean/godo/CHANGELOG.md | 4 ++ .../github.com/digitalocean/godo/droplets.go | 58 ++++++++++--------- vendor/github.com/digitalocean/godo/godo.go | 2 +- .../digitalocean/godo/load_balancers.go | 3 + .../digitalocean/godo/monitoring.go | 4 ++ .../github.com/digitalocean/godo/registry.go | 3 + vendor/modules.txt | 2 +- 16 files changed, 226 insertions(+), 59 deletions(-) diff --git a/commands/displayers/registry.go b/commands/displayers/registry.go index 005232f0d..d0e72e511 100644 --- a/commands/displayers/registry.go +++ b/commands/displayers/registry.go @@ -34,6 +34,7 @@ func (r *Registry) Cols() []string { return []string{ "Name", "Endpoint", + "Region", } } @@ -41,6 +42,7 @@ func (r *Registry) ColMap() map[string]string { return map[string]string{ "Name": "Name", "Endpoint": "Endpoint", + "Region": "Region slug", } } @@ -51,6 +53,7 @@ func (r *Registry) KV() []map[string]interface{} { m := map[string]interface{}{ "Name": reg.Name, "Endpoint": reg.Endpoint(), + "Region": reg.Region, } out = append(out, m) @@ -359,3 +362,35 @@ func (t *RegistrySubscriptionTiers) KV() []map[string]interface{} { return out } + +type RegistryAvailableRegions struct { + Regions []string +} + +func (t *RegistryAvailableRegions) JSON(out io.Writer) error { + return writeJSON(t, out) +} + +func (t *RegistryAvailableRegions) Cols() []string { + return []string{ + "Slug", + } +} + +func (t *RegistryAvailableRegions) ColMap() map[string]string { + return map[string]string{ + "Slug": "Region Slug", + } +} + +func (t *RegistryAvailableRegions) KV() []map[string]interface{} { + out := make([]map[string]interface{}, 0, len(t.Regions)) + + for _, region := range t.Regions { + out = append(out, map[string]interface{}{ + "Slug": region, + }) + } + + return out +} diff --git a/commands/registry.go b/commands/registry.go index 6f0ff5ab2..a38819f52 100644 --- a/commands/registry.go +++ b/commands/registry.go @@ -67,6 +67,8 @@ func Registry() *Command { "Create a private container registry", createRegDesc, Writer) AddStringFlag(cmdRunRegistryCreate, doctl.ArgSubscriptionTier, "", "basic", "Subscription tier for the new registry. Possible values: see `doctl registry options subscription-tiers`", requiredOpt()) + AddStringFlag(cmdRunRegistryCreate, doctl.ArgRegionSlug, "", "", + "Region for the new registry. Possible values: see `doctl registry options available-regions`") getRegDesc := "This command retrieves details about a private container registry including its name and the endpoint used to access it." CmdBuilder(cmd, RunRegistryGet, "get", "Retrieve details about a container registry", @@ -304,6 +306,8 @@ func RegistryOptions() *Command { tiersDesc := "List available container registry subscription tiers" CmdBuilder(cmd, RunRegistryOptionsTiers, "subscription-tiers", tiersDesc, tiersDesc, Writer, aliasOpt("tiers")) + regionsDesc := "List available container registry regions" + CmdBuilder(cmd, RunGetRegistryOptionsRegions, "available-regions", regionsDesc, regionsDesc, Writer, aliasOpt("regions")) return cmd } @@ -322,12 +326,17 @@ func RunRegistryCreate(c *CmdConfig) error { if err != nil { return err } + region, err := c.Doit.GetString(c.NS, doctl.ArgRegionSlug) + if err != nil { + return err + } rs := c.Registry() rcr := &godo.RegistryCreateRequest{ Name: name, SubscriptionTierSlug: subscriptionTier, + Region: region, } r, err := rs.Create(rcr) if err != nil { @@ -906,3 +915,15 @@ func RunRegistryOptionsTiers(c *CmdConfig) error { } return c.Display(item) } + +func RunGetRegistryOptionsRegions(c *CmdConfig) error { + regions, err := c.Registry().GetAvailableRegions() + if err != nil { + return err + } + + item := &displayers.RegistryAvailableRegions{ + Regions: regions, + } + return c.Display(item) +} diff --git a/commands/registry_test.go b/commands/registry_test.go index ba4f99691..cd1cd3d8d 100644 --- a/commands/registry_test.go +++ b/commands/registry_test.go @@ -34,6 +34,7 @@ import ( var ( testRegistryName = "container-registry" + testRegistryRegion = "r1" testSubscriptionTier = "basic" invalidRegistryName = "invalid-container-registry" testRegistry = do.Registry{Registry: &godo.Registry{Name: testRegistryName}} @@ -159,17 +160,36 @@ func TestGarbageCollectionCommand(t *testing.T) { } func TestRegistryCreate(t *testing.T) { - withTestClient(t, func(config *CmdConfig, tm *tcMocks) { - rcr := godo.RegistryCreateRequest{ - Name: testRegistryName, - SubscriptionTierSlug: testSubscriptionTier, - } - tm.registry.EXPECT().Create(&rcr).Return(&testRegistry, nil) - config.Args = append(config.Args, testRegistryName) - config.Doit.Set(config.NS, doctl.ArgSubscriptionTier, "basic") + t.Run("success", func(t *testing.T) { + withTestClient(t, func(config *CmdConfig, tm *tcMocks) { + rcr := godo.RegistryCreateRequest{ + Name: testRegistryName, + SubscriptionTierSlug: testSubscriptionTier, + Region: testRegistryRegion, + } + tm.registry.EXPECT().Create(&rcr).Return(&testRegistry, nil) + config.Args = append(config.Args, testRegistryName) + config.Doit.Set(config.NS, doctl.ArgSubscriptionTier, testSubscriptionTier) + config.Doit.Set(config.NS, doctl.ArgRegionSlug, testRegistryRegion) + + err := RunRegistryCreate(config) + assert.NoError(t, err) + }) + }) - err := RunRegistryCreate(config) - assert.NoError(t, err) + t.Run("region omitted", func(t *testing.T) { + withTestClient(t, func(config *CmdConfig, tm *tcMocks) { + rcr := godo.RegistryCreateRequest{ + Name: testRegistryName, + SubscriptionTierSlug: testSubscriptionTier, + } + tm.registry.EXPECT().Create(&rcr).Return(&testRegistry, nil) + config.Args = append(config.Args, testRegistryName) + config.Doit.Set(config.NS, doctl.ArgSubscriptionTier, testSubscriptionTier) + + err := RunRegistryCreate(config) + assert.NoError(t, err) + }) }) } @@ -1025,3 +1045,18 @@ func TestGarbageCollectionUpdate(t *testing.T) { }) } } + +func TestGetAvailableRegions(t *testing.T) { + withTestClient(t, func(config *CmdConfig, tm *tcMocks) { + t.Run("success", func(t *testing.T) { + tm.registry.EXPECT().GetAvailableRegions().Return([]string{"fra1", "sfo2", "blr1"}, nil) + err := RunGetRegistryOptionsRegions(config) + assert.NoError(t, err) + }) + t.Run("error", func(t *testing.T) { + tm.registry.EXPECT().GetAvailableRegions().Return(nil, errors.New("whoops")) + err := RunGetRegistryOptionsRegions(config) + assert.Error(t, err) + }) + }) +} diff --git a/do/mocks/RegistryService.go b/do/mocks/RegistryService.go index 1a503dbac..2ebd3c3b0 100644 --- a/do/mocks/RegistryService.go +++ b/do/mocks/RegistryService.go @@ -151,6 +151,21 @@ func (mr *MockRegistryServiceMockRecorder) Get() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRegistryService)(nil).Get)) } +// GetAvailableRegions mocks base method. +func (m *MockRegistryService) GetAvailableRegions() ([]string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAvailableRegions") + ret0, _ := ret[0].([]string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAvailableRegions indicates an expected call of GetAvailableRegions. +func (mr *MockRegistryServiceMockRecorder) GetAvailableRegions() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAvailableRegions", reflect.TypeOf((*MockRegistryService)(nil).GetAvailableRegions)) +} + // GetGarbageCollection mocks base method. func (m *MockRegistryService) GetGarbageCollection(arg0 string) (*do.GarbageCollection, error) { m.ctrl.T.Helper() diff --git a/do/registry.go b/do/registry.go index ea81806d0..3f967b1b7 100644 --- a/do/registry.go +++ b/do/registry.go @@ -85,6 +85,7 @@ type RegistryService interface { ListGarbageCollections(string) ([]GarbageCollection, error) CancelGarbageCollection(string, string) (*GarbageCollection, error) GetSubscriptionTiers() ([]RegistrySubscriptionTier, error) + GetAvailableRegions() ([]string, error) RevokeOAuthToken(token string, endpoint string) error } @@ -342,6 +343,15 @@ func (rs *registryService) GetSubscriptionTiers() ([]RegistrySubscriptionTier, e return ret, nil } +func (rs *registryService) GetAvailableRegions() ([]string, error) { + opts, _, err := rs.client.Registry.GetOptions(rs.ctx) + if err != nil { + return nil, err + } + + return opts.AvailableRegions, nil +} + func (rs *registryService) RevokeOAuthToken(token string, endpoint string) error { data := url.Values{} data.Set("token", token) diff --git a/go.mod b/go.mod index 269903086..27448bc2c 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/blang/semver v3.5.1+incompatible github.com/containerd/continuity v0.0.0-20200413184840-d3ef23f19fbb // indirect github.com/creack/pty v1.1.11 - github.com/digitalocean/godo v1.75.0 + github.com/digitalocean/godo v1.76.0 github.com/docker/cli v0.0.0-20200622130859-87db43814b48 github.com/docker/docker v17.12.0-ce-rc1.0.20200531234253-77e06fda0c94+incompatible // indirect github.com/docker/docker-credential-helpers v0.6.3 // indirect diff --git a/go.sum b/go.sum index 98022462b..953df0eae 100644 --- a/go.sum +++ b/go.sum @@ -99,8 +99,8 @@ github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/digitalocean/godo v1.75.0 h1:UijUv60I095CqJqGKdjY2RTPnnIa4iFddmq+1wfyS4Y= -github.com/digitalocean/godo v1.75.0/go.mod h1:GBmu8MkjZmNARE7IXRPmkbbnocNN8+uBm0xbEVw2LCs= +github.com/digitalocean/godo v1.76.0 h1:pRXXYkoOYyviwPy8tTxOYEIL6OQd3RlewzGAkKUZTBs= +github.com/digitalocean/godo v1.76.0/go.mod h1:GBmu8MkjZmNARE7IXRPmkbbnocNN8+uBm0xbEVw2LCs= github.com/docker/cli v0.0.0-20200622130859-87db43814b48 h1:AC8qbhi/SjYf4iN2W3jSsofZGHWPjG8pjf5P143KUM8= github.com/docker/cli v0.0.0-20200622130859-87db43814b48/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/docker v17.12.0-ce-rc1.0.20200531234253-77e06fda0c94+incompatible h1:PmGHHCZ43l6h8aZIi+Xa+z1SWe4dFImd5EK3TNp1jlo= diff --git a/integration/registry_create_test.go b/integration/registry_create_test.go index 271b2270e..ad2b22068 100644 --- a/integration/registry_create_test.go +++ b/integration/registry_create_test.go @@ -19,6 +19,8 @@ var _ = suite("registry/create", func(t *testing.T, when spec.G, it spec.S) { expect *require.Assertions server *httptest.Server expectedTierSlug string + reqRegion string // region provided in http create req + expectedRegion string // region in response ) it.Before(func() { @@ -43,10 +45,15 @@ var _ = suite("registry/create", func(t *testing.T, when spec.G, it spec.S) { reqBody, err := ioutil.ReadAll(req.Body) expect.NoError(err) - expectedJSON := fmt.Sprintf(registryCreateRequest, expectedTierSlug) + var expectedJSON string + if reqRegion == "" { + expectedJSON = fmt.Sprintf(registryCreateRequest, expectedTierSlug) + } else { + expectedJSON = fmt.Sprintf(registryCreateRequestWithRegion, expectedTierSlug, reqRegion) + } expect.JSONEq(expectedJSON, string(reqBody)) w.WriteHeader(http.StatusCreated) - w.Write([]byte(registryCreateResponse)) + w.Write([]byte(fmt.Sprintf(registryCreateResponse, expectedRegion))) default: dump, err := httputil.DumpRequest(req, true) if err != nil { @@ -67,11 +74,13 @@ var _ = suite("registry/create", func(t *testing.T, when spec.G, it spec.S) { "my-registry", ) expectedTierSlug = "basic" + reqRegion = "" + expectedRegion = "default" output, err := cmd.CombinedOutput() expect.NoError(err) - expect.Equal(strings.TrimSpace(registryGetOutput), strings.TrimSpace(string(output))) + expect.Equal(strings.TrimSpace(fmt.Sprintf(registryGetOutput, expectedRegion)), strings.TrimSpace(string(output))) }) it("creates a registry with subscription tier specified", func() { @@ -84,11 +93,32 @@ var _ = suite("registry/create", func(t *testing.T, when spec.G, it spec.S) { "--subscription-tier", "starter", ) expectedTierSlug = "starter" + reqRegion = "" + expectedRegion = "default" + + output, err := cmd.CombinedOutput() + expect.NoError(err) + + expect.Equal(strings.TrimSpace(fmt.Sprintf(registryGetOutput, expectedRegion)), strings.TrimSpace(string(output))) + }) + + it("creates a registry with region specified", func() { + cmd := exec.Command(builtBinaryPath, + "-t", "some-magic-token", + "-u", server.URL, + "registry", + "create", + "my-registry", + "--region", "r1", + ) + expectedTierSlug = "basic" + reqRegion = "r1" + expectedRegion = "r1" output, err := cmd.CombinedOutput() expect.NoError(err) - expect.Equal(strings.TrimSpace(registryGetOutput), strings.TrimSpace(string(output))) + expect.Equal(strings.TrimSpace(fmt.Sprintf(registryGetOutput, expectedRegion)), strings.TrimSpace(string(output))) }) }) @@ -99,20 +129,18 @@ const ( "subscription_tier_slug": "%s" } ` - registryCreateRequestWithTier = ` + registryCreateRequestWithRegion = ` { "name": "my-registry", - "subscription_tier_slug": "basic" + "subscription_tier_slug": "%s", + "region": "%s" } ` registryCreateResponse = ` { "registry": { - "name": "my-registry" + "name": "my-registry", + "region": "%s" } }` - registryCreateOutput = ` -Name Endpoint -my-registry registry.digitalocean.com/my-registry -` ) diff --git a/integration/registry_get_test.go b/integration/registry_get_test.go index 34b568b1e..108e85531 100644 --- a/integration/registry_get_test.go +++ b/integration/registry_get_test.go @@ -1,6 +1,7 @@ package integration import ( + "fmt" "net/http" "net/http/httptest" "net/http/httputil" @@ -14,8 +15,9 @@ import ( var _ = suite("registry/get", func(t *testing.T, when spec.G, it spec.S) { var ( - expect *require.Assertions - server *httptest.Server + expect *require.Assertions + server *httptest.Server + expectedRegion string ) it.Before(func() { @@ -56,11 +58,12 @@ var _ = suite("registry/get", func(t *testing.T, when spec.G, it spec.S) { "registry", "get", ) + expectedRegion = "r1" output, err := cmd.CombinedOutput() expect.NoError(err) - expect.Equal(strings.TrimSpace(registryGetOutput), strings.TrimSpace(string(output))) + expect.Equal(strings.TrimSpace(fmt.Sprintf(registryGetOutput, expectedRegion)), strings.TrimSpace(string(output))) }) }) @@ -68,11 +71,13 @@ const ( registryGetResponse = ` { "registry": { - "name": "my-registry" + "name": "my-registry", + "region": "r1" } }` + // note: used by tests in registry_create_test.go as well registryGetOutput = ` -Name Endpoint -my-registry registry.digitalocean.com/my-registry +Name Endpoint Region slug +my-registry registry.digitalocean.com/my-registry %s ` ) diff --git a/vendor/github.com/digitalocean/godo/CHANGELOG.md b/vendor/github.com/digitalocean/godo/CHANGELOG.md index 353494c12..e42718760 100644 --- a/vendor/github.com/digitalocean/godo/CHANGELOG.md +++ b/vendor/github.com/digitalocean/godo/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [v1.76.0] - 2022-03-09 + +- #516 - @CollinShoop - Add registry region support + ## [v1.75.0] - 2022-01-27 - #508 - @ElanHasson - Synchronize public protos and add multiple specs diff --git a/vendor/github.com/digitalocean/godo/droplets.go b/vendor/github.com/digitalocean/godo/droplets.go index 9a4845697..27f54de44 100644 --- a/vendor/github.com/digitalocean/godo/droplets.go +++ b/vendor/github.com/digitalocean/godo/droplets.go @@ -216,37 +216,41 @@ func (d DropletCreateSSHKey) MarshalJSON() ([]byte, error) { // DropletCreateRequest represents a request to create a Droplet. type DropletCreateRequest struct { - Name string `json:"name"` - Region string `json:"region"` - Size string `json:"size"` - Image DropletCreateImage `json:"image"` - SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` - Backups bool `json:"backups"` - IPv6 bool `json:"ipv6"` - PrivateNetworking bool `json:"private_networking"` - Monitoring bool `json:"monitoring"` - UserData string `json:"user_data,omitempty"` - Volumes []DropletCreateVolume `json:"volumes,omitempty"` - Tags []string `json:"tags"` - VPCUUID string `json:"vpc_uuid,omitempty"` - WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + Name string `json:"name"` + Region string `json:"region"` + Size string `json:"size"` + Image DropletCreateImage `json:"image"` + SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` + Backups bool `json:"backups"` + IPv6 bool `json:"ipv6"` + PrivateNetworking bool `json:"private_networking"` + Monitoring bool `json:"monitoring"` + UserData string `json:"user_data,omitempty"` + Volumes []DropletCreateVolume `json:"volumes,omitempty"` + Tags []string `json:"tags"` + VPCUUID string `json:"vpc_uuid,omitempty"` + WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + DisablePublicNetworking bool `json:"disable_public_networking,omitempty"` + WithFloatingIPAddress bool `json:"with_floating_ip_address,omitempty"` } // DropletMultiCreateRequest is a request to create multiple Droplets. type DropletMultiCreateRequest struct { - Names []string `json:"names"` - Region string `json:"region"` - Size string `json:"size"` - Image DropletCreateImage `json:"image"` - SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` - Backups bool `json:"backups"` - IPv6 bool `json:"ipv6"` - PrivateNetworking bool `json:"private_networking"` - Monitoring bool `json:"monitoring"` - UserData string `json:"user_data,omitempty"` - Tags []string `json:"tags"` - VPCUUID string `json:"vpc_uuid,omitempty"` - WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + Names []string `json:"names"` + Region string `json:"region"` + Size string `json:"size"` + Image DropletCreateImage `json:"image"` + SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` + Backups bool `json:"backups"` + IPv6 bool `json:"ipv6"` + PrivateNetworking bool `json:"private_networking"` + Monitoring bool `json:"monitoring"` + UserData string `json:"user_data,omitempty"` + Tags []string `json:"tags"` + VPCUUID string `json:"vpc_uuid,omitempty"` + WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + DisablePublicNetworking bool `json:"disable_public_networking,omitempty"` + WithFloatingIPAddress bool `json:"with_floating_ip_address,omitempty"` } func (d DropletCreateRequest) String() string { diff --git a/vendor/github.com/digitalocean/godo/godo.go b/vendor/github.com/digitalocean/godo/godo.go index 305102a58..be431e43c 100644 --- a/vendor/github.com/digitalocean/godo/godo.go +++ b/vendor/github.com/digitalocean/godo/godo.go @@ -20,7 +20,7 @@ import ( ) const ( - libraryVersion = "1.75.0" + libraryVersion = "1.76.0" defaultBaseURL = "https://api.digitalocean.com/" userAgent = "godo/" + libraryVersion mediaType = "application/json" diff --git a/vendor/github.com/digitalocean/godo/load_balancers.go b/vendor/github.com/digitalocean/godo/load_balancers.go index 303c48a38..da19a5193 100644 --- a/vendor/github.com/digitalocean/godo/load_balancers.go +++ b/vendor/github.com/digitalocean/godo/load_balancers.go @@ -50,6 +50,7 @@ type LoadBalancer struct { EnableBackendKeepalive bool `json:"enable_backend_keepalive,omitempty"` VPCUUID string `json:"vpc_uuid,omitempty"` DisableLetsEncryptDNSRecords *bool `json:"disable_lets_encrypt_dns_records,omitempty"` + ValidateOnly bool `json:"validate_only,omitempty"` } // String creates a human-readable description of a LoadBalancer. @@ -79,6 +80,7 @@ func (l LoadBalancer) AsRequest() *LoadBalancerRequest { HealthCheck: l.HealthCheck, VPCUUID: l.VPCUUID, DisableLetsEncryptDNSRecords: l.DisableLetsEncryptDNSRecords, + ValidateOnly: l.ValidateOnly, } if l.DisableLetsEncryptDNSRecords != nil { @@ -162,6 +164,7 @@ type LoadBalancerRequest struct { EnableBackendKeepalive bool `json:"enable_backend_keepalive,omitempty"` VPCUUID string `json:"vpc_uuid,omitempty"` DisableLetsEncryptDNSRecords *bool `json:"disable_lets_encrypt_dns_records,omitempty"` + ValidateOnly bool `json:"validate_only,omitempty"` } // String creates a human-readable description of a LoadBalancerRequest. diff --git a/vendor/github.com/digitalocean/godo/monitoring.go b/vendor/github.com/digitalocean/godo/monitoring.go index 3683a699b..8464c773c 100644 --- a/vendor/github.com/digitalocean/godo/monitoring.go +++ b/vendor/github.com/digitalocean/godo/monitoring.go @@ -26,6 +26,10 @@ const ( DropletOneMinuteLoadAverage = "v1/insights/droplet/load_1" DropletFiveMinuteLoadAverage = "v1/insights/droplet/load_5" DropletFifteenMinuteLoadAverage = "v1/insights/droplet/load_15" + + LoadBalancerCPUUtilizationPercent = "v1/insights/lbaas/avg_cpu_utilization_percent" + LoadBalancerConnectionUtilizationPercent = "v1/insights/lbaas/connection_utilization_percent" + LoadBalancerDropletHealth = "v1/insights/lbaas/droplet_health" ) // MonitoringService is an interface for interfacing with the diff --git a/vendor/github.com/digitalocean/godo/registry.go b/vendor/github.com/digitalocean/godo/registry.go index a1ebcae50..2fe9d2bd9 100644 --- a/vendor/github.com/digitalocean/godo/registry.go +++ b/vendor/github.com/digitalocean/godo/registry.go @@ -50,6 +50,7 @@ type RegistryServiceOp struct { type RegistryCreateRequest struct { Name string `json:"name,omitempty"` SubscriptionTierSlug string `json:"subscription_tier_slug,omitempty"` + Region string `json:"region,omitempty"` } // RegistryDockerCredentialsRequest represents a request to retrieve docker @@ -65,6 +66,7 @@ type Registry struct { StorageUsageBytes uint64 `json:"storage_usage_bytes,omitempty"` StorageUsageBytesUpdatedAt time.Time `json:"storage_usage_bytes_updated_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` + Region string `json:"region,omitempty"` } // Repository represents a repository @@ -192,6 +194,7 @@ type UpdateGarbageCollectionRequest struct { // RegistryOptions are options for users when creating or updating a registry. type RegistryOptions struct { SubscriptionTiers []*RegistrySubscriptionTier `json:"subscription_tiers,omitempty"` + AvailableRegions []string `json:"available_regions"` } type registryOptionsRoot struct { diff --git a/vendor/modules.txt b/vendor/modules.txt index 3d5cfb46d..2acaaafda 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -20,7 +20,7 @@ github.com/creack/pty # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/digitalocean/godo v1.75.0 +# github.com/digitalocean/godo v1.76.0 ## explicit; go 1.16 github.com/digitalocean/godo github.com/digitalocean/godo/metrics