refact(credentiallibrary): Switch subtype attributes to oneof
This updates the credential library resources to use a oneof for attributes. This allows requests to the credential library service to leverage the new subtypes.AttributeTransformerInterceptor so that attributes are strongly typed prior to the service handler.
This commit is contained in:
1 parent
95315a3e0a
commit
3d4ba0389e
12 files changed
+542
-529
No files matched your search
+18
-4
@@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/api/visibility.proto";
|
||||
import "controller/api/resources/scopes/v1/scope.proto";
|
||||
import "controller/custom_options/v1/options.proto";
|
||||
|
||||
@@ -16,7 +17,10 @@ message CredentialLibrary {
|
||||
string id = 10;
|
||||
|
||||
// The ID of the Credential Store of which this Credential Library is a part.
|
||||
string credential_store_id = 20 [json_name = "credential_store_id"];
|
||||
string credential_store_id = 20 [
|
||||
json_name = "credential_store_id",
|
||||
(controller.custom_options.v1.subtype_source_id) = true
|
||||
];
|
||||
|
||||
// Output only. Scope information for this Credential Library.
|
||||
resources.scopes.v1.ScopeInfo scope = 30;
|
||||
@@ -40,8 +44,18 @@ message CredentialLibrary {
|
||||
// The Credential Library type.
|
||||
string type = 90;
|
||||
|
||||
// The attributes that are applicable for the specific Credential Library type.
|
||||
google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true];
|
||||
oneof attrs {
|
||||
// The attributes that are applicable for the specific Credential Library type.
|
||||
google.protobuf.Struct attributes = 100 [
|
||||
(custom_options.v1.generate_sdk_option) = true,
|
||||
(custom_options.v1.subtype) = "default"
|
||||
];
|
||||
VaultCredentialLibraryAttributes vault_credential_library_attributes = 101 [
|
||||
(google.api.field_visibility).restriction = "INTERNAL",
|
||||
(custom_options.v1.generate_sdk_option) = true,
|
||||
(custom_options.v1.subtype) = "vault"
|
||||
];
|
||||
}
|
||||
|
||||
// Output only. The available actions on this resource for this user.
|
||||
repeated string authorized_actions = 300 [json_name = "authorized_actions"];
|
||||
@@ -63,4 +77,4 @@ message VaultCredentialLibraryAttributes {
|
||||
|
||||
// The body of the HTTP request the library sends to vault. When set http_method must be "POST"
|
||||
google.protobuf.StringValue http_request_body = 30 [json_name = "http_request_body", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_request_body" that: "HttpRequestBody" }];
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "controller/api/resources/credentiallibraries/v1/credential_library.proto";
|
||||
import "controller/custom_options/v1/options.proto";
|
||||
|
||||
option (custom_options.v1.domain) = "credential";
|
||||
|
||||
service CredentialLibraryService {
|
||||
// GetCredentialLibrary returns a stored Credential Library if present. The provided request
|
||||
|
||||
Reference in new issue
Block a user