func (s *baseSuite) SetUpTest(c *gc.C) { s.BaseSuite.SetUpTest(c) s.JujuConnSuite.SetUpTest(c) client, err := backups.NewClient(s.APIState) c.Assert(err, gc.IsNil) s.client = client }
return newAPIClient(c) } // SetFlags implements Command.SetFlags. func (c *CommandBase) SetFlags(f *gnuflag.FlagSet) { if c.Log != nil { c.Log.AddFlags(f) } } var newAPIClient = func(c *CommandBase) (APIClient, error) { root, err := c.NewAPIRoot() if err != nil { return nil, errors.Trace(err) } return backups.NewClient(root) } // dumpMetadata writes the formatted backup metadata to stdout. func (c *CommandBase) dumpMetadata(ctx *cmd.Context, result *params.BackupsMetadataResult) { fmt.Fprintf(ctx.Stdout, "backup ID: %q\n", result.ID) fmt.Fprintf(ctx.Stdout, "checksum: %q\n", result.Checksum) fmt.Fprintf(ctx.Stdout, "checksum format: %q\n", result.ChecksumFormat) fmt.Fprintf(ctx.Stdout, "size (B): %d\n", result.Size) fmt.Fprintf(ctx.Stdout, "stored: %v\n", result.Stored) fmt.Fprintf(ctx.Stdout, "started: %v\n", result.Started) fmt.Fprintf(ctx.Stdout, "finished: %v\n", result.Finished) fmt.Fprintf(ctx.Stdout, "notes: %q\n", result.Notes) fmt.Fprintf(ctx.Stdout, "model ID: %q\n", result.Model)
func (s *baseSuite) SetUpTest(c *gc.C) { s.BaseSuite.SetUpTest(c) s.JujuConnSuite.SetUpTest(c) s.client = backups.NewClient(s.APIState) }