Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = cli.Command{ Name: "grants", Action: cli.ShowSubcommandHelp, Description: "Administer grants", Subcommands: []*cli.Command{&CreateCommand}, }
View Source
var CreateCommand = cli.Command{ Name: "create", Action: func(c *cli.Context) error { api, err := types.NewClientWithResponses(c.String("api-url")) if err != nil { return err } b := types.PostGrantsJSONRequestBody{ Subject: "chris@commonfate.io", Start: iso8601.New(time.Now().Add(time.Second * 2)), End: iso8601.New(time.Now().Add(time.Hour)), Provider: "cf-dev", With: types.CreateGrant_With{ AdditionalProperties: map[string]string{"accountId": "123451234512"}, }, } res, err := api.PostGrantsWithResponse(c.Context, b) if err != nil { return err } if res.StatusCode() == http.StatusCreated { zap.S().Infow("created grant", "grant", res.JSON201.Grant) } else { zap.S().Infow("error creating grant", "error", res.JSON400.Error) } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.