diff --git a/go.mod b/go.mod index fd55e36a..ec432930 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0 - github.com/vultr/govultr/v3 v3.4.0 + github.com/vultr/govultr/v3 v3.5.0 golang.org/x/oauth2 v0.14.0 ) diff --git a/go.sum b/go.sum index 3790289b..4bd45b19 100644 --- a/go.sum +++ b/go.sum @@ -141,8 +141,8 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9 github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/vultr/govultr/v3 v3.4.0 h1:yV9QpKa+/Fr9rvEfTZO5i4al2H+OiweyD1WEFcjkzXk= -github.com/vultr/govultr/v3 v3.4.0/go.mod h1:rt9v2x114jZmmLAE/h5N5jnxTmsK9ewwS2oQZ0UBQzM= +github.com/vultr/govultr/v3 v3.5.0 h1:nei4XFi6Ttg6nfxZdSuUV9bwSoIUdGI48G/elxLg1x0= +github.com/vultr/govultr/v3 v3.5.0/go.mod h1:rt9v2x114jZmmLAE/h5N5jnxTmsK9ewwS2oQZ0UBQzM= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= diff --git a/vendor/github.com/vultr/govultr/v3/CHANGELOG.md b/vendor/github.com/vultr/govultr/v3/CHANGELOG.md index 35189699..402a46ca 100644 --- a/vendor/github.com/vultr/govultr/v3/CHANGELOG.md +++ b/vendor/github.com/vultr/govultr/v3/CHANGELOG.md @@ -1,9 +1,21 @@ # Change Log +## [v3.5.0](https://github.com/vultr/govultr/compare/v3.4.1...v3.5.0) (2023-12-01) +### Enhancement +* Instance: Add disable IPv4 option create request [PR 287](https://github.com/vultr/govultr/pull/287) +* Database: Add user access control for Redis [PR 288](https://github.com/vultr/govultr/pull/288) + +## [v3.4.1](https://github.com/vultr/govultr/compare/v3.4.0...v3.4.1) (2023-11-17) +### Enhancement +* Database: Add support for usage endpoint [PR 282](https://github.com/vultr/govultr/pull/282) + +### Bug Fix +* Container Registry: minor API fixes [PR 284](https://github.com/vultr/govultr/pull/284) + ## [v3.4.0](https://github.com/vultr/govultr/compare/v3.3.4...v3.4.0) (2023-11-10) ### Enhancements -* database: Support read replica promotion [PR 276](https://github.com/vultr/govultr/pull/276) -* kubernetes: Add managed firewall support [PR 277](https://github.com/vultr/govultr/pull/277) -* container-registry: Add support for container registry operations [PR 278](https://github.com/vultr/govultr/pull/278) +* Database: Support read replica promotion [PR 276](https://github.com/vultr/govultr/pull/276) +* Kubernetes: Add managed firewall support [PR 277](https://github.com/vultr/govultr/pull/277) +* Container Registry: Add support for container registry operations [PR 278](https://github.com/vultr/govultr/pull/278) ### Dependencies * Bump github.com/hashicorp/go-retryablehttp from 0.7.4 to 0.7.5 [PR 280](https://github.com/vultr/govultr/pull/280) diff --git a/vendor/github.com/vultr/govultr/v3/bare_metal_server.go b/vendor/github.com/vultr/govultr/v3/bare_metal_server.go index 70695824..8ae73b85 100644 --- a/vendor/github.com/vultr/govultr/v3/bare_metal_server.go +++ b/vendor/github.com/vultr/govultr/v3/bare_metal_server.go @@ -94,7 +94,7 @@ type BareMetalCreate struct { // Deprecated: Tag should no longer be used. Instead, use Tags. Tag string `json:"tag,omitempty"` ReservedIPv4 string `json:"reserved_ipv4,omitempty"` - PersistentPXE *bool `json:"persistent_pxe,omitempty"` + PersistentPxe *bool `json:"persistent_pxe,omitempty"` Tags []string `json:"tags"` AttachVPC2 []string `json:"attach_vpc2,omitempty"` DetachVPC2 []string `json:"detach_vpc2,omitempty"` @@ -103,14 +103,12 @@ type BareMetalCreate struct { // BareMetalUpdate represents the optional parameters that can be set when updating a Bare Metal server type BareMetalUpdate struct { - OsID int `json:"os_id,omitempty"` - EnableIPv6 *bool `json:"enable_ipv6,omitempty"` - Label string `json:"label,omitempty"` - AppID int `json:"app_id,omitempty"` - ImageID string `json:"image_id,omitempty"` - UserData string `json:"user_data,omitempty"` - PersistentPXE *bool `json:"persistent_pxe,omitempty"` - + OsID int `json:"os_id,omitempty"` + EnableIPv6 *bool `json:"enable_ipv6,omitempty"` + Label string `json:"label,omitempty"` + AppID int `json:"app_id,omitempty"` + ImageID string `json:"image_id,omitempty"` + UserData string `json:"user_data,omitempty"` // Deprecated: Tag should no longer be used. Instead, use Tags. Tag *string `json:"tag,omitempty"` Tags []string `json:"tags"` diff --git a/vendor/github.com/vultr/govultr/v3/container_registry.go b/vendor/github.com/vultr/govultr/v3/container_registry.go index 00d7ba81..662a10eb 100644 --- a/vendor/github.com/vultr/govultr/v3/container_registry.go +++ b/vendor/github.com/vultr/govultr/v3/container_registry.go @@ -25,7 +25,7 @@ type ContainerRegistryService interface { UpdateRepository(ctx context.Context, vcrID, imageName string, updateReq *ContainerRegistryRepoUpdateReq) (*ContainerRegistryRepo, *http.Response, error) //nolint:lll DeleteRepository(ctx context.Context, vcrID, imageName string) error CreateDockerCredentials(ctx context.Context, vcrID string, createOptions *DockerCredentialsOpt) (*ContainerRegistryDockerCredentials, *http.Response, error) //nolint:lll - ListRegions(ctx context.Context, options *ListOptions) ([]ContainerRegistryRegion, *Meta, *http.Response, error) + ListRegions(ctx context.Context) ([]ContainerRegistryRegion, *Meta, *http.Response, error) ListPlans(ctx context.Context) (*ContainerRegistryPlans, *http.Response, error) } @@ -106,8 +106,8 @@ type ContainerRegistryReq struct { // ContainerRegistryUpdateReq represents the data used to update a registry type ContainerRegistryUpdateReq struct { - Public *bool `json:"public"` - Plan *string `json:"plan"` + Public *bool `json:"public,omitempty"` + Plan *string `json:"plan,omitempty"` } // ContainerRegistryRepo represents the data of a registry repository @@ -392,7 +392,7 @@ func (h *ContainerRegistryServiceHandler) CreateDockerCredentials(ctx context.Co // ListRegions will return a list of regions relevant to the container registry // API operations -func (h *ContainerRegistryServiceHandler) ListRegions(ctx context.Context, options *ListOptions) ([]ContainerRegistryRegion, *Meta, *http.Response, error) { //nolint:lll +func (h *ContainerRegistryServiceHandler) ListRegions(ctx context.Context) ([]ContainerRegistryRegion, *Meta, *http.Response, error) { req, errReq := h.client.NewRequest(ctx, http.MethodGet, fmt.Sprintf("%s/region/list", vcrPath), nil) if errReq != nil { return nil, nil, nil, errReq diff --git a/vendor/github.com/vultr/govultr/v3/database.go b/vendor/github.com/vultr/govultr/v3/database.go index 17c3279a..382bb39c 100644 --- a/vendor/github.com/vultr/govultr/v3/database.go +++ b/vendor/github.com/vultr/govultr/v3/database.go @@ -21,11 +21,14 @@ type DatabaseService interface { Update(ctx context.Context, databaseID string, databaseReq *DatabaseUpdateReq) (*Database, *http.Response, error) Delete(ctx context.Context, databaseID string) error + GetUsage(ctx context.Context, databaseID string) (*DatabaseUsage, *http.Response, error) + ListUsers(ctx context.Context, databaseID string) ([]DatabaseUser, *Meta, *http.Response, error) CreateUser(ctx context.Context, databaseID string, databaseUserReq *DatabaseUserCreateReq) (*DatabaseUser, *http.Response, error) GetUser(ctx context.Context, databaseID string, username string) (*DatabaseUser, *http.Response, error) UpdateUser(ctx context.Context, databaseID string, username string, databaseUserReq *DatabaseUserUpdateReq) (*DatabaseUser, *http.Response, error) //nolint:lll DeleteUser(ctx context.Context, databaseID string, username string) error + UpdateUserACL(ctx context.Context, databaseID string, username string, databaseUserACLReq *DatabaseUserACLReq) (*DatabaseUser, *http.Response, error) //nolint:lll ListDBs(ctx context.Context, databaseID string) ([]DatabaseDB, *Meta, *http.Response, error) CreateDB(ctx context.Context, databaseID string, databaseDBReq *DatabaseDBCreateReq) (*DatabaseDB, *http.Response, error) @@ -214,11 +217,59 @@ type DatabaseUpdateReq struct { RedisEvictionPolicy string `json:"redis_eviction_policy,omitempty"` } +// DatabaseUsage represents disk, memory, and CPU usage for a Managed Database +type DatabaseUsage struct { + Disk DatabaseDiskUsage `json:"disk"` + Memory DatabaseMemoryUsage `json:"memory"` + CPU DatabaseCPUUsage `json:"cpu"` +} + +// DatabaseDiskUsage represents disk usage details for a Managed Database +type DatabaseDiskUsage struct { + CurrentGB float32 `json:"current_gb"` + MaxGB int `json:"max_gb"` + Percentage float32 `json:"percentage"` +} + +// DatabaseMemoryUsage represents memory usage details for a Managed Database +type DatabaseMemoryUsage struct { + CurrentMB float32 `json:"current_mb"` + MaxMB int `json:"max_mb"` + Percentage float32 `json:"percentage"` +} + +// DatabaseCPUUsage represents average CPU usage for a Managed Database +type DatabaseCPUUsage struct { + Percentage float32 `json:"percentage"` +} + +// databaseUsageBase represents a migration status object API response for a Managed Database +type databaseUsageBase struct { + Usage *DatabaseUsage `json:"usage"` +} + // DatabaseUser represents a user within a Managed Database cluster type DatabaseUser struct { - Username string `json:"username"` - Password string `json:"password"` - Encryption string `json:"encryption,omitempty"` + Username string `json:"username"` + Password string `json:"password"` + Encryption string `json:"encryption,omitempty"` + AccessControl *DatabaseUserACL `json:"access_control,omitempty"` +} + +// DatabaseUserACL represents an access control configuration for a user within a Redis Managed Database cluster +type DatabaseUserACL struct { + RedisACLCategories []string `json:"redis_acl_categories"` + RedisACLChannels []string `json:"redis_acl_channels"` + RedisACLCommands []string `json:"redis_acl_commands"` + RedisACLKeys []string `json:"redis_acl_keys"` +} + +// DatabaseUserACLReq represents input for updating a user's access control within a Redis Managed Database cluster +type DatabaseUserACLReq struct { + RedisACLCategories *[]string `json:"redis_acl_categories,omitempty"` + RedisACLChannels *[]string `json:"redis_acl_channels,omitempty"` + RedisACLCommands *[]string `json:"redis_acl_commands,omitempty"` + RedisACLKeys *[]string `json:"redis_acl_keys,omitempty"` } // databaseUserBase holds the API response for retrieving a single database user within a Managed Database @@ -600,6 +651,24 @@ func (d *DatabaseServiceHandler) Delete(ctx context.Context, databaseID string) return err } +// GetUsage retrieves disk, memory, and CPU usage information for your Managed Database. +func (d *DatabaseServiceHandler) GetUsage(ctx context.Context, databaseID string) (*DatabaseUsage, *http.Response, error) { + uri := fmt.Sprintf("%s/%s/usage", databasePath, databaseID) + + req, err := d.client.NewRequest(ctx, http.MethodGet, uri, nil) + if err != nil { + return nil, nil, err + } + + databaseUsage := new(databaseUsageBase) + resp, err := d.client.DoWithContext(ctx, req, databaseUsage) + if err != nil { + return nil, nil, err + } + + return databaseUsage.Usage, resp, nil +} + // ListUsers retrieves all database users on your Managed Database. func (d *DatabaseServiceHandler) ListUsers(ctx context.Context, databaseID string) ([]DatabaseUser, *Meta, *http.Response, error) { //nolint:dupl,lll uri := fmt.Sprintf("%s/%s/users", databasePath, databaseID) @@ -685,6 +754,24 @@ func (d *DatabaseServiceHandler) DeleteUser(ctx context.Context, databaseID, use return err } +// UpdateUserACL will update a user's access control within the Redis Managed Database +func (d *DatabaseServiceHandler) UpdateUserACL(ctx context.Context, databaseID, username string, databaseUserACLReq *DatabaseUserACLReq) (*DatabaseUser, *http.Response, error) { //nolint:lll,dupl + uri := fmt.Sprintf("%s/%s/users/%s/access-control", databasePath, databaseID, username) + + req, err := d.client.NewRequest(ctx, http.MethodPut, uri, databaseUserACLReq) + if err != nil { + return nil, nil, err + } + + databaseUser := new(databaseUserBase) + resp, err := d.client.DoWithContext(ctx, req, databaseUser) + if err != nil { + return nil, nil, err + } + + return databaseUser.DatabaseUser, resp, nil +} + // ListDBs retrieves all logical databases on your Managed Database. func (d *DatabaseServiceHandler) ListDBs(ctx context.Context, databaseID string) ([]DatabaseDB, *Meta, *http.Response, error) { //nolint:dupl,lll uri := fmt.Sprintf("%s/%s/dbs", databasePath, databaseID) diff --git a/vendor/github.com/vultr/govultr/v3/govultr.go b/vendor/github.com/vultr/govultr/v3/govultr.go index 062c3308..02eae48e 100644 --- a/vendor/github.com/vultr/govultr/v3/govultr.go +++ b/vendor/github.com/vultr/govultr/v3/govultr.go @@ -19,7 +19,7 @@ import ( ) const ( - version = "3.4.0" + version = "3.5.0" defaultBase = "https://api.vultr.com" userAgent = "govultr/" + version rateLimit = 500 * time.Millisecond diff --git a/vendor/github.com/vultr/govultr/v3/instance.go b/vendor/github.com/vultr/govultr/v3/instance.go index fe2f744f..7b24f438 100644 --- a/vendor/github.com/vultr/govultr/v3/instance.go +++ b/vendor/github.com/vultr/govultr/v3/instance.go @@ -257,18 +257,19 @@ type InstanceCreateReq struct { Plan string `json:"plan,omitempty"` Label string `json:"label,omitempty"` // Deprecated: Tag should no longer be used. Instead, use Tags. - Tag string `json:"tag,omitempty"` - Tags []string `json:"tags"` - OsID int `json:"os_id,omitempty"` - ISOID string `json:"iso_id,omitempty"` - AppID int `json:"app_id,omitempty"` - ImageID string `json:"image_id,omitempty"` - FirewallGroupID string `json:"firewall_group_id,omitempty"` - Hostname string `json:"hostname,omitempty"` - IPXEChainURL string `json:"ipxe_chain_url,omitempty"` - ScriptID string `json:"script_id,omitempty"` - SnapshotID string `json:"snapshot_id,omitempty"` - EnableIPv6 *bool `json:"enable_ipv6,omitempty"` + Tag string `json:"tag,omitempty"` + Tags []string `json:"tags"` + OsID int `json:"os_id,omitempty"` + ISOID string `json:"iso_id,omitempty"` + AppID int `json:"app_id,omitempty"` + ImageID string `json:"image_id,omitempty"` + FirewallGroupID string `json:"firewall_group_id,omitempty"` + Hostname string `json:"hostname,omitempty"` + IPXEChainURL string `json:"ipxe_chain_url,omitempty"` + ScriptID string `json:"script_id,omitempty"` + SnapshotID string `json:"snapshot_id,omitempty"` + EnableIPv6 *bool `json:"enable_ipv6,omitempty"` + DisablePublicIPv4 *bool `json:"disable_public_ipv4,omitempty"` // Deprecated: EnablePrivateNetwork should no longer be used. Instead, use EnableVPC. EnablePrivateNetwork *bool `json:"enable_private_network,omitempty"` // Deprecated: AttachPrivateNetwork should no longer be used. Instead, use AttachVPC. diff --git a/vendor/modules.txt b/vendor/modules.txt index cacb55ae..c6b8ae3a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -229,7 +229,7 @@ github.com/vmihailenco/msgpack/v5/msgpcode github.com/vmihailenco/tagparser/v2 github.com/vmihailenco/tagparser/v2/internal github.com/vmihailenco/tagparser/v2/internal/parser -# github.com/vultr/govultr/v3 v3.4.0 +# github.com/vultr/govultr/v3 v3.5.0 ## explicit; go 1.20 github.com/vultr/govultr/v3 # github.com/zclconf/go-cty v1.14.1