-
Notifications
You must be signed in to change notification settings - Fork 20
Azure support on csmt artifacts commands #3230
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 all commits
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 |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ func (c *artifactCommand) newCreateCommand() *cobra.Command { | |
| } | ||
|
|
||
| cmd.Flags().String("artifact-file", "", "Connect artifact JAR file or ZIP file.") | ||
| pcmd.AddCloudAwsFlag(cmd) | ||
| pcmd.AddCloudAwsAzureFlag(cmd) | ||
| pcmd.AddEnvironmentFlag(cmd, c.AuthenticatedCLICommand) | ||
| cmd.Flags().String("description", "", "Specify the Connect artifact description.") | ||
| pcmd.AddContextFlag(cmd, c.CLICommand) | ||
|
|
@@ -80,17 +80,24 @@ func (c *artifactCommand) createArtifact(cmd *cobra.Command, args []string) erro | |
| Environment: camv1.PtrString(environment), | ||
| } | ||
|
|
||
| if strings.ToLower(cloud) != "aws" { | ||
| return fmt.Errorf("only cloud supported is `AWS`") | ||
| supportedClouds := []string{"aws", "azure"} | ||
| if !slices.Contains(supportedClouds, strings.ToLower(cloud)) { | ||
| return fmt.Errorf("only clouds supported are `AWS` and `AZURE`") | ||
| } | ||
|
|
||
| resp, err := c.V2Client.GetArtifactPresignedUrl(request) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if err := utils.UploadFile(resp.GetUploadUrl(), artifactFile, resp.GetUploadFormData()); err != nil { | ||
| return err | ||
| if strings.ToLower(cloud) == "azure" { | ||
| if err := utils.UploadFileToAzureBlob(resp.GetUploadUrl(), artifactFile, strings.ToLower(resp.GetContentFormat())); err != nil { | ||
| return err | ||
| } | ||
| } else { | ||
| if err := utils.UploadFile(resp.GetUploadUrl(), artifactFile, resp.GetUploadFormData()); err != nil { | ||
|
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. lets rename UploadFile to refelect in the name that it is only for aws
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. Hi @tmalikconfluent |
||
| return err | ||
| } | ||
| } | ||
|
|
||
| createArtifactRequest := camv1.CamV1ConnectArtifact{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| +----------------+-------------------------------+ | ||
| | ID | cfa-azure-jar123 | | ||
| | Name | my-connect-artifact-azure-jar | | ||
| | Description | new-jar-artifact | | ||
| | Cloud | AZURE | | ||
| | Environment | env-123456 | | ||
| | Content Format | JAR | | ||
| | Status | PROCESSING | | ||
| +----------------+-------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| +----------------+-------------------------------+ | ||
| | ID | cfa-azure-zip123 | | ||
| | Name | my-connect-artifact-azure-zip | | ||
| | Description | new-zip-artifact | | ||
| | Cloud | AZURE | | ||
| | Environment | env-123456 | | ||
| | Content Format | ZIP | | ||
| | Status | PROCESSING | | ||
| +----------------+-------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Error: only cloud supported is `AWS` | ||
| Error: only clouds supported are `AWS` and `AZURE` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Deleted Connect Artifact "cfa-azure-zip123". |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Are you sure you want to delete Connect Artifact "cfa-azure-zip123"? (y/n): Deleted Connect Artifact "cfa-azure-zip123". |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| +----------------+-------------------------------+ | ||
| | ID | cfa-azure-jar123 | | ||
| | Name | my-connect-artifact-azure-jar | | ||
| | Description | new-jar-artifact | | ||
| | Cloud | AZURE | | ||
| | Environment | env-123456 | | ||
| | Content Format | JAR | | ||
| | Status | READY | | ||
| +----------------+-------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "id": "cfa-azure-jar123", | ||
| "name": "my-connect-artifact-azure-jar", | ||
| "description": "new-jar-artifact", | ||
| "cloud": "AZURE", | ||
| "environment": "env-123456", | ||
| "content_format": "JAR", | ||
| "status": "READY" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| id: cfa-azure-jar123 | ||
| name: my-connect-artifact-azure-jar | ||
| description: new-jar-artifact | ||
| cloud: AZURE | ||
| environment: env-123456 | ||
| content_format: JAR | ||
| status: READY |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| +----------------+-------------------------------+ | ||
| | ID | cfa-azure-zip123 | | ||
| | Name | my-connect-artifact-azure-zip | | ||
| | Description | new-zip-artifact | | ||
| | Cloud | AZURE | | ||
| | Environment | env-123456 | | ||
| | Content Format | ZIP | | ||
| | Status | PROCESSING | | ||
| +----------------+-------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| [ | ||
| { | ||
| "id": "cfa-azure-jar123", | ||
| "name": "my-connect-artifact-azure-jar", | ||
| "description": "new-jar-artifact", | ||
| "cloud": "AZURE", | ||
| "environment": "env-123456", | ||
| "content_format": "JAR", | ||
| "status": "READY" | ||
| }, | ||
| { | ||
| "id": "cfa-azure-zip123", | ||
| "name": "my-connect-artifact-azure-zip", | ||
| "description": "new-zip-artifact", | ||
| "cloud": "AZURE", | ||
| "environment": "env-123456", | ||
| "content_format": "ZIP", | ||
| "status": "PROCESSING" | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| - id: cfa-azure-jar123 | ||
| name: my-connect-artifact-azure-jar | ||
| description: new-jar-artifact | ||
| cloud: AZURE | ||
| environment: env-123456 | ||
| content_format: JAR | ||
| status: READY | ||
| - id: cfa-azure-zip123 | ||
| name: my-connect-artifact-azure-zip | ||
| description: new-zip-artifact | ||
| cloud: AZURE | ||
| environment: env-123456 | ||
| content_format: ZIP | ||
| status: PROCESSING |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| ID | Name | Description | Cloud | Environment | Content Format | Status | ||
| -------------------+-------------------------------+------------------+-------+-------------+----------------+------------- | ||
| cfa-azure-jar123 | my-connect-artifact-azure-jar | new-jar-artifact | AZURE | env-123456 | JAR | READY | ||
| cfa-azure-zip123 | my-connect-artifact-azure-zip | new-zip-artifact | AZURE | env-123456 | ZIP | PROCESSING |
Uh oh!
There was an error while loading. Please reload this page.