Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CompletionCmd = &cobra.Command{ Use: "completion", Short: TRCLI("cli.completion.summary"), Long: TRCLI("cli.completion.description"), RunE: func(cmd *cobra.Command, args []string) error { err := RootCmd.GenBashCompletion(os.Stdout) if err != nil { return err } return nil }, }
CompletionCmd defines 'completion' subcommand
View Source
var ConfigureCmd = &cobra.Command{ Use: "configure", Short: TRCLI("cli.configure.summary"), Long: TRCLI("cli.configure.description"), RunE: func(cmd *cobra.Command, args []string) error { pn := getSpecifiedProfileName() if pn == "" { pn = "default" } profile, err := collectProfileInfo(pn) if err != nil { cmd.SilenceUsage = true return err } err = saveProfile(pn, profile, configureOverwrite) if err != nil { cmd.SilenceUsage = true return err } return nil }, }
ConfigureCmd defines 'configure' subcommand
View Source
var ConfigureGetCmd = &cobra.Command{ Use: "get", Short: TRCLI("cli.configure.get.summary"), Long: TRCLI("cli.configure.get.description"), RunE: func(cmd *cobra.Command, args []string) error { pn := getSpecifiedProfileName() if pn == "" { pn = "default" } p, err := loadProfile(pn) if err != nil { return err } return prettyPrintObjectAsJSON(p, os.Stdout) }, }
ConfigureGetCmd defineds 'get' subcommand
View Source
var ConfigureSandboxCmd = &cobra.Command{ Use: "configure-sandbox", Short: TRCLI("cli.configure_sandbox.summary"), Long: TRCLI("cli.configure_sandbox.description"), RunE: func(cmd *cobra.Command, args []string) error { pn := getSpecifiedSandboxProfileName() var p *profile var err error if configureSandboxAuthKeyID == "" || configureSandboxAuthKey == "" || configureSandboxEmail == "" || configureSandboxPassword == "" { p, err = collectSandboxProfileInfo(pn, configureSandboxRegisterPaymentMethod) if err != nil { cmd.SilenceUsage = true return err } ep := getSpecifiedSandboxEndpoint(p.CoverageType) p.Endpoint = &ep } else { ct := getSpecifiedCoverageType() ep := getSpecifiedSandboxEndpoint(ct) p = &profile{ Sandbox: true, CoverageType: ct, Endpoint: &ep, AuthKeyID: &configureSandboxAuthKeyID, AuthKey: &configureSandboxAuthKey, Email: &configureSandboxEmail, Password: &configureSandboxPassword, RegisterPaymentMethod: configureSandboxRegisterPaymentMethod, } } _, err = sandboxInit(p) if err != nil { cmd.SilenceUsage = true return err } p.AuthKeyID = nil p.AuthKey = nil err = saveProfile(pn, p, configureSandboxOverwrite) if err != nil { cmd.SilenceUsage = true return err } return nil }, }
ConfigureSandboxCmd defines 'configure-sandbox' subcommand
View Source
var SelfUpdateCmd = &cobra.Command{ Use: "self-update", Short: TRCLI("cli.self_update.summary"), Long: TRCLI("cli.self_update.description"), RunE: func(cmd *cobra.Command, args []string) error { latestReleased, err := retrieveLatestReleasedFromGitHub() if err != nil { return err } if !isNewerThanCurrentVersion(latestReleased.TagName) { fmt.Printf(TRCLI("cli.self_update.already_latest"), version) return nil } fmt.Printf(TRCLI("cli.self_update.prompt_confirmation"), latestReleased.TagName, strings.TrimPrefix(latestReleased.TagName, "v"), runtime.GOARCH) yes, err := readDefaultNoConfirmationPrompt() if err != nil { return err } if !yes { return errors.New("abort") } downloaded, err := downloadExecutableBinary(latestReleased.TagName, latestReleased.Assets) if err != nil { return err } err = swapExecutableBinaryFile(downloaded) if err != nil { return err } fmt.Println(TRCLI("cli.self_update.update_finished")) return nil }, }
View Source
var Test500Cmd = &cobra.Command{ Use: "500", Short: TRCLI("cli.test._500.summary"), Long: TRCLI("cli.test._500.description"), RunE: func(cmd *cobra.Command, args []string) error { opt := &apiClientOptions{ BasePath: "/", Language: getSelectedLanguage(), } ac := newAPIClient(opt) if v := os.Getenv("SORACOM_VERBOSE"); v != "" { ac.SetVerbose(true) } param := &apiParams{ method: "POST", path: "500", contentType: "application/json", body: `{"expect":"500 Internal Server Error"}`, } _, err := ac.callAPI(param) return err }, }
Test500Cmd defines 'test 500' subcommand
View Source
var TestCmd = &cobra.Command{ Use: "test", Short: TRCLI("cli.test.summary"), Long: TRCLI("cli.test.description"), Hidden: true, }
TestCmd defines 'test' subcommand
View Source
var UnconfigureCmd = &cobra.Command{ Use: "unconfigure", Short: TRCLI("cli.unconfigure.summary"), Long: TRCLI("cli.unconfigure.description"), RunE: func(cmd *cobra.Command, args []string) error { pn := getSpecifiedProfileName() if pn == "" { pn = "default" } if confirmDeleteProfile(pn) { err := deleteProfile(pn) if err != nil { cmd.SilenceUsage = true return err } } return nil }, }
UnconfigureCmd defines 'unconfigure' subcommand
View Source
var VersionCmd = &cobra.Command{ Use: "version", Short: TRCLI("cli.version.summary"), Long: TRCLI("cli.version.description"), Run: func(cmd *cobra.Command, args []string) { fmt.Printf("SORACOM API client v%s\n", version) }, }
VersionCmd defines 'version' subcommand
Functions ¶
Types ¶
type APICredentials ¶ added in v1.1.1
type APICredentialsSource ¶ added in v1.1.1
type APICredentialsSource interface {
GetAPICredentials(ac *apiClient) (*APICredentials, error)
}
Source Files
¶
- api_credentials.go
- api_credentials_source.go
- apiclient.go
- auth_request.go
- auth_result.go
- check_param.go
- completion.go
- configure.go
- configure_get.go
- configure_sandbox.go
- endpoint.go
- harvest_files_path_escape.go
- lang_utils.go
- pretty_print_json.go
- profiles.go
- prompt.go
- self_update.go
- stringutils.go
- switch_user_request.go
- test.go
- to_json.go
- version.go
- version_checker.go
Click to show internal directories.
Click to hide internal directories.