Skip to content

Commit f1cfb73

Browse files
authored
Deprecate VPC2 service and structs (#364)
1 parent c68af58 commit f1cfb73

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

govultr.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ type Client struct {
7272
User UserService
7373
VirtualFileSystemStorage VirtualFileSystemStorageService
7474
VPC VPCService
75-
VPC2 VPC2Service
75+
// Deprecated: VPC2 is no longer supported
76+
VPC2 VPC2Service
7677

7778
// Optional function called after every successful request made to the Vultr API
7879
onRequestCompleted RequestCompletionCallback

vpc2.go

+28
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,24 @@ const vpc2Path = "/v2/vpc2"
1212

1313
// VPC2Service is the interface to interact with the VPC 2.0 endpoints on the Vultr API
1414
// Link : https://www.vultr.com/api/#tag/vpc2
15+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
16+
// future release
1517
type VPC2Service interface {
18+
// Deprecated: VPC2 is no longer supported
1619
Create(ctx context.Context, createReq *VPC2Req) (*VPC2, *http.Response, error)
20+
// Deprecated: VPC2 is no longer supported
1721
Get(ctx context.Context, vpcID string) (*VPC2, *http.Response, error)
22+
// Deprecated: VPC2 is no longer supported
1823
Update(ctx context.Context, vpcID string, description string) error
24+
// Deprecated: VPC2 is no longer supported
1925
Delete(ctx context.Context, vpcID string) error
26+
// Deprecated: VPC2 is no longer supported
2027
List(ctx context.Context, options *ListOptions) ([]VPC2, *Meta, *http.Response, error)
28+
// Deprecated: VPC2 is no longer supported
2129
ListNodes(ctx context.Context, vpc2ID string, options *ListOptions) ([]VPC2Node, *Meta, *http.Response, error)
30+
// Deprecated: VPC2 is no longer supported
2231
Attach(ctx context.Context, vpcID string, attachReq *VPC2AttachDetachReq) error
32+
// Deprecated: VPC2 is no longer supported
2333
Detach(ctx context.Context, vpcID string, detachReq *VPC2AttachDetachReq) error
2434
}
2535

@@ -29,6 +39,8 @@ type VPC2ServiceHandler struct {
2939
}
3040

3141
// VPC2 represents a Vultr VPC 2.0
42+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
43+
// future release
3244
type VPC2 struct {
3345
ID string `json:"id"`
3446
Region string `json:"region"`
@@ -77,6 +89,8 @@ type vpc2NodesBase struct {
7789
}
7890

7991
// Create creates a new VPC 2.0. A VPC 2.0 can only be used at the location for which it was created.
92+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
93+
// future release
8094
func (n *VPC2ServiceHandler) Create(ctx context.Context, createReq *VPC2Req) (*VPC2, *http.Response, error) {
8195
req, err := n.client.NewRequest(ctx, http.MethodPost, vpc2Path, createReq)
8296
if err != nil {
@@ -93,6 +107,8 @@ func (n *VPC2ServiceHandler) Create(ctx context.Context, createReq *VPC2Req) (*V
93107
}
94108

95109
// Get gets the VPC 2.0 of the requested ID
110+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
111+
// future release
96112
func (n *VPC2ServiceHandler) Get(ctx context.Context, vpcID string) (*VPC2, *http.Response, error) {
97113
uri := fmt.Sprintf("%s/%s", vpc2Path, vpcID)
98114
req, err := n.client.NewRequest(ctx, http.MethodGet, uri, nil)
@@ -110,6 +126,8 @@ func (n *VPC2ServiceHandler) Get(ctx context.Context, vpcID string) (*VPC2, *htt
110126
}
111127

112128
// Update updates a VPC 2.0
129+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
130+
// future release
113131
func (n *VPC2ServiceHandler) Update(ctx context.Context, vpcID, description string) error {
114132
uri := fmt.Sprintf("%s/%s", vpc2Path, vpcID)
115133

@@ -124,6 +142,8 @@ func (n *VPC2ServiceHandler) Update(ctx context.Context, vpcID, description stri
124142
}
125143

126144
// Delete deletes a VPC 2.0. Before deleting, a VPC 2.0 must be disabled from all instances
145+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
146+
// future release
127147
func (n *VPC2ServiceHandler) Delete(ctx context.Context, vpcID string) error {
128148
uri := fmt.Sprintf("%s/%s", vpc2Path, vpcID)
129149
req, err := n.client.NewRequest(ctx, http.MethodDelete, uri, nil)
@@ -135,6 +155,8 @@ func (n *VPC2ServiceHandler) Delete(ctx context.Context, vpcID string) error {
135155
}
136156

137157
// List lists all VPCs 2.0 on the current account
158+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
159+
// future release
138160
func (n *VPC2ServiceHandler) List(ctx context.Context, options *ListOptions) ([]VPC2, *Meta, *http.Response, error) { //nolint:dupl
139161
req, err := n.client.NewRequest(ctx, http.MethodGet, vpc2Path, nil)
140162
if err != nil {
@@ -158,6 +180,8 @@ func (n *VPC2ServiceHandler) List(ctx context.Context, options *ListOptions) ([]
158180
}
159181

160182
// ListNodes lists all nodes attached to a VPC 2.0 network
183+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
184+
// future release
161185
func (n *VPC2ServiceHandler) ListNodes(ctx context.Context, vpc2ID string, options *ListOptions) ([]VPC2Node, *Meta, *http.Response, error) { //nolint:dupl,lll
162186
uri := fmt.Sprintf("%s/%s/nodes", vpc2Path, vpc2ID)
163187

@@ -183,6 +207,8 @@ func (n *VPC2ServiceHandler) ListNodes(ctx context.Context, vpc2ID string, optio
183207
}
184208

185209
// Attach attaches nodes to a VPC 2.0 network
210+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
211+
// future release
186212
func (n *VPC2ServiceHandler) Attach(ctx context.Context, vpcID string, attachReq *VPC2AttachDetachReq) error {
187213
uri := fmt.Sprintf("%s/%s/nodes/attach", vpc2Path, vpcID)
188214

@@ -196,6 +222,8 @@ func (n *VPC2ServiceHandler) Attach(ctx context.Context, vpcID string, attachReq
196222
}
197223

198224
// Detach detaches nodes from a VPC 2.0 network
225+
// Deprecated: VPC2 is no longer supported and functionality will cease in a
226+
// future release
199227
func (n *VPC2ServiceHandler) Detach(ctx context.Context, vpcID string, detachReq *VPC2AttachDetachReq) error {
200228
uri := fmt.Sprintf("%s/%s/nodes/detach", vpc2Path, vpcID)
201229

0 commit comments

Comments
 (0)