diff --git a/.github/workflows/check-dependencies-task.yml b/.github/workflows/check-dependencies-task.yml index 1fa96ccb..ee00aad0 100644 --- a/.github/workflows/check-dependencies-task.yml +++ b/.github/workflows/check-dependencies-task.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install licensed uses: jonabc/setup-licensed@v1 @@ -43,7 +43,7 @@ jobs: version: 3.x - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} @@ -81,7 +81,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install licensed uses: jonabc/setup-licensed@v1 @@ -90,7 +90,7 @@ jobs: version: 3.x - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} diff --git a/.github/workflows/release-go-task.yml b/.github/workflows/release-go-task.yml index abbfcc14..57c1e886 100644 --- a/.github/workflows/release-go-task.yml +++ b/.github/workflows/release-go-task.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -55,7 +55,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download artifacts uses: actions/download-artifact@v4 diff --git a/.github/workflows/test-go-task.yml b/.github/workflows/test-go-task.yml index 2868e0b6..45484e16 100644 --- a/.github/workflows/test-go-task.yml +++ b/.github/workflows/test-go-task.yml @@ -75,10 +75,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} diff --git a/.licenses/go/github.com/arduino/iot-client-go/v2.dep.yml b/.licenses/go/github.com/arduino/iot-client-go/v3.dep.yml similarity index 85% rename from .licenses/go/github.com/arduino/iot-client-go/v2.dep.yml rename to .licenses/go/github.com/arduino/iot-client-go/v3.dep.yml index 43ef0bb2..070abedd 100644 --- a/.licenses/go/github.com/arduino/iot-client-go/v2.dep.yml +++ b/.licenses/go/github.com/arduino/iot-client-go/v3.dep.yml @@ -1,9 +1,9 @@ --- -name: github.com/arduino/iot-client-go/v2 -version: v2.0.3 +name: github.com/arduino/iot-client-go/v3 +version: v3.0.1 type: go summary: -homepage: https://pkg.go.dev/github.com/arduino/iot-client-go/v2 +homepage: https://pkg.go.dev/github.com/arduino/iot-client-go/v3 license: apache-2.0 licenses: - sources: LICENSE diff --git a/.licenses/go/golang.org/x/oauth2.dep.yml b/.licenses/go/golang.org/x/oauth2.dep.yml index 7be49c5b..fec14f35 100644 --- a/.licenses/go/golang.org/x/oauth2.dep.yml +++ b/.licenses/go/golang.org/x/oauth2.dep.yml @@ -1,6 +1,6 @@ --- name: golang.org/x/oauth2 -version: v0.21.0 +version: v0.23.0 type: go summary: Package oauth2 provides support for making OAuth2 authorized and authenticated HTTP requests, as specified in RFC 6749. @@ -9,7 +9,7 @@ license: bsd-3-clause licenses: - sources: LICENSE text: | - Copyright (c) 2009 The Go Authors. All rights reserved. + Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -21,7 +21,7 @@ licenses: copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/.licenses/go/golang.org/x/oauth2/clientcredentials.dep.yml b/.licenses/go/golang.org/x/oauth2/clientcredentials.dep.yml index f5cc2b56..8421ec51 100644 --- a/.licenses/go/golang.org/x/oauth2/clientcredentials.dep.yml +++ b/.licenses/go/golang.org/x/oauth2/clientcredentials.dep.yml @@ -1,15 +1,15 @@ --- name: golang.org/x/oauth2/clientcredentials -version: v0.21.0 +version: v0.23.0 type: go summary: Package clientcredentials implements the OAuth2.0 "client credentials" token flow, also known as the "two-legged OAuth 2.0". homepage: https://pkg.go.dev/golang.org/x/oauth2/clientcredentials license: bsd-3-clause licenses: -- sources: oauth2@v0.21.0/LICENSE +- sources: oauth2@v0.23.0/LICENSE text: | - Copyright (c) 2009 The Go Authors. All rights reserved. + Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -21,7 +21,7 @@ licenses: copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/.licenses/go/golang.org/x/oauth2/internal.dep.yml b/.licenses/go/golang.org/x/oauth2/internal.dep.yml index 4d1daff8..7267f93c 100644 --- a/.licenses/go/golang.org/x/oauth2/internal.dep.yml +++ b/.licenses/go/golang.org/x/oauth2/internal.dep.yml @@ -1,14 +1,14 @@ --- name: golang.org/x/oauth2/internal -version: v0.21.0 +version: v0.23.0 type: go summary: Package internal contains support packages for oauth2 package. homepage: https://pkg.go.dev/golang.org/x/oauth2/internal license: bsd-3-clause licenses: -- sources: oauth2@v0.21.0/LICENSE +- sources: oauth2@v0.23.0/LICENSE text: | - Copyright (c) 2009 The Go Authors. All rights reserved. + Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -20,7 +20,7 @@ licenses: copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/command/dashboard/dashboard.go b/command/dashboard/dashboard.go index 431fb6b4..a47abeb6 100644 --- a/command/dashboard/dashboard.go +++ b/command/dashboard/dashboard.go @@ -18,7 +18,7 @@ package dashboard import ( - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" ) // DashboardInfo contains the most interesting diff --git a/command/device/createlora.go b/command/device/createlora.go index 06542bad..84c9509d 100644 --- a/command/device/createlora.go +++ b/command/device/createlora.go @@ -26,7 +26,7 @@ import ( "github.com/arduino/arduino-cloud-cli/arduino/cli" "github.com/arduino/arduino-cloud-cli/config" "github.com/arduino/arduino-cloud-cli/internal/iot" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "github.com/sirupsen/logrus" "go.bug.st/serial" ) diff --git a/command/device/device.go b/command/device/device.go index 8c9dede1..40f91b47 100644 --- a/command/device/device.go +++ b/command/device/device.go @@ -19,7 +19,7 @@ package device import ( "github.com/arduino/arduino-cloud-cli/command/tag" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" ) // DeviceInfo contains the most interesting diff --git a/command/device/provision.go b/command/device/provision.go index 2515cb3a..89ac0cab 100644 --- a/command/device/provision.go +++ b/command/device/provision.go @@ -29,7 +29,7 @@ import ( "github.com/arduino/arduino-cloud-cli/internal/binary" "github.com/arduino/arduino-cloud-cli/internal/serial" "github.com/arduino/go-paths-helper" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "github.com/sirupsen/logrus" ) diff --git a/command/ota/massupload.go b/command/ota/massupload.go index 1fbffa38..efa3d689 100644 --- a/command/ota/massupload.go +++ b/command/ota/massupload.go @@ -31,7 +31,7 @@ import ( "github.com/arduino/arduino-cloud-cli/internal/ota" otaapi "github.com/arduino/arduino-cloud-cli/internal/ota-api" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" ) const ( diff --git a/command/ota/massupload_test.go b/command/ota/massupload_test.go index ba50d9fa..1b3676c3 100644 --- a/command/ota/massupload_test.go +++ b/command/ota/massupload_test.go @@ -25,7 +25,7 @@ import ( "testing" otaapi "github.com/arduino/arduino-cloud-cli/internal/ota-api" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "github.com/gofrs/uuid" "github.com/stretchr/testify/assert" ) diff --git a/command/template/apply.go b/command/template/apply.go index 8ba09e4c..b0630ca1 100644 --- a/command/template/apply.go +++ b/command/template/apply.go @@ -31,7 +31,7 @@ import ( "github.com/arduino/arduino-cloud-cli/config" "github.com/arduino/arduino-cloud-cli/internal/iot" storageapi "github.com/arduino/arduino-cloud-cli/internal/storage-api" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "github.com/gofrs/uuid" "github.com/sirupsen/logrus" ) diff --git a/command/thing/bind.go b/command/thing/bind.go index c6ee8983..7fdc217d 100644 --- a/command/thing/bind.go +++ b/command/thing/bind.go @@ -23,7 +23,7 @@ import ( "github.com/arduino/arduino-cloud-cli/config" "github.com/arduino/arduino-cloud-cli/internal/iot" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" ) // BindParams contains the parameters needed to diff --git a/command/thing/thing.go b/command/thing/thing.go index 8b10defb..61ba305b 100644 --- a/command/thing/thing.go +++ b/command/thing/thing.go @@ -19,7 +19,7 @@ package thing import ( "github.com/arduino/arduino-cloud-cli/command/tag" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" ) // ThingInfo contains the main parameters of diff --git a/go.mod b/go.mod index f29d6e6b..9b6fd915 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/arduino/arduino-cloud-cli -go 1.23.0 +go 1.23 require ( github.com/arduino/arduino-cli v0.0.0-20240927141754-d9dd4ba1ed71 github.com/arduino/go-paths-helper v1.12.1 github.com/arduino/go-win32-utils v1.0.0 - github.com/arduino/iot-client-go/v2 v2.0.3 + github.com/arduino/iot-client-go/v3 v3.0.1 github.com/gofrs/uuid v4.2.0+incompatible github.com/google/go-cmp v0.6.0 github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6 @@ -19,7 +19,7 @@ require ( go.bug.st/cleanup v1.0.0 go.bug.st/serial v1.6.2 golang.org/x/crypto v0.18.0 - golang.org/x/oauth2 v0.21.0 + golang.org/x/oauth2 v0.23.0 google.golang.org/grpc v1.61.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools v2.2.0+incompatible diff --git a/go.sum b/go.sum index 8eccfc5f..8f7e0be0 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,8 @@ github.com/arduino/go-properties-orderedmap v1.7.1 h1:HQ9Pn/mk3+XyfrE39EEvaZwJkr github.com/arduino/go-properties-orderedmap v1.7.1/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk= github.com/arduino/go-win32-utils v1.0.0 h1:/cXB86sOJxOsCHP7sQmXGLkdValwJt56mIwOHYxgQjQ= github.com/arduino/go-win32-utils v1.0.0/go.mod h1:0jqM7doGEAs6DaJCxxhLBUDS5OawrqF48HqXkcEie/Q= -github.com/arduino/iot-client-go/v2 v2.0.3 h1:/mYkInEgr2a4s3bSFhjCzynBApPcYlpDwsuTQiyMbag= -github.com/arduino/iot-client-go/v2 v2.0.3/go.mod h1:kwX4B2AVEWl5ug94QbQ087xbvLFa9Co//jhbM/Z2eSQ= +github.com/arduino/iot-client-go/v3 v3.0.1 h1:AwkctEtP7ilVXBOF2yZPJZpjpuUmKNGr/OdYxPx/4QQ= +github.com/arduino/iot-client-go/v3 v3.0.1/go.mod h1:r2QEAP5Jalkr0YWNPhFl0EJzFRQNy24wN5CVbn11f64= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= @@ -582,8 +582,8 @@ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/iot/client.go b/internal/iot/client.go index 788a4e05..e4882d6f 100644 --- a/internal/iot/client.go +++ b/internal/iot/client.go @@ -23,7 +23,7 @@ import ( "os" "github.com/arduino/arduino-cloud-cli/config" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "golang.org/x/oauth2" ) @@ -70,9 +70,9 @@ func (cl *Client) DeviceCreate(ctx context.Context, fqbn, name, serial, dType st payload.ConnectionType = cType } - req := cl.api.DevicesV2Api.DevicesV2Create(ctx) + req := cl.api.DevicesV2API.DevicesV2Create(ctx) req = req.CreateDevicesV2Payload(payload) - dev, _, err := cl.api.DevicesV2Api.DevicesV2CreateExecute(req) + dev, _, err := cl.api.DevicesV2API.DevicesV2CreateExecute(req) if err != nil { err = fmt.Errorf("creating device, %w", errorDetail(err)) return nil, err @@ -98,9 +98,9 @@ func (cl *Client) DeviceLoraCreate(ctx context.Context, name, serial, devType, e UserId: "me", } - req := cl.api.LoraDevicesV1Api.LoraDevicesV1Create(ctx) + req := cl.api.LoraDevicesV1API.LoraDevicesV1Create(ctx) req = req.CreateLoraDevicesV1Payload(payload) - dev, _, err := cl.api.LoraDevicesV1Api.LoraDevicesV1CreateExecute(req) + dev, _, err := cl.api.LoraDevicesV1API.LoraDevicesV1CreateExecute(req) if err != nil { err = fmt.Errorf("creating lora device: %w", errorDetail(err)) return nil, err @@ -117,18 +117,18 @@ func (cl *Client) DevicePassSet(ctx context.Context, id string) (*iotclient.Ardu } // Fetch suggested password - req := cl.api.DevicesV2PassApi.DevicesV2PassGet(ctx, id) + req := cl.api.DevicesV2PassAPI.DevicesV2PassGet(ctx, id) req = req.SuggestedPassword(true) - pass, _, err := cl.api.DevicesV2PassApi.DevicesV2PassGetExecute(req) + pass, _, err := cl.api.DevicesV2PassAPI.DevicesV2PassGetExecute(req) if err != nil { err = fmt.Errorf("fetching device suggested password: %w", errorDetail(err)) return nil, err } // Set password to the suggested one - reqSet := cl.api.DevicesV2PassApi.DevicesV2PassSet(ctx, id) + reqSet := cl.api.DevicesV2PassAPI.DevicesV2PassSet(ctx, id) reqSet = reqSet.Devicev2Pass(iotclient.Devicev2Pass{Password: pass.SuggestedPassword}) - pass, _, err = cl.api.DevicesV2PassApi.DevicesV2PassSetExecute(reqSet) + pass, _, err = cl.api.DevicesV2PassAPI.DevicesV2PassSetExecute(reqSet) if err != nil { err = fmt.Errorf("setting device password: %w", errorDetail(err)) return nil, err @@ -144,8 +144,8 @@ func (cl *Client) DeviceDelete(ctx context.Context, id string) error { return err } - req := cl.api.DevicesV2Api.DevicesV2Delete(ctx, id) - _, err = cl.api.DevicesV2Api.DevicesV2DeleteExecute(req) + req := cl.api.DevicesV2API.DevicesV2Delete(ctx, id) + _, err = cl.api.DevicesV2API.DevicesV2DeleteExecute(req) if err != nil { err = fmt.Errorf("deleting device: %w", errorDetail(err)) return err @@ -161,7 +161,7 @@ func (cl *Client) DeviceList(ctx context.Context, tags map[string]string) ([]iot return nil, err } - req := cl.api.DevicesV2Api.DevicesV2List(ctx) + req := cl.api.DevicesV2API.DevicesV2List(ctx) if tags != nil { t := make([]string, 0, len(tags)) for key, val := range tags { @@ -170,7 +170,7 @@ func (cl *Client) DeviceList(ctx context.Context, tags map[string]string) ([]iot } req = req.Tags(t) } - devices, _, err := cl.api.DevicesV2Api.DevicesV2ListExecute(req) + devices, _, err := cl.api.DevicesV2API.DevicesV2ListExecute(req) if err != nil { err = fmt.Errorf("listing devices: %w", errorDetail(err)) return nil, err @@ -186,8 +186,8 @@ func (cl *Client) DeviceShow(ctx context.Context, id string) (*iotclient.Arduino return nil, err } - req := cl.api.DevicesV2Api.DevicesV2Show(ctx, id) - dev, _, err := cl.api.DevicesV2Api.DevicesV2ShowExecute(req) + req := cl.api.DevicesV2API.DevicesV2Show(ctx, id) + dev, _, err := cl.api.DevicesV2API.DevicesV2ShowExecute(req) if err != nil { err = fmt.Errorf("retrieving device, %w", errorDetail(err)) return nil, err @@ -202,9 +202,9 @@ func (cl *Client) DeviceNetworkCredentials(ctx context.Context, deviceType, conn return nil, err } - req := cl.api.NetworkCredentialsV1Api.NetworkCredentialsV1Show(ctx, deviceType) + req := cl.api.NetworkCredentialsV1API.NetworkCredentialsV1Show(ctx, deviceType) req = req.Connection(connection) - dev, _, err := cl.api.NetworkCredentialsV1Api.NetworkCredentialsV1ShowExecute(req) + dev, _, err := cl.api.NetworkCredentialsV1API.NetworkCredentialsV1ShowExecute(req) if err != nil { err = fmt.Errorf("retrieving device network configuration, %w", errorDetail(err)) return nil, err @@ -220,11 +220,11 @@ func (cl *Client) DeviceOTA(ctx context.Context, id string, file *os.File, expir return err } - req := cl.api.DevicesV2OtaApi.DevicesV2OtaUpload(ctx, id) + req := cl.api.DevicesV2OtaAPI.DevicesV2OtaUpload(ctx, id) req = req.ExpireInMins(int32(expireMins)) req = req.Async(true) req = req.OtaFile(file) - _, resp, err := cl.api.DevicesV2OtaApi.DevicesV2OtaUploadExecute(req) + _, resp, err := cl.api.DevicesV2OtaAPI.DevicesV2OtaUploadExecute(req) if err != nil { // 409 (Conflict) is the status code for an already existing OTA in progress for the same device. Handling it in a different way. if resp != nil && resp.StatusCode == 409 { @@ -243,9 +243,9 @@ func (cl *Client) DeviceTagsCreate(ctx context.Context, id string, tags map[stri } for key, val := range tags { - req := cl.api.DevicesV2TagsApi.DevicesV2TagsUpsert(ctx, id) + req := cl.api.DevicesV2TagsAPI.DevicesV2TagsUpsert(ctx, id) req = req.Tag(iotclient.Tag{Key: key, Value: val}) - _, err := cl.api.DevicesV2TagsApi.DevicesV2TagsUpsertExecute(req) + _, err := cl.api.DevicesV2TagsAPI.DevicesV2TagsUpsertExecute(req) if err != nil { err = fmt.Errorf("cannot create tag %s: %w", key, errorDetail(err)) return err @@ -263,8 +263,8 @@ func (cl *Client) DeviceTagsDelete(ctx context.Context, id string, keys []string } for _, key := range keys { - req := cl.api.DevicesV2TagsApi.DevicesV2TagsDelete(ctx, id, key) - _, err := cl.api.DevicesV2TagsApi.DevicesV2TagsDeleteExecute(req) + req := cl.api.DevicesV2TagsAPI.DevicesV2TagsDelete(ctx, id, key) + _, err := cl.api.DevicesV2TagsAPI.DevicesV2TagsDeleteExecute(req) if err != nil { err = fmt.Errorf("cannot delete tag %s: %w", key, errorDetail(err)) return err @@ -281,8 +281,8 @@ func (cl *Client) LoraFrequencyPlansList(ctx context.Context) ([]iotclient.Ardui return nil, err } - req := cl.api.LoraFreqPlanV1Api.LoraFreqPlanV1List(ctx) - freqs, _, err := cl.api.LoraFreqPlanV1Api.LoraFreqPlanV1ListExecute(req) + req := cl.api.LoraFreqPlanV1API.LoraFreqPlanV1List(ctx) + freqs, _, err := cl.api.LoraFreqPlanV1API.LoraFreqPlanV1ListExecute(req) if err != nil { err = fmt.Errorf("listing lora frequency plans: %w", errorDetail(err)) return nil, err @@ -304,9 +304,9 @@ func (cl *Client) CertificateCreate(ctx context.Context, id, csr string) (*iotcl Enabled: true, } - req := cl.api.DevicesV2CertsApi.DevicesV2CertsCreate(ctx, id) + req := cl.api.DevicesV2CertsAPI.DevicesV2CertsCreate(ctx, id) req = req.CreateDevicesV2CertsPayload(cert) - newCert, _, err := cl.api.DevicesV2CertsApi.DevicesV2CertsCreateExecute(req) + newCert, _, err := cl.api.DevicesV2CertsAPI.DevicesV2CertsCreateExecute(req) if err != nil { err = fmt.Errorf("creating certificate, %w", errorDetail(err)) return nil, err @@ -322,10 +322,10 @@ func (cl *Client) ThingCreate(ctx context.Context, thing *iotclient.ThingCreate, return nil, err } - req := cl.api.ThingsV2Api.ThingsV2Create(ctx) + req := cl.api.ThingsV2API.ThingsV2Create(ctx) req = req.ThingCreate(*thing) req = req.Force(force) - newThing, _, err := cl.api.ThingsV2Api.ThingsV2CreateExecute(req) + newThing, _, err := cl.api.ThingsV2API.ThingsV2CreateExecute(req) if err != nil { return nil, fmt.Errorf("%s: %w", "adding new thing", errorDetail(err)) } @@ -339,10 +339,10 @@ func (cl *Client) ThingUpdate(ctx context.Context, id string, thing *iotclient.T return err } - req := cl.api.ThingsV2Api.ThingsV2Update(ctx, id) + req := cl.api.ThingsV2API.ThingsV2Update(ctx, id) req = req.Force(force) req = req.ThingUpdate(*thing) - _, _, err = cl.api.ThingsV2Api.ThingsV2UpdateExecute(req) + _, _, err = cl.api.ThingsV2API.ThingsV2UpdateExecute(req) if err != nil { return fmt.Errorf("%s: %v", "updating thing", errorDetail(err)) } @@ -356,8 +356,8 @@ func (cl *Client) ThingDelete(ctx context.Context, id string) error { return err } - req := cl.api.ThingsV2Api.ThingsV2Delete(ctx, id) - _, err = cl.api.ThingsV2Api.ThingsV2DeleteExecute(req) + req := cl.api.ThingsV2API.ThingsV2Delete(ctx, id) + _, err = cl.api.ThingsV2API.ThingsV2DeleteExecute(req) if err != nil { err = fmt.Errorf("deleting thing: %w", errorDetail(err)) return err @@ -372,8 +372,8 @@ func (cl *Client) ThingShow(ctx context.Context, id string) (*iotclient.ArduinoT return nil, err } - req := cl.api.ThingsV2Api.ThingsV2Show(ctx, id) - thing, _, err := cl.api.ThingsV2Api.ThingsV2ShowExecute(req) + req := cl.api.ThingsV2API.ThingsV2Show(ctx, id) + thing, _, err := cl.api.ThingsV2API.ThingsV2ShowExecute(req) if err != nil { return nil, fmt.Errorf("retrieving thing, %w", errorDetail(err)) } @@ -387,10 +387,10 @@ func (cl *Client) ThingClone(ctx context.Context, id, newName string) (*iotclien return nil, err } - req := cl.api.ThingsV2Api.ThingsV2Clone(ctx, id) + req := cl.api.ThingsV2API.ThingsV2Clone(ctx, id) includeTags := true req = req.ThingClone(iotclient.ThingClone{Name: newName, IncludeTags: &includeTags}) - thing, _, err := cl.api.ThingsV2Api.ThingsV2CloneExecute(req) + thing, _, err := cl.api.ThingsV2API.ThingsV2CloneExecute(req) if err != nil { return nil, fmt.Errorf("cloning thing thing, %w", errorDetail(err)) } @@ -404,7 +404,7 @@ func (cl *Client) ThingList(ctx context.Context, ids []string, device *string, p return nil, err } - req := cl.api.ThingsV2Api.ThingsV2List(ctx) + req := cl.api.ThingsV2API.ThingsV2List(ctx) req = req.ShowProperties(props) if ids != nil { req = req.Ids(ids) @@ -422,7 +422,7 @@ func (cl *Client) ThingList(ctx context.Context, ids []string, device *string, p } req = req.Tags(t) } - things, _, err := cl.api.ThingsV2Api.ThingsV2ListExecute(req) + things, _, err := cl.api.ThingsV2API.ThingsV2ListExecute(req) if err != nil { err = fmt.Errorf("retrieving things, %w", errorDetail(err)) return nil, err @@ -438,9 +438,9 @@ func (cl *Client) ThingTagsCreate(ctx context.Context, id string, tags map[strin } for key, val := range tags { - req := cl.api.ThingsV2TagsApi.ThingsV2TagsUpsert(ctx, id) + req := cl.api.ThingsV2TagsAPI.ThingsV2TagsUpsert(ctx, id) req = req.Tag(iotclient.Tag{Key: key, Value: val}) - _, err := cl.api.ThingsV2TagsApi.ThingsV2TagsUpsertExecute(req) + _, err := cl.api.ThingsV2TagsAPI.ThingsV2TagsUpsertExecute(req) if err != nil { err = fmt.Errorf("cannot create tag %s: %w", key, errorDetail(err)) return err @@ -458,8 +458,8 @@ func (cl *Client) ThingTagsDelete(ctx context.Context, id string, keys []string) } for _, key := range keys { - req := cl.api.ThingsV2TagsApi.ThingsV2TagsDelete(ctx, id, key) - _, err := cl.api.ThingsV2TagsApi.ThingsV2TagsDeleteExecute(req) + req := cl.api.ThingsV2TagsAPI.ThingsV2TagsDelete(ctx, id, key) + _, err := cl.api.ThingsV2TagsAPI.ThingsV2TagsDeleteExecute(req) if err != nil { err = fmt.Errorf("cannot delete tag %s: %w", key, errorDetail(err)) return err @@ -475,9 +475,9 @@ func (cl *Client) DashboardCreate(ctx context.Context, dashboard *iotclient.Dash return nil, err } - req := cl.api.DashboardsV2Api.DashboardsV2Create(ctx) + req := cl.api.DashboardsV2API.DashboardsV2Create(ctx) req = req.Dashboardv2(*dashboard) - newDashboard, _, err := cl.api.DashboardsV2Api.DashboardsV2CreateExecute(req) + newDashboard, _, err := cl.api.DashboardsV2API.DashboardsV2CreateExecute(req) if err != nil { return nil, fmt.Errorf("%s: %w", "adding new dashboard", errorDetail(err)) } @@ -492,8 +492,8 @@ func (cl *Client) DashboardShow(ctx context.Context, id string) (*iotclient.Ardu return nil, err } - req := cl.api.DashboardsV2Api.DashboardsV2Show(ctx, id) - dashboard, _, err := cl.api.DashboardsV2Api.DashboardsV2ShowExecute(req) + req := cl.api.DashboardsV2API.DashboardsV2Show(ctx, id) + dashboard, _, err := cl.api.DashboardsV2API.DashboardsV2ShowExecute(req) if err != nil { err = fmt.Errorf("retrieving dashboard, %w", errorDetail(err)) return nil, err @@ -508,8 +508,8 @@ func (cl *Client) DashboardList(ctx context.Context) ([]iotclient.ArduinoDashboa return nil, err } - req := cl.api.DashboardsV2Api.DashboardsV2List(ctx) - dashboards, _, err := cl.api.DashboardsV2Api.DashboardsV2ListExecute(req) + req := cl.api.DashboardsV2API.DashboardsV2List(ctx) + dashboards, _, err := cl.api.DashboardsV2API.DashboardsV2ListExecute(req) if err != nil { err = fmt.Errorf("listing dashboards: %w", errorDetail(err)) return nil, err @@ -524,8 +524,8 @@ func (cl *Client) DashboardDelete(ctx context.Context, id string) error { return err } - req := cl.api.DashboardsV2Api.DashboardsV2Delete(ctx, id) - _, err = cl.api.DashboardsV2Api.DashboardsV2DeleteExecute(req) + req := cl.api.DashboardsV2API.DashboardsV2Delete(ctx, id) + _, err = cl.api.DashboardsV2API.DashboardsV2DeleteExecute(req) if err != nil { err = fmt.Errorf("deleting dashboard: %w", errorDetail(err)) return err @@ -544,7 +544,7 @@ func (cl *Client) TemplateApply(ctx context.Context, id, thingId, prefix, device thingOption["device_id"] = deviceId thingOption["secrets"] = credentials - req := cl.api.TemplatesApi.TemplatesApply(ctx) + req := cl.api.TemplatesAPI.TemplatesApply(ctx) req = req.Template(iotclient.Template{ PrefixName: toStringPointer(prefix), CustomTemplateId: toStringPointer(id), @@ -552,7 +552,7 @@ func (cl *Client) TemplateApply(ctx context.Context, id, thingId, prefix, device thingId: thingOption, }, }) - dev, _, err := cl.api.TemplatesApi.TemplatesApplyExecute(req) + dev, _, err := cl.api.TemplatesAPI.TemplatesApplyExecute(req) if err != nil { err = fmt.Errorf("retrieving device, %w", errorDetail(err)) return nil, err @@ -572,7 +572,7 @@ func (cl *Client) setup(client, secret, organizationId string) error { } config.Servers = iotclient.ServerConfigurations{ { - URL: fmt.Sprintf("%s/iot", baseURL), + URL: baseURL, Description: "IoT API endpoint", }, } diff --git a/internal/iot/error.go b/internal/iot/error.go index e26de626..74f29120 100644 --- a/internal/iot/error.go +++ b/internal/iot/error.go @@ -21,7 +21,7 @@ import ( "encoding/json" "fmt" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" ) // errorDetail takes a generic iot-client-go error diff --git a/internal/iot/token.go b/internal/iot/token.go index 07f83bd7..bfa3df37 100644 --- a/internal/iot/token.go +++ b/internal/iot/token.go @@ -25,7 +25,7 @@ import ( "os" "strings" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "golang.org/x/oauth2" cc "golang.org/x/oauth2/clientcredentials" ) diff --git a/internal/template/dashboard.go b/internal/template/dashboard.go index eae04243..a8490c91 100644 --- a/internal/template/dashboard.go +++ b/internal/template/dashboard.go @@ -22,7 +22,7 @@ import ( "encoding/json" "fmt" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" ) type dashboardTemplate struct { diff --git a/internal/template/extract.go b/internal/template/extract.go index 1585c577..5418e0b4 100644 --- a/internal/template/extract.go +++ b/internal/template/extract.go @@ -23,7 +23,7 @@ import ( "fmt" "os" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "gopkg.in/yaml.v3" ) diff --git a/internal/template/load.go b/internal/template/load.go index 6086c25d..e07e76f1 100644 --- a/internal/template/load.go +++ b/internal/template/load.go @@ -25,7 +25,7 @@ import ( "io" "os" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "github.com/gofrs/uuid" "gopkg.in/yaml.v3" ) diff --git a/internal/template/load_test.go b/internal/template/load_test.go index 705dc0d1..88bdc931 100644 --- a/internal/template/load_test.go +++ b/internal/template/load_test.go @@ -21,7 +21,7 @@ import ( "context" "testing" - iotclient "github.com/arduino/iot-client-go/v2" + iotclient "github.com/arduino/iot-client-go/v3" "github.com/gofrs/uuid" "github.com/google/go-cmp/cmp" )