Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
679820c
Merge pull request #1350 from aziontech/dev
PatrickMenoti Dec 8, 2025
bc58abc
Merge pull request #1355 from aziontech/dev
PatrickMenoti Dec 11, 2025
1c63c55
Merge pull request #1360 from aziontech/dev
PatrickMenoti Dec 16, 2025
358d465
Merge pull request #1365 from aziontech/dev
PatrickMenoti Jan 5, 2026
1b784e0
Merge pull request #1370 from aziontech/dev
PatrickMenoti Jan 12, 2026
9099fdb
Merge pull request #1376 from aziontech/dev
PatrickMenoti Jan 13, 2026
3f6d91e
Merge pull request #1391 from aziontech/dev
PatrickMenoti Feb 5, 2026
2109b2f
Merge pull request #1394 from aziontech/dev
pablodiehl Feb 11, 2026
62ae941
Merge pull request #1399 from aziontech/dev
PatrickMenoti Feb 18, 2026
9c58fc7
Merge pull request #1416 from aziontech/dev
PatrickMenoti Mar 4, 2026
57dee13
Merge pull request #1436 from aziontech/dev
PatrickMenoti Mar 30, 2026
56665cf
Merge pull request #1439 from aziontech/dev
PatrickMenoti Mar 30, 2026
6c04770
Merge pull request #1442 from aziontech/dev
PatrickMenoti Apr 2, 2026
1bc0a23
Merge pull request #1449 from aziontech/dev
PatrickMenoti Apr 10, 2026
bb80bef
Merge pull request #1461 from aziontech/dev
PatrickMenoti May 5, 2026
ffa8d4e
Merge pull request #1482 from aziontech/dev
PatrickMenoti Jun 5, 2026
ea1de54
Merge pull request #1484 from aziontech/dev
PatrickMenoti Jun 8, 2026
74af6c9
refactor: update v3 api url #patch
PatrickMenoti Jun 16, 2026
8e664d7
Merge pull request #1493 from aziontech/hotfix-v3-url
PatrickMenoti Jun 16, 2026
7df1e94
Merge branch 'main' into dev
PatrickMenoti Jun 17, 2026
c26d653
chore: change calls to patch endpoint
PatrickMenoti Jun 18, 2026
e159459
tests: fix tests
PatrickMenoti Jun 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion env/prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
API_URL=https://api.azion.net
API_URL=https://api.azionapi.net
API_V4_URL=https://api.azion.com/v4
AUTH_URL=https://sso.azion.com/api
STORAGE_URL=https://api.azion.com/v4
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/device_groups/device_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func (c *Client) Create(ctx context.Context, req sdk.DeviceGroupRequest, applica
return resp.GetData(), nil
}

func (c *Client) Update(ctx context.Context, req sdk.DeviceGroupRequest, applicationID, deviceGroupID int64) (sdk.DeviceGroup, error) {
func (c *Client) Update(ctx context.Context, req sdk.PatchedDeviceGroupRequest, applicationID, deviceGroupID int64) (sdk.DeviceGroup, error) {
logger.Debug("Update Device Group")

request := c.apiClient.ApplicationsDeviceGroupsAPI.
UpdateDeviceGroup(ctx, applicationID, deviceGroupID).
DeviceGroupRequest(req)
PartialUpdateDeviceGroup(ctx, applicationID, deviceGroupID).
PatchedDeviceGroupRequest(req)
resp, httpResp, err := request.Execute()
if err != nil {
logger.Debug("Error while updating a Device Group", zap.Any("ID", deviceGroupID), zap.Error(err))
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/dns_record/dns_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func (c *Client) Create(ctx context.Context, req sdk.RecordRequest, zoneID int64
return resp.GetData(), nil
}

func (c *Client) Update(ctx context.Context, req sdk.RecordRequest, zoneID, recordID int64) (sdk.Record, error) {
func (c *Client) Update(ctx context.Context, req sdk.PatchedRecordRequest, zoneID, recordID int64) (sdk.Record, error) {
logger.Debug("Update DNS Record")

request := c.apiClient.DNSRecordsAPI.
UpdateDnsRecord(ctx, recordID, zoneID).
RecordRequest(req)
PartialUpdateDnsRecord(ctx, recordID, zoneID).
PatchedRecordRequest(req)
resp, httpResp, err := request.Execute()
if err != nil {
logger.Debug("Error while updating a DNS Record", zap.Any("ID", recordID), zap.Error(err))
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/dns_zone/dns_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func (c *Client) Create(ctx context.Context, req sdk.ZoneRequest) (sdk.Zone, err
return resp.GetData(), nil
}

func (c *Client) Update(ctx context.Context, req sdk.UpdateZoneRequest, zoneID int64) (sdk.Zone, error) {
func (c *Client) Update(ctx context.Context, req sdk.PatchedUpdateZoneRequest, zoneID int64) (sdk.Zone, error) {
logger.Debug("Update DNS Zone")

request := c.apiClient.DNSZonesAPI.
UpdateDnsZone(ctx, zoneID).
UpdateZoneRequest(req)
PartialUpdateDnsZone(ctx, zoneID).
PatchedUpdateZoneRequest(req)
resp, httpResp, err := request.Execute()
if err != nil {
logger.Debug("Error while updating a DNS Zone", zap.Any("ID", zoneID), zap.Error(err))
Expand Down
5 changes: 1 addition & 4 deletions pkg/cmd/update/device_groups/device_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
client := api.NewClient(f.HttpClient, f.Config.GetString("api_v4_url"), f.Config.GetString("token"))

request := sdk.DeviceGroupRequest{}
request := sdk.PatchedDeviceGroupRequest{}

if !cmd.Flags().Changed("application-id") {
answers, err := utils.AskInput(msg.DeviceGroupsUpdateAskInputApplicationID)
Expand Down Expand Up @@ -84,9 +84,6 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
return utils.ErrorUnmarshalReader
}
} else {
// The device group update is a full replacement (PUT), and both
// name and user_agent are required. Fetch the current values for
// any attribute the user didn't provide so they are preserved.
if !cmd.Flags().Changed("name") || !cmd.Flags().Changed("user-agent") {
current, err := client.Get(context.Background(), fields.ApplicationID, fields.GroupID)
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/cmd/update/dns_record/dns_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
client := api.NewClient(f.HttpClient, f.Config.GetString("api_v4_url"), f.Config.GetString("token"))

request := sdk.RecordRequest{}
request := sdk.PatchedRecordRequest{}

if !cmd.Flags().Changed("zone-id") {
answers, err := utils.AskInput(msg.DNSRecordUpdateAskInputZoneID)
Expand Down Expand Up @@ -90,9 +90,8 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
return utils.ErrorUnmarshalReader
}
} else {
// The DNS record update is a full replacement (PUT); name, type
// and rdata are required. Fetch the current record and preserve
// any attribute the user didn't provide.
// The update is a partial update (PATCH). Fetch the current
// record and preserve any attribute the user didn't provide.
current, err := client.Get(context.Background(), fields.ZoneID, fields.RecordID)
if err != nil {
return fmt.Errorf(msg.ErrorGetDNSRecord.Error(), err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/update/dns_record/dns_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestUpdate(t *testing.T) {
httpmock.JSONFromFile("./fixtures/response.json"),
)
mock.Register(
httpmock.REST("PUT", "workspace/dns/zones/1337/records/1111"),
httpmock.REST("PATCH", "workspace/dns/zones/1337/records/1111"),
httpmock.JSONFromFile("./fixtures/response.json"),
)

Expand All @@ -42,7 +42,7 @@ func TestUpdate(t *testing.T) {
t.Run("update with file", func(t *testing.T) {
mock := &httpmock.Registry{}
mock.Register(
httpmock.REST("PUT", "workspace/dns/zones/1337/records/1111"),
httpmock.REST("PATCH", "workspace/dns/zones/1337/records/1111"),
httpmock.JSONFromFile("./fixtures/response.json"),
)

Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/update/dns_zone/dns_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
client := api.NewClient(f.HttpClient, f.Config.GetString("api_v4_url"), f.Config.GetString("token"))

request := sdk.UpdateZoneRequest{}
request := sdk.PatchedUpdateZoneRequest{}

if !cmd.Flags().Changed("zone-id") {
answers, err := utils.AskInput(msg.DNSZoneUpdateAskInputZoneID)
Expand All @@ -67,9 +67,9 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
return utils.ErrorUnmarshalReader
}
} else {
// The DNS zone update is a full replacement (PUT), and both
// name and active are required. Fetch the current values for
// any attribute the user didn't provide so they are preserved.
// The update is a partial update (PATCH). Fetch the current
// values for any attribute the user didn't provide so they are
// preserved.
if !cmd.Flags().Changed("name") || !cmd.Flags().Changed("active") {
current, err := client.Get(context.Background(), fields.ZoneID)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/update/dns_zone/dns_zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestUpdate(t *testing.T) {
t.Run("update DNS zone with name and active", func(t *testing.T) {
mock := &httpmock.Registry{}
mock.Register(
httpmock.REST("PUT", "workspace/dns/zones/1337"),
httpmock.REST("PATCH", "workspace/dns/zones/1337"),
httpmock.JSONFromFile("./fixtures/response.json"),
)

Expand All @@ -42,7 +42,7 @@ func TestUpdate(t *testing.T) {
httpmock.JSONFromFile("./fixtures/response.json"),
)
mock.Register(
httpmock.REST("PUT", "workspace/dns/zones/1337"),
httpmock.REST("PATCH", "workspace/dns/zones/1337"),
httpmock.JSONFromFile("./fixtures/response.json"),
)

Expand All @@ -59,7 +59,7 @@ func TestUpdate(t *testing.T) {
t.Run("update with file", func(t *testing.T) {
mock := &httpmock.Registry{}
mock.Register(
httpmock.REST("PUT", "workspace/dns/zones/1337"),
httpmock.REST("PATCH", "workspace/dns/zones/1337"),
httpmock.JSONFromFile("./fixtures/response.json"),
)

Expand All @@ -76,7 +76,7 @@ func TestUpdate(t *testing.T) {
t.Run("not found", func(t *testing.T) {
mock := &httpmock.Registry{}
mock.Register(
httpmock.REST("PUT", "workspace/dns/zones/1234"),
httpmock.REST("PATCH", "workspace/dns/zones/1234"),
httpmock.StatusStringResponse(http.StatusNotFound, "Not Found"),
)

Expand Down
4 changes: 4 additions & 0 deletions utils/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,10 @@ func LogAndRewindBody(httpResp *http.Response) error {
}

func LogAndRewindBodyV4(httpResp *http.Response) (string, error) {
if httpResp == nil {
return "", nil
}

logger.Debug("", zap.Any("Status Code", httpResp.StatusCode))
logger.Debug("", zap.Any("Headers", httpResp.Header))
var errResp ErrorResponse
Expand Down
Loading