Debian Codegraph @

cmdline/token/ping.go

raw symbols SCIP
1 //
2 // Copyright (c) SAS Institute Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 package tokenscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/
18
19 import (
20 "contextscip-go gomod github.com/golang/go/src go1.18 context/"
21 "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/"
22
23 "github.com/spf13/cobrascip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/"
24
25 "github.com/sassoftware/relic/v7/cmdline/sharedscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/shared`/"
26 )
27
28 var PingCmdscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/PingCmd. = &cobrascip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/Command#{
29 Usescip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/Command#Use.: "ping",
30 Shortscip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/Command#Short.: "Check whether a token is working",
31 RunEscip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/Command#RunE.: pingCmdscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/pingCmd().,
32 }
33
34 func initscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/init().() {
35 sharedscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/shared`/.RootCmdscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/shared`/RootCmd..AddCommandscip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/Command#AddCommand().(PingCmdscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/PingCmd.)
36 PingCmdscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/PingCmd..Flagsscip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/Command#Flags().().StringVarPscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/FlagSet#StringVarP().(&argTokenscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/argToken., "token", "t", "", "Name of token section in config file to use")
37 }
38
39 func pingCmdscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/pingCmd().(cmd *cobrascip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.6.1 `github.com/spf13/cobra`/Command#, args []string) error {
40 token, err := openTokenscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/openToken().(argTokenscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/token`/argToken.)
41 if err != nil {
42 return sharedscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/shared`/.Failscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/shared`/Fail().(err)
43 }
44 if err := token.Pingscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token`/Token#Ping.(contextscip-go gomod github.com/golang/go/src go1.18 context/.Backgroundscip-go gomod github.com/golang/go/src go1.18 context/Background().()); err != nil {
45 return sharedscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/shared`/.Failscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/cmdline/shared`/Fail().(err)
46 } else {
47 fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.18 fmt/Println().("OK")
48 }
49 return nil
50 }