├── command ├── ota │ ├── testdata │ │ ├── empty.bin │ │ └── cloud.bin │ ├── cancel.go │ ├── readheader.go │ └── encode.go ├── template │ ├── .testdata │ │ └── template_ok-rp-with-binaries.tino │ ├── apply_test.go │ ├── list.go │ ├── import.go │ └── export.go ├── tag │ ├── resource.go │ ├── tag.go │ ├── delete.go │ └── create.go ├── dashboard │ ├── delete.go │ ├── list.go │ ├── dashboard.go │ └── extract.go ├── thing │ ├── extract.go │ ├── clone.go │ ├── thing.go │ └── bind.go └── device │ ├── listfrequency.go │ └── listfqbn_test.go ├── internal ├── lzss │ ├── testdata │ │ ├── empty.bin │ │ ├── empty.lzss │ │ ├── blink.bin │ │ ├── blink.lzss │ │ ├── cloud.bin │ │ └── cloud.lzss │ ├── lzss_test.go │ ├── decoder_test.go │ └── decoder.go ├── ota │ ├── testdata │ │ ├── blink.bin │ │ ├── blink.ota │ │ ├── cloud.bin │ │ ├── cloud.ota │ │ └── esp32.ota │ ├── decoder_test.go │ ├── version_test.go │ └── version.go ├── binary │ ├── gpgkey │ │ ├── index_public.gpg.key │ │ └── key.go │ └── index_test.go ├── template │ ├── testdata │ │ ├── dashboard-no-options.yaml │ │ ├── dashboard-detailed.yaml │ │ ├── dashboard-wrong-options.yaml │ │ ├── dashboard-with-variable.yaml │ │ ├── home-security-dashboard.yaml │ │ ├── dashboard-two-widgets.yaml │ │ └── home-security-dashboard.json │ └── filter.go ├── ota-api │ └── dto_test.go ├── iot-api-raw │ └── dto.go ├── iot │ ├── client_test.go │ └── error.go └── board-protocols │ ├── transport │ └── transport_interface.go │ └── provisioning-protocol │ └── provisioning_protocol_test.go ├── .gitignore ├── firmware └── provision │ └── LoraProvision │ └── LoraProvision.ino ├── designs ├── _pull_request_template.md └── _template.md ├── .github └── PULL_REQUEST_TEMPLATE.md ├── gon.config.hcl ├── main.go ├── .licenses └── go │ ├── github.com │ ├── arduino │ │ └── iot-client-go │ │ │ └── v3.dep.yml │ ├── mailru │ │ ├── easyjson.dep.yml │ │ └── easyjson │ │ │ ├── jwriter.dep.yml │ │ │ ├── jlexer.dep.yml │ │ │ └── buffer.dep.yml │ ├── spf13 │ │ ├── viper.dep.yml │ │ ├── jwalterweatherman.dep.yml │ │ ├── cast.dep.yml │ │ ├── viper │ │ │ └── internal │ │ │ │ ├── encoding.dep.yml │ │ │ │ └── encoding │ │ │ │ ├── hcl.dep.yml │ │ │ │ ├── json.dep.yml │ │ │ │ ├── toml.dep.yml │ │ │ │ └── yaml.dep.yml │ │ └── pflag.dep.yml │ ├── mattn │ │ ├── go-isatty.dep.yml │ │ ├── go-colorable.dep.yml │ │ └── go-runewidth.dep.yml │ ├── mitchellh │ │ ├── go-homedir.dep.yml │ │ └── mapstructure.dep.yml │ ├── josharian │ │ └── intern.dep.yml │ ├── h2non │ │ ├── filetype.dep.yml │ │ └── filetype │ │ │ ├── types.dep.yml │ │ │ ├── matchers.dep.yml │ │ │ └── matchers │ │ │ └── isobmff.dep.yml │ ├── chzyer │ │ └── readline.dep.yml │ ├── subosito │ │ └── gotenv.dep.yml │ ├── creack │ │ └── goselect.dep.yml │ ├── codeclysm │ │ └── extract │ │ │ └── v4.dep.yml │ ├── sirupsen │ │ └── logrus.dep.yml │ ├── rivo │ │ └── uniseg.dep.yml │ ├── leonelquinteros │ │ ├── gotext.dep.yml │ │ └── gotext │ │ │ └── plurals.dep.yml │ ├── x448 │ │ └── float16.dep.yml │ ├── jbenet │ │ └── go-context │ │ │ └── io.dep.yml │ ├── fatih │ │ └── color.dep.yml │ ├── cmaglie │ │ └── pb.dep.yml │ ├── pkg │ │ └── errors.dep.yml │ ├── beevik │ │ └── ntp.dep.yml │ ├── gofrs │ │ └── uuid.dep.yml │ ├── ulikunitz │ │ ├── xz.dep.yml │ │ └── xz │ │ │ ├── internal │ │ │ ├── hash.dep.yml │ │ │ └── xlog.dep.yml │ │ │ └── lzma.dep.yml │ ├── howeyc │ │ └── crc16.dep.yml │ ├── fxamacker │ │ └── cbor │ │ │ └── v2.dep.yml │ ├── golang │ │ └── protobuf │ │ │ ├── ptypes │ │ │ ├── any.dep.yml │ │ │ ├── duration.dep.yml │ │ │ └── timestamp.dep.yml │ │ │ ├── proto.dep.yml │ │ │ ├── ptypes.dep.yml │ │ │ └── jsonpb.dep.yml │ ├── pmylund │ │ └── sortutil.dep.yml │ ├── manifoldco │ │ ├── promptui │ │ │ ├── list.dep.yml │ │ │ └── screenbuf.dep.yml │ │ └── promptui.dep.yml │ ├── src-d │ │ ├── gcfg │ │ │ ├── types.dep.yml │ │ │ ├── scanner.dep.yml │ │ │ └── token.dep.yml │ │ └── gcfg.dep.yml │ └── magiconair │ │ └── properties.dep.yml │ ├── gopkg.in │ └── warnings.v0.dep.yml │ ├── go.bug.st │ ├── cleanup.dep.yml │ ├── downloader │ │ └── v2.dep.yml │ └── relaxed-semver.dep.yml │ └── golang.org │ └── x │ ├── oauth2 │ ├── internal.dep.yml │ └── clientcredentials.dep.yml │ └── oauth2.dep.yml ├── cli ├── credentials │ ├── credentials.go │ └── find.go ├── dashboard │ └── dashboard.go ├── ota │ ├── ota.go │ ├── decode.go │ └── cancel.go ├── template │ ├── template.go │ ├── list.go │ └── import.go ├── version │ └── version.go ├── thing │ └── thing.go └── device │ └── device.go ├── arduino ├── commander.go ├── grpc │ ├── board.go │ └── compile.go └── dir.go └── version └── version.go /command/ota/testdata/empty.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /internal/lzss/testdata/empty.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /internal/lzss/testdata/empty.lzss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /command/ota/testdata/cloud.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/command/ota/testdata/cloud.bin -------------------------------------------------------------------------------- /internal/ota/testdata/blink.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/ota/testdata/blink.bin -------------------------------------------------------------------------------- /internal/ota/testdata/blink.ota: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/ota/testdata/blink.ota -------------------------------------------------------------------------------- /internal/ota/testdata/cloud.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/ota/testdata/cloud.bin -------------------------------------------------------------------------------- /internal/ota/testdata/cloud.ota: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/ota/testdata/cloud.ota -------------------------------------------------------------------------------- /internal/ota/testdata/esp32.ota: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/ota/testdata/esp32.ota -------------------------------------------------------------------------------- /internal/lzss/testdata/blink.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/lzss/testdata/blink.bin -------------------------------------------------------------------------------- /internal/lzss/testdata/blink.lzss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/lzss/testdata/blink.lzss -------------------------------------------------------------------------------- /internal/lzss/testdata/cloud.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/lzss/testdata/cloud.bin -------------------------------------------------------------------------------- /internal/lzss/testdata/cloud.lzss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/lzss/testdata/cloud.lzss -------------------------------------------------------------------------------- /internal/binary/gpgkey/index_public.gpg.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/internal/binary/gpgkey/index_public.gpg.key -------------------------------------------------------------------------------- /command/template/.testdata/template_ok-rp-with-binaries.tino: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/arduino-cloud-cli/main/command/template/.testdata/template_ok-rp-with-binaries.tino -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compilation artifacts 2 | arduino-cloud-cli 3 | arduino-cloud-cli.exe 4 | 5 | # Configuration file 6 | arduino-cloud-credentials.* 7 | 8 | # Provisioning binaries and metadata 9 | firmware/binaries 10 | firmware/provision/**/build 11 | -------------------------------------------------------------------------------- /internal/template/testdata/dashboard-no-options.yaml: -------------------------------------------------------------------------------- 1 | name: dashboard-no-options 2 | widgets: 3 | - height: 1 4 | height_mobile: 2 5 | name: Switch-name 6 | type: Switch 7 | width: 3 8 | width_mobile: 4 9 | x: 5 10 | x_mobile: 6 11 | "y": 7 12 | y_mobile: 8 13 | -------------------------------------------------------------------------------- /command/tag/resource.go: -------------------------------------------------------------------------------- 1 | package tag 2 | 3 | // ResourceType specifies which resource the 4 | // tag command refers to. 5 | // Valid resources are the entities of the 6 | // cloud that have a 'tags' field. 7 | type ResourceType int 8 | 9 | const ( 10 | None ResourceType = iota 11 | Device 12 | Thing 13 | ) 14 | -------------------------------------------------------------------------------- /internal/template/testdata/dashboard-detailed.yaml: -------------------------------------------------------------------------------- 1 | name: dashboard 2 | widgets: 3 | - height: 1 4 | height_mobile: 2 5 | name: Switch-name 6 | options: 7 | showLabels: true 8 | type: Switch 9 | width: 3 10 | width_mobile: 4 11 | x: 5 12 | x_mobile: 6 13 | "y": 7 14 | y_mobile: 8 15 | -------------------------------------------------------------------------------- /command/template/apply_test.go: -------------------------------------------------------------------------------- 1 | package template 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestTemplateLIsting(t *testing.T) { 10 | tmpDir := t.TempDir() 11 | path := ".testdata/template_ok-rp-with-binaries.tino" 12 | file, err := extractBinary(&path, tmpDir) 13 | assert.Nil(t, err) 14 | assert.NotNil(t, file) 15 | } 16 | -------------------------------------------------------------------------------- /firmware/provision/LoraProvision/LoraProvision.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | LoRaModem modem; 4 | 5 | void setup() { 6 | Serial.begin(9600); 7 | while (!Serial); 8 | if (!modem.begin(EU868)) { 9 | Serial.println("Failed to start module"); 10 | while (1) {} 11 | }; 12 | } 13 | 14 | void loop() { 15 | Serial.println(modem.deviceEUI()); 16 | delay(3000); 17 | } 18 | -------------------------------------------------------------------------------- /designs/_pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Pull Request Template 2 | 3 | ## Title 4 | 5 | ``` 6 | [Design] title of the design document 7 | ``` 8 | 9 | ## Description 10 | 11 | ``` 12 | ### Reviewer workflow 13 | 14 | - [ ] First draft (problem statement, pick a candidate solution). 15 | - [ ] Edited and discussed. 16 | - [ ] Reviewed by peers. 17 | - [ ] Reviewed by stakeholders. 18 | ``` 19 | -------------------------------------------------------------------------------- /internal/template/testdata/dashboard-wrong-options.yaml: -------------------------------------------------------------------------------- 1 | name: dashboard 2 | widgets: 3 | - height: 1 4 | height_mobile: 2 5 | name: Switch-name 6 | options: 7 | showLabels: true 8 | name: name-wrong 9 | icon: wrong 10 | section: section-wrong 11 | type: Switch 12 | width: 3 13 | width_mobile: 4 14 | x: 5 15 | x_mobile: 6 16 | "y": 7 17 | y_mobile: 8 18 | -------------------------------------------------------------------------------- /internal/template/testdata/dashboard-with-variable.yaml: -------------------------------------------------------------------------------- 1 | name: dashboard-with-variable 2 | widgets: 3 | - height: 1 4 | height_mobile: 2 5 | name: Switch-name 6 | options: 7 | showLabels: true 8 | variables: 9 | - thing_id: thing 10 | variable_id: switchy 11 | type: Switch 12 | width: 3 13 | width_mobile: 4 14 | x: 5 15 | x_mobile: 6 16 | "y": 7 17 | y_mobile: 8 18 | -------------------------------------------------------------------------------- /internal/template/testdata/home-security-dashboard.yaml: -------------------------------------------------------------------------------- 1 | id: home-security-alarm-dashboard 2 | name: Home Security Alarm 3 | widgets: 4 | - type: Messenger 5 | name: message_update 6 | variables: 7 | - thing_id: home-security-alarm 8 | variable_id: message_update 9 | - type: Switch 10 | name: light_alarm 11 | variables: 12 | - thing_id: home-security-alarm 13 | variable_id: light_alarm 14 | options: 15 | showLabels: true -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Motivation 2 | 3 | 4 | ### Change description 5 | 6 | 7 | ### Additional Notes 8 | 9 | 10 | ### Reviewer checklist 11 | 12 | * [ ] PR address a single concern. 13 | * [ ] PR title and description are properly filled. 14 | * [ ] Changes will be merged in `main`. 15 | * [ ] Changes are covered by tests. 16 | * [ ] Logging is meaningful in case of troubleshooting. 17 | * [ ] History is clean, commit messages are meaningful (see `CONTRIBUTING.md`) and are well formatted. 18 | -------------------------------------------------------------------------------- /internal/template/testdata/dashboard-two-widgets.yaml: -------------------------------------------------------------------------------- 1 | id: dashboard-two-widgets 2 | name: dashboard-two-widgets 3 | widgets: 4 | - type: Slider 5 | name: blink_speed 6 | width: 8 7 | height: 7 8 | x: 7 9 | y: 5 10 | variables: 11 | - thing_id: remote-controlled-lights 12 | variable_id: blink_speed 13 | options: 14 | min: 0 15 | max: 5000 16 | - type: Switch 17 | name: relay_2 18 | width: 5 19 | height: 5 20 | x: 5 21 | y: 0 22 | variables: 23 | - thing_id: remote-controlled-lights 24 | variable_id: relay_2 25 | options: 26 | showLabels: true -------------------------------------------------------------------------------- /gon.config.hcl: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/gon.config.hcl 2 | # See: https://github.com/Bearer/gon#configuration-file 3 | source = ["dist/arduino-cloud-cli_osx_darwin_amd64/arduino-cloud-cli", "dist/arduino-cloud-cli_osx_darwin_arm64/arduino-cloud-cli"] 4 | bundle_id = "cc.arduino.arduino-cloud-cli" 5 | 6 | sign { 7 | application_identity = "Developer ID Application: ARDUINO SA (7KT7ZWMCJT)" 8 | } 9 | 10 | # Ask Gon for zip output to force notarization process to take place. 11 | # The CI will ignore the zip output, using the signed binary only. 12 | zip { 13 | output_path = "unused.zip" 14 | } -------------------------------------------------------------------------------- /internal/ota-api/dto_test.go: -------------------------------------------------------------------------------- 1 | package otaapi 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestProgressBar_notCompletePct(t *testing.T) { 10 | firmwareSize := int64(25665 * 2) 11 | bar := formatStateData("fetch", "25665", firmwareSize, false) 12 | assert.Equal(t, "[========== ] 50% (firmware size: 51330 bytes)", bar) 13 | } 14 | 15 | func TestProgressBar_ifFlashState_goTo100Pct(t *testing.T) { 16 | firmwareSize := int64(25665 * 2) 17 | bar := formatStateData("fetch", "25665", firmwareSize, true) // If in flash status, go to 100% 18 | assert.Equal(t, "[====================] 100% (firmware size: 51330 bytes)", bar) 19 | } 20 | -------------------------------------------------------------------------------- /internal/template/testdata/home-security-dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "home-security-alarm-dashboard", 3 | "name": "Home Security Alarm", 4 | "widgets": [ 5 | { 6 | "type": "Messenger", 7 | "name": "message_update", 8 | "variables": [ 9 | { 10 | "thing_id": "home-security-alarm", 11 | "variable_id": "message_update" 12 | } 13 | ] 14 | }, 15 | { 16 | "type": "Switch", 17 | "name": "light_alarm", 18 | "variables": [ 19 | { 20 | "thing_id": "home-security-alarm", 21 | "variable_id": "light_alarm" 22 | } 23 | ], 24 | "options": { 25 | "showLabels": true 26 | } 27 | } 28 | ] 29 | } -------------------------------------------------------------------------------- /internal/iot-api-raw/dto.go: -------------------------------------------------------------------------------- 1 | package iotapiraw 2 | 3 | type BoardType struct { 4 | FQBN *string `json:"fqbn,omitempty"` 5 | Label string `json:"label"` 6 | MinProvSketchVersion *string `json:"min_provisioning_sketch_version,omitempty"` 7 | MinWiFiVersion *string `json:"min_provisioning_wifi_version,omitempty"` 8 | Provisioning *string `json:"provisioning,omitempty"` 9 | Tags []string `json:"tags"` 10 | Type string `json:"type"` 11 | Vendor string `json:"vendor"` 12 | OTAAvailable *bool `json:"ota_available,omitempty"` 13 | } 14 | 15 | type BoardTypeList []BoardType 16 | 17 | type Prov2SketchBinRes struct { 18 | Binary string `json:"bin"` 19 | FileName string `json:"filename"` 20 | FQBN string `json:"fqbn"` 21 | Name string `json:"name"` 22 | SHA256 string `json:"sha256"` 23 | } 24 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package main 19 | 20 | import "github.com/arduino/arduino-cloud-cli/cli" 21 | 22 | func main() { 23 | cli.Execute() 24 | } 25 | -------------------------------------------------------------------------------- /internal/lzss/lzss_test.go: -------------------------------------------------------------------------------- 1 | package lzss 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | "testing" 7 | ) 8 | 9 | func TestEncode(t *testing.T) { 10 | tests := []struct { 11 | name string 12 | infile string 13 | outfile string 14 | }{ 15 | { 16 | name: "blink", 17 | infile: "testdata/blink.bin", 18 | outfile: "testdata/blink.lzss", 19 | }, 20 | { 21 | name: "cloud sketch", 22 | infile: "testdata/cloud.bin", 23 | outfile: "testdata/cloud.lzss", 24 | }, 25 | } 26 | 27 | for _, tt := range tests { 28 | t.Run(tt.name, func(t *testing.T) { 29 | input, err := ioutil.ReadFile(tt.infile) 30 | if err != nil { 31 | t.Fatal("couldn't open test file") 32 | } 33 | 34 | want, err := ioutil.ReadFile(tt.outfile) 35 | if err != nil { 36 | t.Fatal("couldn't open test file") 37 | } 38 | 39 | got := Encode(input) 40 | if !bytes.Equal(want, got) { 41 | t.Error("encoding failed") 42 | } 43 | }) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.licenses/go/github.com/arduino/iot-client-go/v3.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/arduino/iot-client-go/v3 3 | version: v3.1.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/arduino/iot-client-go/v3 7 | license: apache-2.0 8 | licenses: 9 | - sources: LICENSE 10 | text: |2 11 | Copyright 2019-20 Arduino SA 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | notices: [] 25 | -------------------------------------------------------------------------------- /internal/binary/gpgkey/key.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package gpgkey 19 | 20 | import ( 21 | _ "embed" 22 | ) 23 | 24 | var ( 25 | //go:embed index_public.gpg.key 26 | IndexPublicKey []byte 27 | ) 28 | -------------------------------------------------------------------------------- /internal/lzss/decoder_test.go: -------------------------------------------------------------------------------- 1 | package lzss 2 | 3 | import ( 4 | "bytes" 5 | "os" 6 | "testing" 7 | ) 8 | 9 | func TestDecode(t *testing.T) { 10 | tests := []struct { 11 | name string 12 | infile string 13 | outfile string 14 | }{ 15 | { 16 | name: "blink", 17 | infile: "testdata/blink.lzss", 18 | outfile: "testdata/blink.bin", 19 | }, 20 | { 21 | name: "cloud sketch", 22 | infile: "testdata/cloud.lzss", 23 | outfile: "testdata/cloud.bin", 24 | }, 25 | { 26 | name: "empty binary", 27 | infile: "testdata/empty.lzss", 28 | outfile: "testdata/empty.bin", 29 | }, 30 | } 31 | 32 | for _, tt := range tests { 33 | t.Run(tt.name, func(t *testing.T) { 34 | input, err := os.ReadFile(tt.infile) 35 | if err != nil { 36 | t.Fatal("couldn't open test file") 37 | } 38 | 39 | want, err := os.ReadFile(tt.outfile) 40 | if err != nil { 41 | t.Fatal("couldn't open test file") 42 | } 43 | 44 | got := Decompress(input) 45 | if !bytes.Equal(want, got) { 46 | t.Error("decoding failed", want, got) 47 | } 48 | }) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /internal/lzss/decoder.go: -------------------------------------------------------------------------------- 1 | // This code is a go port of LZSS encoder-decoder (Haruhiko Okumura; public domain) 2 | 3 | package lzss 4 | 5 | import ( 6 | "bytes" 7 | 8 | "github.com/icza/bitio" 9 | ) 10 | 11 | func Decompress(data []byte) []byte { 12 | input := bitio.NewReader(bytes.NewBuffer(data)) 13 | output := make([]byte, 0) 14 | 15 | buffer := make([]byte, bufsz*2) 16 | for i := 0; i < bufsz-looksz; i++ { 17 | buffer[i] = ' ' 18 | } 19 | 20 | r := bufsz - looksz 21 | var char byte 22 | var isChar bool 23 | var err error 24 | for { 25 | isChar, err = input.ReadBool() 26 | if err != nil { 27 | break 28 | } 29 | 30 | if isChar { 31 | char, err = input.ReadByte() 32 | if err != nil { 33 | break 34 | } 35 | output = append(output, char) 36 | buffer[r] = char 37 | r++ 38 | r &= bufsz - 1 39 | } else { 40 | var i, j uint64 41 | i, err = input.ReadBits(idxsz) 42 | if err != nil { 43 | break 44 | } 45 | j, err = input.ReadBits(lensz) 46 | if err != nil { 47 | break 48 | } 49 | 50 | for k := 0; k <= int(j)+1; k++ { 51 | char = buffer[(int(i)+k)&(bufsz-1)] 52 | output = append(output, char) 53 | buffer[r] = char 54 | r++ 55 | r &= bufsz - 1 56 | } 57 | } 58 | } 59 | 60 | return output 61 | } 62 | -------------------------------------------------------------------------------- /cli/credentials/credentials.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package credentials 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | ) 23 | 24 | func NewCommand() *cobra.Command { 25 | credentialsCommand := &cobra.Command{ 26 | Use: "credentials", 27 | Short: "Credentials commands.", 28 | Long: "Credentials commands.", 29 | } 30 | 31 | credentialsCommand.AddCommand(initInitCommand()) 32 | credentialsCommand.AddCommand(initFindCommand()) 33 | 34 | return credentialsCommand 35 | } 36 | -------------------------------------------------------------------------------- /internal/iot/client_test.go: -------------------------------------------------------------------------------- 1 | package iot 2 | 3 | import ( 4 | "testing" 5 | 6 | iotclient "github.com/arduino/iot-client-go/v3" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestJSON_UnknownFields_areAccepted(t *testing.T) { 11 | 12 | cert := iotclient.ArduinoDevicev2Cert{} 13 | 14 | // Add unknown fields to the JSON and verify that marshalling and unmarshalling works without raising error. 15 | // This is useful when the API is extended with new fields and the client is not updated yet. 16 | certJson := `{ 17 | "compressed": { 18 | "not_after": "0001-01-01T00:00:00Z", 19 | "not_before": "0001-01-01T00:00:00Z", 20 | "serial": "", 21 | "signature": "signature", 22 | "signature_asn1_x": "", 23 | "signature_asn1_y": "" 24 | }, 25 | "der": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA", 26 | "device_id": "123", 27 | "enabled": true, 28 | "href": "", 29 | "id": "", 30 | "pem": "-----BEGIN CERTIFICATE-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA", 31 | "unknown_field": "value", 32 | "unknown_field2": "value2", 33 | "new_api_field": 2222 34 | }` 35 | 36 | err := cert.UnmarshalJSON([]byte(certJson)) 37 | if err != nil { 38 | t.Errorf("UnmarshalJSON failed: %s", err) 39 | } 40 | assert.Equal(t, 3, len(cert.AdditionalProperties)) 41 | } 42 | -------------------------------------------------------------------------------- /arduino/commander.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package arduino 19 | 20 | import ( 21 | "context" 22 | 23 | rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" 24 | ) 25 | 26 | // Commander of arduino package allows to call 27 | // the arduino-cli commands in a programmatic way. 28 | type Commander interface { 29 | BoardList(ctx context.Context) ([]*rpc.DetectedPort, error) 30 | UploadBin(ctx context.Context, fqbn, bin, address, protocol string) error 31 | //Compile() error 32 | } 33 | -------------------------------------------------------------------------------- /command/tag/tag.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package tag 19 | 20 | import "fmt" 21 | 22 | // TagsInfo transforms tags into user-readable strings. 23 | // An error is returned if a tag value is not a string. 24 | func TagsInfo(tags map[string]interface{}) ([]string, error) { 25 | var str []string 26 | for key, value := range tags { 27 | valStr, ok := value.(string) 28 | if !ok { 29 | return nil, fmt.Errorf("value of tag `%s` should be of type `string` but is of type `%T`", key, value) 30 | } 31 | str = append(str, key+"="+valStr) 32 | } 33 | return str, nil 34 | } 35 | -------------------------------------------------------------------------------- /cli/dashboard/dashboard.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package dashboard 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | ) 23 | 24 | func NewCommand() *cobra.Command { 25 | dashboardCommand := &cobra.Command{ 26 | Use: "dashboard", 27 | Short: "Dashboard commands.", 28 | Long: "Dashboard commands.", 29 | } 30 | 31 | dashboardCommand.AddCommand(initCreateCommand()) 32 | dashboardCommand.AddCommand(initListCommand()) 33 | dashboardCommand.AddCommand(initDeleteCommand()) 34 | dashboardCommand.AddCommand(initExtractCommand()) 35 | 36 | return dashboardCommand 37 | } 38 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mailru/easyjson.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mailru/easyjson 3 | version: v0.7.7 4 | type: go 5 | summary: Package easyjson contains marshaler/unmarshaler interfaces and helper functions. 6 | homepage: https://pkg.go.dev/github.com/mailru/easyjson 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright (c) 2016 Mail.Ru Group 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | notices: [] 19 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mailru/easyjson/jwriter.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mailru/easyjson/jwriter 3 | version: v0.7.7 4 | type: go 5 | summary: Package jwriter contains a JSON writer. 6 | homepage: https://pkg.go.dev/github.com/mailru/easyjson/jwriter 7 | license: mit 8 | licenses: 9 | - sources: easyjson@v0.7.7/LICENSE 10 | text: | 11 | Copyright (c) 2016 Mail.Ru Group 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | notices: [] 19 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mailru/easyjson/jlexer.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mailru/easyjson/jlexer 3 | version: v0.7.7 4 | type: go 5 | summary: Package jlexer contains a JSON lexer implementation. 6 | homepage: https://pkg.go.dev/github.com/mailru/easyjson/jlexer 7 | license: mit 8 | licenses: 9 | - sources: easyjson@v0.7.7/LICENSE 10 | text: | 11 | Copyright (c) 2016 Mail.Ru Group 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | notices: [] 19 | -------------------------------------------------------------------------------- /cli/ota/ota.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | ) 23 | 24 | func NewCommand() *cobra.Command { 25 | otaCommand := &cobra.Command{ 26 | Use: "ota", 27 | Short: "Over The Air.", 28 | Long: "Over The Air firmware update.", 29 | } 30 | 31 | otaCommand.AddCommand(initUploadCommand()) 32 | otaCommand.AddCommand(initMassUploadCommand()) 33 | otaCommand.AddCommand(initOtaStatusCommand()) 34 | otaCommand.AddCommand(initEncodeBinaryCommand()) 35 | otaCommand.AddCommand(initDecodeHeaderCommand()) 36 | otaCommand.AddCommand(initOtaCancelCommand()) 37 | 38 | return otaCommand 39 | } 40 | -------------------------------------------------------------------------------- /cli/template/template.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package template 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | ) 23 | 24 | func NewCommand() *cobra.Command { 25 | templateCommand := &cobra.Command{ 26 | Use: "template", 27 | Short: "Custom templates.", 28 | Long: "Commands to manage custom templates lifecycle, like import, export and apply.", 29 | } 30 | 31 | templateCommand.AddCommand(initTemplateImportCommand()) 32 | templateCommand.AddCommand(initTemplateExportCommand()) 33 | templateCommand.AddCommand(initTemplateListCommand()) 34 | templateCommand.AddCommand(initTemplateApplyCommand()) 35 | 36 | return templateCommand 37 | } 38 | -------------------------------------------------------------------------------- /command/template/list.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package template 19 | 20 | import ( 21 | "github.com/arduino/arduino-cli/cli/feedback" 22 | "github.com/arduino/arduino-cloud-cli/config" 23 | storageapi "github.com/arduino/arduino-cloud-cli/internal/storage-api" 24 | ) 25 | 26 | func ListCustomTemplates(cred *config.Credentials) error { 27 | 28 | apiclient := storageapi.NewClient(cred) 29 | 30 | templates, err := apiclient.ListCustomTemplates() 31 | if err != nil { 32 | return err 33 | } 34 | 35 | if templates == nil { 36 | feedback.Print("No templates found") 37 | } else { 38 | feedback.PrintResult(templates) 39 | } 40 | 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/viper.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/viper 3 | version: v1.10.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/spf13/viper 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mattn/go-isatty.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mattn/go-isatty 3 | version: v0.0.14 4 | type: go 5 | summary: Package isatty implements interface to isatty 6 | homepage: https://pkg.go.dev/github.com/mattn/go-isatty 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright (c) Yasuhiro MATSUMOTO 12 | 13 | MIT License (Expat) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | - sources: README.md 21 | text: MIT 22 | notices: [] 23 | -------------------------------------------------------------------------------- /internal/template/filter.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package template 19 | 20 | var ( 21 | widgetOptWhitelist = map[string]struct{}{ 22 | "showThing": {}, 23 | "frameless": {}, 24 | "interpolation": {}, 25 | "max": {}, 26 | "min": {}, 27 | "mode": {}, 28 | "percentage": {}, 29 | "showLabels": {}, 30 | "step": {}, 31 | "vertical": {}, 32 | "dateFormat": {}, 33 | "timeFormat": {}, 34 | "display": {}, 35 | } 36 | ) 37 | 38 | func filterWidgetOptions(opts map[string]interface{}) { 39 | for opt := range opts { 40 | if _, ok := widgetOptWhitelist[opt]; !ok { 41 | delete(opts, opt) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mitchellh/go-homedir.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mitchellh/go-homedir 3 | version: v1.1.0 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/mitchellh/go-homedir 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2013 Mitchell Hashimoto 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /internal/board-protocols/transport/transport_interface.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2025 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package transport 19 | 20 | import ( 21 | "github.com/arduino/arduino-cloud-cli/internal/board-protocols/frame" 22 | ) 23 | 24 | type TransportInterfaceParams struct { 25 | Port string 26 | BoundRate int 27 | } 28 | 29 | // MsgType indicates the type of the packet. 30 | type InterfaceType byte 31 | 32 | const ( 33 | Serial InterfaceType = iota 34 | BLE 35 | ) 36 | 37 | type TransportInterface interface { 38 | Connect(params TransportInterfaceParams) error 39 | Send(data []byte) error 40 | Receive(timeoutSeconds int) ([]frame.Frame, error) 41 | Connected() bool 42 | Type() InterfaceType 43 | Close() error 44 | } 45 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/jwalterweatherman.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/jwalterweatherman 3 | version: v1.1.0 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/spf13/jwalterweatherman 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/josharian/intern.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/josharian/intern 3 | version: v1.0.0 4 | type: go 5 | summary: Package intern interns strings. 6 | homepage: https://pkg.go.dev/github.com/josharian/intern 7 | license: mit 8 | licenses: 9 | - sources: license.md 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2019 Josh Bleecher Snyder 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /command/dashboard/delete.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package dashboard 19 | 20 | import ( 21 | "context" 22 | 23 | "github.com/arduino/arduino-cloud-cli/config" 24 | "github.com/arduino/arduino-cloud-cli/internal/iot" 25 | ) 26 | 27 | // DeleteParams contains the parameters needed to 28 | // delete a dashboard from Arduino IoT Cloud. 29 | type DeleteParams struct { 30 | ID string 31 | } 32 | 33 | // Delete command is used to delete a dashboard 34 | // from Arduino IoT Cloud. 35 | func Delete(ctx context.Context, params *DeleteParams, cred *config.Credentials) error { 36 | iotClient, err := iot.NewClient(cred) 37 | if err != nil { 38 | return err 39 | } 40 | 41 | return iotClient.DashboardDelete(ctx, params.ID) 42 | } 43 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/cast.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/cast 3 | version: v1.4.1 4 | type: go 5 | summary: Package cast provides easy and safe casting in Go. 6 | homepage: https://pkg.go.dev/github.com/spf13/cast 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mailru/easyjson/buffer.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mailru/easyjson/buffer 3 | version: v0.7.7 4 | type: go 5 | summary: Package buffer implements a buffer for serialization, consisting of a chain 6 | of []byte-s to reduce copying and to allow reuse of individual chunks. 7 | homepage: https://pkg.go.dev/github.com/mailru/easyjson/buffer 8 | license: mit 9 | licenses: 10 | - sources: easyjson@v0.7.7/LICENSE 11 | text: | 12 | Copyright (c) 2016 Mail.Ru Group 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | notices: [] 20 | -------------------------------------------------------------------------------- /arduino/grpc/board.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package grpc 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | 24 | rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" 25 | ) 26 | 27 | type boardHandler struct { 28 | *service 29 | } 30 | 31 | // BoardList executes the 'arduino-cli board list' command 32 | // and returns its result. 33 | func (b boardHandler) BoardList(ctx context.Context) ([]*rpc.DetectedPort, error) { 34 | boardListResp, err := b.serviceClient.BoardList(context.Background(), 35 | &rpc.BoardListRequest{Instance: b.instance}) 36 | 37 | if err != nil { 38 | err = fmt.Errorf("%s: %w", "Board list error", err) 39 | return nil, err 40 | } 41 | 42 | return boardListResp.GetPorts(), nil 43 | } 44 | -------------------------------------------------------------------------------- /command/template/import.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package template 19 | 20 | import ( 21 | "github.com/arduino/arduino-cli/cli/feedback" 22 | "github.com/arduino/arduino-cloud-cli/config" 23 | storageapi "github.com/arduino/arduino-cloud-cli/internal/storage-api" 24 | ) 25 | 26 | func ImportCustomTemplate(cred *config.Credentials, filePath string) error { 27 | 28 | apiclient := storageapi.NewClient(cred) 29 | 30 | feedback.Printf("Importing template %s", filePath) 31 | 32 | templateImported, err := apiclient.ImportCustomTemplate(filePath) 33 | if err != nil { 34 | return err 35 | } 36 | 37 | feedback.Printf("Template '%s' (%s) imported successfully", templateImported.Name, templateImported.TemplateId) 38 | 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mattn/go-colorable.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mattn/go-colorable 3 | version: v0.1.12 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/mattn/go-colorable 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2016 Yasuhiro Matsumoto 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | - sources: README.md 33 | text: MIT 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/viper/internal/encoding.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/viper/internal/encoding 3 | version: v1.10.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/spf13/viper/internal/encoding 7 | license: mit 8 | licenses: 9 | - sources: viper@v1.10.1/LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/viper/internal/encoding/hcl.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/viper/internal/encoding/hcl 3 | version: v1.10.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/spf13/viper/internal/encoding/hcl 7 | license: mit 8 | licenses: 9 | - sources: viper@v1.10.1/LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /cli/version/version.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package version 19 | 20 | import ( 21 | "os" 22 | 23 | "github.com/arduino/arduino-cli/cli/feedback" 24 | v "github.com/arduino/arduino-cloud-cli/version" 25 | "github.com/spf13/cobra" 26 | ) 27 | 28 | // NewCommand creates a new `version` command. 29 | func NewCommand() *cobra.Command { 30 | return &cobra.Command{ 31 | Use: "version", 32 | Short: "Shows version number of Arduino Cloud CLI.", 33 | Long: "Shows the version number of Arduino Cloud CLI which is installed on your system.", 34 | Example: " " + os.Args[0] + " version", 35 | Args: cobra.NoArgs, 36 | Run: run, 37 | } 38 | } 39 | 40 | func run(cmd *cobra.Command, args []string) { 41 | feedback.Print(v.VersionInfo) 42 | } 43 | -------------------------------------------------------------------------------- /.licenses/go/github.com/h2non/filetype.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/h2non/filetype 3 | version: v1.1.3 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/h2non/filetype 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) Tomas Aparicio 14 | 15 | Permission is hereby granted, free of charge, to any person 16 | obtaining a copy of this software and associated documentation 17 | files (the "Software"), to deal in the Software without 18 | restriction, including without limitation the rights to use, 19 | copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the 21 | Software is furnished to do so, subject to the following 22 | conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 29 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 31 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 32 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 34 | OTHER DEALINGS IN THE SOFTWARE. 35 | - sources: README.md 36 | text: MIT - Tomas Aparicio 37 | notices: [] 38 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/viper/internal/encoding/json.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/viper/internal/encoding/json 3 | version: v1.10.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/spf13/viper/internal/encoding/json 7 | license: mit 8 | licenses: 9 | - sources: viper@v1.10.1/LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/viper/internal/encoding/toml.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/viper/internal/encoding/toml 3 | version: v1.10.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/spf13/viper/internal/encoding/toml 7 | license: mit 8 | licenses: 9 | - sources: viper@v1.10.1/LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/viper/internal/encoding/yaml.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/viper/internal/encoding/yaml 3 | version: v1.10.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/spf13/viper/internal/encoding/yaml 7 | license: mit 8 | licenses: 9 | - sources: viper@v1.10.1/LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Steve Francia 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/chzyer/readline.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/chzyer/readline 3 | version: v0.0.0-20180603132655-2972be24d48e 4 | type: go 5 | summary: Readline is a pure go implementation for GNU-Readline kind library. 6 | homepage: https://pkg.go.dev/github.com/chzyer/readline 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |+ 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2015 Chzyer 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/go/github.com/subosito/gotenv.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/subosito/gotenv 3 | version: v1.2.0 4 | type: go 5 | summary: Package gotenv provides functionality to dynamically load the environment 6 | variables 7 | homepage: https://pkg.go.dev/github.com/subosito/gotenv 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2013 Alif Rachmawadi 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in 24 | all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | THE SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/go/github.com/creack/goselect.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/creack/goselect 3 | version: v0.1.2 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/creack/goselect 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |+ 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Guillaume J. Charmes 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | - sources: README.md 34 | text: Released under the [MIT license](LICENSE). 35 | notices: [] 36 | -------------------------------------------------------------------------------- /.licenses/go/github.com/codeclysm/extract/v4.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/codeclysm/extract/v4 3 | version: v4.0.0 4 | type: go 5 | summary: Package extract allows to extract archives in zip, tar.gz or tar.bz2 formats 6 | easily. 7 | homepage: https://pkg.go.dev/github.com/codeclysm/extract/v4 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2016 codeclysm 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mattn/go-runewidth.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mattn/go-runewidth 3 | version: v0.0.13 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/mattn/go-runewidth 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2016 Yasuhiro Matsumoto 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | - sources: README.md 33 | text: 'under the MIT License: http://mattn.mit-license.org/2013' 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/go/github.com/sirupsen/logrus.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/sirupsen/logrus 3 | version: v1.9.0 4 | type: go 5 | summary: Package logrus is a structured logger for Go, completely API compatible with 6 | the standard library logger. 7 | homepage: https://pkg.go.dev/github.com/sirupsen/logrus 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2014 Simon Eskildsen 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in 24 | all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | THE SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /cli/thing/thing.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package thing 19 | 20 | import ( 21 | "github.com/arduino/arduino-cloud-cli/cli/thing/tag" 22 | "github.com/spf13/cobra" 23 | ) 24 | 25 | func NewCommand() *cobra.Command { 26 | thingCommand := &cobra.Command{ 27 | Use: "thing", 28 | Short: "Thing commands.", 29 | Long: "Thing commands.", 30 | } 31 | 32 | thingCommand.AddCommand(initCreateCommand()) 33 | thingCommand.AddCommand(initCloneCommand()) 34 | thingCommand.AddCommand(initListCommand()) 35 | thingCommand.AddCommand(initDeleteCommand()) 36 | thingCommand.AddCommand(initExtractCommand()) 37 | thingCommand.AddCommand(initBindCommand()) 38 | thingCommand.AddCommand(tag.InitCreateTagsCommand()) 39 | thingCommand.AddCommand(tag.InitDeleteTagsCommand()) 40 | 41 | return thingCommand 42 | } 43 | -------------------------------------------------------------------------------- /internal/binary/index_test.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package binary 19 | 20 | import ( 21 | "testing" 22 | ) 23 | 24 | func TestFindProvisionBin(t *testing.T) { 25 | var ( 26 | fqbnOK1 = "arduino:samd:nano_33_iot" 27 | fqbnOK2 = "arduino:samd:mkrwifi1010" 28 | fqbnNotFound = "arduino:mbed_nano:nano33ble" 29 | ) 30 | index := &Index{ 31 | Boards: []IndexBoard{ 32 | {FQBN: fqbnOK1, Provision: &IndexBin{URL: "mkr"}}, 33 | {FQBN: fqbnOK2, Provision: &IndexBin{URL: "nano"}}, 34 | }, 35 | } 36 | 37 | bin := index.FindProvisionBin(fqbnOK2) 38 | if bin == nil { 39 | t.Fatal("provision binary not found") 40 | } 41 | 42 | bin = index.FindProvisionBin(fqbnNotFound) 43 | if bin != nil { 44 | t.Fatalf("provision binary should've not be found, but got: %v", bin) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.licenses/go/github.com/rivo/uniseg.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/rivo/uniseg 3 | version: v0.2.0 4 | type: go 5 | summary: 'Package uniseg implements Unicode Text Segmentation according to Unicode 6 | Standard Annex #29 (http://unicode.org/reports/tr29/).' 7 | homepage: https://pkg.go.dev/github.com/rivo/uniseg 8 | license: mit 9 | licenses: 10 | - sources: LICENSE.txt 11 | text: | 12 | MIT License 13 | 14 | Copyright (c) 2019 Oliver Kuederle 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/go/github.com/h2non/filetype/types.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/h2non/filetype/types 3 | version: v1.1.3 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/h2non/filetype/types 7 | license: mit 8 | licenses: 9 | - sources: filetype@v1.1.3/LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) Tomas Aparicio 14 | 15 | Permission is hereby granted, free of charge, to any person 16 | obtaining a copy of this software and associated documentation 17 | files (the "Software"), to deal in the Software without 18 | restriction, including without limitation the rights to use, 19 | copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the 21 | Software is furnished to do so, subject to the following 22 | conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 29 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 31 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 32 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 34 | OTHER DEALINGS IN THE SOFTWARE. 35 | - sources: filetype@v1.1.3/README.md 36 | text: MIT - Tomas Aparicio 37 | notices: [] 38 | -------------------------------------------------------------------------------- /.licenses/go/github.com/h2non/filetype/matchers.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/h2non/filetype/matchers 3 | version: v1.1.3 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/h2non/filetype/matchers 7 | license: mit 8 | licenses: 9 | - sources: filetype@v1.1.3/LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) Tomas Aparicio 14 | 15 | Permission is hereby granted, free of charge, to any person 16 | obtaining a copy of this software and associated documentation 17 | files (the "Software"), to deal in the Software without 18 | restriction, including without limitation the rights to use, 19 | copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the 21 | Software is furnished to do so, subject to the following 22 | conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 29 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 31 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 32 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 34 | OTHER DEALINGS IN THE SOFTWARE. 35 | - sources: filetype@v1.1.3/README.md 36 | text: MIT - Tomas Aparicio 37 | notices: [] 38 | -------------------------------------------------------------------------------- /command/template/export.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package template 19 | 20 | import ( 21 | "fmt" 22 | 23 | "github.com/arduino/arduino-cli/cli/feedback" 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | storageapi "github.com/arduino/arduino-cloud-cli/internal/storage-api" 26 | ) 27 | 28 | func ExportCustomTemplate(cred *config.Credentials, templateId, path string) error { 29 | 30 | apiclient := storageapi.NewClient(cred) 31 | 32 | feedback.Printf("Exporting template %s", templateId) 33 | 34 | filecreaed, err := apiclient.ExportCustomTemplate(templateId, path) 35 | if err != nil { 36 | return err 37 | } 38 | 39 | outf := "" 40 | if filecreaed != nil { 41 | outf = *filecreaed 42 | } 43 | feedback.Printf(fmt.Sprintf("Template %s exported to file: %s", templateId, outf)) 44 | 45 | return nil 46 | } 47 | -------------------------------------------------------------------------------- /.licenses/go/github.com/leonelquinteros/gotext.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/leonelquinteros/gotext 3 | version: v1.4.0 4 | type: go 5 | summary: Package gotext implements GNU gettext utilities. 6 | homepage: https://pkg.go.dev/github.com/leonelquinteros/gotext 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2016 Leonel Quinteros 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | - sources: README.md 33 | text: "[MIT license](LICENSE)" 34 | notices: [] 35 | -------------------------------------------------------------------------------- /command/dashboard/list.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package dashboard 19 | 20 | import ( 21 | "context" 22 | 23 | "github.com/arduino/arduino-cloud-cli/config" 24 | 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | ) 27 | 28 | // List command is used to list 29 | // the dashboards of Arduino IoT Cloud. 30 | func List(ctx context.Context, cred *config.Credentials) ([]DashboardInfo, error) { 31 | iotClient, err := iot.NewClient(cred) 32 | if err != nil { 33 | return nil, err 34 | } 35 | 36 | foundDashboards, err := iotClient.DashboardList(ctx) 37 | if err != nil { 38 | return nil, err 39 | } 40 | 41 | var dashboards []DashboardInfo 42 | for _, found := range foundDashboards { 43 | info := getDashboardInfo(&found) 44 | dashboards = append(dashboards, *info) 45 | } 46 | 47 | return dashboards, nil 48 | } 49 | -------------------------------------------------------------------------------- /internal/iot/error.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package iot 19 | 20 | import ( 21 | "encoding/json" 22 | "fmt" 23 | 24 | iotclient "github.com/arduino/iot-client-go/v3" 25 | ) 26 | 27 | // errorDetail takes a generic iot-client-go error 28 | // and tries to return a more detailed error. 29 | func errorDetail(err error) error { 30 | apiErr, ok := err.(iotclient.GenericOpenAPIError) 31 | if !ok { 32 | return err 33 | } 34 | 35 | modErr, ok := apiErr.Model().(iotclient.ModelError) 36 | if ok { 37 | return fmt.Errorf("%w: %s", err, modErr.GetDetail()) 38 | } 39 | 40 | body := make(map[string]interface{}) 41 | if bodyErr := json.Unmarshal(apiErr.Body(), &body); bodyErr != nil { 42 | return err 43 | } 44 | detail, ok := body["detail"] 45 | if !ok { 46 | return err 47 | } 48 | return fmt.Errorf("%w: %v", err, detail) 49 | } 50 | -------------------------------------------------------------------------------- /.licenses/go/github.com/h2non/filetype/matchers/isobmff.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/h2non/filetype/matchers/isobmff 3 | version: v1.1.3 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/h2non/filetype/matchers/isobmff 7 | license: mit 8 | licenses: 9 | - sources: filetype@v1.1.3/LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) Tomas Aparicio 14 | 15 | Permission is hereby granted, free of charge, to any person 16 | obtaining a copy of this software and associated documentation 17 | files (the "Software"), to deal in the Software without 18 | restriction, including without limitation the rights to use, 19 | copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the 21 | Software is furnished to do so, subject to the following 22 | conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 29 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 31 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 32 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 34 | OTHER DEALINGS IN THE SOFTWARE. 35 | - sources: filetype@v1.1.3/README.md 36 | text: MIT - Tomas Aparicio 37 | notices: [] 38 | -------------------------------------------------------------------------------- /.licenses/go/github.com/x448/float16.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/x448/float16 3 | version: v0.8.4 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/x448/float16 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |+ 11 | MIT License 12 | 13 | Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | - sources: README.md 34 | text: |- 35 | Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker 36 | 37 | Licensed under [MIT License](LICENSE) 38 | notices: [] 39 | -------------------------------------------------------------------------------- /internal/ota/decoder_test.go: -------------------------------------------------------------------------------- 1 | package ota 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/arduino/arduino-cloud-cli/internal/boardpids" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestDecodeHeader(t *testing.T) { 11 | 12 | header, err := DecodeOtaFirmwareHeaderFromFile("testdata/cloud.ota") 13 | assert.Nil(t, err) 14 | assert.Equal(t, boardpids.ArduinoVendorID, header.VID) 15 | assert.Equal(t, "8057", header.PID) 16 | assert.Equal(t, "arduino:samd:nano_33_iot", *header.FQBN) 17 | assert.Equal(t, boardpids.ArduinoFqbnToPID["arduino:samd:nano_33_iot"], header.PID) 18 | 19 | header, err = DecodeOtaFirmwareHeaderFromFile("testdata/blink.ota") 20 | assert.Nil(t, err) 21 | assert.Equal(t, boardpids.ArduinoVendorID, header.VID) 22 | assert.Equal(t, "8057", header.PID) 23 | assert.Equal(t, "arduino:samd:nano_33_iot", *header.FQBN) 24 | assert.Equal(t, boardpids.ArduinoFqbnToPID["arduino:samd:nano_33_iot"], header.PID) 25 | 26 | } 27 | 28 | func TestDecodeWithNoHeader(t *testing.T) { 29 | 30 | header, err := DecodeOtaFirmwareHeaderFromFile("testdata/cloud.bin") 31 | assert.Nil(t, header) 32 | assert.NotNil(t, err) 33 | 34 | header, err = DecodeOtaFirmwareHeaderFromFile("testdata/blink.bin") 35 | assert.Nil(t, header) 36 | assert.NotNil(t, err) 37 | 38 | } 39 | 40 | func TestDecodeEsp32Header(t *testing.T) { 41 | 42 | header, err := DecodeOtaFirmwareHeaderFromFile("testdata/esp32.ota") 43 | assert.Nil(t, err) 44 | assert.Equal(t, boardpids.Esp32MagicNumberPart1, header.VID) 45 | assert.Equal(t, boardpids.Esp32MagicNumberPart2, header.PID) 46 | assert.Nil(t, header.FQBN) 47 | assert.Equal(t, "ESP32", header.BoardType) 48 | 49 | } 50 | -------------------------------------------------------------------------------- /internal/ota/version_test.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | import ( 21 | "bytes" 22 | "fmt" 23 | "os" 24 | "testing" 25 | "text/tabwriter" 26 | 27 | "gotest.tools/assert" 28 | ) 29 | 30 | func TestVersionWithCompressionEnabled(t *testing.T) { 31 | 32 | version := Version{ 33 | Compression: true, 34 | } 35 | 36 | expected := []byte{0, 0, 0, 0, 0, 0, 0, 0x40} 37 | actual := version.Bytes() 38 | 39 | // create a tabwriter for formatting the output 40 | w := new(tabwriter.Writer) 41 | 42 | // Format in tab-separated columns with a tab stop of 8. 43 | w.Init(os.Stdout, 0, 8, 0, '\t', 0) 44 | 45 | fmt.Fprintf(w, "Binary:\t%0.8bb (expected)\n", expected) 46 | fmt.Fprintf(w, "Binary:\t%0.8bb (actual)\n", actual) 47 | w.Flush() 48 | 49 | res := bytes.Compare(expected, actual) 50 | assert.Assert(t, res == 0) // 0 means equal 51 | } 52 | -------------------------------------------------------------------------------- /.licenses/go/github.com/jbenet/go-context/io.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/jbenet/go-context/io 3 | version: v0.0.0-20150711004518-d14ea06fba99 4 | type: go 5 | summary: Package ctxio provides io.Reader and io.Writer wrappers that respect context.Contexts. 6 | homepage: https://pkg.go.dev/github.com/jbenet/go-context/io 7 | license: mit 8 | licenses: 9 | - sources: go-context@v0.0.0-20150711004518-d14ea06fba99/LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Juan Batiz-Benet 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/go/github.com/mitchellh/mapstructure.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/mitchellh/mapstructure 3 | version: v1.4.3 4 | type: go 5 | summary: Package mapstructure exposes functionality to convert one arbitrary Go type 6 | into another, typically to convert a map[string]interface{} into a native Go structure. 7 | homepage: https://pkg.go.dev/github.com/mitchellh/mapstructure 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2013 Mitchell Hashimoto 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in 24 | all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | THE SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /command/dashboard/dashboard.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package dashboard 19 | 20 | import ( 21 | iotclient "github.com/arduino/iot-client-go/v3" 22 | ) 23 | 24 | // DashboardInfo contains the most interesting 25 | // information, in string format, of an Arduino IoT Cloud dashboard. 26 | type DashboardInfo struct { 27 | Name string `json:"name"` 28 | ID string `json:"id"` 29 | UpdatedAt string `json:"updated_at"` 30 | Widgets []string `json:"widgets"` 31 | } 32 | 33 | func getDashboardInfo(dashboard *iotclient.ArduinoDashboardv2) *DashboardInfo { 34 | var widgets []string 35 | for _, w := range dashboard.Widgets { 36 | if w.Name != nil { 37 | widgets = append(widgets, *w.Name) 38 | } 39 | } 40 | info := &DashboardInfo{ 41 | Name: dashboard.Name, 42 | ID: dashboard.Id, 43 | UpdatedAt: dashboard.UpdatedAt.String(), 44 | Widgets: widgets, 45 | } 46 | return info 47 | } 48 | -------------------------------------------------------------------------------- /.licenses/go/github.com/leonelquinteros/gotext/plurals.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/leonelquinteros/gotext/plurals 3 | version: v1.4.0 4 | type: go 5 | summary: Package plurals is the pluralform compiler to get the correct translation 6 | id of the plural string 7 | homepage: https://pkg.go.dev/github.com/leonelquinteros/gotext/plurals 8 | license: mit 9 | licenses: 10 | - sources: gotext@v1.4.0/LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2016 Leonel Quinteros 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | - sources: gotext@v1.4.0/README.md 34 | text: "[MIT license](LICENSE)" 35 | notices: [] 36 | -------------------------------------------------------------------------------- /command/ota/cancel.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | import ( 21 | "fmt" 22 | 23 | "github.com/arduino/arduino-cli/cli/feedback" 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | otaapi "github.com/arduino/arduino-cloud-cli/internal/ota-api" 26 | ) 27 | 28 | func CancelOta(otaid string, cred *config.Credentials) error { 29 | 30 | if feedback.GetFormat() == feedback.JSONMini { 31 | return fmt.Errorf("jsonmini format is not supported for this command") 32 | } 33 | 34 | otapi := otaapi.NewClient(cred) 35 | 36 | if otaid != "" { 37 | _, err := otapi.CancelOta(otaid) 38 | if err != nil { 39 | return err 40 | } 41 | // No error, get current status 42 | res, err := otapi.GetOtaStatusByOtaID(otaid, 1, otaapi.OrderDesc) 43 | if err != nil { 44 | return err 45 | } 46 | if res != nil { 47 | feedback.PrintResult(res.Ota) 48 | } 49 | return nil 50 | } 51 | 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /.licenses/go/github.com/fatih/color.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/fatih/color 3 | version: v1.13.0 4 | type: go 5 | summary: Package color is an ANSI color package to output colorized or SGR defined 6 | output to the standard output. 7 | homepage: https://pkg.go.dev/github.com/fatih/color 8 | license: mit 9 | licenses: 10 | - sources: LICENSE.md 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2013 Fatih Arslan 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy of 17 | this software and associated documentation files (the "Software"), to deal in 18 | the Software without restriction, including without limitation the rights to 19 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 20 | the Software, and to permit persons to whom the Software is furnished to do so, 21 | subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 28 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 29 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 30 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | - sources: README.md 33 | text: The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) 34 | for more details 35 | notices: [] 36 | -------------------------------------------------------------------------------- /command/ota/readheader.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | 24 | "github.com/arduino/arduino-cli/cli/feedback" 25 | "github.com/arduino/arduino-cloud-cli/internal/ota" 26 | ) 27 | 28 | type ReadHeaderParams struct { 29 | File string 30 | } 31 | 32 | // Encode command is used to encode a firmware OTA 33 | func ReadHeader(params *ReadHeaderParams) error { 34 | _, err := os.Stat(params.File) 35 | if err != nil { 36 | return fmt.Errorf("file %s does not exists: %w", params.File, err) 37 | } 38 | 39 | // Verify if file has already an OTA header 40 | header, err := ota.DecodeOtaFirmwareHeaderFromFile(params.File) 41 | if err != nil { 42 | return fmt.Errorf("file %s does not contains a valid OTA header: %v", params.File, err) 43 | } 44 | if header == nil { 45 | return fmt.Errorf("file %s does not contains a valid OTA header", params.File) 46 | } 47 | 48 | feedback.PrintResult(header) 49 | 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /.licenses/go/gopkg.in/warnings.v0.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: gopkg.in/warnings.v0 3 | version: v0.1.2 4 | type: go 5 | summary: Package warnings implements error handling with non-fatal errors (warnings). 6 | homepage: https://pkg.go.dev/gopkg.in/warnings.v0 7 | license: bsd-2-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright (c) 2016 Péter Surányi. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | notices: [] 36 | -------------------------------------------------------------------------------- /cli/device/device.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package device 19 | 20 | import ( 21 | "github.com/arduino/arduino-cloud-cli/cli/device/tag" 22 | "github.com/spf13/cobra" 23 | ) 24 | 25 | func NewCommand() *cobra.Command { 26 | deviceCommand := &cobra.Command{ 27 | Use: "device", 28 | Short: "Device commands.", 29 | Long: "Device commands.", 30 | } 31 | 32 | deviceCommand.AddCommand(initCreateCommand()) 33 | deviceCommand.AddCommand(initConfigureCommand()) 34 | deviceCommand.AddCommand(initListCommand()) 35 | deviceCommand.AddCommand(initShowCommand()) 36 | deviceCommand.AddCommand(initDeleteCommand()) 37 | deviceCommand.AddCommand(tag.InitCreateTagsCommand()) 38 | deviceCommand.AddCommand(tag.InitDeleteTagsCommand()) 39 | deviceCommand.AddCommand(initListFrequencyPlansCommand()) 40 | deviceCommand.AddCommand(initCreateLoraCommand()) 41 | deviceCommand.AddCommand(initCreateGenericCommand()) 42 | deviceCommand.AddCommand(initListFQBNCommand()) 43 | 44 | return deviceCommand 45 | } 46 | -------------------------------------------------------------------------------- /command/thing/extract.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package thing 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | "github.com/arduino/arduino-cloud-cli/internal/template" 27 | ) 28 | 29 | // ExtractParams contains the parameters needed to 30 | // extract a template thing from Arduino IoT Cloud. 31 | type ExtractParams struct { 32 | ID string 33 | } 34 | 35 | // Extract command is used to extract a thing template 36 | // from a thing on Arduino IoT Cloud. 37 | func Extract(ctx context.Context, params *ExtractParams, cred *config.Credentials) (map[string]interface{}, error) { 38 | iotClient, err := iot.NewClient(cred) 39 | if err != nil { 40 | return nil, err 41 | } 42 | 43 | thing, err := iotClient.ThingShow(ctx, params.ID) 44 | if err != nil { 45 | err = fmt.Errorf("%s: %w", "cannot extract thing: ", err) 46 | return nil, err 47 | } 48 | 49 | return template.FromThing(thing), nil 50 | } 51 | -------------------------------------------------------------------------------- /version/version.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package version 19 | 20 | import "fmt" 21 | 22 | var ( 23 | defaultVersionString = "0.0.0-git" 24 | versionString = "" 25 | commit = "" 26 | date = "" 27 | VersionInfo *info 28 | ) 29 | 30 | type info struct { 31 | Application string `json:"Application"` 32 | VersionString string `json:"VersionString"` 33 | Commit string `json:"Commit"` 34 | Date string `json:"Date"` 35 | } 36 | 37 | func newInfo(application string) *info { 38 | return &info{ 39 | Application: application, 40 | VersionString: versionString, 41 | Commit: commit, 42 | Date: date, 43 | } 44 | } 45 | 46 | func (i *info) String() string { 47 | return fmt.Sprintf("%s Version: %s Commit: %s Date: %s", i.Application, i.VersionString, i.Commit, i.Date) 48 | } 49 | 50 | func init() { 51 | if versionString == "" { 52 | versionString = defaultVersionString 53 | } 54 | VersionInfo = newInfo("arduino-cloud-cli") 55 | } 56 | -------------------------------------------------------------------------------- /.licenses/go/github.com/cmaglie/pb.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/cmaglie/pb 3 | version: v1.0.27 4 | type: go 5 | summary: Simple console progress bars 6 | homepage: https://pkg.go.dev/github.com/cmaglie/pb 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: |- 11 | Copyright (c) 2012-2015, Sergey Cherepanov 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 19 | 20 | * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | notices: [] 24 | -------------------------------------------------------------------------------- /.licenses/go/github.com/pkg/errors.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/pkg/errors 3 | version: v0.9.1 4 | type: go 5 | summary: Package errors provides simple error handling primitives. 6 | homepage: https://pkg.go.dev/github.com/pkg/errors 7 | license: bsd-2-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright (c) 2015, Dave Cheney 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | * Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 20 | * Redistributions in binary form must reproduce the above copyright notice, 21 | this list of conditions and the following disclaimer in the documentation 22 | and/or other materials provided with the distribution. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | - sources: README.md 35 | text: BSD-2-Clause 36 | notices: [] 37 | -------------------------------------------------------------------------------- /designs/_template.md: -------------------------------------------------------------------------------- 1 | # Title: Template for design documents 2 | 3 | Use this as a template to write a design document when adding new 4 | major features to the project. It helps other developers 5 | understand the scope of the project, validate technical complexity and 6 | feasibility. It also serves as a public documentation of how the feature 7 | actually works. 8 | 9 | ## Review Period 10 | 11 | Best before Month, day year. 12 | 13 | ## What is the problem? 14 | 15 | ## Out-of-Scope 16 | 17 | ## User Experience Walkthrough 18 | 19 | ## Implementation 20 | 21 | ### Project Changes 22 | 23 | _Explain the changes to api or command line interface, including adding new 24 | commands, modifying arguments etc_ 25 | 26 | ### Breaking Change 27 | 28 | _Are there any breaking changes to the interface? Explain_ 29 | 30 | ### Design 31 | 32 | _Explain how this feature will be implemented. Highlight the components 33 | of your implementation, relationships_ _between components, constraints, 34 | etc._ 35 | 36 | ### Security 37 | 38 | _Tip: How does this change impact security? Answer the following 39 | questions to help answer this question better:_ 40 | 41 | **What new dependencies (libraries/cli) does this change require?** 42 | 43 | **What other Docker container images are you using?** 44 | 45 | **Are you creating a new HTTP endpoint? If so explain how it will be 46 | created & used** 47 | 48 | **Are you connecting to a remote API? If so explain how is this 49 | connection secured** 50 | 51 | **Are you reading/writing to a temporary folder? If so, what is this 52 | used for and when do you clean up?** 53 | 54 | ### Documentation Changes 55 | 56 | _Explain the changes required to internal and public documentation (API reference, tutorial, etc)_ 57 | 58 | ## Additional Notes 59 | 60 | _Link any useful metadata: Jira task, GitHub issue, …_ 61 | -------------------------------------------------------------------------------- /.licenses/go/github.com/beevik/ntp.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/beevik/ntp 3 | version: v1.4.3 4 | type: go 5 | summary: Package ntp provides an implementation of a Simple NTP (SNTP) client capable 6 | of querying the current time from a remote NTP server. 7 | homepage: https://pkg.go.dev/github.com/beevik/ntp 8 | license: bsd-2-clause 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | Copyright © 2015-2023 Brett Vickers. All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions 16 | are met: 17 | 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 21 | 2. Redistributions in binary form must reproduce the above copyright 22 | notice, this list of conditions and the following disclaimer in the 23 | documentation and/or other materials provided with the distribution. 24 | 25 | THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY 26 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR 29 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 30 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 31 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 33 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | notices: [] 37 | -------------------------------------------------------------------------------- /command/dashboard/extract.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package dashboard 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | "github.com/arduino/arduino-cloud-cli/internal/template" 27 | ) 28 | 29 | // ExtractParams contains the parameters needed to 30 | // extract a template dashboard from Arduino IoT Cloud. 31 | type ExtractParams struct { 32 | ID string 33 | } 34 | 35 | // Extract command is used to extract a dashboard template 36 | // from a dashboard on Arduino IoT Cloud. 37 | func Extract(ctx context.Context, params *ExtractParams, cred *config.Credentials) (map[string]interface{}, error) { 38 | iotClient, err := iot.NewClient(cred) 39 | if err != nil { 40 | return nil, err 41 | } 42 | 43 | dashboard, err := iotClient.DashboardShow(ctx, params.ID) 44 | if err != nil { 45 | err = fmt.Errorf("%s: %w", "cannot extract dashboard: ", err) 46 | return nil, err 47 | } 48 | 49 | return template.FromDashboard(dashboard), nil 50 | } 51 | -------------------------------------------------------------------------------- /cli/template/list.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package template 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | 24 | "github.com/arduino/arduino-cli/cli/errorcodes" 25 | "github.com/arduino/arduino-cli/cli/feedback" 26 | "github.com/arduino/arduino-cloud-cli/command/template" 27 | "github.com/arduino/arduino-cloud-cli/config" 28 | "github.com/spf13/cobra" 29 | ) 30 | 31 | func initTemplateListCommand() *cobra.Command { 32 | listCommand := &cobra.Command{ 33 | Use: "list", 34 | Short: "List templates", 35 | Long: "List available templates", 36 | Run: func(cmd *cobra.Command, args []string) { 37 | if err := runTemplateListCommand(); err != nil { 38 | feedback.Errorf("Error during template list: %v", err) 39 | os.Exit(errorcodes.ErrGeneric) 40 | } 41 | }, 42 | } 43 | 44 | return listCommand 45 | } 46 | 47 | func runTemplateListCommand() error { 48 | cred, err := config.RetrieveCredentials() 49 | if err != nil { 50 | return fmt.Errorf("retrieving credentials: %w", err) 51 | } 52 | return template.ListCustomTemplates(cred) 53 | } 54 | -------------------------------------------------------------------------------- /command/thing/clone.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package thing 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | ) 27 | 28 | // CloneParams contains the parameters needed to clone a thing. 29 | type CloneParams struct { 30 | Name string // Name of the new thing 31 | CloneID string // ID of thing to be cloned 32 | } 33 | 34 | // Clone allows to create a new thing from an already existing one. 35 | func Clone(ctx context.Context, params *CloneParams, cred *config.Credentials) (*ThingInfo, error) { 36 | iotClient, err := iot.NewClient(cred) 37 | if err != nil { 38 | return nil, err 39 | } 40 | 41 | newThing, err := iotClient.ThingClone(ctx, params.CloneID, params.Name) 42 | if err != nil { 43 | return nil, fmt.Errorf("cloning thing %s: %w", params.CloneID, err) 44 | } 45 | 46 | t, err := getThingInfo(newThing) 47 | if err != nil { 48 | return nil, fmt.Errorf("parsing thing %s from cloud: %w", newThing.Id, err) 49 | } 50 | return t, nil 51 | } 52 | -------------------------------------------------------------------------------- /.licenses/go/github.com/gofrs/uuid.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/gofrs/uuid 3 | version: v4.2.0+incompatible 4 | type: go 5 | summary: Package uuid provides implementations of the Universally Unique Identifier 6 | (UUID), as specified in RFC-4122 and the Peabody RFC Draft (revision 02). 7 | homepage: https://pkg.go.dev/github.com/gofrs/uuid 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | Copyright (C) 2013-2018 by Maxim Bublis 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining 15 | a copy of this software and associated documentation files (the 16 | "Software"), to deal in the Software without restriction, including 17 | without limitation the rights to use, copy, modify, merge, publish, 18 | distribute, sublicense, and/or sell copies of the Software, and to 19 | permit persons to whom the Software is furnished to do so, subject to 20 | the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be 23 | included in all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 29 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 30 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 31 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | - sources: README.md 33 | text: |- 34 | This source code of this package is released under the MIT License. Please see 35 | the [LICENSE](https://github.com/gofrs/uuid/blob/master/LICENSE) for the full 36 | content of the license. 37 | notices: [] 38 | -------------------------------------------------------------------------------- /arduino/dir.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package arduino 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | "path/filepath" 24 | "runtime" 25 | 26 | "github.com/arduino/go-paths-helper" 27 | "github.com/arduino/go-win32-utils" 28 | ) 29 | 30 | // DataDir returns the Arduino default data directory (arduino15). 31 | func DataDir() (*paths.Path, error) { 32 | userHomeDir, err := os.UserHomeDir() 33 | if err != nil { 34 | return nil, fmt.Errorf("unable to get user home dir: %w", err) 35 | } 36 | 37 | var path *paths.Path 38 | switch runtime.GOOS { 39 | case "darwin": 40 | path = paths.New(filepath.Join(userHomeDir, "Library", "Arduino15")) 41 | case "windows": 42 | localAppDataPath, err := win32.GetLocalAppDataFolder() 43 | if err != nil { 44 | return nil, fmt.Errorf("unable to get local app data folder: %w", err) 45 | } 46 | path = paths.New(filepath.Join(localAppDataPath, "Arduino15")) 47 | default: // linux, android, *bsd, plan9 and other Unix-like systems 48 | path = paths.New(filepath.Join(userHomeDir, ".arduino15")) 49 | } 50 | 51 | return path, nil 52 | } 53 | -------------------------------------------------------------------------------- /command/tag/delete.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package tag 19 | 20 | import ( 21 | "context" 22 | "errors" 23 | 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | ) 27 | 28 | // DeleteTagsParams contains the parameters needed to 29 | // delete tags of a device from Arduino IoT Cloud. 30 | type DeleteTagsParams struct { 31 | ID string 32 | Keys []string // Keys of tags to delete 33 | Resource ResourceType 34 | } 35 | 36 | // DeleteTags command is used to delete tags of a device 37 | // from Arduino IoT Cloud. 38 | func DeleteTags(ctx context.Context, params *DeleteTagsParams, cred *config.Credentials) error { 39 | iotClient, err := iot.NewClient(cred) 40 | if err != nil { 41 | return err 42 | } 43 | 44 | switch params.Resource { 45 | case Thing: 46 | err = iotClient.ThingTagsDelete(ctx, params.ID, params.Keys) 47 | case Device: 48 | err = iotClient.DeviceTagsDelete(ctx, params.ID, params.Keys) 49 | default: 50 | err = errors.New("passed Resource parameter is not valid") 51 | } 52 | return err 53 | } 54 | -------------------------------------------------------------------------------- /command/thing/thing.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package thing 19 | 20 | import ( 21 | "github.com/arduino/arduino-cloud-cli/command/tag" 22 | iotclient "github.com/arduino/iot-client-go/v3" 23 | ) 24 | 25 | // ThingInfo contains the main parameters of 26 | // an Arduino IoT Cloud thing. 27 | type ThingInfo struct { 28 | Name string `json:"name"` 29 | ID string `json:"id"` 30 | DeviceID string `json:"device_id"` 31 | Variables []string `json:"variables"` 32 | Tags []string `json:"tags,omitempty"` 33 | } 34 | 35 | func getThingInfo(thing *iotclient.ArduinoThing) (*ThingInfo, error) { 36 | // Process thing variables 37 | var vars []string 38 | for _, p := range thing.Properties { 39 | vars = append(vars, p.Name) 40 | } 41 | // Process thing tags 42 | tags, err := tag.TagsInfo(thing.Tags) 43 | if err != nil { 44 | return nil, err 45 | } 46 | 47 | info := &ThingInfo{ 48 | Name: thing.Name, 49 | ID: thing.Id, 50 | DeviceID: dereferenceString(thing.DeviceId), 51 | Variables: vars, 52 | Tags: tags, 53 | } 54 | return info, nil 55 | } 56 | -------------------------------------------------------------------------------- /command/thing/bind.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package thing 19 | 20 | import ( 21 | "context" 22 | 23 | "github.com/arduino/arduino-cloud-cli/config" 24 | 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | iotclient "github.com/arduino/iot-client-go/v3" 27 | ) 28 | 29 | // BindParams contains the parameters needed to 30 | // bind a thing to a device. 31 | type BindParams struct { 32 | ID string // ID of the thing to be bound 33 | DeviceID string // ID of the device to be bound 34 | } 35 | 36 | // Bind command is used to bind a thing to a device 37 | // on Arduino IoT Cloud. 38 | func Bind(ctx context.Context, params *BindParams, cred *config.Credentials) error { 39 | iotClient, err := iot.NewClient(cred) 40 | if err != nil { 41 | return err 42 | } 43 | 44 | thing := &iotclient.ThingUpdate{ 45 | DeviceId: ¶ms.DeviceID, 46 | } 47 | 48 | err = iotClient.ThingUpdate(ctx, params.ID, thing, true) 49 | if err != nil { 50 | return err 51 | } 52 | 53 | return nil 54 | } 55 | 56 | func dereferenceString(s *string) string { 57 | if s == nil { 58 | return "" 59 | } 60 | return *s 61 | } 62 | -------------------------------------------------------------------------------- /command/tag/create.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package tag 19 | 20 | import ( 21 | "context" 22 | "errors" 23 | 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | ) 27 | 28 | // CreateTagsParams contains the parameters needed to create or overwrite 29 | // tags on a resource of Arduino IoT Cloud. 30 | type CreateTagsParams struct { 31 | ID string // Resource ID 32 | Tags map[string]string // Map of tags to create 33 | Resource ResourceType 34 | } 35 | 36 | // CreateTags allows to create or overwrite tags 37 | // on a resource of Arduino IoT Cloud. 38 | func CreateTags(ctx context.Context, params *CreateTagsParams, cred *config.Credentials) error { 39 | iotClient, err := iot.NewClient(cred) 40 | if err != nil { 41 | return err 42 | } 43 | 44 | switch params.Resource { 45 | case Thing: 46 | err = iotClient.ThingTagsCreate(ctx, params.ID, params.Tags) 47 | case Device: 48 | err = iotClient.DeviceTagsCreate(ctx, params.ID, params.Tags) 49 | default: 50 | err = errors.New("passed Resource parameter is not valid") 51 | } 52 | return err 53 | } 54 | -------------------------------------------------------------------------------- /.licenses/go/github.com/ulikunitz/xz.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/ulikunitz/xz 3 | version: v0.5.12 4 | type: go 5 | summary: Package xz supports the compression and decompression of xz files. 6 | homepage: https://pkg.go.dev/github.com/ulikunitz/xz 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright (c) 2014-2022 Ulrich Kunitz 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | * Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 20 | * Redistributions in binary form must reproduce the above copyright notice, 21 | this list of conditions and the following disclaimer in the documentation 22 | and/or other materials provided with the distribution. 23 | 24 | * My name, Ulrich Kunitz, may not be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 31 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | notices: [] 38 | -------------------------------------------------------------------------------- /cli/credentials/find.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package credentials 19 | 20 | import ( 21 | "os" 22 | 23 | "github.com/arduino/arduino-cli/cli/errorcodes" 24 | "github.com/arduino/arduino-cli/cli/feedback" 25 | "github.com/arduino/arduino-cloud-cli/config" 26 | "github.com/sirupsen/logrus" 27 | "github.com/spf13/cobra" 28 | ) 29 | 30 | func initFindCommand() *cobra.Command { 31 | findCommand := &cobra.Command{ 32 | Use: "find", 33 | Short: "Find the credentials that would be used in your current directory", 34 | Long: "Find the credentials to access Arduino IoT Cloud that would be used in your current directory", 35 | Run: func(cmd *cobra.Command, args []string) { 36 | if err := runFindCommand(); err != nil { 37 | feedback.Errorf("Error during credentials find: %v", err) 38 | os.Exit(errorcodes.ErrGeneric) 39 | } 40 | }, 41 | } 42 | 43 | return findCommand 44 | } 45 | 46 | func runFindCommand() error { 47 | logrus.Info("Looking for credentials") 48 | 49 | src, err := config.FindCredentials() 50 | if err != nil { 51 | return err 52 | } 53 | 54 | feedback.Printf("Using credentials in: %s", src) 55 | return nil 56 | } 57 | -------------------------------------------------------------------------------- /.licenses/go/github.com/howeyc/crc16.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/howeyc/crc16 3 | version: v0.0.0-20171223171357-2b2a61e366a6 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/howeyc/crc16 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright (c) 2012 The Go Authors. All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google Inc. nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | notices: [] 39 | -------------------------------------------------------------------------------- /.licenses/go/github.com/ulikunitz/xz/internal/hash.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/ulikunitz/xz/internal/hash 3 | version: v0.5.12 4 | type: go 5 | summary: Package hash provides rolling hashes. 6 | homepage: https://pkg.go.dev/github.com/ulikunitz/xz/internal/hash 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: xz@v0.5.12/LICENSE 10 | text: | 11 | Copyright (c) 2014-2022 Ulrich Kunitz 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | * Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 20 | * Redistributions in binary form must reproduce the above copyright notice, 21 | this list of conditions and the following disclaimer in the documentation 22 | and/or other materials provided with the distribution. 23 | 24 | * My name, Ulrich Kunitz, may not be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 31 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | notices: [] 38 | -------------------------------------------------------------------------------- /.licenses/go/github.com/ulikunitz/xz/lzma.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/ulikunitz/xz/lzma 3 | version: v0.5.12 4 | type: go 5 | summary: Package lzma supports the decoding and encoding of LZMA streams. 6 | homepage: https://pkg.go.dev/github.com/ulikunitz/xz/lzma 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: xz@v0.5.12/LICENSE 10 | text: | 11 | Copyright (c) 2014-2022 Ulrich Kunitz 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | * Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 20 | * Redistributions in binary form must reproduce the above copyright notice, 21 | this list of conditions and the following disclaimer in the documentation 22 | and/or other materials provided with the distribution. 23 | 24 | * My name, Ulrich Kunitz, may not be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 31 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | notices: [] 38 | -------------------------------------------------------------------------------- /internal/board-protocols/provisioning-protocol/provisioning_protocol_test.go: -------------------------------------------------------------------------------- 1 | package provisioningprotocol 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/arduino/arduino-cloud-cli/internal/board-protocols/frame" 8 | "github.com/arduino/arduino-cloud-cli/internal/board-protocols/transport" 9 | "github.com/arduino/arduino-cloud-cli/internal/board-protocols/transport/mocks" 10 | "github.com/stretchr/testify/assert" 11 | "github.com/stretchr/testify/mock" 12 | ) 13 | 14 | func TestSend_Success(t *testing.T) { 15 | mockTransportInterface := &mocks.TransportInterface{} 16 | var tr transport.TransportInterface = mockTransportInterface 17 | provProt := NewProvisioningProtocol(&tr) 18 | mockTransportInterface.On("Connected").Return(true) 19 | mockTransportInterface.On("Send", mock.AnythingOfType("[]uint8")).Return(nil) 20 | 21 | payload := []byte{1, 2} 22 | cmd := SetDay 23 | want := []byte{0x55, 0xaa, 1, 0, 5, 10, 1, 2, 143, 124, 0xaa, 0x55} 24 | 25 | err := provProt.Send(context.TODO(), cmd, payload) 26 | assert.NoError(t, err) 27 | mockTransportInterface.AssertCalled(t, "Send", want) 28 | } 29 | 30 | func TestSendReceive_Success(t *testing.T) { 31 | 32 | mockTransportInterface := &mocks.TransportInterface{} 33 | var tr transport.TransportInterface = mockTransportInterface 34 | provProt := NewProvisioningProtocol(&tr) 35 | 36 | want := []byte{1, 2, 3} 37 | rec := frame.CreateFrame(want, frame.Response) 38 | receivedListFrame := []frame.Frame{ 39 | rec, 40 | } 41 | 42 | mockTransportInterface.On("Connected").Return(true) 43 | mockTransportInterface.On("Send", mock.AnythingOfType("[]uint8")).Return(nil) 44 | mockTransportInterface.On("Receive", mock.Anything).Return(receivedListFrame, nil) 45 | 46 | res, err := provProt.SendReceive(context.TODO(), BeginStorage, []byte{1, 2}) 47 | assert.NoError(t, err) 48 | 49 | assert.NotNil(t, res, "Expected non-nil response") 50 | assert.Equal(t, res, want, "Expected %v but received %v", want, res) 51 | 52 | } 53 | -------------------------------------------------------------------------------- /.licenses/go/github.com/fxamacker/cbor/v2.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/fxamacker/cbor/v2 3 | version: v2.8.0 4 | type: go 5 | summary: Package cbor is a modern CBOR codec (RFC 8949 & RFC 8742) with CBOR tags, 6 | Go struct tag options (toarray/keyasint/omitempty/omitzero), Core Deterministic 7 | Encoding, CTAP2, Canonical CBOR, float64->32->16, and duplicate map key detection. 8 | homepage: https://pkg.go.dev/github.com/fxamacker/cbor/v2 9 | license: mit 10 | licenses: 11 | - sources: LICENSE 12 | text: |- 13 | MIT License 14 | 15 | Copyright (c) 2019-present Faye Amacker 16 | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy 18 | of this software and associated documentation files (the "Software"), to deal 19 | in the Software without restriction, including without limitation the rights 20 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | copies of the Software, and to permit persons to whom the Software is 22 | furnished to do so, subject to the following conditions: 23 | 24 | The above copyright notice and this permission notice shall be included in all 25 | copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | SOFTWARE. 34 | - sources: README.md 35 | text: |- 36 | Copyright © 2019-2024 [Faye Amacker](https://github.com/fxamacker). 37 | 38 | fxamacker/cbor is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text. 39 | 40 |
41 | notices: [] 42 | -------------------------------------------------------------------------------- /.licenses/go/go.bug.st/cleanup.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: go.bug.st/cleanup 3 | version: v1.0.0 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/go.bug.st/cleanup 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: |2+ 11 | 12 | Copyright (c) 2018, Cristian Maglie. 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions 17 | are met: 18 | 19 | 1. Redistributions of source code must retain the above copyright 20 | notice, this list of conditions and the following disclaimer. 21 | 22 | 2. Redistributions in binary form must reproduce the above copyright 23 | notice, this list of conditions and the following disclaimer in 24 | the documentation and/or other materials provided with the 25 | distribution. 26 | 27 | 3. Neither the name of the copyright holder nor the names of its 28 | contributors may be used to endorse or promote products derived 29 | from this software without specific prior written permission. 30 | 31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 35 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 36 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 37 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 38 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 40 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 41 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | notices: [] 45 | -------------------------------------------------------------------------------- /command/device/listfrequency.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package device 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | 24 | "github.com/arduino/arduino-cloud-cli/config" 25 | "github.com/arduino/arduino-cloud-cli/internal/iot" 26 | ) 27 | 28 | // FrequencyPlanInfo describes a LoRa frequency plan. 29 | type FrequencyPlanInfo struct { 30 | Name string `json:"name"` 31 | ID string `json:"id"` 32 | Advanced string `json:"advanced"` 33 | } 34 | 35 | // ListFrequencyPlans command is used to list 36 | // the supported LoRa frequency plans. 37 | func ListFrequencyPlans(ctx context.Context, cred *config.Credentials) ([]FrequencyPlanInfo, error) { 38 | iotClient, err := iot.NewClient(cred) 39 | if err != nil { 40 | return nil, err 41 | } 42 | 43 | foundFreqs, err := iotClient.LoraFrequencyPlansList(ctx) 44 | if err != nil { 45 | return nil, err 46 | } 47 | 48 | freqs := make([]FrequencyPlanInfo, 0, len(foundFreqs)) 49 | for _, f := range foundFreqs { 50 | freq := FrequencyPlanInfo{ 51 | Name: f.Name, 52 | ID: f.Id, 53 | Advanced: fmt.Sprintf("%v", f.Advanced), 54 | } 55 | freqs = append(freqs, freq) 56 | } 57 | 58 | return freqs, nil 59 | } 60 | -------------------------------------------------------------------------------- /.licenses/go/github.com/golang/protobuf/ptypes/any.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/golang/protobuf/ptypes/any 3 | version: v1.5.4 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/golang/protobuf/ptypes/any 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: protobuf@v1.5.4/LICENSE 10 | text: |+ 11 | Copyright 2010 The Go Authors. All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google Inc. nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/go.bug.st/downloader/v2.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: go.bug.st/downloader/v2 3 | version: v2.1.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/go.bug.st/downloader/v2 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: |2+ 11 | 12 | Copyright (c) 2018, Cristian Maglie. 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions 17 | are met: 18 | 19 | 1. Redistributions of source code must retain the above copyright 20 | notice, this list of conditions and the following disclaimer. 21 | 22 | 2. Redistributions in binary form must reproduce the above copyright 23 | notice, this list of conditions and the following disclaimer in 24 | the documentation and/or other materials provided with the 25 | distribution. 26 | 27 | 3. Neither the name of the copyright holder nor the names of its 28 | contributors may be used to endorse or promote products derived 29 | from this software without specific prior written permission. 30 | 31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 35 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 36 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 37 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 38 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 40 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 41 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | notices: [] 45 | -------------------------------------------------------------------------------- /.licenses/go/golang.org/x/oauth2/internal.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/oauth2/internal 3 | version: v0.25.0 4 | type: go 5 | summary: Package internal contains support packages for oauth2 package. 6 | homepage: https://pkg.go.dev/golang.org/x/oauth2/internal 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: oauth2@v0.25.0/LICENSE 10 | text: | 11 | Copyright 2009 The Go Authors. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google LLC nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | notices: [] 39 | -------------------------------------------------------------------------------- /.licenses/go/go.bug.st/relaxed-semver.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: go.bug.st/relaxed-semver 3 | version: v0.10.1 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/go.bug.st/relaxed-semver 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: |2+ 11 | 12 | Copyright (c) 2018-2022, Cristian Maglie. 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions 17 | are met: 18 | 19 | 1. Redistributions of source code must retain the above copyright 20 | notice, this list of conditions and the following disclaimer. 21 | 22 | 2. Redistributions in binary form must reproduce the above copyright 23 | notice, this list of conditions and the following disclaimer in 24 | the documentation and/or other materials provided with the 25 | distribution. 26 | 27 | 3. Neither the name of the copyright holder nor the names of its 28 | contributors may be used to endorse or promote products derived 29 | from this software without specific prior written permission. 30 | 31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 35 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 36 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 37 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 38 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 40 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 41 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | notices: [] 45 | -------------------------------------------------------------------------------- /.licenses/go/github.com/golang/protobuf/ptypes/duration.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/golang/protobuf/ptypes/duration 3 | version: v1.5.4 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/golang/protobuf/ptypes/duration 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: protobuf@v1.5.4/LICENSE 10 | text: |+ 11 | Copyright 2010 The Go Authors. All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google Inc. nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/github.com/golang/protobuf/ptypes/timestamp.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/golang/protobuf/ptypes/timestamp 3 | version: v1.5.4 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/golang/protobuf/ptypes/timestamp 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: protobuf@v1.5.4/LICENSE 10 | text: |+ 11 | Copyright 2010 The Go Authors. All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google Inc. nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/github.com/pmylund/sortutil.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/pmylund/sortutil 3 | version: v0.0.0-20120526081524-abeda66eb583 4 | type: go 5 | summary: 'Sortutil is a Go library which lets you sort a slice without implementing 6 | a sort.Interface, and in different orderings: ascending, descending, or case-insensitive 7 | ascending or descending (for slices of strings.) Additionally, Sortutil lets you 8 | sort a slice of a custom struct by a given struct field or index--for example, you 9 | can sort a []MyStruct by the structs'' "Name" fields, or a [][]int by the second 10 | index of each nested slice, similar to using sorted(key=operator.itemgetter/attrgetter) 11 | in Python.' 12 | homepage: https://pkg.go.dev/github.com/pmylund/sortutil 13 | license: mit 14 | licenses: 15 | - sources: LICENSE 16 | text: "Copyright (c) 2012 Patrick Mylund Nielsen\n \nPermission is hereby granted, 17 | free of charge, to any person obtaining a copy\nof this software and associated 18 | documentation files (the \"Software\"), to deal\nin the Software without restriction, 19 | including without limitation the rights\nto use, copy, modify, merge, publish, 20 | distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons 21 | to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe 22 | above copyright notice and this permission notice shall be included in\nall copies 23 | or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", 24 | WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO 25 | THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 26 | IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 27 | OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN\nTHE SOFTWARE.\n" 30 | notices: [] 31 | -------------------------------------------------------------------------------- /.licenses/go/golang.org/x/oauth2.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/oauth2 3 | version: v0.25.0 4 | type: go 5 | summary: Package oauth2 provides support for making OAuth2 authorized and authenticated 6 | HTTP requests, as specified in RFC 6749. 7 | homepage: https://pkg.go.dev/golang.org/x/oauth2 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | Copyright 2009 The Go Authors. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google LLC nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/github.com/manifoldco/promptui/list.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/manifoldco/promptui/list 3 | version: v0.9.0 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/manifoldco/promptui/list 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: promptui@v0.9.0/LICENSE.md 10 | text: | 11 | BSD 3-Clause License 12 | 13 | Copyright (c) 2017, Arigato Machine Inc. 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 19 | * Redistributions of source code must retain the above copyright notice, this 20 | list of conditions and the following disclaimer. 21 | 22 | * Redistributions in binary form must reproduce the above copyright notice, 23 | this list of conditions and the following disclaimer in the documentation 24 | and/or other materials provided with the distribution. 25 | 26 | * Neither the name of the copyright holder nor the names of its 27 | contributors may be used to endorse or promote products derived from 28 | this software without specific prior written permission. 29 | 30 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 31 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 34 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 36 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 38 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | notices: [] 41 | -------------------------------------------------------------------------------- /.licenses/go/github.com/ulikunitz/xz/internal/xlog.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/ulikunitz/xz/internal/xlog 3 | version: v0.5.12 4 | type: go 5 | summary: Package xlog provides a simple logging package that allows to disable certain 6 | message categories. 7 | homepage: https://pkg.go.dev/github.com/ulikunitz/xz/internal/xlog 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: xz@v0.5.12/LICENSE 11 | text: | 12 | Copyright (c) 2014-2022 Ulrich Kunitz 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 18 | * Redistributions of source code must retain the above copyright notice, this 19 | list of conditions and the following disclaimer. 20 | 21 | * Redistributions in binary form must reproduce the above copyright notice, 22 | this list of conditions and the following disclaimer in the documentation 23 | and/or other materials provided with the distribution. 24 | 25 | * My name, Ulrich Kunitz, may not be used to endorse or promote products 26 | derived from this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 29 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 31 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 32 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 34 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 36 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | notices: [] 39 | -------------------------------------------------------------------------------- /.licenses/go/github.com/manifoldco/promptui/screenbuf.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/manifoldco/promptui/screenbuf 3 | version: v0.9.0 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/manifoldco/promptui/screenbuf 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: promptui@v0.9.0/LICENSE.md 10 | text: | 11 | BSD 3-Clause License 12 | 13 | Copyright (c) 2017, Arigato Machine Inc. 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 19 | * Redistributions of source code must retain the above copyright notice, this 20 | list of conditions and the following disclaimer. 21 | 22 | * Redistributions in binary form must reproduce the above copyright notice, 23 | this list of conditions and the following disclaimer in the documentation 24 | and/or other materials provided with the distribution. 25 | 26 | * Neither the name of the copyright holder nor the names of its 27 | contributors may be used to endorse or promote products derived from 28 | this software without specific prior written permission. 29 | 30 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 31 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 34 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 36 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 38 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | notices: [] 41 | -------------------------------------------------------------------------------- /.licenses/go/github.com/golang/protobuf/proto.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/golang/protobuf/proto 3 | version: v1.5.4 4 | type: go 5 | summary: Package proto provides functionality for handling protocol buffer messages. 6 | homepage: https://pkg.go.dev/github.com/golang/protobuf/proto 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: protobuf@v1.5.4/LICENSE 10 | text: |+ 11 | Copyright 2010 The Go Authors. All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google Inc. nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/github.com/src-d/gcfg/types.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/src-d/gcfg/types 3 | version: v1.4.0 4 | type: go 5 | summary: Package types defines helpers for type conversions. 6 | homepage: https://pkg.go.dev/github.com/src-d/gcfg/types 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: gcfg@v1.4.0/LICENSE 10 | text: | 11 | Copyright (c) 2012 Péter Surányi. Portions Copyright (c) 2009 The Go 12 | Authors. All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google Inc. nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/github.com/golang/protobuf/ptypes.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/golang/protobuf/ptypes 3 | version: v1.5.4 4 | type: go 5 | summary: Package ptypes provides functionality for interacting with well-known types. 6 | homepage: https://pkg.go.dev/github.com/golang/protobuf/ptypes 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: protobuf@v1.5.4/LICENSE 10 | text: |+ 11 | Copyright 2010 The Go Authors. All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google Inc. nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/github.com/src-d/gcfg/scanner.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/src-d/gcfg/scanner 3 | version: v1.4.0 4 | type: go 5 | summary: Package scanner implements a scanner for gcfg configuration text. 6 | homepage: https://pkg.go.dev/github.com/src-d/gcfg/scanner 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: gcfg@v1.4.0/LICENSE 10 | text: | 11 | Copyright (c) 2012 Péter Surányi. Portions Copyright (c) 2009 The Go 12 | Authors. All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google Inc. nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | notices: [] 40 | -------------------------------------------------------------------------------- /cli/ota/decode.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | import ( 21 | "os" 22 | 23 | "github.com/arduino/arduino-cli/cli/errorcodes" 24 | "github.com/arduino/arduino-cli/cli/feedback" 25 | "github.com/arduino/arduino-cloud-cli/command/ota" 26 | "github.com/spf13/cobra" 27 | ) 28 | 29 | type decodeHeaderFlags struct { 30 | file string 31 | } 32 | 33 | func initDecodeHeaderCommand() *cobra.Command { 34 | flags := &decodeHeaderFlags{} 35 | uploadCommand := &cobra.Command{ 36 | Use: "header-decode", 37 | Short: "OTA firmware header decoder", 38 | Long: "decode OTA firmware header of the given binary file", 39 | Run: func(cmd *cobra.Command, args []string) { 40 | if err := runDecodeHeaderCommand(flags); err != nil { 41 | feedback.Errorf("Error during firmware decoding: %v", err) 42 | os.Exit(errorcodes.ErrGeneric) 43 | } 44 | }, 45 | } 46 | uploadCommand.Flags().StringVarP(&flags.file, "file", "", "", "Binary file (.ota)") 47 | uploadCommand.MarkFlagRequired("file") 48 | return uploadCommand 49 | } 50 | 51 | func runDecodeHeaderCommand(flags *decodeHeaderFlags) error { 52 | params := &ota.ReadHeaderParams{ 53 | File: flags.file, 54 | } 55 | if err := ota.ReadHeader(params); err != nil { 56 | return err 57 | } 58 | return nil 59 | } 60 | -------------------------------------------------------------------------------- /.licenses/go/github.com/magiconair/properties.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/magiconair/properties 3 | version: v1.8.5 4 | type: go 5 | summary: Package properties provides functions for reading and writing ISO-8859-1 6 | and UTF-8 encoded .properties files and has support for recursive property expansion. 7 | homepage: https://pkg.go.dev/github.com/magiconair/properties 8 | license: bsd-2-clause 9 | licenses: 10 | - sources: LICENSE.md 11 | text: | 12 | Copyright (c) 2013-2020, Frank Schroeder 13 | 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 19 | * Redistributions of source code must retain the above copyright notice, this 20 | list of conditions and the following disclaimer. 21 | 22 | * Redistributions in binary form must reproduce the above copyright notice, 23 | this list of conditions and the following disclaimer in the documentation 24 | and/or other materials provided with the distribution. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 27 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 30 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | - sources: README.md 37 | text: 2 clause BSD license. See [LICENSE](https://github.com/magiconair/properties/blob/master/LICENSE) 38 | file for details. 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/golang.org/x/oauth2/clientcredentials.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/oauth2/clientcredentials 3 | version: v0.25.0 4 | type: go 5 | summary: Package clientcredentials implements the OAuth2.0 "client credentials" token 6 | flow, also known as the "two-legged OAuth 2.0". 7 | homepage: https://pkg.go.dev/golang.org/x/oauth2/clientcredentials 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: oauth2@v0.25.0/LICENSE 11 | text: | 12 | Copyright 2009 The Go Authors. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google LLC nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | notices: [] 40 | -------------------------------------------------------------------------------- /.licenses/go/github.com/golang/protobuf/jsonpb.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/golang/protobuf/jsonpb 3 | version: v1.5.4 4 | type: go 5 | summary: Package jsonpb provides functionality to marshal and unmarshal between a 6 | protocol buffer message and JSON. 7 | homepage: https://pkg.go.dev/github.com/golang/protobuf/jsonpb 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: protobuf@v1.5.4/LICENSE 11 | text: |+ 12 | Copyright 2010 The Go Authors. All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google Inc. nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | 40 | notices: [] 41 | -------------------------------------------------------------------------------- /.licenses/go/github.com/spf13/pflag.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/spf13/pflag 3 | version: v1.0.5 4 | type: go 5 | summary: Package pflag is a drop-in replacement for Go's flag package, implementing 6 | POSIX/GNU-style --flags. 7 | homepage: https://pkg.go.dev/github.com/spf13/pflag 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | Copyright (c) 2012 Alex Ogier. All rights reserved. 13 | Copyright (c) 2012 The Go Authors. All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are 17 | met: 18 | 19 | * Redistributions of source code must retain the above copyright 20 | notice, this list of conditions and the following disclaimer. 21 | * Redistributions in binary form must reproduce the above 22 | copyright notice, this list of conditions and the following disclaimer 23 | in the documentation and/or other materials provided with the 24 | distribution. 25 | * Neither the name of Google Inc. nor the names of its 26 | contributors may be used to endorse or promote products derived from 27 | this software without specific prior written permission. 28 | 29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | notices: [] 41 | -------------------------------------------------------------------------------- /.licenses/go/github.com/manifoldco/promptui.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/manifoldco/promptui 3 | version: v0.9.0 4 | type: go 5 | summary: Package promptui is a library providing a simple interface to create command-line 6 | prompts for go. 7 | homepage: https://pkg.go.dev/github.com/manifoldco/promptui 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: LICENSE.md 11 | text: | 12 | BSD 3-Clause License 13 | 14 | Copyright (c) 2017, Arigato Machine Inc. 15 | All rights reserved. 16 | 17 | Redistribution and use in source and binary forms, with or without 18 | modification, are permitted provided that the following conditions are met: 19 | 20 | * Redistributions of source code must retain the above copyright notice, this 21 | list of conditions and the following disclaimer. 22 | 23 | * Redistributions in binary form must reproduce the above copyright notice, 24 | this list of conditions and the following disclaimer in the documentation 25 | and/or other materials provided with the distribution. 26 | 27 | * Neither the name of the copyright holder nor the names of its 28 | contributors may be used to endorse or promote products derived from 29 | this software without specific prior written permission. 30 | 31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 32 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 33 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 34 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 35 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 37 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 38 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 39 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | notices: [] 42 | -------------------------------------------------------------------------------- /.licenses/go/github.com/src-d/gcfg.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/src-d/gcfg 3 | version: v1.4.0 4 | type: go 5 | summary: Package gcfg reads "INI-style" text-based configuration files with "name=value" 6 | pairs grouped into sections (gcfg files). 7 | homepage: https://pkg.go.dev/github.com/src-d/gcfg 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | Copyright (c) 2012 Péter Surányi. Portions Copyright (c) 2009 The Go 13 | Authors. All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are 17 | met: 18 | 19 | * Redistributions of source code must retain the above copyright 20 | notice, this list of conditions and the following disclaimer. 21 | * Redistributions in binary form must reproduce the above 22 | copyright notice, this list of conditions and the following disclaimer 23 | in the documentation and/or other materials provided with the 24 | distribution. 25 | * Neither the name of Google Inc. nor the names of its 26 | contributors may be used to endorse or promote products derived from 27 | this software without specific prior written permission. 28 | 29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | notices: [] 41 | -------------------------------------------------------------------------------- /internal/ota/version.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | const compressionEnabledMagicNumber = 0x40 21 | 22 | // Version contains all the OTA header information 23 | // Check out https://arduino.atlassian.net/wiki/spaces/RFC/pages/1616871540/OTA+header+structure for more 24 | // information on the OTA header specs. 25 | type Version struct { 26 | HeaderVersion uint8 27 | Compression bool 28 | Signature bool 29 | Spare uint8 30 | PayloadTarget uint8 31 | PayloadMayor uint8 32 | PayloadMinor uint8 33 | PayloadPatch uint8 34 | PayloadBuildNum uint32 35 | } 36 | 37 | // Bytes builds a 8 byte length representation of the Version Struct for the OTA update. 38 | func (v *Version) Bytes() []byte { 39 | version := []byte{0, 0, 0, 0, 0, 0, 0, 0} 40 | 41 | // Set compression 42 | if v.Compression { 43 | version[7] = 0x40 44 | } 45 | 46 | // Other field are currently not implemented ¯\_(ツ)_/¯ 47 | 48 | return version 49 | } 50 | 51 | // Bytes builds a 8 byte length representation of the Version Struct for the OTA update. 52 | func decodeVersion(version []byte) Version { 53 | 54 | compressed := (version[7] == compressionEnabledMagicNumber) 55 | 56 | // Other field are currently not implemented ¯\_(ツ)_/¯ 57 | 58 | return Version{ 59 | Compression: compressed, 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /cli/ota/cancel.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | 24 | "github.com/arduino/arduino-cli/cli/errorcodes" 25 | "github.com/arduino/arduino-cli/cli/feedback" 26 | "github.com/arduino/arduino-cloud-cli/command/ota" 27 | "github.com/arduino/arduino-cloud-cli/config" 28 | "github.com/spf13/cobra" 29 | ) 30 | 31 | type cancelFlags struct { 32 | otaID string 33 | } 34 | 35 | func initOtaCancelCommand() *cobra.Command { 36 | flags := &cancelFlags{} 37 | uploadCommand := &cobra.Command{ 38 | Use: "cancel", 39 | Short: "OTA cancel", 40 | Long: "Cancel OTA by OTA ID", 41 | Run: func(cmd *cobra.Command, args []string) { 42 | if err := runOtaCancelCommand(flags); err != nil { 43 | feedback.Errorf("Error during ota cancel: %v", err) 44 | os.Exit(errorcodes.ErrGeneric) 45 | } 46 | }, 47 | } 48 | uploadCommand.Flags().StringVarP(&flags.otaID, "ota-id", "o", "", "OTA ID") 49 | 50 | return uploadCommand 51 | } 52 | 53 | func runOtaCancelCommand(flags *cancelFlags) error { 54 | if flags.otaID == "" { 55 | return fmt.Errorf("required flag \"ota-id\" not set") 56 | } 57 | 58 | cred, err := config.RetrieveCredentials() 59 | if err != nil { 60 | return fmt.Errorf("retrieving credentials: %w", err) 61 | } 62 | 63 | return ota.CancelOta(flags.otaID, cred) 64 | } 65 | -------------------------------------------------------------------------------- /arduino/grpc/compile.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package grpc 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | "io" 24 | "path/filepath" 25 | 26 | rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" 27 | ) 28 | 29 | type compileHandler struct { 30 | *service 31 | } 32 | 33 | // Compile executes the 'arduino-cli compile' command 34 | // and returns its result. 35 | func (c compileHandler) Compile() error { 36 | return nil 37 | } 38 | 39 | // Upload executes the 'arduino-cli upload -i' command 40 | // and returns its result. 41 | func (c compileHandler) UploadBin(ctx context.Context, fqbn, bin, address, protocol string) error { 42 | stream, err := c.serviceClient.Upload(context.Background(), 43 | &rpc.UploadRequest{ 44 | Instance: c.instance, 45 | Fqbn: fqbn, 46 | SketchPath: filepath.Dir(bin), 47 | ImportFile: bin, 48 | Port: &rpc.Port{Address: address, Protocol: protocol}, 49 | Verbose: true, 50 | }) 51 | 52 | if err != nil { 53 | err = fmt.Errorf("%s: %w", "uploading", err) 54 | return err 55 | } 56 | 57 | // Wait for the upload to complete 58 | for { 59 | _, err := stream.Recv() 60 | if err != nil { 61 | if err == io.EOF { 62 | break 63 | } 64 | err = fmt.Errorf("%s: %w", "errors during upload", err) 65 | return err 66 | } 67 | } 68 | 69 | return nil 70 | } 71 | -------------------------------------------------------------------------------- /.licenses/go/github.com/src-d/gcfg/token.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/src-d/gcfg/token 3 | version: v1.4.0 4 | type: go 5 | summary: Package token defines constants representing the lexical tokens of the gcfg 6 | configuration syntax and basic operations on tokens (printing, predicates). 7 | homepage: https://pkg.go.dev/github.com/src-d/gcfg/token 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: gcfg@v1.4.0/LICENSE 11 | text: | 12 | Copyright (c) 2012 Péter Surányi. Portions Copyright (c) 2009 The Go 13 | Authors. All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are 17 | met: 18 | 19 | * Redistributions of source code must retain the above copyright 20 | notice, this list of conditions and the following disclaimer. 21 | * Redistributions in binary form must reproduce the above 22 | copyright notice, this list of conditions and the following disclaimer 23 | in the documentation and/or other materials provided with the 24 | distribution. 25 | * Neither the name of Google Inc. nor the names of its 26 | contributors may be used to endorse or promote products derived from 27 | this software without specific prior written permission. 28 | 29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | notices: [] 41 | -------------------------------------------------------------------------------- /cli/template/import.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package template 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | 24 | "github.com/arduino/arduino-cli/cli/errorcodes" 25 | "github.com/arduino/arduino-cli/cli/feedback" 26 | "github.com/arduino/arduino-cloud-cli/command/template" 27 | "github.com/arduino/arduino-cloud-cli/config" 28 | "github.com/spf13/cobra" 29 | ) 30 | 31 | type importFlags struct { 32 | templateFile string 33 | } 34 | 35 | func initTemplateImportCommand() *cobra.Command { 36 | flags := &importFlags{} 37 | downloadCommand := &cobra.Command{ 38 | Use: "import", 39 | Short: "Import template", 40 | Long: "Import a template from a file", 41 | Run: func(cmd *cobra.Command, args []string) { 42 | if err := runTemplateImportCommand(flags); err != nil { 43 | feedback.Errorf("Error during template import: %v", err) 44 | os.Exit(errorcodes.ErrGeneric) 45 | } 46 | }, 47 | } 48 | 49 | downloadCommand.Flags().StringVarP(&flags.templateFile, "file", "f", "", "Template file to import") 50 | 51 | downloadCommand.MarkFlagRequired("file") 52 | 53 | return downloadCommand 54 | } 55 | 56 | func runTemplateImportCommand(flags *importFlags) error { 57 | cred, err := config.RetrieveCredentials() 58 | if err != nil { 59 | return fmt.Errorf("retrieving credentials: %w", err) 60 | } 61 | return template.ImportCustomTemplate(cred, flags.templateFile) 62 | } 63 | -------------------------------------------------------------------------------- /command/ota/encode.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package ota 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | "strings" 24 | 25 | "github.com/arduino/arduino-cloud-cli/internal/ota" 26 | ) 27 | 28 | type EncodeParams struct { 29 | FQBN string 30 | File string 31 | } 32 | 33 | // Encode command is used to encode a firmware OTA 34 | func Encode(params *EncodeParams) (*string, error) { 35 | _, err := os.Stat(params.File) 36 | if err != nil { 37 | return nil, fmt.Errorf("file %s does not exists: %w", params.File, err) 38 | } 39 | 40 | // Verify if file has already an OTA header 41 | header, _ := ota.DecodeOtaFirmwareHeaderFromFile(params.File) 42 | if header != nil { 43 | return nil, fmt.Errorf("file %s contains a valid OTA header. Skip header encoding", params.File) 44 | } 45 | 46 | var otaFile string 47 | if strings.HasSuffix(params.File, ".bin") { 48 | otaFile = strings.Replace(params.File, ".bin", ".ota", 1) 49 | } else { 50 | otaFile = fmt.Sprintf("%s.ota", params.File) 51 | } 52 | _, err = os.Stat(otaFile) 53 | if err == nil { 54 | // file already exists, we need to delete it 55 | if err = os.Remove(otaFile); err != nil { 56 | return nil, fmt.Errorf("%s: %w", "cannot remove .ota file", err) 57 | } 58 | } 59 | 60 | err = Generate(params.File, otaFile, params.FQBN) 61 | if err != nil { 62 | return nil, fmt.Errorf("%s: %w", "cannot generate .ota file", err) 63 | } 64 | 65 | return &otaFile, nil 66 | } 67 | -------------------------------------------------------------------------------- /command/device/listfqbn_test.go: -------------------------------------------------------------------------------- 1 | // This file is part of arduino-cloud-cli. 2 | // 3 | // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published 7 | // by the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package device 19 | 20 | import ( 21 | "testing" 22 | 23 | "github.com/google/go-cmp/cmp" 24 | ) 25 | 26 | func TestFilterFQBN(t *testing.T) { 27 | var ( 28 | wrong = []FQBNInfo{ 29 | {Name: "Arduino Uno", Value: "arduino:avr:uno", Package: "arduino"}, 30 | {Name: "Arduino Industrial 101", Value: "arduino:avr:chiwawa", Package: "arduino"}, 31 | {Name: "SmartEverything Lion (Native USB Port)", Value: "Arrow:samd:SmartEverything_Lion_native", Package: "Arrow"}, 32 | {Name: "Arduino/Genuino 101", Value: "Intel:arc32:arduino_101", Package: "Intel"}, 33 | {Name: "Atmel atmega328pb Xplained mini", Value: "atmel-avr-xminis:avr:atmega328pb_xplained_mini", Package: "atmel-avr-xminis"}, 34 | } 35 | good = []FQBNInfo{ 36 | {Name: "Arduino Nano RP2040 Connect", Value: "arduino:mbed_nano:nanorp2040connect", Package: "arduino"}, 37 | {Name: "Arduino MKR WiFi 1010", Value: "arduino:samd:mkrwifi1010", Package: "arduino"}, 38 | {Name: "ESP32 Dev Module", Value: "esp32:esp32:esp32", Package: "esp32"}, 39 | {Name: "4D Systems gen4 IoD Range", Value: "esp8266:esp8266:gen4iod", Package: "esp8266"}, 40 | {Name: "BPI-BIT", Value: "esp32:esp32:bpi-bit", Package: "esp32"}, 41 | } 42 | ) 43 | all := append(wrong, good...) 44 | filtered := filterFQBN(all) 45 | if !cmp.Equal(good, filtered) { 46 | t.Errorf("Wrong filter, diff:\n%s", cmp.Diff(good, filtered)) 47 | } 48 | } 49 | --------------------------------------------------------------------------------