-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compose: service bus and event hubs (#4743)
Add support for creating Service Bus and Event Hubs. Addresses #4742
- Loading branch information
1 parent
91ff41d
commit 908d888
Showing
15 changed files
with
377 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ envsubst | |
errcheck | ||
errorinfo | ||
errorlint | ||
eventhubs | ||
executil | ||
flexconsumption | ||
Frontends | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package add | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/azure/azure-dev/cli/azd/internal/names" | ||
"github.com/azure/azure-dev/cli/azd/pkg/input" | ||
"github.com/azure/azure-dev/cli/azd/pkg/project" | ||
) | ||
|
||
func fillEventHubs( | ||
ctx context.Context, | ||
r *project.ResourceConfig, | ||
console input.Console, | ||
p PromptOptions) (*project.ResourceConfig, error) { | ||
r.Name = "event-hubs" | ||
|
||
if _, exists := p.PrjConfig.Resources["event-hubs"]; exists { | ||
return nil, fmt.Errorf("only one event hubs resource is allowed at this time") | ||
} | ||
|
||
for { | ||
topicName, err := console.Prompt(ctx, input.ConsoleOptions{ | ||
Message: "Input the event hub name:", | ||
Help: "Event hub name\n\n" + | ||
"Name of the event hub that the app connects to. " + | ||
"Also known as a Kafka topic.", | ||
}) | ||
if err != nil { | ||
return r, err | ||
} | ||
|
||
if err := names.ValidateLabelName(topicName); err != nil { | ||
console.Message(ctx, err.Error()) | ||
continue | ||
} | ||
|
||
r.Props = project.EventHubsProps{ | ||
Hubs: []string{topicName}, | ||
} | ||
break | ||
} | ||
|
||
return r, nil | ||
} | ||
|
||
func fillServiceBus( | ||
ctx context.Context, | ||
r *project.ResourceConfig, | ||
console input.Console, | ||
p PromptOptions) (*project.ResourceConfig, error) { | ||
r.Name = "service-bus" | ||
|
||
if _, exists := p.PrjConfig.Resources["service-bus"]; exists { | ||
return nil, fmt.Errorf("only one service bus resource is allowed at this time") | ||
} | ||
|
||
for { | ||
queueName, err := console.Prompt(ctx, input.ConsoleOptions{ | ||
Message: "Input the queue name:", | ||
Help: "Service Bus queue name\n\n" + | ||
"Name of the queue that the app connects to. ", | ||
}) | ||
if err != nil { | ||
return r, err | ||
} | ||
|
||
if err := names.ValidateLabelName(queueName); err != nil { | ||
console.Message(ctx, err.Error()) | ||
continue | ||
} | ||
|
||
r.Props = project.ServiceBusProps{ | ||
Queues: []string{queueName}, | ||
} | ||
break | ||
} | ||
|
||
return r, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.