-
Notifications
You must be signed in to change notification settings - Fork 26
Add support for Global API Key in Cli #3253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
5cfeea5
b35f2e2
4882a3d
ae3b696
5d55174
c1abb32
651603f
3962bb2
63ee9de
71b76ca
c0bf7ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,7 +60,7 @@ func New(prerunner pcmd.PreRunner) *cobra.Command { | |
| func (c *command) addResourceFlag(cmd *cobra.Command, isStore bool) { | ||
| description := "The ID of the resource the API key is for." | ||
| if !isStore { | ||
| description += ` Use "cloud" for a Cloud API key, "flink" for a Flink API key, or "tableflow" for a Tableflow API key.` | ||
| description += ` Use "cloud" for a Cloud API key, "global" for a Global API key, "flink" for a Flink API key, or "tableflow" for a Tableflow API key.` | ||
| } | ||
|
|
||
| cmd.Flags().String("resource", "", description) | ||
|
|
@@ -111,6 +111,7 @@ func (c *command) addResourceFlag(cmd *cobra.Command, isStore bool) { | |
| // TODO: update the suggestions when the suggestions[i] related with Tableflow is ready | ||
| if !isStore { | ||
| suggestions = append(suggestions, "cloud") | ||
| suggestions = append(suggestions, "global") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: keep the alphabetical ordering.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the order. |
||
| suggestions = append(suggestions, "flink") | ||
| suggestions = append(suggestions, "tableflow") | ||
| } | ||
|
|
@@ -192,7 +193,7 @@ func (c *command) resolveResourceId(cmd *cobra.Command, v2Client *ccloudv2.Clien | |
| var apiKey string | ||
|
|
||
| switch resourceType { | ||
| case presource.Cloud, presource.Flink, presource.Tableflow: | ||
| case presource.Cloud, presource.Flink, presource.Tableflow, presource.Global: | ||
| break | ||
| case presource.KafkaCluster: | ||
| cluster, err := kafka.FindCluster(c.V2Client, c.Context, resource) | ||
|
|
@@ -232,6 +233,8 @@ func getResourceType(resource apikeysv2.ObjectReference) string { | |
| switch resource.GetKind() { | ||
| case "Cloud": | ||
| return "cloud" | ||
| case "Global": | ||
| return "global" | ||
| case "Cluster": | ||
| if getResourceApi(resource) == "cmk" { | ||
| return "kafka" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,10 @@ func (c *command) newCreateCommand() *cobra.Command { | |
| Text: "Create a Cloud API key:", | ||
| Code: "confluent api-key create --resource cloud", | ||
| }, | ||
| examples.Example{ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we create the dedicated integration test in Something like:
|
||
| Text: "Create a Global API key:", | ||
| Code: "confluent api-key create --resource global", | ||
| }, | ||
| examples.Example{ | ||
| Text: `Create a Flink API key for region "N. Virginia (us-east-1)":`, | ||
| Code: "confluent api-key create --resource flink --cloud aws --region us-east-1", | ||
|
|
@@ -115,6 +119,8 @@ func (c *command) create(cmd *cobra.Command, _ []string) error { | |
| switch resourceType { | ||
| case resource.Cloud: | ||
| key.Spec.Resource.Id = resource.Cloud | ||
| case resource.Global: | ||
| key.Spec.Resource.Id = resource.Global | ||
| case resource.Flink: | ||
| environmentId, err := c.Context.EnvironmentId() | ||
| if err != nil { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.