forked from linode/linodego
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
8,202 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,4 +76,70 @@ jobs: | |
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/xml_to_obj.py "$REPORT_FILENAME" | ||
env: | ||
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }} | ||
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} | ||
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} | ||
|
||
notify-slack: | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
if: always() && github.repository == 'linode/linodego' # Run even if integration tests fail and only on main repository | ||
|
||
steps: | ||
- name: Notify Slack | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
payload: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* :white_check_mark:" | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Build Result:*\n${{ needs.test.result == 'success' && ':large_green_circle: Build Passed' || ':red_circle: Build Failed' }}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Branch:*\n`${{ github.ref_name }}`" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Commit Hash:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Run URL:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run Details>" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "Triggered by: :bust_in_silhouette: `${{ github.actor }}`" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// This package contains various type-related base classes intended | ||
// to be used in composition across type structures in this project. | ||
|
||
package linodego | ||
|
||
// baseType is a base struct containing the core fields of a resource type | ||
// returned from the Linode API. | ||
type baseType[PriceType any, RegionPriceType any] struct { | ||
ID string `json:"id"` | ||
Label string `json:"label"` | ||
Price PriceType `json:"price"` | ||
RegionPrices []RegionPriceType `json:"region_prices"` | ||
Transfer int `json:"transfer"` | ||
} | ||
|
||
// baseTypePrice is a base struct containing the core fields of a resource type's | ||
// base price. | ||
type baseTypePrice struct { | ||
Hourly float64 `json:"hourly"` | ||
Monthly float64 `json:"monthly"` | ||
} | ||
|
||
// baseTypeRegionPrice is a base struct containing the core fields of a resource type's | ||
// region-specific price. | ||
type baseTypeRegionPrice struct { | ||
baseTypePrice | ||
|
||
ID string `json:"id"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package linodego | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
// LKEType represents a single valid LKE type. | ||
// NOTE: This typically corresponds to the availability of a cluster's | ||
// control plane. | ||
type LKEType struct { | ||
baseType[LKETypePrice, LKETypeRegionPrice] | ||
} | ||
|
||
// LKETypePrice represents the base hourly and monthly prices | ||
// for an LKE type entry. | ||
type LKETypePrice struct { | ||
baseTypePrice | ||
} | ||
|
||
// LKETypeRegionPrice represents the regional hourly and monthly prices | ||
// for an LKE type entry. | ||
type LKETypeRegionPrice struct { | ||
baseTypeRegionPrice | ||
} | ||
|
||
// ListLKETypes lists LKE types. This endpoint is cached by default. | ||
func (c *Client) ListLKETypes(ctx context.Context, opts *ListOptions) ([]LKEType, error) { | ||
e := "lke/types" | ||
|
||
endpoint, err := generateListCacheURL(e, opts) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if result := c.getCachedResponse(endpoint); result != nil { | ||
return result.([]LKEType), nil | ||
} | ||
|
||
response, err := getPaginatedResults[LKEType](ctx, c, e, opts) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
c.addCachedResponse(endpoint, response, &cacheExpiryTime) | ||
|
||
return response, nil | ||
} |
Oops, something went wrong.