-
Notifications
You must be signed in to change notification settings - Fork 107
TPT-4277: Implement support for Reserved IP for IPv4 #919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: proj/reserved-ips
Are you sure you want to change the base?
Changes from 8 commits
35b2878
cf20b58
76d9391
802f57f
3d04bdc
2264a2e
dc00ea0
245707c
4a2a3ed
492a403
0606e68
fb8c404
69df217
6a5e955
2b51e3c
09803f2
04c1c9e
ad25985
f1eb655
e150bbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Clean Release Notes | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| clean-release-notes: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Remove ticket prefixes from release notes | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const release = context.payload.release; | ||
|
|
||
| let body = release.body; | ||
|
|
||
| if (!body) { | ||
| console.log("Release body empty, nothing to clean."); | ||
| return; | ||
| } | ||
|
|
||
| // Remove ticket prefixes like "TPT-1234: " or "TPT-1234:" | ||
| body = body.replace(/TPT-\d+:\s*/g, ''); | ||
|
|
||
| await github.rest.repos.updateRelease({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| release_id: release.id, | ||
| body: body | ||
| }); | ||
|
|
||
| console.log("Release notes cleaned."); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,40 @@ import ( | |
| "context" | ||
| ) | ||
|
|
||
| // ReservedIPAssignedEntity represents the entity that a reserved IP is assigned to. | ||
| // NOTE: Reserved IP feature may not currently be available to all users. | ||
| type ReservedIPAssignedEntity struct { | ||
| ID int `json:"id"` | ||
| Label string `json:"label"` | ||
| Type string `json:"type"` | ||
| URL string `json:"url"` | ||
| } | ||
|
|
||
| // ReserveIPOptions represents the options for reserving an IP address | ||
| // NOTE: Reserved IP feature may not currently be available to all users. | ||
| type ReserveIPOptions struct { | ||
| Region string `json:"region"` | ||
| Region string `json:"region"` | ||
| Tags []string `json:"tags,omitempty"` | ||
| } | ||
|
|
||
| // UpdateReservedIPOptions represents the options for updating a reserved IP address | ||
| // NOTE: Reserved IP feature may not currently be available to all users. | ||
| type UpdateReservedIPOptions struct { | ||
| Tags []string `json:"tags"` | ||
| } | ||
|
Comment on lines
+23
to
27
|
||
|
|
||
| // ReservedIPPrice represents the pricing information for a reserved IP type. | ||
| // It is an alias of the shared baseTypePrice to keep pricing consistent across resources. | ||
| type ReservedIPPrice = baseTypePrice | ||
|
|
||
| // ReservedIPRegionPrice represents region-specific pricing for a reserved IP type. | ||
| // It is an alias of the shared baseTypeRegionPrice to keep region pricing consistent across resources. | ||
| type ReservedIPRegionPrice = baseTypeRegionPrice | ||
|
|
||
| // ReservedIPType represents a reserved IP type with pricing information. | ||
| // It reuses the generic baseType to avoid duplicating type/pricing structures. | ||
| type ReservedIPType = baseType[ReservedIPPrice, ReservedIPRegionPrice] | ||
|
|
||
| // ListReservedIPAddresses retrieves a list of reserved IP addresses | ||
| // NOTE: Reserved IP feature may not currently be available to all users. | ||
| func (c *Client) ListReservedIPAddresses(ctx context.Context, opts *ListOptions) ([]InstanceIP, error) { | ||
|
|
@@ -30,9 +58,22 @@ func (c *Client) ReserveIPAddress(ctx context.Context, opts ReserveIPOptions) (* | |
| return doPOSTRequest[InstanceIP](ctx, c, "networking/reserved/ips", opts) | ||
| } | ||
|
|
||
| // UpdateReservedIPAddress updates the tags of a reserved IP address | ||
| // NOTE: Reserved IP feature may not currently be available to all users. | ||
| func (c *Client) UpdateReservedIPAddress(ctx context.Context, address string, opts UpdateReservedIPOptions) (*InstanceIP, error) { | ||
| e := formatAPIPath("networking/reserved/ips/%s", address) | ||
| return doPUTRequest[InstanceIP](ctx, c, e, opts) | ||
| } | ||
|
|
||
| // DeleteReservedIPAddress deletes a reserved IP address | ||
| // NOTE: Reserved IP feature may not currently be available to all users. | ||
| func (c *Client) DeleteReservedIPAddress(ctx context.Context, ipAddress string) error { | ||
| e := formatAPIPath("networking/reserved/ips/%s", ipAddress) | ||
| return doDELETERequest(ctx, c, e) | ||
| } | ||
|
|
||
| // ListReservedIPTypes retrieves a list of reserved IP types with pricing information | ||
| // NOTE: Reserved IP feature may not currently be available to all users. | ||
| func (c *Client) ListReservedIPTypes(ctx context.Context, opts *ListOptions) ([]ReservedIPType, error) { | ||
| return getPaginatedResults[ReservedIPType](ctx, c, "networking/reserved/ips/types", opts) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.