Skip to content

Commit

Permalink
Merge branch 'main' into TPT-3170/remove-image-la
Browse files Browse the repository at this point in the history
  • Loading branch information
yec-akamai authored Nov 27, 2024
2 parents 64ad1fc + bb8fd62 commit 45b57db
Show file tree
Hide file tree
Showing 29 changed files with 8,891 additions and 1,108 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:"
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)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/linode/linodego

require (
github.com/go-resty/resty/v2 v2.16.1
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
Expand Down
4 changes: 2 additions & 2 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.16.1 h1:0EB9QI65hPIGU1uX7EdRPd0ZBcvWHS0DcpAoEayMVQw=
github.com/go-resty/resty/v2 v2.16.1/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 Down
2 changes: 1 addition & 1 deletion k8s/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-resty/resty/v2 v2.16.1 // indirect
github.com/go-resty/resty/v2 v2.16.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
Expand Down
4 changes: 2 additions & 2 deletions k8s/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-resty/resty/v2 v2.16.1 h1:0EB9QI65hPIGU1uX7EdRPd0ZBcvWHS0DcpAoEayMVQw=
github.com/go-resty/resty/v2 v2.16.1/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/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand Down
22 changes: 21 additions & 1 deletion network_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
// IPAddressUpdateOptions fields are those accepted by UpdateToken
type IPAddressUpdateOptions struct {
// The reverse DNS assigned to this address. For public IPv4 addresses, this will be set to a default value provided by Linode if set to nil.
RDNS *string `json:"rdns"`
Reserved *bool `json:"reserved,omitempty"`
RDNS *string `json:"rdns,omitempty"`
}

// LinodeIPAssignment stores an assignment between an IP address and a Linode instance.
Expand All @@ -16,6 +17,14 @@ type LinodeIPAssignment struct {
LinodeID int `json:"linode_id"`
}

type AllocateReserveIPOptions struct {
Type string `json:"type"`
Public bool `json:"public"`
Reserved bool `json:"reserved,omitempty"`
Region string `json:"region,omitempty"`
LinodeID int `json:"linode_id,omitempty"`
}

// LinodesAssignIPsOptions fields are those accepted by InstancesAssignIPs.
type LinodesAssignIPsOptions struct {
Region string `json:"region"`
Expand Down Expand Up @@ -88,3 +97,14 @@ func (c *Client) ShareIPAddresses(ctx context.Context, opts IPAddressesShareOpti
_, err := doPOSTRequest[InstanceIP](ctx, c, e, opts)
return err
}

// AllocateReserveIP allocates a new IPv4 address to the Account, with the option to reserve it
// and optionally assign it to a Linode.
func (c *Client) AllocateReserveIP(ctx context.Context, opts AllocateReserveIPOptions) (*InstanceIP, error) {
e := "networking/ips"
result, err := doPOSTRequest[InstanceIP](ctx, c, e, opts)
if err != nil {
return nil, err
}
return result, nil
}
2 changes: 1 addition & 1 deletion test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-resty/resty/v2 v2.16.1 // indirect
github.com/go-resty/resty/v2 v2.16.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
Expand Down
4 changes: 2 additions & 2 deletions test/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-resty/resty/v2 v2.16.1 h1:0EB9QI65hPIGU1uX7EdRPd0ZBcvWHS0DcpAoEayMVQw=
github.com/go-resty/resty/v2 v2.16.1/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/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand Down
Loading

0 comments on commit 45b57db

Please sign in to comment.