-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
155 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright © 2023 The Things Network Foundation, The Things Industries B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ttnv3 | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
root "go.thethings.network/lorawan-stack-migrate/cmd" | ||
"go.thethings.network/lorawan-stack-migrate/pkg/commands" | ||
"go.thethings.network/lorawan-stack-migrate/pkg/source" | ||
) | ||
|
||
var applicationsCmd = &cobra.Command{ | ||
Use: "application [app-id] ...", | ||
Aliases: []string{"applications", "app"}, | ||
Short: "Export all devices of an application", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
commands.Export(cmd, args, func(s source.Source, item string) error { | ||
return s.RangeDevices(item, root.ExportCfg.ExportDev) | ||
}) | ||
}, | ||
} | ||
|
||
func init() { | ||
ttnv3Cmd.AddCommand(applicationsCmd) | ||
|
||
fs, err := source.FlagSet(sourceName) | ||
if err != nil { | ||
panic(err) | ||
} | ||
applicationsCmd.Flags().AddFlagSet(fs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright © 2023 The Things Network Foundation, The Things Industries B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ttnv3 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
"go.thethings.network/lorawan-stack-migrate/pkg/source" | ||
) | ||
|
||
var devicesCmd = &cobra.Command{ | ||
Use: "device [dev-id] ...", | ||
Short: "Export devices by DevEUI", | ||
Aliases: []string{"end-devices", "end-device", "devices", "dev"}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Printf("%s called\n", cmd.Name()) | ||
}, | ||
} | ||
|
||
func init() { | ||
ttnv3Cmd.AddCommand(devicesCmd) | ||
|
||
fs, err := source.FlagSet(sourceName) | ||
if err != nil { | ||
panic(err) | ||
} | ||
devicesCmd.Flags().AddFlagSet(fs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright © 2023 The Things Network Foundation, The Things Industries B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ttnv3 | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"go.thethings.network/lorawan-stack-migrate/cmd" | ||
) | ||
|
||
const sourceName = "ttnv3" | ||
|
||
// ttnv3Cmd represents the ttnv3 source | ||
var ttnv3Cmd = &cobra.Command{ | ||
Use: sourceName + " ...", | ||
Short: "Export devices from The Things Stack", | ||
SilenceUsage: true, | ||
} | ||
|
||
func init() { | ||
cmd.RootCmd.AddCommand(ttnv3Cmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters