(ctx core.CommandContext)
| 16 | } |
| 17 | |
| 18 | func (c *updateCommand) Execute(ctx core.CommandContext) error { |
| 19 | organizationID, err := core.ResolveOrganizationID(ctx) |
| 20 | if err != nil { |
| 21 | return err |
| 22 | } |
| 23 | |
| 24 | name, group, err := c.buildGroup(ctx) |
| 25 | if err != nil { |
| 26 | return err |
| 27 | } |
| 28 | |
| 29 | body := openapi_client.GroupsUpdateGroupBody{} |
| 30 | domain := core.OrganizationDomainType() |
| 31 | body.SetDomainType(domain) |
| 32 | body.SetDomainId(organizationID) |
| 33 | body.SetGroup(group) |
| 34 | |
| 35 | response, _, err := ctx.API.GroupsAPI. |
| 36 | GroupsUpdateGroup(ctx.Context, name). |
| 37 | Body(body). |
| 38 | Execute() |
| 39 | if err != nil { |
| 40 | return err |
| 41 | } |
| 42 | |
| 43 | updated := response.GetGroup() |
| 44 | if !ctx.Renderer.IsText() { |
| 45 | return ctx.Renderer.Render(updated) |
| 46 | } |
| 47 | |
| 48 | return ctx.Renderer.RenderText(func(stdout io.Writer) error { |
| 49 | return renderGroupText(stdout, updated) |
| 50 | }) |
| 51 | } |
| 52 | |
| 53 | func (c *updateCommand) buildGroup(ctx core.CommandContext) (string, openapi_client.GroupsGroup, error) { |
| 54 | filePath := "" |
nothing calls this directly
no test coverage detected