Documentation ¶
Index ¶
Constants ¶
View Source
const DEFAULT_TIMEOUT = 3 * time.Minute
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "upload [FILE...]", Short: "Upload an API model or a set of traces to Akita.", SilenceUsage: true, Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { if destFlag == "" && serviceFlag == "" { return errors.New("required flag \"dest\" not set") } if destFlag != "" && serviceFlag != "" { return errors.New("cannot set both \"dest\" and \"service\" flags") } if specNameFlag != "" && destFlag != "" { return errors.New("\"name\" flag cannot be used with \"dest\" flag") } if destFlag == "" { destFlag = "akita://" + serviceFlag + ":spec" if specNameFlag != "" { destFlag += ":" + specNameFlag } } destURI, err := akiuri.Parse(destFlag) if err != nil { return errors.Wrapf(err, "%q is not a well-formed AkitaURI", destFlag) } if destURI.ObjectType == nil { return errors.New("\"dest\" must specify an object type. For example, \"akita://serviceName:trace\"") } if len(args) > 1 && destURI.ObjectType.IsSpec() { return errors.New("can only upload one API model at a time") } if appendFlag && !destURI.ObjectType.IsTrace() { return errors.New("\"append\" can only be used with trace objects") } if includeTrackersFlag && !destURI.ObjectType.IsTrace() { return errors.New("\"append\" can only be used with trace objects") } if pluginsFlag != nil && !destURI.ObjectType.IsTrace() { return errors.New("\"plugins\" can only be used with trace objects") } if appendFlag && len(tagsFlag) > 0 && !appendByTagFlag { return errors.New("\"append\" and \"tags\" cannot be used together") } tags, err := util.ParseTagsAndWarn(tagsFlag) if err != nil { return err } if appendByTagFlag { if !destURI.ObjectType.IsTrace() { return errors.New("\"append-by-tag\" can only be used with trace objects") } if destURI.ObjectName != "" { return errors.New("Cannot specify a trace name together with \"append-by-tag\"") } destURI, err = util.GetTraceURIByTags(akiflag.Domain, akiflag.GetClientID(), destURI.ServiceName, tags, "append-by-tag", ) if err != nil { return err } if destURI.ObjectName != "" { appendFlag = true } } uploadArgs := upload.Args{ ClientID: akiflag.GetClientID(), Domain: akiflag.Domain, DestURI: destURI, FilePaths: args, Tags: tags, Append: appendFlag, UploadTimeout: uploadTimeoutFlag, } if err := upload.Run(uploadArgs); err != nil { return cmderr.AkitaErr{Err: err} } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.