From 22ef6ca6f1f1b7c97434f09866dba55219114bfe Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Fri, 10 Jan 2025 11:51:27 -0500 Subject: [PATCH] update godo version --- go.mod | 2 +- go.sum | 4 +- .../github.com/digitalocean/godo/CHANGELOG.md | 7 + .../github.com/digitalocean/godo/apps.gen.go | 78 +++-- vendor/github.com/digitalocean/godo/apps.go | 15 +- .../digitalocean/godo/apps_accessors.go | 80 +++++ vendor/github.com/digitalocean/godo/godo.go | 82 +++--- .../digitalocean/godo/kubernetes.go | 2 +- .../godo/partner_interconnect_attachments.go | 278 ++++++++++++++++++ vendor/modules.txt | 2 +- 10 files changed, 469 insertions(+), 81 deletions(-) create mode 100644 vendor/github.com/digitalocean/godo/partner_interconnect_attachments.go diff --git a/go.mod b/go.mod index 1f0a5e244..ee575d338 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/digitalocean/terraform-provider-digitalocean require ( github.com/aws/aws-sdk-go v1.42.18 - github.com/digitalocean/godo v1.131.1 + github.com/digitalocean/godo v1.133.0 github.com/hashicorp/awspolicyequivalence v1.5.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index 6fa43ba64..ec0aa4da0 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 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.131.1 h1:2QsRwjNukKgOQbflMxOsTDoC05o5UKBpqQMFKXegYKE= -github.com/digitalocean/godo v1.131.1/go.mod h1:PU8JB6I1XYkQIdHFop8lLAY9ojp6M0XcU0TWaQSxbrc= +github.com/digitalocean/godo v1.133.0 h1:vMD+DjWWoiriMBT80yEk4A32Sjf4Sy0WX8/9EuUYma8= +github.com/digitalocean/godo v1.133.0/go.mod h1:PU8JB6I1XYkQIdHFop8lLAY9ojp6M0XcU0TWaQSxbrc= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= diff --git a/vendor/github.com/digitalocean/godo/CHANGELOG.md b/vendor/github.com/digitalocean/godo/CHANGELOG.md index 8b177989d..c171439bf 100644 --- a/vendor/github.com/digitalocean/godo/CHANGELOG.md +++ b/vendor/github.com/digitalocean/godo/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## [v1.133.0] - 2025-01-10 +- #769 - @guptado - support partner interconnect attachment operations +- #767 - @loosla - [kubernetes]: make kubernetes maintenance_policy day case insensitive + +## [v1.132.0] - 2024-12-17 +- #764 - @greeshmapill - APPS-9365: Add bitbucket source to App Spec + ## [v1.131.1] - 2024-12-10 - #762 - @imaskm - Updated list ipv6 response diff --git a/vendor/github.com/digitalocean/godo/apps.gen.go b/vendor/github.com/digitalocean/godo/apps.gen.go index 6fc029cb9..63457cda4 100644 --- a/vendor/github.com/digitalocean/godo/apps.gen.go +++ b/vendor/github.com/digitalocean/godo/apps.gen.go @@ -285,10 +285,11 @@ const ( // AppFunctionsSpec struct for AppFunctionsSpec type AppFunctionsSpec struct { // The name. Must be unique across all components within the same app. - Name string `json:"name"` - Git *GitSourceSpec `json:"git,omitempty"` - GitHub *GitHubSourceSpec `json:"github,omitempty"` - GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Name string `json:"name"` + Git *GitSourceSpec `json:"git,omitempty"` + GitHub *GitHubSourceSpec `json:"github,omitempty"` + GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Bitbucket *BitbucketSourceSpec `json:"bitbucket,omitempty"` // An optional path to the working directory to use for the build. Must be relative to the root of the repo. SourceDir string `json:"source_dir,omitempty"` // A list of environment variables made available to the component. @@ -365,11 +366,12 @@ type AppIngressSpecRuleStringMatch struct { // AppJobSpec struct for AppJobSpec type AppJobSpec struct { // The name. Must be unique across all components within the same app. - Name string `json:"name"` - Git *GitSourceSpec `json:"git,omitempty"` - GitHub *GitHubSourceSpec `json:"github,omitempty"` - Image *ImageSourceSpec `json:"image,omitempty"` - GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Name string `json:"name"` + Git *GitSourceSpec `json:"git,omitempty"` + GitHub *GitHubSourceSpec `json:"github,omitempty"` + Image *ImageSourceSpec `json:"image,omitempty"` + GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Bitbucket *BitbucketSourceSpec `json:"bitbucket,omitempty"` // The path to the Dockerfile relative to the root of the repo. If set, it will be used to build this component. Otherwise, App Platform will attempt to build it using buildpacks. DockerfilePath string `json:"dockerfile_path,omitempty"` // An optional build command to run while building this component from source. @@ -481,11 +483,12 @@ type AppRouteSpec struct { // AppServiceSpec struct for AppServiceSpec type AppServiceSpec struct { // The name. Must be unique across all components within the same app. - Name string `json:"name"` - Git *GitSourceSpec `json:"git,omitempty"` - GitHub *GitHubSourceSpec `json:"github,omitempty"` - Image *ImageSourceSpec `json:"image,omitempty"` - GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Name string `json:"name"` + Git *GitSourceSpec `json:"git,omitempty"` + GitHub *GitHubSourceSpec `json:"github,omitempty"` + Image *ImageSourceSpec `json:"image,omitempty"` + GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Bitbucket *BitbucketSourceSpec `json:"bitbucket,omitempty"` // The path to the Dockerfile relative to the root of the repo. If set, it will be used to build this component. Otherwise, App Platform will attempt to build it using buildpacks. DockerfilePath string `json:"dockerfile_path,omitempty"` // An optional build command to run while building this component from source. @@ -578,10 +581,11 @@ type AppSpec struct { // AppStaticSiteSpec struct for AppStaticSiteSpec type AppStaticSiteSpec struct { // The name. Must be unique across all components within the same app. - Name string `json:"name"` - Git *GitSourceSpec `json:"git,omitempty"` - GitHub *GitHubSourceSpec `json:"github,omitempty"` - GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Name string `json:"name"` + Git *GitSourceSpec `json:"git,omitempty"` + GitHub *GitHubSourceSpec `json:"github,omitempty"` + GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Bitbucket *BitbucketSourceSpec `json:"bitbucket,omitempty"` // The path to the Dockerfile relative to the root of the repo. If set, it will be used to build this component. Otherwise, App Platform will attempt to build it using buildpacks. DockerfilePath string `json:"dockerfile_path,omitempty"` // An optional build command to run while building this component from source. @@ -617,11 +621,12 @@ type AppVariableDefinition struct { // AppWorkerSpec struct for AppWorkerSpec type AppWorkerSpec struct { // The name. Must be unique across all components within the same app. - Name string `json:"name"` - Git *GitSourceSpec `json:"git,omitempty"` - GitHub *GitHubSourceSpec `json:"github,omitempty"` - Image *ImageSourceSpec `json:"image,omitempty"` - GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Name string `json:"name"` + Git *GitSourceSpec `json:"git,omitempty"` + GitHub *GitHubSourceSpec `json:"github,omitempty"` + Image *ImageSourceSpec `json:"image,omitempty"` + GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Bitbucket *BitbucketSourceSpec `json:"bitbucket,omitempty"` // The path to the Dockerfile relative to the root of the repo. If set, it will be used to build this component. Otherwise, App Platform will attempt to build it using buildpacks. DockerfilePath string `json:"dockerfile_path,omitempty"` // An optional build command to run while building this component from source. @@ -651,6 +656,13 @@ type AppWorkerSpecTermination struct { GracePeriodSeconds int32 `json:"grace_period_seconds,omitempty"` } +// BitbucketSourceSpec struct for BitbucketSourceSpec +type BitbucketSourceSpec struct { + Repo string `json:"repo,omitempty"` + Branch string `json:"branch,omitempty"` + DeployOnPush bool `json:"deploy_on_push,omitempty"` +} + // Buildpack struct for Buildpack type Buildpack struct { // The ID of the buildpack. @@ -702,12 +714,13 @@ type DeploymentCauseDetailsDOCRPush struct { // DeploymentCauseDetailsGitPush struct for DeploymentCauseDetailsGitPush type DeploymentCauseDetailsGitPush struct { - GitHub *GitHubSourceSpec `json:"github,omitempty"` - GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` - Username string `json:"username,omitempty"` - CommitAuthor string `json:"commit_author,omitempty"` - CommitSHA string `json:"commit_sha,omitempty"` - CommitMessage string `json:"commit_message,omitempty"` + GitHub *GitHubSourceSpec `json:"github,omitempty"` + GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Bitbucket *BitbucketSourceSpec `json:"bitbucket,omitempty"` + Username string `json:"username,omitempty"` + CommitAuthor string `json:"commit_author,omitempty"` + CommitSHA string `json:"commit_sha,omitempty"` + CommitMessage string `json:"commit_message,omitempty"` } // AppCORSPolicy struct for AppCORSPolicy @@ -911,9 +924,10 @@ type DeploymentWorker struct { // DetectRequest struct for DetectRequest type DetectRequest struct { - Git *GitSourceSpec `json:"git,omitempty"` - GitHub *GitHubSourceSpec `json:"github,omitempty"` - GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Git *GitSourceSpec `json:"git,omitempty"` + GitHub *GitHubSourceSpec `json:"github,omitempty"` + GitLab *GitLabSourceSpec `json:"gitlab,omitempty"` + Bitbucket *BitbucketSourceSpec `json:"bitbucket,omitempty"` // An optional commit hash to use instead of the branch specified in the source spec. CommitSHA string `json:"commit_sha,omitempty"` // An optional path to the working directory for the detection process. diff --git a/vendor/github.com/digitalocean/godo/apps.go b/vendor/github.com/digitalocean/godo/apps.go index 97b0cbd73..f6b78d904 100644 --- a/vendor/github.com/digitalocean/godo/apps.go +++ b/vendor/github.com/digitalocean/godo/apps.go @@ -689,6 +689,7 @@ type AppBuildableComponentSpec interface { GetGit() *GitSourceSpec GetGitHub() *GitHubSourceSpec GetGitLab() *GitLabSourceSpec + GetBitbucket() *BitbucketSourceSpec GetSourceDir() string @@ -731,10 +732,11 @@ type AppRoutableComponentSpec interface { type AppSourceType string const ( - AppSourceTypeGitHub AppSourceType = "github" - AppSourceTypeGitLab AppSourceType = "gitlab" - AppSourceTypeGit AppSourceType = "git" - AppSourceTypeImage AppSourceType = "image" + AppSourceTypeBitbucket AppSourceType = "bitbucket" + AppSourceTypeGitHub AppSourceType = "github" + AppSourceTypeGitLab AppSourceType = "gitlab" + AppSourceTypeGit AppSourceType = "git" + AppSourceTypeImage AppSourceType = "image" ) // SourceSpec represents a source. @@ -742,6 +744,11 @@ type SourceSpec interface { GetType() AppSourceType } +// GetType returns the Bitbucket source type. +func (s *BitbucketSourceSpec) GetType() AppSourceType { + return AppSourceTypeBitbucket +} + // GetType returns the GitHub source type. func (s *GitHubSourceSpec) GetType() AppSourceType { return AppSourceTypeGitHub diff --git a/vendor/github.com/digitalocean/godo/apps_accessors.go b/vendor/github.com/digitalocean/godo/apps_accessors.go index 02e7c4b15..4d9a214ae 100644 --- a/vendor/github.com/digitalocean/godo/apps_accessors.go +++ b/vendor/github.com/digitalocean/godo/apps_accessors.go @@ -805,6 +805,14 @@ func (a *AppFunctionsSpec) GetAlerts() []*AppAlertSpec { return a.Alerts } +// GetBitbucket returns the Bitbucket field. +func (a *AppFunctionsSpec) GetBitbucket() *BitbucketSourceSpec { + if a == nil { + return nil + } + return a.Bitbucket +} + // GetCORS returns the CORS field. func (a *AppFunctionsSpec) GetCORS() *AppCORSPolicy { if a == nil { @@ -1141,6 +1149,14 @@ func (a *AppJobSpec) GetAlerts() []*AppAlertSpec { return a.Alerts } +// GetBitbucket returns the Bitbucket field. +func (a *AppJobSpec) GetBitbucket() *BitbucketSourceSpec { + if a == nil { + return nil + } + return a.Bitbucket +} + // GetBuildCommand returns the BuildCommand field. func (a *AppJobSpec) GetBuildCommand() string { if a == nil { @@ -1645,6 +1661,14 @@ func (a *AppServiceSpec) GetAutoscaling() *AppAutoscalingSpec { return a.Autoscaling } +// GetBitbucket returns the Bitbucket field. +func (a *AppServiceSpec) GetBitbucket() *BitbucketSourceSpec { + if a == nil { + return nil + } + return a.Bitbucket +} + // GetBuildCommand returns the BuildCommand field. func (a *AppServiceSpec) GetBuildCommand() string { if a == nil { @@ -2013,6 +2037,14 @@ func (a *AppSpec) GetWorkers() []*AppWorkerSpec { return a.Workers } +// GetBitbucket returns the Bitbucket field. +func (a *AppStaticSiteSpec) GetBitbucket() *BitbucketSourceSpec { + if a == nil { + return nil + } + return a.Bitbucket +} + // GetBuildCommand returns the BuildCommand field. func (a *AppStaticSiteSpec) GetBuildCommand() string { if a == nil { @@ -2237,6 +2269,14 @@ func (a *AppWorkerSpec) GetAutoscaling() *AppAutoscalingSpec { return a.Autoscaling } +// GetBitbucket returns the Bitbucket field. +func (a *AppWorkerSpec) GetBitbucket() *BitbucketSourceSpec { + if a == nil { + return nil + } + return a.Bitbucket +} + // GetBuildCommand returns the BuildCommand field. func (a *AppWorkerSpec) GetBuildCommand() string { if a == nil { @@ -2365,6 +2405,30 @@ func (a *AppWorkerSpecTermination) GetGracePeriodSeconds() int32 { return a.GracePeriodSeconds } +// GetBranch returns the Branch field. +func (b *BitbucketSourceSpec) GetBranch() string { + if b == nil { + return "" + } + return b.Branch +} + +// GetDeployOnPush returns the DeployOnPush field. +func (b *BitbucketSourceSpec) GetDeployOnPush() bool { + if b == nil { + return false + } + return b.DeployOnPush +} + +// GetRepo returns the Repo field. +func (b *BitbucketSourceSpec) GetRepo() string { + if b == nil { + return "" + } + return b.Repo +} + // GetDescription returns the Description field. func (b *Buildpack) GetDescription() []string { if b == nil { @@ -2701,6 +2765,14 @@ func (d *DeploymentCauseDetailsDOCRPush) GetTag() string { return d.Tag } +// GetBitbucket returns the Bitbucket field. +func (d *DeploymentCauseDetailsGitPush) GetBitbucket() *BitbucketSourceSpec { + if d == nil { + return nil + } + return d.Bitbucket +} + // GetCommitAuthor returns the CommitAuthor field. func (d *DeploymentCauseDetailsGitPush) GetCommitAuthor() string { if d == nil { @@ -3077,6 +3149,14 @@ func (d *DeployTemplate) GetSpec() *AppSpec { return d.Spec } +// GetBitbucket returns the Bitbucket field. +func (d *DetectRequest) GetBitbucket() *BitbucketSourceSpec { + if d == nil { + return nil + } + return d.Bitbucket +} + // GetCommitSHA returns the CommitSHA field. func (d *DetectRequest) GetCommitSHA() string { if d == nil { diff --git a/vendor/github.com/digitalocean/godo/godo.go b/vendor/github.com/digitalocean/godo/godo.go index 94d31631a..86d4255c9 100644 --- a/vendor/github.com/digitalocean/godo/godo.go +++ b/vendor/github.com/digitalocean/godo/godo.go @@ -21,7 +21,7 @@ import ( ) const ( - libraryVersion = "1.131.1" + libraryVersion = "1.133.0" defaultBaseURL = "https://api.digitalocean.com/" userAgent = "godo/" + libraryVersion mediaType = "application/json" @@ -54,45 +54,46 @@ type Client struct { ratemtx sync.Mutex // Services used for communicating with the API - Account AccountService - Actions ActionsService - Apps AppsService - Balance BalanceService - BillingHistory BillingHistoryService - CDNs CDNService - Certificates CertificatesService - Databases DatabasesService - Domains DomainsService - Droplets DropletsService - DropletActions DropletActionsService - DropletAutoscale DropletAutoscaleService - Firewalls FirewallsService - FloatingIPs FloatingIPsService - FloatingIPActions FloatingIPActionsService - Functions FunctionsService - Images ImagesService - ImageActions ImageActionsService - Invoices InvoicesService - Keys KeysService - Kubernetes KubernetesService - LoadBalancers LoadBalancersService - Monitoring MonitoringService - OneClick OneClickService - Projects ProjectsService - Regions RegionsService - Registry RegistryService - Registries RegistriesService - ReservedIPs ReservedIPsService - ReservedIPV6s ReservedIPV6sService - ReservedIPActions ReservedIPActionsService - ReservedIPV6Actions ReservedIPV6ActionsService - Sizes SizesService - Snapshots SnapshotsService - Storage StorageService - StorageActions StorageActionsService - Tags TagsService - UptimeChecks UptimeChecksService - VPCs VPCsService + Account AccountService + Actions ActionsService + Apps AppsService + Balance BalanceService + BillingHistory BillingHistoryService + CDNs CDNService + Certificates CertificatesService + Databases DatabasesService + Domains DomainsService + Droplets DropletsService + DropletActions DropletActionsService + DropletAutoscale DropletAutoscaleService + Firewalls FirewallsService + FloatingIPs FloatingIPsService + FloatingIPActions FloatingIPActionsService + Functions FunctionsService + Images ImagesService + ImageActions ImageActionsService + Invoices InvoicesService + Keys KeysService + Kubernetes KubernetesService + LoadBalancers LoadBalancersService + Monitoring MonitoringService + OneClick OneClickService + Projects ProjectsService + Regions RegionsService + Registry RegistryService + Registries RegistriesService + ReservedIPs ReservedIPsService + ReservedIPV6s ReservedIPV6sService + ReservedIPActions ReservedIPActionsService + ReservedIPV6Actions ReservedIPV6ActionsService + Sizes SizesService + Snapshots SnapshotsService + Storage StorageService + StorageActions StorageActionsService + Tags TagsService + UptimeChecks UptimeChecksService + VPCs VPCsService + PartnerInterconnectAttachments PartnerInterconnectAttachmentsService // Optional function called after every successful request made to the DO APIs onRequestCompleted RequestCompletionCallback @@ -307,6 +308,7 @@ func NewClient(httpClient *http.Client) *Client { c.Tags = &TagsServiceOp{client: c} c.UptimeChecks = &UptimeChecksServiceOp{client: c} c.VPCs = &VPCsServiceOp{client: c} + c.PartnerInterconnectAttachments = &PartnerInterconnectAttachmentsServiceOp{client: c} c.headers = make(map[string]string) diff --git a/vendor/github.com/digitalocean/godo/kubernetes.go b/vendor/github.com/digitalocean/godo/kubernetes.go index 9b3bcfa1a..07842c72a 100644 --- a/vendor/github.com/digitalocean/godo/kubernetes.go +++ b/vendor/github.com/digitalocean/godo/kubernetes.go @@ -315,7 +315,7 @@ var ( // KubernetesMaintenanceToDay returns the appropriate KubernetesMaintenancePolicyDay for the given string. func KubernetesMaintenanceToDay(day string) (KubernetesMaintenancePolicyDay, error) { - d, ok := toDay[day] + d, ok := toDay[strings.ToLower(day)] if !ok { return 0, fmt.Errorf("unknown day: %q", day) } diff --git a/vendor/github.com/digitalocean/godo/partner_interconnect_attachments.go b/vendor/github.com/digitalocean/godo/partner_interconnect_attachments.go new file mode 100644 index 000000000..87a0e9ed6 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/partner_interconnect_attachments.go @@ -0,0 +1,278 @@ +package godo + +import ( + "context" + "fmt" + "net/http" + "time" +) + +const partnerInterconnectAttachmentsBasePath = "/v2/partner_interconnect/attachments" + +// PartnerInterconnectAttachmentsService is an interface for managing Partner Interconnect Attachments with the +// DigitalOcean API. +// See: https://docs.digitalocean.com/reference/api/api-reference/#tag/PartnerInterconnectAttachments +type PartnerInterconnectAttachmentsService interface { + List(context.Context, *ListOptions) ([]*PartnerInterconnectAttachment, *Response, error) + Create(context.Context, *PartnerInterconnectAttachmentCreateRequest) (*PartnerInterconnectAttachment, *Response, error) + Get(context.Context, string) (*PartnerInterconnectAttachment, *Response, error) + Update(context.Context, string, *PartnerInterconnectAttachmentUpdateRequest) (*PartnerInterconnectAttachment, *Response, error) + Delete(context.Context, string) (*Response, error) + GetServiceKey(context.Context, string) (*ServiceKey, *Response, error) + SetRoutes(context.Context, string, *PartnerInterconnectAttachmentSetRoutesRequest) (*PartnerInterconnectAttachment, *Response, error) + ListRoutes(context.Context, string, *ListOptions) ([]*RemoteRoute, *Response, error) +} + +var _ PartnerInterconnectAttachmentsService = &PartnerInterconnectAttachmentsServiceOp{} + +// PartnerInterconnectAttachmentsServiceOp interfaces with the Partner Interconnect Attachment endpoints in the DigitalOcean API. +type PartnerInterconnectAttachmentsServiceOp struct { + client *Client +} + +// PartnerInterconnectAttachmentCreateRequest represents a request to create a Partner Interconnect Attachment. +type PartnerInterconnectAttachmentCreateRequest struct { + // Name is the name of the Partner Interconnect Attachment + Name string `json:"name,omitempty"` + // ConnectionBandwidthInMbps is the bandwidth of the connection in Mbps + ConnectionBandwidthInMbps int `json:"connection_bandwidth_in_mbps,omitempty"` + // Region is the region where the Partner Interconnect Attachment is created + Region string `json:"region,omitempty"` + // NaaSProvider is the name of the Network as a Service provider + NaaSProvider string `json:"naas_provider,omitempty"` + // VPCIDs is the IDs of the VPCs to which the Partner Interconnect Attachment is connected + VPCIDs []string `json:"vpc_ids,omitempty"` + // BGP is the BGP configuration of the Partner Interconnect Attachment + BGP BGP `json:"bgp,omitempty"` +} + +// PartnerInterconnectAttachmentUpdateRequest represents a request to update a Partner Interconnect Attachment. +type PartnerInterconnectAttachmentUpdateRequest struct { + // Name is the name of the Partner Interconnect Attachment + Name string `json:"name,omitempty"` + //VPCIDs is the IDs of the VPCs to which the Partner Interconnect Attachment is connected + VPCIDs []string `json:"vpc_ids,omitempty"` +} + +type PartnerInterconnectAttachmentSetRoutesRequest struct { + // Routes is the list of routes to be used for the Partner Interconnect Attachment + Routes []string `json:"routes,omitempty"` +} + +// BGP represents the BGP configuration of a Partner Interconnect Attachment. +type BGP struct { + // LocalASN is the local ASN + LocalASN int `json:"local_asn,omitempty"` + // LocalRouterIP is the local router IP + LocalRouterIP string `json:"local_router_ip,omitempty"` + // PeerASN is the peer ASN + PeerASN int `json:"peer_asn,omitempty"` + // PeerRouterIP is the peer router IP + PeerRouterIP string `json:"peer_router_ip,omitempty"` +} + +// ServiceKey represents the service key of a Partner Interconnect Attachment. +type ServiceKey struct { + ServiceKey string `json:"service_key,omitempty"` +} + +// RemoteRoute represents a route for a Partner Interconnect Attachment. +type RemoteRoute struct { + // ID is the generated ID of the Route + ID string `json:"id,omitempty"` + // Cidr is the CIDR of the route + Cidr string `json:"cidr,omitempty"` +} + +// PartnerInterconnectAttachment represents a DigitalOcean Partner Interconnect Attachment. +type PartnerInterconnectAttachment struct { + // ID is the generated ID of the Partner Interconnect Attachment + ID string `json:"id,omitempty"` + // Name is the name of the Partner Interconnect Attachment + Name string `json:"name,omitempty"` + // State is the state of the Partner Interconnect Attachment + State string `json:"state,omitempty"` + // ConnectionBandwidthInMbps is the bandwidth of the connection in Mbps + ConnectionBandwidthInMbps int `json:"connection_bandwidth_in_mbps,omitempty"` + // Region is the region where the Partner Interconnect Attachment is created + Region string `json:"region,omitempty"` + // NaaSProvider is the name of the Network as a Service provider + NaaSProvider string `json:"naas_provider,omitempty"` + // VPCIDs is the IDs of the VPCs to which the Partner Interconnect Attachment is connected + VPCIDs []string `json:"vpc_ids,omitempty"` + // BGP is the BGP configuration of the Partner Interconnect Attachment + BGP BGP `json:"bgp,omitempty"` + // CreatedAt is time when this Partner Interconnect Attachment was first created + CreatedAt time.Time `json:"created_at,omitempty"` +} + +type partnerInterconnectAttachmentRoot struct { + PartnerInterconnectAttachment *PartnerInterconnectAttachment `json:"partner_interconnect_attachment"` +} + +type partnerInterconnectAttachmentsRoot struct { + PartnerInterconnectAttachments []*PartnerInterconnectAttachment `json:"partner_interconnect_attachments"` + Links *Links `json:"links"` + Meta *Meta `json:"meta"` +} + +type serviceKeyRoot struct { + ServiceKey *ServiceKey `json:"service_key"` +} + +type remoteRoutesRoot struct { + RemoteRoutes []*RemoteRoute `json:"remote_routes"` + Links *Links `json:"links"` + Meta *Meta `json:"meta"` +} + +// List returns a list of all Partner Interconnect Attachments, with optional pagination. +func (s *PartnerInterconnectAttachmentsServiceOp) List(ctx context.Context, opt *ListOptions) ([]*PartnerInterconnectAttachment, *Response, error) { + path, err := addOptions(partnerInterconnectAttachmentsBasePath, opt) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(partnerInterconnectAttachmentsRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + if m := root.Meta; m != nil { + resp.Meta = m + } + return root.PartnerInterconnectAttachments, resp, nil +} + +// Create creates a new Partner Interconnect Attachment. +func (s *PartnerInterconnectAttachmentsServiceOp) Create(ctx context.Context, create *PartnerInterconnectAttachmentCreateRequest) (*PartnerInterconnectAttachment, *Response, error) { + path := partnerInterconnectAttachmentsBasePath + req, err := s.client.NewRequest(ctx, http.MethodPost, path, create) + if err != nil { + return nil, nil, err + } + + root := new(partnerInterconnectAttachmentRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.PartnerInterconnectAttachment, resp, nil +} + +// Get returns the details of a Partner Interconnect Attachment. +func (s *PartnerInterconnectAttachmentsServiceOp) Get(ctx context.Context, id string) (*PartnerInterconnectAttachment, *Response, error) { + path := fmt.Sprintf("%s/%s", partnerInterconnectAttachmentsBasePath, id) + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(partnerInterconnectAttachmentRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.PartnerInterconnectAttachment, resp, nil +} + +// Update updates a Partner Interconnect Attachment properties. +func (s *PartnerInterconnectAttachmentsServiceOp) Update(ctx context.Context, id string, update *PartnerInterconnectAttachmentUpdateRequest) (*PartnerInterconnectAttachment, *Response, error) { + path := fmt.Sprintf("%s/%s", partnerInterconnectAttachmentsBasePath, id) + req, err := s.client.NewRequest(ctx, http.MethodPatch, path, update) + if err != nil { + return nil, nil, err + } + + root := new(partnerInterconnectAttachmentRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.PartnerInterconnectAttachment, resp, nil +} + +// Delete deletes a Partner Interconnect Attachment. +func (s *PartnerInterconnectAttachmentsServiceOp) Delete(ctx context.Context, id string) (*Response, error) { + path := fmt.Sprintf("%s/%s", partnerInterconnectAttachmentsBasePath, id) + req, err := s.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +func (s *PartnerInterconnectAttachmentsServiceOp) GetServiceKey(ctx context.Context, id string) (*ServiceKey, *Response, error) { + path := fmt.Sprintf("%s/%s/service_key", partnerInterconnectAttachmentsBasePath, id) + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(serviceKeyRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.ServiceKey, resp, nil +} + +// ListRoutes lists all routes for a Partner Interconnect Attachment. +func (s *PartnerInterconnectAttachmentsServiceOp) ListRoutes(ctx context.Context, id string, opt *ListOptions) ([]*RemoteRoute, *Response, error) { + path, err := addOptions(fmt.Sprintf("%s/%s/remote_routes", partnerInterconnectAttachmentsBasePath, id), opt) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(remoteRoutesRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + if m := root.Meta; m != nil { + resp.Meta = m + } + + return root.RemoteRoutes, resp, nil +} + +// SetRoutes updates specific properties of a Partner Interconnect Attachment. +func (s *PartnerInterconnectAttachmentsServiceOp) SetRoutes(ctx context.Context, id string, set *PartnerInterconnectAttachmentSetRoutesRequest) (*PartnerInterconnectAttachment, *Response, error) { + path := fmt.Sprintf("%s/%s/remote_routes", partnerInterconnectAttachmentsBasePath, id) + req, err := s.client.NewRequest(ctx, http.MethodPut, path, set) + if err != nil { + return nil, nil, err + } + + root := new(partnerInterconnectAttachmentRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.PartnerInterconnectAttachment, resp, nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 13fa4e7be..708cd27c3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -58,7 +58,7 @@ github.com/aws/aws-sdk-go/service/sts/stsiface # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/digitalocean/godo v1.131.1 +# github.com/digitalocean/godo v1.133.0 ## explicit; go 1.22 github.com/digitalocean/godo github.com/digitalocean/godo/metrics