MCPcopy Create free account
hub / github.com/anchordotdev/cli / realmAPID

Method realmAPID

lcl/setup.go:259–288  ·  view source on GitHub ↗
(ctx context.Context, cfg *cli.Config, drv *ui.Driver, orgAPID string)

Source from the content-addressed store, hash-verified

257}
258
259func (c *Setup) realmAPID(ctx context.Context, cfg *cli.Config, drv *ui.Driver, orgAPID string) (string, error) {
260 if c.RealmAPID != "" {
261 return c.RealmAPID, nil
262 }
263
264 if cfg.Lcl.RealmAPID != "" {
265 drv.Activate(ctx, &componentmodels.ConfigVia{
266 Config: cfg,
267 ConfigFetchFn: func(cfg *cli.Config) any { return cfg.Lcl.RealmAPID },
268 Flag: "--realm",
269 Singular: "realm",
270 })
271 return cfg.Lcl.RealmAPID, nil
272 }
273
274 selector := &component.Selector[api.Realm]{
275 Prompt: fmt.Sprintf("Which %s realm's lcl.host local development environment do you want to setup?", ui.Emphasize(orgAPID)),
276 Flag: "--realm",
277
278 Fetcher: &component.Fetcher[api.Realm]{
279 FetchFn: func() ([]api.Realm, error) { return c.anc.GetOrgRealms(ctx, orgAPID) },
280 },
281 }
282
283 realm, err := selector.Choice(ctx, drv)
284 if err != nil {
285 return "", err
286 }
287 return realm.Apid, nil
288}
289
290func (c *Setup) serviceAPID(ctx context.Context, cfg *cli.Config, drv *ui.Driver, orgAPID, realmAPID string) (string, error) {
291 if c.ServiceAPID != "" {

Callers 1

performMethod · 0.95

Calls 3

ActivateMethod · 0.80
GetOrgRealmsMethod · 0.80
ChoiceMethod · 0.80

Tested by

no test coverage detected