-
Notifications
You must be signed in to change notification settings - Fork 210
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
Extensions Framework: Adds gRPC proto files and generated services #4695
Open
wbreza
wants to merge
3
commits into
Azure:main
Choose a base branch
from
wbreza:grpc-services
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
PROTO_DIR=grpc/proto | ||
GEN_DIR=pkg/azdext | ||
INCLUDE_DIR=grpc/include # Local directory containing the protobuf include files | ||
|
||
.PHONY: all proto clean | ||
|
||
all: proto | ||
|
||
proto: | ||
# Generate server-side code | ||
mkdir -p $(GEN_DIR) | ||
# Generate code for all .proto files into the same package | ||
protoc --proto_path=$(INCLUDE_DIR) \ | ||
--proto_path=$(PROTO_DIR) \ | ||
--go_out=$(GEN_DIR) --go_opt=paths=source_relative \ | ||
--go-grpc_out=$(GEN_DIR) --go-grpc_opt=paths=source_relative \ | ||
$(PROTO_DIR)/*.proto | ||
|
||
clean: | ||
rm -rf $(GEN_DIR) |
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,33 @@ | ||
syntax = "proto3"; | ||
|
||
package azdext; | ||
|
||
option go_package = "github.com/azure/azure-dev/cli/azd/pkg/azdext/gen;azdext"; | ||
|
||
import "models.proto"; | ||
|
||
service DeploymentService { | ||
// Gets the current environment. | ||
rpc GetDeployment(EmptyRequest) returns (GetDeploymentResponse); | ||
|
||
rpc GetDeploymentContext(EmptyRequest) returns (GetDeploymentContextResponse); | ||
} | ||
|
||
message GetDeploymentResponse { | ||
Deployment deployment = 1; | ||
} | ||
|
||
message GetDeploymentContextResponse { | ||
azdext.AzureContext AzureContext = 1; | ||
} | ||
|
||
message Deployment { | ||
string id = 1; | ||
string location = 2; | ||
string deploymentId = 3; | ||
string name = 4; | ||
string type = 5; | ||
map<string, string> tags = 6; | ||
map<string,string> outputs = 7; | ||
repeated string resources = 8; | ||
} |
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,149 @@ | ||
syntax = "proto3"; | ||
|
||
package azdext; | ||
|
||
option go_package = "github.com/azure/azure-dev/cli/azd/pkg/azdext/gen;azdext"; | ||
|
||
import "models.proto"; | ||
|
||
// EnvironmentService defines methods for managing environments and their key-value pairs. | ||
service EnvironmentService { | ||
// Gets the current environment. | ||
rpc GetCurrent(EmptyRequest) returns (EnvironmentResponse); | ||
|
||
rpc List(EmptyRequest) returns (EnvironmentListResponse); | ||
|
||
// Get retrieves an environment by its name. | ||
rpc Get (GetEnvironmentRequest) returns (EnvironmentResponse); | ||
|
||
// Select sets the current environment to the specified environment. | ||
rpc Select (SelectEnvironmentRequest) returns (EmptyResponse); | ||
|
||
// GetValues retrieves all key-value pairs in the specified environment. | ||
rpc GetValues (GetEnvironmentRequest) returns (KeyValueListResponse); | ||
|
||
// GetValue retrieves the value of a specific key in the specified environment. | ||
rpc GetValue (GetEnvRequest) returns (KeyValueResponse); | ||
|
||
// SetValue sets the value of a key in the specified environment. | ||
rpc SetValue (SetEnvRequest) returns (EmptyResponse); | ||
|
||
// RPC for getting a config value by path | ||
rpc GetConfig (GetConfigRequest) returns (GetConfigResponse); | ||
|
||
// RPC for getting a config value as a string by path | ||
rpc GetConfigString (GetConfigStringRequest) returns (GetConfigStringResponse); | ||
|
||
// RPC for getting a config section by path | ||
rpc GetConfigSection (GetConfigSectionRequest) returns (GetConfigSectionResponse); | ||
|
||
// RPC for setting a config value at a given path | ||
rpc SetConfig (SetConfigRequest) returns (EmptyResponse); | ||
|
||
// RPC for unsetting a config value at a given path | ||
rpc UnsetConfig (UnsetConfigRequest) returns (EmptyResponse); | ||
} | ||
|
||
// Request to retrieve an environment by name. | ||
message GetEnvironmentRequest { | ||
string name = 1; // Name of the environment. | ||
} | ||
|
||
message SelectEnvironmentRequest { | ||
string name = 1; // Name of the environment. | ||
} | ||
|
||
// Request to retrieve a specific key-value pair. | ||
message GetEnvRequest { | ||
string env_name = 1; // Name of the environment. | ||
string key = 2; // Key to retrieve. | ||
} | ||
|
||
// Request to set a key-value pair. | ||
message SetEnvRequest { | ||
string env_name = 1; // Name of the environment. | ||
string key = 2; // Key to set. | ||
string value = 3; // Value to set for the key. | ||
} | ||
|
||
// Response containing details of an environment. | ||
message EnvironmentResponse { | ||
Environment environment = 1; // Environment details. | ||
} | ||
|
||
message EnvironmentListResponse { | ||
repeated EnvironmentDescription environments = 1; // List of environments. | ||
} | ||
|
||
// Response containing a list of key-value pairs. | ||
message KeyValueListResponse { | ||
repeated KeyValue key_values = 1; // List of key-value pairs. | ||
} | ||
|
||
// Response containing a single key-value pair. | ||
message KeyValueResponse { | ||
string key = 1; // Key name. | ||
string value = 2; // Value associated with the key. | ||
} | ||
|
||
// Environment object definition. | ||
message Environment { | ||
string name = 1; // Name of the environment. | ||
} | ||
|
||
message EnvironmentDescription { | ||
string name = 1; // Name of the environment. | ||
bool local = 2; // Whether the environment is local. | ||
bool remote = 3; // Whether the environment is remote. | ||
bool default = 4; // Whether the environment is the default. | ||
} | ||
|
||
// Key-value pair definition. | ||
message KeyValue { | ||
string key = 1; // Key name. | ||
string value = 2; // Value associated with the key. | ||
} | ||
|
||
// Request message for Get | ||
message GetConfigRequest { | ||
string path = 1; | ||
} | ||
|
||
// Response message for Get | ||
message GetConfigResponse { | ||
bytes value = 1; | ||
bool found = 2; | ||
} | ||
|
||
// Request message for GetString | ||
message GetConfigStringRequest { | ||
string path = 1; | ||
} | ||
|
||
// Response message for GetString | ||
message GetConfigStringResponse { | ||
string value = 1; | ||
bool found = 2; | ||
} | ||
|
||
// Request message for GetSection | ||
message GetConfigSectionRequest { | ||
string path = 1; | ||
} | ||
|
||
// Response message for GetSection | ||
message GetConfigSectionResponse { | ||
bytes section = 1; | ||
bool found = 2; | ||
} | ||
|
||
// Request message for Set | ||
message SetConfigRequest { | ||
string path = 1; | ||
bytes value = 2; | ||
} | ||
|
||
// Request message for Unset | ||
message UnsetConfigRequest { | ||
string path = 1; | ||
} |
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,59 @@ | ||
syntax = "proto3"; | ||
|
||
package azdext; | ||
|
||
option go_package = "github.com/azure/azure-dev/cli/azd/pkg/azdext/gen;azdext"; | ||
|
||
// Messages for requests and responses | ||
message EmptyRequest {} | ||
|
||
// EmptyResponse message for methods with no output. | ||
message EmptyResponse {} | ||
|
||
// Message representing a Subscription | ||
message Subscription { | ||
string id = 1; | ||
string name = 2; | ||
string tenantId = 3; | ||
string userAccessTenant_id = 4; | ||
bool isDefault = 5; | ||
} | ||
|
||
message ResourceGroup { | ||
string id = 1; | ||
string name = 2; | ||
string location = 3; | ||
} | ||
|
||
message Location { | ||
string name = 1; | ||
string displayName = 2; | ||
string regionalDisplayName = 3; | ||
} | ||
|
||
message AzureScope { | ||
string tenantId = 1; | ||
string subscriptionId = 2; | ||
string location = 3; | ||
string resourceGroup = 4; | ||
} | ||
|
||
message AzureContext { | ||
AzureScope scope = 1; | ||
repeated string resources = 2; | ||
} | ||
|
||
message Resource { | ||
string id = 1; | ||
string name = 2; | ||
string type = 3; | ||
string location = 4; | ||
} | ||
|
||
message ResourceExtended { | ||
string id = 1; | ||
string name = 2; | ||
string type = 3; | ||
string location = 4; | ||
string kind = 5; | ||
} |
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,58 @@ | ||
syntax = "proto3"; | ||
|
||
package azdext; | ||
|
||
option go_package = "github.com/azure/azure-dev/cli/azd/pkg/azdext/gen;azdext"; | ||
|
||
import "models.proto"; | ||
|
||
// ProjectService defines methods for managing projects and their configurations. | ||
service ProjectService { | ||
// Gets the current project. | ||
rpc Get(EmptyRequest) returns (GetProjectResponse); | ||
} | ||
|
||
// ProjectConfig message definition | ||
message ProjectConfig { | ||
string name = 1; | ||
string resource_group_name = 2; | ||
string path = 3; | ||
ProjectMetadata metadata = 4; | ||
map<string, ServiceConfig> services = 5; | ||
InfraOptions infra = 6; | ||
} | ||
|
||
// GetProjectResponse message definition | ||
message GetProjectResponse { | ||
ProjectConfig project = 1; | ||
} | ||
|
||
// RequiredVersions message definition | ||
message RequiredVersions { | ||
string azd = 1; | ||
} | ||
|
||
// ProjectMetadata message definition | ||
message ProjectMetadata { | ||
string template = 1; | ||
} | ||
|
||
// ServiceConfig message definition | ||
message ServiceConfig { | ||
string name = 1; | ||
string resource_group_name = 2; | ||
string resource_name = 3; | ||
string api_version = 4; | ||
string relative_path = 5; | ||
string host = 6; | ||
string language = 7; | ||
string output_path = 8; | ||
string image = 9; | ||
} | ||
|
||
// InfraOptions message definition | ||
message InfraOptions { | ||
string provider = 1; | ||
string path = 2; | ||
string module = 3; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add notes to https://github.com/Azure/azure-dev/blob/main/cli/azd/CONTRIBUTING.md about how to run this file to generate files when needed