diff --git a/command/dashboard/create.go b/command/dashboard/create.go index 8c2d8c0f..add52b89 100644 --- a/command/dashboard/create.go +++ b/command/dashboard/create.go @@ -21,8 +21,8 @@ import ( "errors" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" "github.com/arduino/arduino-cloud-cli/internal/template" + "github.com/arduino/arduino-cloud-cli/iot" ) // CreateParams contains the parameters needed to create a new dashboard. diff --git a/command/dashboard/delete.go b/command/dashboard/delete.go index e3446525..206dc030 100644 --- a/command/dashboard/delete.go +++ b/command/dashboard/delete.go @@ -19,7 +19,7 @@ package dashboard import ( "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // DeleteParams contains the parameters needed to diff --git a/command/dashboard/extract.go b/command/dashboard/extract.go index 5b702fe1..a0c1f6cc 100644 --- a/command/dashboard/extract.go +++ b/command/dashboard/extract.go @@ -21,8 +21,8 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" "github.com/arduino/arduino-cloud-cli/internal/template" + "github.com/arduino/arduino-cloud-cli/iot" ) // ExtractParams contains the parameters needed to diff --git a/command/dashboard/list.go b/command/dashboard/list.go index 7ae44dfc..fa76e18d 100644 --- a/command/dashboard/list.go +++ b/command/dashboard/list.go @@ -19,7 +19,7 @@ package dashboard import ( "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // List command is used to list diff --git a/command/device/create.go b/command/device/create.go index 422bf185..b5584142 100644 --- a/command/device/create.go +++ b/command/device/create.go @@ -23,7 +23,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" + "github.com/arduino/arduino-cloud-cli/iot" "github.com/sirupsen/logrus" ) diff --git a/command/device/creategeneric.go b/command/device/creategeneric.go index 9dd0a5c9..5873f2fb 100644 --- a/command/device/creategeneric.go +++ b/command/device/creategeneric.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) const ( diff --git a/command/device/createlora.go b/command/device/createlora.go index afa77f54..540495ab 100644 --- a/command/device/createlora.go +++ b/command/device/createlora.go @@ -24,7 +24,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" + "github.com/arduino/arduino-cloud-cli/iot" iotclient "github.com/arduino/iot-client-go" "github.com/sirupsen/logrus" "go.bug.st/serial" diff --git a/command/device/delete.go b/command/device/delete.go index 7b9de638..1b9868de 100644 --- a/command/device/delete.go +++ b/command/device/delete.go @@ -21,7 +21,7 @@ import ( "errors" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // DeleteParams contains the parameters needed to diff --git a/command/device/list.go b/command/device/list.go index aeee20ba..58dc14d5 100644 --- a/command/device/list.go +++ b/command/device/list.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // ListParams contains the optional parameters needed diff --git a/command/device/listfrequency.go b/command/device/listfrequency.go index 6cd14e4a..e0171620 100644 --- a/command/device/listfrequency.go +++ b/command/device/listfrequency.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // FrequencyPlanInfo describes a LoRa frequency plan. diff --git a/command/device/provision.go b/command/device/provision.go index 38408666..757796ca 100644 --- a/command/device/provision.go +++ b/command/device/provision.go @@ -64,7 +64,7 @@ func downloadProvisioningFile(fqbn string) (string, error) { } type certificateCreator interface { - CertificateCreate(id, csr string) (*iotclient.ArduinoCompressedv2, error) + CertificateCreate(id, csr string) (*iotclient.ArduinoDevicev2Cert, error) } // provision is responsible for running the provisioning @@ -129,11 +129,14 @@ func (p provision) configBoard() error { if err != nil { return err } - cert, err := p.cert.CertificateCreate(p.id, string(csr)) + + c, err := p.cert.CertificateCreate(p.id, string(csr)) if err != nil { return err } + cert := c.Compressed + logrus.Info("Requesting begin storage") err = p.ser.Send(serial.BeginStorage, nil) if err != nil { diff --git a/command/ota/massupload.go b/command/ota/massupload.go index 5f316f20..49b663bb 100644 --- a/command/ota/massupload.go +++ b/command/ota/massupload.go @@ -25,7 +25,7 @@ import ( "path/filepath" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" iotclient "github.com/arduino/iot-client-go" ) diff --git a/command/ota/upload.go b/command/ota/upload.go index 7595ad3a..c64516fc 100644 --- a/command/ota/upload.go +++ b/command/ota/upload.go @@ -24,7 +24,7 @@ import ( "path/filepath" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) const ( diff --git a/command/tag/create.go b/command/tag/create.go index fc6b9025..cde0234f 100644 --- a/command/tag/create.go +++ b/command/tag/create.go @@ -21,7 +21,7 @@ import ( "errors" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // CreateTagsParams contains the parameters needed to create or overwrite diff --git a/command/tag/delete.go b/command/tag/delete.go index 779db943..a062273a 100644 --- a/command/tag/delete.go +++ b/command/tag/delete.go @@ -21,7 +21,7 @@ import ( "errors" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // DeleteTagsParams contains the parameters needed to diff --git a/command/thing/bind.go b/command/thing/bind.go index 343c6564..7ca4e36b 100644 --- a/command/thing/bind.go +++ b/command/thing/bind.go @@ -19,7 +19,7 @@ package thing import ( "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" iotclient "github.com/arduino/iot-client-go" ) diff --git a/command/thing/clone.go b/command/thing/clone.go index c960b3b3..70610418 100644 --- a/command/thing/clone.go +++ b/command/thing/clone.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" iotclient "github.com/arduino/iot-client-go" ) diff --git a/command/thing/create.go b/command/thing/create.go index 88588618..9759c767 100644 --- a/command/thing/create.go +++ b/command/thing/create.go @@ -22,8 +22,8 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" "github.com/arduino/arduino-cloud-cli/internal/template" + "github.com/arduino/arduino-cloud-cli/iot" ) // CreateParams contains the parameters needed to create a new thing. diff --git a/command/thing/delete.go b/command/thing/delete.go index f71a3e12..e73ea6be 100644 --- a/command/thing/delete.go +++ b/command/thing/delete.go @@ -21,7 +21,7 @@ import ( "errors" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // DeleteParams contains the parameters needed to diff --git a/command/thing/extract.go b/command/thing/extract.go index 5541d196..e00e1d2f 100644 --- a/command/thing/extract.go +++ b/command/thing/extract.go @@ -21,8 +21,8 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" "github.com/arduino/arduino-cloud-cli/internal/template" + "github.com/arduino/arduino-cloud-cli/iot" ) // ExtractParams contains the parameters needed to diff --git a/command/thing/list.go b/command/thing/list.go index 1d88f6d6..13763ef9 100644 --- a/command/thing/list.go +++ b/command/thing/list.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/arduino/arduino-cloud-cli/config" - "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/arduino-cloud-cli/iot" ) // ListParams contains the optional parameters needed diff --git a/internal/iot/client.go b/iot/client.go similarity index 99% rename from internal/iot/client.go rename to iot/client.go index 7145000b..c6e180d4 100644 --- a/internal/iot/client.go +++ b/iot/client.go @@ -199,7 +199,7 @@ func (cl *Client) LoraFrequencyPlansList() ([]iotclient.ArduinoLorafreqplanv1, e // CertificateCreate allows to upload a certificate on Arduino IoT Cloud. // It returns the certificate parameters populated by the cloud. -func (cl *Client) CertificateCreate(id, csr string) (*iotclient.ArduinoCompressedv2, error) { +func (cl *Client) CertificateCreate(id, csr string) (*iotclient.ArduinoDevicev2Cert, error) { cert := iotclient.CreateDevicesV2CertsPayload{ Ca: "Arduino", Csr: csr, @@ -212,7 +212,7 @@ func (cl *Client) CertificateCreate(id, csr string) (*iotclient.ArduinoCompresse return nil, err } - return &newCert.Compressed, nil + return &newCert, nil } // ThingCreate adds a new thing on Arduino IoT Cloud. diff --git a/internal/iot/error.go b/iot/error.go similarity index 100% rename from internal/iot/error.go rename to iot/error.go diff --git a/internal/iot/token.go b/iot/token.go similarity index 100% rename from internal/iot/token.go rename to iot/token.go