2021-03-31 16:56:34 +01:00
|
|
|
// Copyright (C) 2021 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"github.com/zeebo/clingy"
|
2021-05-26 21:19:29 +01:00
|
|
|
|
|
|
|
"storj.io/storj/cmd/uplinkng/ulext"
|
2021-03-31 16:56:34 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type cmdAccessCreate struct {
|
2021-05-26 21:19:29 +01:00
|
|
|
ex ulext.External
|
|
|
|
|
2021-03-31 16:56:34 +01:00
|
|
|
accessPermissions
|
|
|
|
|
|
|
|
token string
|
|
|
|
passphrase string
|
|
|
|
name string
|
|
|
|
save bool
|
|
|
|
}
|
|
|
|
|
2021-05-26 21:19:29 +01:00
|
|
|
func newCmdAccessCreate(ex ulext.External) *cmdAccessCreate {
|
|
|
|
return &cmdAccessCreate{ex: ex}
|
|
|
|
}
|
|
|
|
|
2021-05-25 00:11:50 +01:00
|
|
|
func (c *cmdAccessCreate) Setup(params clingy.Parameters) {
|
|
|
|
c.token = params.Flag("token", "Setup token from satellite UI (prompted if unspecified)", "").(string)
|
|
|
|
c.passphrase = params.Flag("passphrase", "Passphrase used for encryption (prompted if unspecified)", "").(string)
|
|
|
|
c.name = params.Flag("name", "Name to save newly created access, if --save is true", "default").(string)
|
|
|
|
c.save = params.Flag("save", "Save the access", true, clingy.Transform(strconv.ParseBool)).(bool)
|
2021-03-31 16:56:34 +01:00
|
|
|
|
2021-05-25 00:11:50 +01:00
|
|
|
c.accessPermissions.Setup(params)
|
2021-03-31 16:56:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmdAccessCreate) Execute(ctx clingy.Context) error {
|
|
|
|
return nil
|
|
|
|
}
|