Skip to content

Commit

Permalink
Merge branch 'main' into zhiwei/volume-api-parity
Browse files Browse the repository at this point in the history
  • Loading branch information
zliang-akamai authored Nov 28, 2024
2 parents 0b6bedd + d291aac commit 4e526ff
Show file tree
Hide file tree
Showing 110 changed files with 20,339 additions and 3,237 deletions.
87 changes: 29 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,66 +80,37 @@ jobs:

notify-slack:
runs-on: ubuntu-latest
needs: [test]
if: ${{ (success() || failure()) && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository == 'linode/linodego' }} # Run even if integration tests fail and only on main repository
needs: [ test ]
if: ${{ (success() || failure()) && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository == 'linode/linodego' }}

steps:
- name: Notify Slack
uses: slackapi/slack-github-action@v1.27.0
uses: slackapi/slack-github-action@v2.0.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
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 }}
channel: ${{ secrets.SLACK_CHANNEL_ID }}
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 }}`"
83 changes: 27 additions & 56 deletions .github/workflows/nightly_smoke_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,61 +38,32 @@ jobs:

- name: Notify Slack
if: (success() || failure()) && github.repository == 'linode/linodego'
uses: slackapi/slack-github-action@v1.27.0
uses: slackapi/slack-github-action@v2.0.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
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${{ steps.smoke_tests.outcome == '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 }}
channel: ${{ secrets.SLACK_CHANNEL_ID }}
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${{ steps.smoke_tests.outcome == '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 }}`"
25 changes: 9 additions & 16 deletions .github/workflows/release-notify-slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Notify Slack - Main Message
id: main_message
uses: slackapi/[email protected]
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.DEV_DX_SLACK_CHANNEL_ID }}
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*New Release Published: _linodego_ <${{ github.event.release.html_url }}|${{ github.event.release.tag_name }}> is now live!* :tada:"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
channel: ${{ secrets.DEV_DX_SLACK_CHANNEL_ID }}
blocks:
- type: section
text:
type: mrkdwn
text: "*New Release Published: _linodego_ <${{ github.event.release.html_url }}|${{ github.event.release.tag_name }}> is now live!* :tada:"
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ linters:
enable-all: true
disable:
# deprecated linters
- execinquery
- exportloopref
####################

Expand Down Expand Up @@ -60,7 +59,6 @@ linters:
- wsl
- varnamelen
- tagliatelle
- gomnd
- nlreturn
- wrapcheck
- wastedassign
Expand All @@ -73,4 +71,5 @@ linters:
- tagalign
- inamedparam
- perfsprint
- recvcheck
fast: false
1 change: 1 addition & 0 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Account struct {
BillingSource string `json:"billing_source"`
Capabilities []string `json:"capabilities"`
ActiveSince *time.Time `json:"active_since"`
ActivePromotions []Promotion `json:"active_promotions"`
}

// AccountUpdateOptions fields are those accepted by UpdateAccount
Expand Down
6 changes: 6 additions & 0 deletions account_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ type Event struct {

// When this Event was created.
Created *time.Time `json:"-"`

// Provides additional information about the event.
Message string `json:"message"`

// The total duration in seconds that it takes for the Event to complete.
Duration float64 `json:"duration"`
}

// EventAction constants start with Action and include all known Linode API Event Actions.
Expand Down
20 changes: 15 additions & 5 deletions account_invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,33 @@ import (

// Invoice structs reflect an invoice for billable activity on the account.
type Invoice struct {
ID int `json:"id"`
Label string `json:"label"`
Total float32 `json:"total"`
Date *time.Time `json:"-"`
ID int `json:"id"`
Label string `json:"label"`
Total float32 `json:"total"`
Date *time.Time `json:"-"`
Tax float32 `json:"tax"`
Subtotal float32 `json:"subtotal"`
BillingSource string `json:"billing_source"`
TaxSummary []InvoiceTaxSummary `json:"tax_summary"`
}

type InvoiceTaxSummary struct {
Tax float32 `json:"tax"`
Name string `json:"name"`
}

// InvoiceItem structs reflect a single billable activity associate with an Invoice
type InvoiceItem struct {
Label string `json:"label"`
Type string `json:"type"`
UnitPrice int `json:"unitprice"`
UnitPrice float32 `json:"unit_price"`
Quantity int `json:"quantity"`
Amount float32 `json:"amount"`
Tax float32 `json:"tax"`
Region *string `json:"region"`
From *time.Time `json:"-"`
To *time.Time `json:"-"`
Total float32 `json:"total"`
}

// ListInvoices gets a paginated list of Invoices against the Account
Expand Down
23 changes: 23 additions & 0 deletions domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ const (
DomainStatusHasErrors DomainStatus = "has_errors"
)

type DomainCloneOptions struct {
Domain string `json:"domain"`
}

type DomainImportOptions struct {
Domain string `json:"domain"`
RemoteNameserver string `json:"remove_nameserver"`
}

// GetUpdateOptions converts a Domain to DomainUpdateOptions for use in UpdateDomain
func (d Domain) GetUpdateOptions() (du DomainUpdateOptions) {
du.Domain = d.Domain
Expand Down Expand Up @@ -244,3 +253,17 @@ func (c *Client) GetDomainZoneFile(ctx context.Context, domainID int) (*DomainZo

return response, nil
}

// CloneDomain clones a Domain and all associated DNS records from a Domain that is registered in Linode's DNS manager.
func (c *Client) CloneDomain(ctx context.Context, domainID int, opts DomainCloneOptions) (*Domain, error) {
e := formatAPIPath("domains/%d/clone", domainID)

return doPOSTRequest[Domain](ctx, c, e, opts)
}

// ImportDomain imports a domain zone from a remote nameserver.
func (c *Client) ImportDomain(ctx context.Context, opts DomainImportOptions) (*Domain, error) {
e := "domains/import"

return doPOSTRequest[Domain](ctx, c, e, opts)
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/linode/linodego

require (
github.com/go-resty/resty/v2 v2.15.3
github.com/go-resty/resty/v2 v2.16.2
github.com/google/go-cmp v0.6.0
github.com/jarcoal/httpmock v1.3.1
golang.org/x/net v0.30.0
golang.org/x/oauth2 v0.23.0
golang.org/x/text v0.19.0
golang.org/x/text v0.20.0
gopkg.in/ini.v1 v1.66.6
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8=
github.com/go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
github.com/go-resty/resty/v2 v2.16.2 h1:CpRqTjIzq/rweXUt9+GxzzQdlkqMdt8Lm/fuK/CAbAg=
github.com/go-resty/resty/v2 v2.16.2/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww=
Expand All @@ -16,8 +16,8 @@ golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
5 changes: 5 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
Expand All @@ -48,9 +49,13 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2 h1:IRJeR9r1pYWsHKTRe/IInb7lYvbBVIqOgsX/u0mbOWY=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
Expand Down
Loading

0 comments on commit 4e526ff

Please sign in to comment.