diff --git a/api/accounts/account.gen.go b/api/accounts/account.gen.go index 47e70bd0b..bcad294d8 100644 --- a/api/accounts/account.gen.go +++ b/api/accounts/account.gen.go @@ -23,6 +23,7 @@ type Account struct { Type string `json:"type,omitempty"` AuthMethodId string `json:"auth_method_id,omitempty"` Attributes map[string]interface{} `json:"attributes,omitempty"` + ManagedGroupIds []string `json:"managed_group_ids,omitempty"` AuthorizedActions []string `json:"authorized_actions,omitempty"` response *api.Response diff --git a/globals/fields.go b/globals/fields.go index 56d8fd652..b8a467ca5 100644 --- a/globals/fields.go +++ b/globals/fields.go @@ -53,4 +53,6 @@ const ( FullNameField = "full_name" PrimaryAccountIdField = "primary_account_id" EmailField = "email" + ManagedGroupIdsField = "managed_group_ids" + FilterField = "filter" ) diff --git a/internal/auth/oidc/store/oidc.pb.go b/internal/auth/oidc/store/oidc.pb.go index 99b9bf055..c29acd120 100644 --- a/internal/auth/oidc/store/oidc.pb.go +++ b/internal/auth/oidc/store/oidc.pb.go @@ -1202,7 +1202,7 @@ var file_controller_storage_auth_oidc_store_v1_oidc_proto_rawDesc = []byte{ 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, - 0x69, 0x6d, 0x65, 0x22, 0xbf, 0x03, 0x0a, 0x0c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, + 0x69, 0x6d, 0x65, 0x22, 0xa6, 0x03, 0x0a, 0x0c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, @@ -1222,30 +1222,29 @@ var file_controller_storage_auth_oidc_store_v1_oidc_proto_rawDesc = []byte{ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x3c, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, - 0x46, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xc2, 0xdd, 0x29, 0x1e, 0x0a, 0x0c, 0x41, 0x75, 0x74, - 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x52, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x14, 0xc2, 0xdd, 0x29, 0x10, 0x0a, 0x06, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0xaf, 0x01, 0x0a, 0x19, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, - 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, - 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x65, - 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, - 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6f, 0x69, 0x64, 0x63, 0x2f, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x46, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x50, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x1f, 0xc2, 0xdd, 0x29, 0x1b, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x12, 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x66, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0xaf, 0x01, 0x0a, + 0x19, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, + 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x1e, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x42, 0x3e, + 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, + 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6f, 0x69, + 0x64, 0x63, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/cmd/commands/accountscmd/funcs.go b/internal/cmd/commands/accountscmd/funcs.go index 54a2889fa..cb18ecbac 100644 --- a/internal/cmd/commands/accountscmd/funcs.go +++ b/internal/cmd/commands/accountscmd/funcs.go @@ -281,6 +281,14 @@ func printItemTable(result api.GenericResult) string { ) } + if len(item.ManagedGroupIds) > 0 { + ret = append(ret, + "", + " Managed Group IDs:", + base.WrapSlice(4, item.ManagedGroupIds), + ) + } + if len(item.AuthorizedActions) > 0 { ret = append(ret, "", diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index dc567010f..1d34c0216 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -29,6 +29,9 @@ { "name": "HostSetService" }, + { + "name": "ManagedGroupService" + }, { "name": "RoleService" }, @@ -1367,6 +1370,147 @@ ] } }, + "/v1/managed-groups": { + "get": { + "summary": "Lists all ManagedGroups in a specific Auth Method.", + "operationId": "ManagedGroupService_ListManagedGroups", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/controller.api.services.v1.ListManagedGroupsResponse" + } + } + }, + "parameters": [ + { + "name": "auth_method_id", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "controller.api.services.v1.ManagedGroupService" + ] + }, + "post": { + "summary": "Creates a single ManagedGroup in the provided Auth Method.", + "operationId": "ManagedGroupService_CreateManagedGroup", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + ], + "tags": [ + "controller.api.services.v1.ManagedGroupService" + ] + } + }, + "/v1/managed-groups/{id}": { + "get": { + "summary": "Gets a single ManagedGroup.", + "operationId": "ManagedGroupService_GetManagedGroup", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "controller.api.services.v1.ManagedGroupService" + ] + }, + "delete": { + "summary": "Deletes a ManagedGroup.", + "operationId": "ManagedGroupService_DeleteManagedGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/controller.api.services.v1.DeleteManagedGroupResponse" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "controller.api.services.v1.ManagedGroupService" + ] + }, + "patch": { + "summary": "Updates a ManagedGroup.", + "operationId": "ManagedGroupService_UpdateManagedGroup", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + }, + { + "name": "update_mask", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "controller.api.services.v1.ManagedGroupService" + ] + } + }, "/v1/roles": { "get": { "summary": "Lists all Roles.", @@ -2544,6 +2688,14 @@ "type": "object", "description": "The attributes that are applicable for the specific Account type." }, + "managed_group_ids": { + "type": "array", + "items": { + "type": "string" + }, + "title": "Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account", + "readOnly": true + }, "authorized_actions": { "type": "array", "items": { @@ -2998,6 +3150,67 @@ }, "title": "HostSet is a collection of Hosts created and managed by a Host Catalog" }, + "controller.api.resources.managedgroups.v1.ManagedGroup": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Output only. The ID of the ManagedGroup.", + "readOnly": true + }, + "scope": { + "$ref": "#/definitions/controller.api.resources.scopes.v1.ScopeInfo", + "description": "Output only. Scope information for the ManagedGroup.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "Optional name for identification purposes." + }, + "description": { + "type": "string", + "description": "Optional user-set description for identification purposes." + }, + "created_time": { + "type": "string", + "format": "date-time", + "description": "Output only. The time this resource was created.", + "readOnly": true + }, + "updated_time": { + "type": "string", + "format": "date-time", + "description": "Output only. The time this resource was last updated.", + "readOnly": true + }, + "version": { + "type": "integer", + "format": "int64", + "description": "Version is used in mutation requests, after the initial creation, to ensure this resource has not changed.\nThe mutation will fail if the version does not match the latest known good version." + }, + "type": { + "type": "string", + "description": "The type of this ManagedGroup." + }, + "auth_method_id": { + "type": "string", + "description": "The ID of the Auth Method that is associated with this ManagedGroup." + }, + "attributes": { + "type": "object", + "description": "The attributes that are applicable for the specific ManagedGroup type." + }, + "authorized_actions": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Output only. The available actions on this resource for this user.", + "readOnly": true + } + }, + "title": "ManagedGroup contains all fields related to an ManagedGroup resource" + }, "controller.api.resources.roles.v1.Grant": { "type": "object", "properties": { @@ -4067,6 +4280,17 @@ } } }, + "controller.api.services.v1.CreateManagedGroupResponse": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "item": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + }, "controller.api.services.v1.CreateRoleResponse": { "type": "object", "properties": { @@ -4132,6 +4356,9 @@ "controller.api.services.v1.DeleteHostSetResponse": { "type": "object" }, + "controller.api.services.v1.DeleteManagedGroupResponse": { + "type": "object" + }, "controller.api.services.v1.DeleteRoleResponse": { "type": "object" }, @@ -4200,6 +4427,14 @@ } } }, + "controller.api.services.v1.GetManagedGroupResponse": { + "type": "object", + "properties": { + "item": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + }, "controller.api.services.v1.GetRoleResponse": { "type": "object", "properties": { @@ -4317,6 +4552,17 @@ } } }, + "controller.api.services.v1.ListManagedGroupsResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + } + }, "controller.api.services.v1.ListRolesResponse": { "type": "object", "properties": { @@ -4770,6 +5016,14 @@ } } }, + "controller.api.services.v1.UpdateManagedGroupResponse": { + "type": "object", + "properties": { + "item": { + "$ref": "#/definitions/controller.api.resources.managedgroups.v1.ManagedGroup" + } + } + }, "controller.api.services.v1.UpdateRoleResponse": { "type": "object", "properties": { diff --git a/internal/gen/controller/api/resources/accounts/account.pb.go b/internal/gen/controller/api/resources/accounts/account.pb.go index 85083d190..7f23c0d55 100644 --- a/internal/gen/controller/api/resources/accounts/account.pb.go +++ b/internal/gen/controller/api/resources/accounts/account.pb.go @@ -52,6 +52,8 @@ type Account struct { AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` // The attributes that are applicable for the specific Account type. Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account + ManagedGroupIds []string `protobuf:"bytes,110,rep,name=managed_group_ids,proto3" json:"managed_group_ids,omitempty"` // Output only. The available actions on this resource for this user. AuthorizedActions []string `protobuf:"bytes,300,rep,name=authorized_actions,proto3" json:"authorized_actions,omitempty"` } @@ -158,6 +160,13 @@ func (x *Account) GetAttributes() *structpb.Struct { return nil } +func (x *Account) GetManagedGroupIds() []string { + if x != nil { + return x.ManagedGroupIds + } + return nil +} + func (x *Account) GetAuthorizedActions() []string { if x != nil { return x.AuthorizedActions @@ -235,7 +244,7 @@ type OidcAccountAttributes struct { // subject is a case sensitive string that maps to the OIDC sub claim. // This value is immutable after creation time. Subject string `protobuf:"bytes,90,opt,name=subject,proto3" json:"subject,omitempty"` - // Output only. full_name is a string that maps to the OIDC name claim + // Output only. full_name is a string that maps to the OIDC name claim. FullName string `protobuf:"bytes,100,opt,name=full_name,proto3" json:"full_name,omitempty"` // Output only. email is a string that maps to the OIDC email claim. Email string `protobuf:"bytes,110,opt,name=email,proto3" json:"email,omitempty"` @@ -321,7 +330,7 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0, 0x04, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x04, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, @@ -355,35 +364,38 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, - 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, 0xda, 0x29, 0x01, - 0xc2, 0xdd, 0x29, 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x2e, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x4c, 0x6f, 0x67, - 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x14, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x22, 0x89, 0x01, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x06, - 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, - 0x29, 0x01, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, - 0x01, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x75, - 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, - 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, - 0x6c, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x42, 0x57, - 0x5a, 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, - 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, + 0x29, 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6c, + 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x14, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x22, 0x89, 0x01, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x06, 0x69, 0x73, + 0x73, 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, + 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, + 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x75, 0x6c, + 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, + 0x6e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x42, 0x57, 0x5a, 0x55, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/gen/controller/api/resources/managedgroups/managed_group.pb.go b/internal/gen/controller/api/resources/managedgroups/managed_group.pb.go new file mode 100644 index 000000000..1a6891c78 --- /dev/null +++ b/internal/gen/controller/api/resources/managedgroups/managed_group.pb.go @@ -0,0 +1,375 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.8 +// source: controller/api/resources/managedgroups/v1/managed_group.proto + +package managedgroups + +import ( + scopes "github.com/hashicorp/boundary/internal/gen/controller/api/resources/scopes" + _ "github.com/hashicorp/boundary/internal/gen/controller/protooptions" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ManagedGroup contains all fields related to an ManagedGroup resource +type ManagedGroup struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Output only. The ID of the ManagedGroup. + Id string `protobuf:"bytes,10,opt,name=id,proto3" json:"id,omitempty"` + // Output only. Scope information for the ManagedGroup. + Scope *scopes.ScopeInfo `protobuf:"bytes,20,opt,name=scope,proto3" json:"scope,omitempty"` + // Optional name for identification purposes. + Name *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=name,proto3" json:"name,omitempty"` + // Optional user-set description for identification purposes. + Description *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=description,proto3" json:"description,omitempty"` + // Output only. The time this resource was created. + CreatedTime *timestamppb.Timestamp `protobuf:"bytes,50,opt,name=created_time,proto3" json:"created_time,omitempty"` + // Output only. The time this resource was last updated. + UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,60,opt,name=updated_time,proto3" json:"updated_time,omitempty"` + // Version is used in mutation requests, after the initial creation, to ensure this resource has not changed. + // The mutation will fail if the version does not match the latest known good version. + Version uint32 `protobuf:"varint,70,opt,name=version,proto3" json:"version,omitempty"` + // The type of this ManagedGroup. + Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"` + // The ID of the Auth Method that is associated with this ManagedGroup. + AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` + // The attributes that are applicable for the specific ManagedGroup type. + Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Output only. The available actions on this resource for this user. + AuthorizedActions []string `protobuf:"bytes,300,rep,name=authorized_actions,proto3" json:"authorized_actions,omitempty"` +} + +func (x *ManagedGroup) Reset() { + *x = ManagedGroup{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ManagedGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ManagedGroup) ProtoMessage() {} + +func (x *ManagedGroup) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ManagedGroup.ProtoReflect.Descriptor instead. +func (*ManagedGroup) Descriptor() ([]byte, []int) { + return file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescGZIP(), []int{0} +} + +func (x *ManagedGroup) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ManagedGroup) GetScope() *scopes.ScopeInfo { + if x != nil { + return x.Scope + } + return nil +} + +func (x *ManagedGroup) GetName() *wrapperspb.StringValue { + if x != nil { + return x.Name + } + return nil +} + +func (x *ManagedGroup) GetDescription() *wrapperspb.StringValue { + if x != nil { + return x.Description + } + return nil +} + +func (x *ManagedGroup) GetCreatedTime() *timestamppb.Timestamp { + if x != nil { + return x.CreatedTime + } + return nil +} + +func (x *ManagedGroup) GetUpdatedTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedTime + } + return nil +} + +func (x *ManagedGroup) GetVersion() uint32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *ManagedGroup) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ManagedGroup) GetAuthMethodId() string { + if x != nil { + return x.AuthMethodId + } + return "" +} + +func (x *ManagedGroup) GetAttributes() *structpb.Struct { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *ManagedGroup) GetAuthorizedActions() []string { + if x != nil { + return x.AuthorizedActions + } + return nil +} + +// Attributes associated only with ManagedGroups with type "oidc". +type OidcManagedGroupAttributes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The boolean expression filter to use to determine membership. + Filter string `protobuf:"bytes,10,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (x *OidcManagedGroupAttributes) Reset() { + *x = OidcManagedGroupAttributes{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OidcManagedGroupAttributes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OidcManagedGroupAttributes) ProtoMessage() {} + +func (x *OidcManagedGroupAttributes) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OidcManagedGroupAttributes.ProtoReflect.Descriptor instead. +func (*OidcManagedGroupAttributes) Descriptor() ([]byte, []int) { + return file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescGZIP(), []int{1} +} + +func (x *OidcManagedGroupAttributes) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +var File_controller_api_resources_managedgroups_v1_managed_group_proto protoreflect.FileDescriptor + +var file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDesc = []byte{ + 0x0a, 0x3d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x29, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd5, 0x04, 0x0a, 0x0c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, + 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, + 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x3d, 0x0a, + 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, + 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x59, 0x0a, + 0x1a, 0x4f, 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x23, 0xa0, 0xda, 0x29, + 0x01, 0xc2, 0xdd, 0x29, 0x1b, 0x0a, 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x2e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x61, 0x5a, 0x5f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, + 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x3b, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescOnce sync.Once + file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescData = file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDesc +) + +func file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescGZIP() []byte { + file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescOnce.Do(func() { + file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescData) + }) + return file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDescData +} + +var file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_controller_api_resources_managedgroups_v1_managed_group_proto_goTypes = []interface{}{ + (*ManagedGroup)(nil), // 0: controller.api.resources.managedgroups.v1.ManagedGroup + (*OidcManagedGroupAttributes)(nil), // 1: controller.api.resources.managedgroups.v1.OidcManagedGroupAttributes + (*scopes.ScopeInfo)(nil), // 2: controller.api.resources.scopes.v1.ScopeInfo + (*wrapperspb.StringValue)(nil), // 3: google.protobuf.StringValue + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 5: google.protobuf.Struct +} +var file_controller_api_resources_managedgroups_v1_managed_group_proto_depIdxs = []int32{ + 2, // 0: controller.api.resources.managedgroups.v1.ManagedGroup.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo + 3, // 1: controller.api.resources.managedgroups.v1.ManagedGroup.name:type_name -> google.protobuf.StringValue + 3, // 2: controller.api.resources.managedgroups.v1.ManagedGroup.description:type_name -> google.protobuf.StringValue + 4, // 3: controller.api.resources.managedgroups.v1.ManagedGroup.created_time:type_name -> google.protobuf.Timestamp + 4, // 4: controller.api.resources.managedgroups.v1.ManagedGroup.updated_time:type_name -> google.protobuf.Timestamp + 5, // 5: controller.api.resources.managedgroups.v1.ManagedGroup.attributes:type_name -> google.protobuf.Struct + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_controller_api_resources_managedgroups_v1_managed_group_proto_init() } +func file_controller_api_resources_managedgroups_v1_managed_group_proto_init() { + if File_controller_api_resources_managedgroups_v1_managed_group_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ManagedGroup); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OidcManagedGroupAttributes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_controller_api_resources_managedgroups_v1_managed_group_proto_goTypes, + DependencyIndexes: file_controller_api_resources_managedgroups_v1_managed_group_proto_depIdxs, + MessageInfos: file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes, + }.Build() + File_controller_api_resources_managedgroups_v1_managed_group_proto = out.File + file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDesc = nil + file_controller_api_resources_managedgroups_v1_managed_group_proto_goTypes = nil + file_controller_api_resources_managedgroups_v1_managed_group_proto_depIdxs = nil +} diff --git a/internal/gen/controller/api/services/managed_group_service.pb.go b/internal/gen/controller/api/services/managed_group_service.pb.go new file mode 100644 index 000000000..0b3b3566e --- /dev/null +++ b/internal/gen/controller/api/services/managed_group_service.pb.go @@ -0,0 +1,873 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.8 +// source: controller/api/services/v1/managed_group_service.proto + +package services + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + managedgroups "github.com/hashicorp/boundary/internal/gen/controller/api/resources/managedgroups" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" + _ "google.golang.org/protobuf/types/known/wrapperspb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetManagedGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetManagedGroupRequest) Reset() { + *x = GetManagedGroupRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetManagedGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetManagedGroupRequest) ProtoMessage() {} + +func (x *GetManagedGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetManagedGroupRequest.ProtoReflect.Descriptor instead. +func (*GetManagedGroupRequest) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{0} +} + +func (x *GetManagedGroupRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetManagedGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *managedgroups.ManagedGroup `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetManagedGroupResponse) Reset() { + *x = GetManagedGroupResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetManagedGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetManagedGroupResponse) ProtoMessage() {} + +func (x *GetManagedGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetManagedGroupResponse.ProtoReflect.Descriptor instead. +func (*GetManagedGroupResponse) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{1} +} + +func (x *GetManagedGroupResponse) GetItem() *managedgroups.ManagedGroup { + if x != nil { + return x.Item + } + return nil +} + +type ListManagedGroupsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AuthMethodId string `protobuf:"bytes,1,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` + Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (x *ListManagedGroupsRequest) Reset() { + *x = ListManagedGroupsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListManagedGroupsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListManagedGroupsRequest) ProtoMessage() {} + +func (x *ListManagedGroupsRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListManagedGroupsRequest.ProtoReflect.Descriptor instead. +func (*ListManagedGroupsRequest) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListManagedGroupsRequest) GetAuthMethodId() string { + if x != nil { + return x.AuthMethodId + } + return "" +} + +func (x *ListManagedGroupsRequest) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +type ListManagedGroupsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items []*managedgroups.ManagedGroup `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` +} + +func (x *ListManagedGroupsResponse) Reset() { + *x = ListManagedGroupsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListManagedGroupsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListManagedGroupsResponse) ProtoMessage() {} + +func (x *ListManagedGroupsResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListManagedGroupsResponse.ProtoReflect.Descriptor instead. +func (*ListManagedGroupsResponse) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{3} +} + +func (x *ListManagedGroupsResponse) GetItems() []*managedgroups.ManagedGroup { + if x != nil { + return x.Items + } + return nil +} + +type CreateManagedGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *managedgroups.ManagedGroup `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *CreateManagedGroupRequest) Reset() { + *x = CreateManagedGroupRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateManagedGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateManagedGroupRequest) ProtoMessage() {} + +func (x *CreateManagedGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateManagedGroupRequest.ProtoReflect.Descriptor instead. +func (*CreateManagedGroupRequest) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateManagedGroupRequest) GetItem() *managedgroups.ManagedGroup { + if x != nil { + return x.Item + } + return nil +} + +type CreateManagedGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` + Item *managedgroups.ManagedGroup `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *CreateManagedGroupResponse) Reset() { + *x = CreateManagedGroupResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateManagedGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateManagedGroupResponse) ProtoMessage() {} + +func (x *CreateManagedGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateManagedGroupResponse.ProtoReflect.Descriptor instead. +func (*CreateManagedGroupResponse) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateManagedGroupResponse) GetUri() string { + if x != nil { + return x.Uri + } + return "" +} + +func (x *CreateManagedGroupResponse) GetItem() *managedgroups.ManagedGroup { + if x != nil { + return x.Item + } + return nil +} + +type UpdateManagedGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Item *managedgroups.ManagedGroup `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=update_mask,proto3" json:"update_mask,omitempty"` +} + +func (x *UpdateManagedGroupRequest) Reset() { + *x = UpdateManagedGroupRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateManagedGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateManagedGroupRequest) ProtoMessage() {} + +func (x *UpdateManagedGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateManagedGroupRequest.ProtoReflect.Descriptor instead. +func (*UpdateManagedGroupRequest) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateManagedGroupRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateManagedGroupRequest) GetItem() *managedgroups.ManagedGroup { + if x != nil { + return x.Item + } + return nil +} + +func (x *UpdateManagedGroupRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type UpdateManagedGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *managedgroups.ManagedGroup `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *UpdateManagedGroupResponse) Reset() { + *x = UpdateManagedGroupResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateManagedGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateManagedGroupResponse) ProtoMessage() {} + +func (x *UpdateManagedGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateManagedGroupResponse.ProtoReflect.Descriptor instead. +func (*UpdateManagedGroupResponse) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateManagedGroupResponse) GetItem() *managedgroups.ManagedGroup { + if x != nil { + return x.Item + } + return nil +} + +type DeleteManagedGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteManagedGroupRequest) Reset() { + *x = DeleteManagedGroupRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteManagedGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteManagedGroupRequest) ProtoMessage() {} + +func (x *DeleteManagedGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteManagedGroupRequest.ProtoReflect.Descriptor instead. +func (*DeleteManagedGroupRequest) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteManagedGroupRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteManagedGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteManagedGroupResponse) Reset() { + *x = DeleteManagedGroupResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteManagedGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteManagedGroupResponse) ProtoMessage() {} + +func (x *DeleteManagedGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_managed_group_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteManagedGroupResponse.ProtoReflect.Descriptor instead. +func (*DeleteManagedGroupResponse) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP(), []int{9} +} + +var File_controller_api_services_v1_managed_group_service_proto protoreflect.FileDescriptor + +var file_controller_api_services_v1_managed_group_service_proto_rawDesc = []byte{ + 0x0a, 0x36, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, + 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x66, 0x0a, + 0x17, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x5a, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x22, 0x6a, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, + 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x68, 0x0a, + 0x19, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x7b, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb6, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, + 0x3c, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, + 0x52, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x69, 0x0a, + 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0xae, 0x08, 0x0a, 0x13, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc1, 0x01, 0x0a, 0x0f, + 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, + 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, + 0x41, 0x1d, 0x12, 0x1b, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, + 0x65, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x12, + 0xd3, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x51, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x92, 0x41, + 0x34, 0x12, 0x32, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x12, 0xea, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x65, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x20, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x92, 0x41, 0x3c, 0x12, 0x3a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, + 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x2e, 0x12, 0xcc, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x36, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x47, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, + 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x19, 0x12, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x73, 0x20, 0x61, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x2e, 0x12, 0xc0, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x36, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, + 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x92, 0x41, 0x19, 0x12, 0x17, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x2e, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, + 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_controller_api_services_v1_managed_group_service_proto_rawDescOnce sync.Once + file_controller_api_services_v1_managed_group_service_proto_rawDescData = file_controller_api_services_v1_managed_group_service_proto_rawDesc +) + +func file_controller_api_services_v1_managed_group_service_proto_rawDescGZIP() []byte { + file_controller_api_services_v1_managed_group_service_proto_rawDescOnce.Do(func() { + file_controller_api_services_v1_managed_group_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_api_services_v1_managed_group_service_proto_rawDescData) + }) + return file_controller_api_services_v1_managed_group_service_proto_rawDescData +} + +var file_controller_api_services_v1_managed_group_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_controller_api_services_v1_managed_group_service_proto_goTypes = []interface{}{ + (*GetManagedGroupRequest)(nil), // 0: controller.api.services.v1.GetManagedGroupRequest + (*GetManagedGroupResponse)(nil), // 1: controller.api.services.v1.GetManagedGroupResponse + (*ListManagedGroupsRequest)(nil), // 2: controller.api.services.v1.ListManagedGroupsRequest + (*ListManagedGroupsResponse)(nil), // 3: controller.api.services.v1.ListManagedGroupsResponse + (*CreateManagedGroupRequest)(nil), // 4: controller.api.services.v1.CreateManagedGroupRequest + (*CreateManagedGroupResponse)(nil), // 5: controller.api.services.v1.CreateManagedGroupResponse + (*UpdateManagedGroupRequest)(nil), // 6: controller.api.services.v1.UpdateManagedGroupRequest + (*UpdateManagedGroupResponse)(nil), // 7: controller.api.services.v1.UpdateManagedGroupResponse + (*DeleteManagedGroupRequest)(nil), // 8: controller.api.services.v1.DeleteManagedGroupRequest + (*DeleteManagedGroupResponse)(nil), // 9: controller.api.services.v1.DeleteManagedGroupResponse + (*managedgroups.ManagedGroup)(nil), // 10: controller.api.resources.managedgroups.v1.ManagedGroup + (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask +} +var file_controller_api_services_v1_managed_group_service_proto_depIdxs = []int32{ + 10, // 0: controller.api.services.v1.GetManagedGroupResponse.item:type_name -> controller.api.resources.managedgroups.v1.ManagedGroup + 10, // 1: controller.api.services.v1.ListManagedGroupsResponse.items:type_name -> controller.api.resources.managedgroups.v1.ManagedGroup + 10, // 2: controller.api.services.v1.CreateManagedGroupRequest.item:type_name -> controller.api.resources.managedgroups.v1.ManagedGroup + 10, // 3: controller.api.services.v1.CreateManagedGroupResponse.item:type_name -> controller.api.resources.managedgroups.v1.ManagedGroup + 10, // 4: controller.api.services.v1.UpdateManagedGroupRequest.item:type_name -> controller.api.resources.managedgroups.v1.ManagedGroup + 11, // 5: controller.api.services.v1.UpdateManagedGroupRequest.update_mask:type_name -> google.protobuf.FieldMask + 10, // 6: controller.api.services.v1.UpdateManagedGroupResponse.item:type_name -> controller.api.resources.managedgroups.v1.ManagedGroup + 0, // 7: controller.api.services.v1.ManagedGroupService.GetManagedGroup:input_type -> controller.api.services.v1.GetManagedGroupRequest + 2, // 8: controller.api.services.v1.ManagedGroupService.ListManagedGroups:input_type -> controller.api.services.v1.ListManagedGroupsRequest + 4, // 9: controller.api.services.v1.ManagedGroupService.CreateManagedGroup:input_type -> controller.api.services.v1.CreateManagedGroupRequest + 6, // 10: controller.api.services.v1.ManagedGroupService.UpdateManagedGroup:input_type -> controller.api.services.v1.UpdateManagedGroupRequest + 8, // 11: controller.api.services.v1.ManagedGroupService.DeleteManagedGroup:input_type -> controller.api.services.v1.DeleteManagedGroupRequest + 1, // 12: controller.api.services.v1.ManagedGroupService.GetManagedGroup:output_type -> controller.api.services.v1.GetManagedGroupResponse + 3, // 13: controller.api.services.v1.ManagedGroupService.ListManagedGroups:output_type -> controller.api.services.v1.ListManagedGroupsResponse + 5, // 14: controller.api.services.v1.ManagedGroupService.CreateManagedGroup:output_type -> controller.api.services.v1.CreateManagedGroupResponse + 7, // 15: controller.api.services.v1.ManagedGroupService.UpdateManagedGroup:output_type -> controller.api.services.v1.UpdateManagedGroupResponse + 9, // 16: controller.api.services.v1.ManagedGroupService.DeleteManagedGroup:output_type -> controller.api.services.v1.DeleteManagedGroupResponse + 12, // [12:17] is the sub-list for method output_type + 7, // [7:12] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_controller_api_services_v1_managed_group_service_proto_init() } +func file_controller_api_services_v1_managed_group_service_proto_init() { + if File_controller_api_services_v1_managed_group_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_controller_api_services_v1_managed_group_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetManagedGroupRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetManagedGroupResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListManagedGroupsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListManagedGroupsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateManagedGroupRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateManagedGroupResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateManagedGroupRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateManagedGroupResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteManagedGroupRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_managed_group_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteManagedGroupResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_controller_api_services_v1_managed_group_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_controller_api_services_v1_managed_group_service_proto_goTypes, + DependencyIndexes: file_controller_api_services_v1_managed_group_service_proto_depIdxs, + MessageInfos: file_controller_api_services_v1_managed_group_service_proto_msgTypes, + }.Build() + File_controller_api_services_v1_managed_group_service_proto = out.File + file_controller_api_services_v1_managed_group_service_proto_rawDesc = nil + file_controller_api_services_v1_managed_group_service_proto_goTypes = nil + file_controller_api_services_v1_managed_group_service_proto_depIdxs = nil +} diff --git a/internal/gen/controller/api/services/managed_group_service.pb.gw.go b/internal/gen/controller/api/services/managed_group_service.pb.gw.go new file mode 100644 index 000000000..0fe29d9d1 --- /dev/null +++ b/internal/gen/controller/api/services/managed_group_service.pb.gw.go @@ -0,0 +1,622 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: controller/api/services/v1/managed_group_service.proto + +/* +Package services is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package services + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_ManagedGroupService_GetManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, client ManagedGroupServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetManagedGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetManagedGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ManagedGroupService_GetManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, server ManagedGroupServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetManagedGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetManagedGroup(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ManagedGroupService_ListManagedGroups_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_ManagedGroupService_ListManagedGroups_0(ctx context.Context, marshaler runtime.Marshaler, client ManagedGroupServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListManagedGroupsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ManagedGroupService_ListManagedGroups_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListManagedGroups(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ManagedGroupService_ListManagedGroups_0(ctx context.Context, marshaler runtime.Marshaler, server ManagedGroupServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListManagedGroupsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ManagedGroupService_ListManagedGroups_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListManagedGroups(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ManagedGroupService_CreateManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, client ManagedGroupServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateManagedGroupRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateManagedGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ManagedGroupService_CreateManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, server ManagedGroupServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateManagedGroupRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateManagedGroup(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ManagedGroupService_UpdateManagedGroup_0 = &utilities.DoubleArray{Encoding: map[string]int{"item": 0, "id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_ManagedGroupService_UpdateManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, client ManagedGroupServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateManagedGroupRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Item); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ManagedGroupService_UpdateManagedGroup_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateManagedGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ManagedGroupService_UpdateManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, server ManagedGroupServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateManagedGroupRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Item); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ManagedGroupService_UpdateManagedGroup_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateManagedGroup(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ManagedGroupService_DeleteManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, client ManagedGroupServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteManagedGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.DeleteManagedGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ManagedGroupService_DeleteManagedGroup_0(ctx context.Context, marshaler runtime.Marshaler, server ManagedGroupServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteManagedGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.DeleteManagedGroup(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterManagedGroupServiceHandlerServer registers the http handlers for service ManagedGroupService to "mux". +// UnaryRPC :call ManagedGroupServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterManagedGroupServiceHandlerFromEndpoint instead. +func RegisterManagedGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ManagedGroupServiceServer) error { + + mux.Handle("GET", pattern_ManagedGroupService_GetManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/GetManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ManagedGroupService_GetManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_GetManagedGroup_0(ctx, mux, outboundMarshaler, w, req, response_ManagedGroupService_GetManagedGroup_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ManagedGroupService_ListManagedGroups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/ListManagedGroups") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ManagedGroupService_ListManagedGroups_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_ListManagedGroups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ManagedGroupService_CreateManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ManagedGroupService_CreateManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_CreateManagedGroup_0(ctx, mux, outboundMarshaler, w, req, response_ManagedGroupService_CreateManagedGroup_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ManagedGroupService_UpdateManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ManagedGroupService_UpdateManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_UpdateManagedGroup_0(ctx, mux, outboundMarshaler, w, req, response_ManagedGroupService_UpdateManagedGroup_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_ManagedGroupService_DeleteManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ManagedGroupService_DeleteManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_DeleteManagedGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterManagedGroupServiceHandlerFromEndpoint is same as RegisterManagedGroupServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterManagedGroupServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterManagedGroupServiceHandler(ctx, mux, conn) +} + +// RegisterManagedGroupServiceHandler registers the http handlers for service ManagedGroupService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterManagedGroupServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterManagedGroupServiceHandlerClient(ctx, mux, NewManagedGroupServiceClient(conn)) +} + +// RegisterManagedGroupServiceHandlerClient registers the http handlers for service ManagedGroupService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ManagedGroupServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ManagedGroupServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "ManagedGroupServiceClient" to call the correct interceptors. +func RegisterManagedGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ManagedGroupServiceClient) error { + + mux.Handle("GET", pattern_ManagedGroupService_GetManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/GetManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ManagedGroupService_GetManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_GetManagedGroup_0(ctx, mux, outboundMarshaler, w, req, response_ManagedGroupService_GetManagedGroup_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ManagedGroupService_ListManagedGroups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/ListManagedGroups") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ManagedGroupService_ListManagedGroups_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_ListManagedGroups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ManagedGroupService_CreateManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ManagedGroupService_CreateManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_CreateManagedGroup_0(ctx, mux, outboundMarshaler, w, req, response_ManagedGroupService_CreateManagedGroup_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ManagedGroupService_UpdateManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ManagedGroupService_UpdateManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_UpdateManagedGroup_0(ctx, mux, outboundMarshaler, w, req, response_ManagedGroupService_UpdateManagedGroup_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_ManagedGroupService_DeleteManagedGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ManagedGroupService_DeleteManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ManagedGroupService_DeleteManagedGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +type response_ManagedGroupService_GetManagedGroup_0 struct { + proto.Message +} + +func (m response_ManagedGroupService_GetManagedGroup_0) XXX_ResponseBody() interface{} { + response := m.Message.(*GetManagedGroupResponse) + return response.Item +} + +type response_ManagedGroupService_CreateManagedGroup_0 struct { + proto.Message +} + +func (m response_ManagedGroupService_CreateManagedGroup_0) XXX_ResponseBody() interface{} { + response := m.Message.(*CreateManagedGroupResponse) + return response.Item +} + +type response_ManagedGroupService_UpdateManagedGroup_0 struct { + proto.Message +} + +func (m response_ManagedGroupService_UpdateManagedGroup_0) XXX_ResponseBody() interface{} { + response := m.Message.(*UpdateManagedGroupResponse) + return response.Item +} + +var ( + pattern_ManagedGroupService_GetManagedGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "managed-groups", "id"}, "")) + + pattern_ManagedGroupService_ListManagedGroups_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "managed-groups"}, "")) + + pattern_ManagedGroupService_CreateManagedGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "managed-groups"}, "")) + + pattern_ManagedGroupService_UpdateManagedGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "managed-groups", "id"}, "")) + + pattern_ManagedGroupService_DeleteManagedGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "managed-groups", "id"}, "")) +) + +var ( + forward_ManagedGroupService_GetManagedGroup_0 = runtime.ForwardResponseMessage + + forward_ManagedGroupService_ListManagedGroups_0 = runtime.ForwardResponseMessage + + forward_ManagedGroupService_CreateManagedGroup_0 = runtime.ForwardResponseMessage + + forward_ManagedGroupService_UpdateManagedGroup_0 = runtime.ForwardResponseMessage + + forward_ManagedGroupService_DeleteManagedGroup_0 = runtime.ForwardResponseMessage +) diff --git a/internal/gen/controller/api/services/managed_group_service_grpc.pb.go b/internal/gen/controller/api/services/managed_group_service_grpc.pb.go new file mode 100644 index 000000000..69bd29978 --- /dev/null +++ b/internal/gen/controller/api/services/managed_group_service_grpc.pb.go @@ -0,0 +1,291 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package services + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ManagedGroupServiceClient is the client API for ManagedGroupService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ManagedGroupServiceClient interface { + // GetManagedGroup returns a stored ManagedGroup if present. The provided request must + // include the id for the ManagedGroup be retrieved. If missing, malformed or + // referencing a non existing ManagedGroup an error is returned. + GetManagedGroup(ctx context.Context, in *GetManagedGroupRequest, opts ...grpc.CallOption) (*GetManagedGroupResponse, error) + // ListManagedGroups returns a list of stored ManagedGroups which exist inside the + // provided Auth Method. The request must include the Auth Method id which + // contains the ManagedGroups being listed. If missing or malformed an error + // is returned. + ListManagedGroups(ctx context.Context, in *ListManagedGroupsRequest, opts ...grpc.CallOption) (*ListManagedGroupsResponse, error) + // CreateManagedGroup creates and stores a ManagedGroup. The provided request + // must include the Auth Method ID in which the ManagedGroup will be created. + // If the Auth Method ID is missing, malformed, or references a non existing + // resource an error is returned. If a name or login_name is provided that is + // in use in another ManagedGroup in the same Auth Method an error is + // returned. + CreateManagedGroup(ctx context.Context, in *CreateManagedGroupRequest, opts ...grpc.CallOption) (*CreateManagedGroupResponse, error) + // UpdateManagedGroup updates an existing ManagedGroup. The provided + // ManagedGroup must not have any read only fields set. The update mask must + // be included in the request and contain at least 1 mutable field. To unset a + // field's value, include the field in the update mask and don't set it in the + // provided ManagedGroup. An error is returned if the ManagedGroup id is + // missing or references a non-existing resource. An error is also returned if + // the request attempts to update the name to one that is already in use in + // the containing Auth Method. + UpdateManagedGroup(ctx context.Context, in *UpdateManagedGroupRequest, opts ...grpc.CallOption) (*UpdateManagedGroupResponse, error) + // DeleteManagedGroup removes a ManagedGroup. If the provided ManagedGroup Id + // is malformed or not provided an error is returned. + DeleteManagedGroup(ctx context.Context, in *DeleteManagedGroupRequest, opts ...grpc.CallOption) (*DeleteManagedGroupResponse, error) +} + +type managedGroupServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewManagedGroupServiceClient(cc grpc.ClientConnInterface) ManagedGroupServiceClient { + return &managedGroupServiceClient{cc} +} + +func (c *managedGroupServiceClient) GetManagedGroup(ctx context.Context, in *GetManagedGroupRequest, opts ...grpc.CallOption) (*GetManagedGroupResponse, error) { + out := new(GetManagedGroupResponse) + err := c.cc.Invoke(ctx, "/controller.api.services.v1.ManagedGroupService/GetManagedGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managedGroupServiceClient) ListManagedGroups(ctx context.Context, in *ListManagedGroupsRequest, opts ...grpc.CallOption) (*ListManagedGroupsResponse, error) { + out := new(ListManagedGroupsResponse) + err := c.cc.Invoke(ctx, "/controller.api.services.v1.ManagedGroupService/ListManagedGroups", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managedGroupServiceClient) CreateManagedGroup(ctx context.Context, in *CreateManagedGroupRequest, opts ...grpc.CallOption) (*CreateManagedGroupResponse, error) { + out := new(CreateManagedGroupResponse) + err := c.cc.Invoke(ctx, "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managedGroupServiceClient) UpdateManagedGroup(ctx context.Context, in *UpdateManagedGroupRequest, opts ...grpc.CallOption) (*UpdateManagedGroupResponse, error) { + out := new(UpdateManagedGroupResponse) + err := c.cc.Invoke(ctx, "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managedGroupServiceClient) DeleteManagedGroup(ctx context.Context, in *DeleteManagedGroupRequest, opts ...grpc.CallOption) (*DeleteManagedGroupResponse, error) { + out := new(DeleteManagedGroupResponse) + err := c.cc.Invoke(ctx, "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ManagedGroupServiceServer is the server API for ManagedGroupService service. +// All implementations must embed UnimplementedManagedGroupServiceServer +// for forward compatibility +type ManagedGroupServiceServer interface { + // GetManagedGroup returns a stored ManagedGroup if present. The provided request must + // include the id for the ManagedGroup be retrieved. If missing, malformed or + // referencing a non existing ManagedGroup an error is returned. + GetManagedGroup(context.Context, *GetManagedGroupRequest) (*GetManagedGroupResponse, error) + // ListManagedGroups returns a list of stored ManagedGroups which exist inside the + // provided Auth Method. The request must include the Auth Method id which + // contains the ManagedGroups being listed. If missing or malformed an error + // is returned. + ListManagedGroups(context.Context, *ListManagedGroupsRequest) (*ListManagedGroupsResponse, error) + // CreateManagedGroup creates and stores a ManagedGroup. The provided request + // must include the Auth Method ID in which the ManagedGroup will be created. + // If the Auth Method ID is missing, malformed, or references a non existing + // resource an error is returned. If a name or login_name is provided that is + // in use in another ManagedGroup in the same Auth Method an error is + // returned. + CreateManagedGroup(context.Context, *CreateManagedGroupRequest) (*CreateManagedGroupResponse, error) + // UpdateManagedGroup updates an existing ManagedGroup. The provided + // ManagedGroup must not have any read only fields set. The update mask must + // be included in the request and contain at least 1 mutable field. To unset a + // field's value, include the field in the update mask and don't set it in the + // provided ManagedGroup. An error is returned if the ManagedGroup id is + // missing or references a non-existing resource. An error is also returned if + // the request attempts to update the name to one that is already in use in + // the containing Auth Method. + UpdateManagedGroup(context.Context, *UpdateManagedGroupRequest) (*UpdateManagedGroupResponse, error) + // DeleteManagedGroup removes a ManagedGroup. If the provided ManagedGroup Id + // is malformed or not provided an error is returned. + DeleteManagedGroup(context.Context, *DeleteManagedGroupRequest) (*DeleteManagedGroupResponse, error) + mustEmbedUnimplementedManagedGroupServiceServer() +} + +// UnimplementedManagedGroupServiceServer must be embedded to have forward compatible implementations. +type UnimplementedManagedGroupServiceServer struct { +} + +func (UnimplementedManagedGroupServiceServer) GetManagedGroup(context.Context, *GetManagedGroupRequest) (*GetManagedGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetManagedGroup not implemented") +} +func (UnimplementedManagedGroupServiceServer) ListManagedGroups(context.Context, *ListManagedGroupsRequest) (*ListManagedGroupsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListManagedGroups not implemented") +} +func (UnimplementedManagedGroupServiceServer) CreateManagedGroup(context.Context, *CreateManagedGroupRequest) (*CreateManagedGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateManagedGroup not implemented") +} +func (UnimplementedManagedGroupServiceServer) UpdateManagedGroup(context.Context, *UpdateManagedGroupRequest) (*UpdateManagedGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateManagedGroup not implemented") +} +func (UnimplementedManagedGroupServiceServer) DeleteManagedGroup(context.Context, *DeleteManagedGroupRequest) (*DeleteManagedGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteManagedGroup not implemented") +} +func (UnimplementedManagedGroupServiceServer) mustEmbedUnimplementedManagedGroupServiceServer() {} + +// UnsafeManagedGroupServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ManagedGroupServiceServer will +// result in compilation errors. +type UnsafeManagedGroupServiceServer interface { + mustEmbedUnimplementedManagedGroupServiceServer() +} + +func RegisterManagedGroupServiceServer(s grpc.ServiceRegistrar, srv ManagedGroupServiceServer) { + s.RegisterService(&ManagedGroupService_ServiceDesc, srv) +} + +func _ManagedGroupService_GetManagedGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetManagedGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagedGroupServiceServer).GetManagedGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.api.services.v1.ManagedGroupService/GetManagedGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagedGroupServiceServer).GetManagedGroup(ctx, req.(*GetManagedGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ManagedGroupService_ListManagedGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListManagedGroupsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagedGroupServiceServer).ListManagedGroups(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.api.services.v1.ManagedGroupService/ListManagedGroups", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagedGroupServiceServer).ListManagedGroups(ctx, req.(*ListManagedGroupsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ManagedGroupService_CreateManagedGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateManagedGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagedGroupServiceServer).CreateManagedGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagedGroupServiceServer).CreateManagedGroup(ctx, req.(*CreateManagedGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ManagedGroupService_UpdateManagedGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateManagedGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagedGroupServiceServer).UpdateManagedGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagedGroupServiceServer).UpdateManagedGroup(ctx, req.(*UpdateManagedGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ManagedGroupService_DeleteManagedGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteManagedGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagedGroupServiceServer).DeleteManagedGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagedGroupServiceServer).DeleteManagedGroup(ctx, req.(*DeleteManagedGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ManagedGroupService_ServiceDesc is the grpc.ServiceDesc for ManagedGroupService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ManagedGroupService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "controller.api.services.v1.ManagedGroupService", + HandlerType: (*ManagedGroupServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetManagedGroup", + Handler: _ManagedGroupService_GetManagedGroup_Handler, + }, + { + MethodName: "ListManagedGroups", + Handler: _ManagedGroupService_ListManagedGroups_Handler, + }, + { + MethodName: "CreateManagedGroup", + Handler: _ManagedGroupService_CreateManagedGroup_Handler, + }, + { + MethodName: "UpdateManagedGroup", + Handler: _ManagedGroupService_UpdateManagedGroup_Handler, + }, + { + MethodName: "DeleteManagedGroup", + Handler: _ManagedGroupService_DeleteManagedGroup_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "controller/api/services/v1/managed_group_service.proto", +} diff --git a/internal/proto/local/controller/api/resources/accounts/v1/account.proto b/internal/proto/local/controller/api/resources/accounts/v1/account.proto index 304c6a7cb..f4c16f564 100644 --- a/internal/proto/local/controller/api/resources/accounts/v1/account.proto +++ b/internal/proto/local/controller/api/resources/accounts/v1/account.proto @@ -43,6 +43,9 @@ message Account { // The attributes that are applicable for the specific Account type. google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + // Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account + repeated string managed_group_ids = 110 [json_name="managed_group_ids"]; + // Output only. The available actions on this resource for this user. repeated string authorized_actions = 300 [json_name="authorized_actions"]; } @@ -66,7 +69,7 @@ message OidcAccountAttributes { // This value is immutable after creation time. string subject = 90 [json_name="subject", (custom_options.v1.generate_sdk_option) = true]; - // Output only. full_name is a string that maps to the OIDC name claim + // Output only. full_name is a string that maps to the OIDC name claim. string full_name = 100 [json_name="full_name"]; // Output only. email is a string that maps to the OIDC email claim. diff --git a/internal/proto/local/controller/api/resources/managedgroups/v1/managed_group.proto b/internal/proto/local/controller/api/resources/managedgroups/v1/managed_group.proto new file mode 100644 index 000000000..716bf64a9 --- /dev/null +++ b/internal/proto/local/controller/api/resources/managedgroups/v1/managed_group.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package controller.api.resources.managedgroups.v1; + +option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/resources/managedgroups;managedgroups"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/protobuf/struct.proto"; +import "controller/api/resources/scopes/v1/scope.proto"; +import "controller/custom_options/v1/options.proto"; + +// ManagedGroup contains all fields related to an ManagedGroup resource +message ManagedGroup { + // Output only. The ID of the ManagedGroup. + string id = 10; + + // Output only. Scope information for the ManagedGroup. + resources.scopes.v1.ScopeInfo scope = 20; + + // Optional name for identification purposes. + google.protobuf.StringValue name = 30 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "Name"}]; + + // Optional user-set description for identification purposes. + google.protobuf.StringValue description = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "Description"}]; + + // Output only. The time this resource was created. + google.protobuf.Timestamp created_time = 50 [json_name="created_time"]; + + // Output only. The time this resource was last updated. + google.protobuf.Timestamp updated_time = 60 [json_name="updated_time"]; + + // Version is used in mutation requests, after the initial creation, to ensure this resource has not changed. + // The mutation will fail if the version does not match the latest known good version. + uint32 version = 70; + + // The type of this ManagedGroup. + string type = 80; + + // The ID of the Auth Method that is associated with this ManagedGroup. + string auth_method_id = 90 [json_name="auth_method_id"]; + + // The attributes that are applicable for the specific ManagedGroup type. + google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + + // Output only. The available actions on this resource for this user. + repeated string authorized_actions = 300 [json_name="authorized_actions"]; +} + +// Attributes associated only with ManagedGroups with type "oidc". +message OidcManagedGroupAttributes { + // The boolean expression filter to use to determine membership. + string filter = 10 [json_name="filter", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.filter" that: "Filter"}]; +} \ No newline at end of file diff --git a/internal/proto/local/controller/api/services/v1/managed_group_service.proto b/internal/proto/local/controller/api/services/v1/managed_group_service.proto new file mode 100644 index 000000000..4804b1d68 --- /dev/null +++ b/internal/proto/local/controller/api/services/v1/managed_group_service.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; + +package controller.api.services.v1; + +option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services"; + +import "protoc-gen-openapiv2/options/annotations.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/wrappers.proto"; +import "controller/api/resources/managedgroups/v1/managed_group.proto"; + +service ManagedGroupService { + + // GetManagedGroup returns a stored ManagedGroup if present. The provided request must + // include the id for the ManagedGroup be retrieved. If missing, malformed or + // referencing a non existing ManagedGroup an error is returned. + rpc GetManagedGroup(GetManagedGroupRequest) returns (GetManagedGroupResponse) { + option (google.api.http) = { + get: "/v1/managed-groups/{id}" + response_body: "item" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Gets a single ManagedGroup." + }; + } + + // ListManagedGroups returns a list of stored ManagedGroups which exist inside the + // provided Auth Method. The request must include the Auth Method id which + // contains the ManagedGroups being listed. If missing or malformed an error + // is returned. + rpc ListManagedGroups(ListManagedGroupsRequest) returns (ListManagedGroupsResponse) { + option (google.api.http) = { + get: "/v1/managed-groups" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Lists all ManagedGroups in a specific Auth Method." + }; + } + + // CreateManagedGroup creates and stores a ManagedGroup. The provided request + // must include the Auth Method ID in which the ManagedGroup will be created. + // If the Auth Method ID is missing, malformed, or references a non existing + // resource an error is returned. If a name or login_name is provided that is + // in use in another ManagedGroup in the same Auth Method an error is + // returned. + rpc CreateManagedGroup(CreateManagedGroupRequest) returns (CreateManagedGroupResponse) { + option (google.api.http) = { + post: "/v1/managed-groups" + body: "item" + response_body: "item" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Creates a single ManagedGroup in the provided Auth Method." + }; + } + + // UpdateManagedGroup updates an existing ManagedGroup. The provided + // ManagedGroup must not have any read only fields set. The update mask must + // be included in the request and contain at least 1 mutable field. To unset a + // field's value, include the field in the update mask and don't set it in the + // provided ManagedGroup. An error is returned if the ManagedGroup id is + // missing or references a non-existing resource. An error is also returned if + // the request attempts to update the name to one that is already in use in + // the containing Auth Method. + rpc UpdateManagedGroup(UpdateManagedGroupRequest) returns (UpdateManagedGroupResponse) { + option (google.api.http) = { + patch: "/v1/managed-groups/{id}" + body: "item" + response_body: "item" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Updates a ManagedGroup." + }; + } + + // DeleteManagedGroup removes a ManagedGroup. If the provided ManagedGroup Id + // is malformed or not provided an error is returned. + rpc DeleteManagedGroup(DeleteManagedGroupRequest) returns (DeleteManagedGroupResponse) { + option (google.api.http) = { + delete: "/v1/managed-groups/{id}" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Deletes a ManagedGroup." + }; + } +} + +message GetManagedGroupRequest { + string id = 1; +} + +message GetManagedGroupResponse { + resources.managedgroups.v1.ManagedGroup item = 1; +} + +message ListManagedGroupsRequest { + string auth_method_id = 1 [json_name="auth_method_id"]; + string filter = 30 [json_name="filter"]; +} + +message ListManagedGroupsResponse { + repeated resources.managedgroups.v1.ManagedGroup items = 1; +} + +message CreateManagedGroupRequest { + resources.managedgroups.v1.ManagedGroup item = 2; +} + +message CreateManagedGroupResponse { + string uri = 1; + resources.managedgroups.v1.ManagedGroup item = 2; +} + +message UpdateManagedGroupRequest { + string id = 1; + resources.managedgroups.v1.ManagedGroup item = 2; + google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; +} + +message UpdateManagedGroupResponse { + resources.managedgroups.v1.ManagedGroup item = 1; +} + +message DeleteManagedGroupRequest { + string id = 1; +} + +message DeleteManagedGroupResponse {} \ No newline at end of file diff --git a/internal/proto/local/controller/storage/auth/oidc/store/v1/oidc.proto b/internal/proto/local/controller/storage/auth/oidc/store/v1/oidc.proto index 0a771f1fe..88fa61413 100644 --- a/internal/proto/local/controller/storage/auth/oidc/store/v1/oidc.proto +++ b/internal/proto/local/controller/storage/auth/oidc/store/v1/oidc.proto @@ -280,11 +280,11 @@ message ManagedGroup { // auth_method_id is the fk to the account's auth method. // @inject_tag: `gorm:"not_null"` - string auth_method_id = 70 [(custom_options.v1.mask_mapping) = { this: "AuthMethodId" that: "auth_method_id" }]; + string auth_method_id = 70; // filter is a go-bexpr filter // @inject_tag: `gorm:"not_null"` - string filter = 80 [(custom_options.v1.mask_mapping) = { this: "Filter" that: "filter" }]; + string filter = 80 [(custom_options.v1.mask_mapping) = { this: "Filter" that: "attributes.filter" }]; } // ManagedGroupMemberAccount contains a mapping between a managed group and a diff --git a/internal/servers/controller/handler.go b/internal/servers/controller/handler.go index af4e79ee2..0101f37e1 100644 --- a/internal/servers/controller/handler.go +++ b/internal/servers/controller/handler.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers/accounts" "github.com/hashicorp/boundary/internal/servers/controller/handlers/authmethods" "github.com/hashicorp/boundary/internal/servers/controller/handlers/host_sets" + "github.com/hashicorp/boundary/internal/servers/controller/handlers/managed_groups" "github.com/hashicorp/boundary/internal/servers/controller/handlers/sessions" "github.com/hashicorp/boundary/internal/servers/controller/handlers/targets" "github.com/hashicorp/boundary/sdk/strutil" @@ -166,6 +167,13 @@ func handleGrpcGateway(c *Controller, props HandlerProperties) (http.Handler, er if err := services.RegisterSessionServiceHandlerServer(ctx, mux, ss); err != nil { return nil, fmt.Errorf("failed to register session service handler: %w", err) } + mgs, err := managed_groups.NewService(c.OidcRepoFn) + if err != nil { + return nil, fmt.Errorf("failed to create managed groups handler service: %w", err) + } + if err := services.RegisterManagedGroupServiceHandlerServer(ctx, mux, mgs); err != nil { + return nil, fmt.Errorf("failed to register managed groups service handler: %w", err) + } return mux, nil } diff --git a/internal/servers/controller/handlers/accounts/account_service.go b/internal/servers/controller/handlers/accounts/account_service.go index 25fb279b2..ad7acd2ef 100644 --- a/internal/servers/controller/handlers/accounts/account_service.go +++ b/internal/servers/controller/handlers/accounts/account_service.go @@ -95,7 +95,7 @@ type Service struct { oidcRepoFn common.OidcAuthRepoFactory } -// NewService returns a user service which handles user related requests to boundary. +// NewService returns a account service which handles account related requests to boundary. func NewService(pwRepo common.PasswordAuthRepoFactory, oidcRepo common.OidcAuthRepoFactory) (Service, error) { const op = "accounts.NewService" if pwRepo == nil { @@ -180,7 +180,7 @@ func (s Service) GetAccount(ctx context.Context, req *pbs.GetAccountRequest) (*p if authResults.Error != nil { return nil, authResults.Error } - acct, err := s.getFromRepo(ctx, req.GetId()) + acct, mgIds, err := s.getFromRepo(ctx, req.GetId()) if err != nil { return nil, err } @@ -198,6 +198,9 @@ func (s Service) GetAccount(ctx context.Context, req *pbs.GetAccountRequest) (*p if outputFields.Has(globals.AuthorizedActionsField) { outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[auth.SubtypeFromId(acct.GetPublicId())]).Strings())) } + if outputFields.Has(globals.ManagedGroupIdsField) { + outputOpts = append(outputOpts, handlers.WithManagedGroupIds(mgIds)) + } item, err := toProto(ctx, acct, outputOpts...) if err != nil { @@ -379,39 +382,49 @@ func (s Service) SetPassword(ctx context.Context, req *pbs.SetPasswordRequest) ( return &pbs.SetPasswordResponse{Item: item}, nil } -func (s Service) getFromRepo(ctx context.Context, id string) (auth.Account, error) { +// getFromRepo returns the account and, if available, managed groups the account +// belongs to within the auth method +func (s Service) getFromRepo(ctx context.Context, id string) (auth.Account, []string, error) { var acct auth.Account + var mgIds []string switch auth.SubtypeFromId(id) { case auth.PasswordSubtype: repo, err := s.pwRepoFn() if err != nil { - return nil, err + return nil, nil, err } a, err := repo.LookupAccount(ctx, id) if err != nil { if errors.IsNotFoundError(err) { - return nil, handlers.NotFoundErrorf("Account %q doesn't exist.", id) + return nil, nil, handlers.NotFoundErrorf("Account %q doesn't exist.", id) } - return nil, err + return nil, nil, err } acct = a case auth.OidcSubtype: repo, err := s.oidcRepoFn() if err != nil { - return nil, err + return nil, nil, err } a, err := repo.LookupAccount(ctx, id) if err != nil { if errors.IsNotFoundError(err) { - return nil, handlers.NotFoundErrorf("Account %q doesn't exist.", id) + return nil, nil, handlers.NotFoundErrorf("Account %q doesn't exist.", id) } - return nil, err + return nil, nil, err + } + mgs, err := repo.ListManagedGroupMembershipsByMember(ctx, a.GetPublicId()) + if err != nil { + return nil, nil, err + } + for _, mg := range mgs { + mgIds = append(mgIds, mg.GetManagedGroupId()) } acct = a default: - return nil, handlers.NotFoundErrorf("Unrecognized id.") + return nil, nil, handlers.NotFoundErrorf("Unrecognized id.") } - return acct, nil + return acct, mgIds, nil } func (s Service) createPwInRepo(ctx context.Context, am auth.AuthMethod, item *pb.Account) (*password.Account, error) { @@ -433,7 +446,7 @@ func (s Service) createPwInRepo(ctx context.Context, am auth.AuthMethod, item *p } a, err := password.NewAccount(am.GetPublicId(), opts...) if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build user for creation: %v.", err) + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build account for creation: %v.", err) } repo, err := s.pwRepoFn() if err != nil { @@ -449,7 +462,7 @@ func (s Service) createPwInRepo(ctx context.Context, am auth.AuthMethod, item *p return nil, errors.Wrap(err, op) } if out == nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create user but no error returned from repository.") + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create account but no error returned from repository.") } return out, nil } @@ -480,7 +493,7 @@ func (s Service) createOidcInRepo(ctx context.Context, am auth.AuthMethod, item } a, err := oidc.NewAccount(am.GetPublicId(), attrs.GetSubject(), opts...) if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build user for creation: %v.", err) + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build account for creation: %v.", err) } repo, err := s.oidcRepoFn() if err != nil { @@ -489,10 +502,10 @@ func (s Service) createOidcInRepo(ctx context.Context, am auth.AuthMethod, item out, err := repo.CreateAccount(ctx, am.GetScopeId(), a) if err != nil { - return nil, errors.Wrap(err, op, errors.WithMsg("unable to create user")) + return nil, errors.Wrap(err, op, errors.WithMsg("unable to create account")) } if out == nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create user but no error returned from repository.") + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create account but no error returned from repository.") } return out, nil } @@ -510,7 +523,7 @@ func (s Service) createInRepo(ctx context.Context, am auth.AuthMethod, item *pb. return nil, errors.Wrap(err, op) } if am == nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create auth method but no error returned from repository.") + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create account but no error returned from repository.") } out = am case auth.OidcSubtype: @@ -519,7 +532,7 @@ func (s Service) createInRepo(ctx context.Context, am auth.AuthMethod, item *pb. return nil, errors.Wrap(err, op) } if am == nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create auth method but no error returned from repository.") + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create account but no error returned from repository.") } out = am } @@ -836,6 +849,9 @@ func toProto(ctx context.Context, in auth.Account, opt ...handlers.Option) (*pb. if outputFields.Has(globals.AuthorizedActionsField) { out.AuthorizedActions = opts.WithAuthorizedActions } + if outputFields.Has(globals.ManagedGroupIdsField) { + out.ManagedGroupIds = opts.WithManagedGroupIds + } switch i := in.(type) { case *password.Account: if outputFields.Has(globals.TypeField) { diff --git a/internal/servers/controller/handlers/accounts/account_service_test.go b/internal/servers/controller/handlers/accounts/account_service_test.go index d5db6cc83..3d1f6204d 100644 --- a/internal/servers/controller/handlers/accounts/account_service_test.go +++ b/internal/servers/controller/handlers/accounts/account_service_test.go @@ -148,6 +148,9 @@ func TestGet(t *testing.T) { oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0]), ) oidcA := oidc.TestAccount(t, conn, oidcAm, "test-subject") + // Create a managed group that will always match, so we can test that it is + // returned in results + mg := oidc.TestManagedGroup(t, conn, oidcAm, `"/token/sub" matches ".*"`) oidcWireAccount := pb.Account{ Id: oidcA.GetPublicId(), AuthMethodId: oidcA.GetAuthMethodId(), @@ -161,6 +164,7 @@ func TestGet(t *testing.T) { "subject": structpb.NewStringValue("test-subject"), }}, AuthorizedActions: oidcAuthorizedActions, + ManagedGroupIds: []string{mg.GetPublicId()}, } cases := []struct { @@ -207,6 +211,18 @@ func TestGet(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) + + if auth.SubtypeFromId(tc.req.Id) == auth.OidcSubtype { + // Set up managed groups before getting. First get the current + // managed group to make sure we have the right version. + oidcRepo, err := oidcRepoFn() + require.NoError(err) + currMg, err := oidcRepo.LookupManagedGroup(ctx, mg.GetPublicId()) + require.NoError(err) + _, _, err = oidcRepo.SetManagedGroupMemberships(ctx, oidcAm, oidcA, []*oidc.ManagedGroup{currMg}) + require.NoError(err) + } + got, gErr := s.GetAccount(auth.DisabledAuthTestContext(iamRepoFn, org.GetPublicId()), tc.req) if tc.err != nil { require.Error(gErr) @@ -622,7 +638,7 @@ func TestDelete_twice(t *testing.T) { assert.NoError(gErr, "First attempt") _, gErr = s.DeleteAccount(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), req) assert.Error(gErr, "Second attempt") - assert.True(errors.Is(gErr, handlers.ApiErrorWithCode(codes.NotFound)), "Expected permission denied for the second delete.") + assert.True(errors.Is(gErr, handlers.ApiErrorWithCode(codes.NotFound)), "Expected not found for the second delete.") } func TestCreatePassword(t *testing.T) { @@ -1057,7 +1073,7 @@ func TestUpdatePassword(t *testing.T) { o, _ := iam.TestScopes(t, iam.TestRepo(t, conn, wrap)) am := password.TestAuthMethods(t, conn, o.GetPublicId(), 1)[0] tested, err := accounts.NewService(pwRepoFn, oidcRepoFn) - require.NoError(t, err, "Error when getting new auth_method service.") + require.NoError(t, err, "Error when getting new accounts service.") defaultScopeInfo := &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()} defaultAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ diff --git a/internal/servers/controller/handlers/accounts/validate_test.go b/internal/servers/controller/handlers/accounts/validate_test.go index ec7a51a58..2e175f821 100644 --- a/internal/servers/controller/handlers/accounts/validate_test.go +++ b/internal/servers/controller/handlers/accounts/validate_test.go @@ -21,6 +21,7 @@ func fieldError(field, details string) string { } func TestValidateCreateRequest(t *testing.T) { + t.Parallel() cases := []struct { name string item *pb.Account @@ -132,6 +133,7 @@ func TestValidateCreateRequest(t *testing.T) { } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() req := &pbs.CreateAccountRequest{Item: tc.item} err := validateCreateRequest(req) if tc.errContains == "" { @@ -145,6 +147,7 @@ func TestValidateCreateRequest(t *testing.T) { } func TestValidateUpdateRequest(t *testing.T) { + t.Parallel() cases := []struct { name string req *pbs.UpdateAccountRequest @@ -207,6 +210,7 @@ func TestValidateUpdateRequest(t *testing.T) { } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() err := validateUpdateRequest(tc.req) if tc.errContains == "" { require.NoError(t, err) @@ -218,6 +222,7 @@ func TestValidateUpdateRequest(t *testing.T) { } t.Run("oidc read only fields", func(t *testing.T) { + t.Parallel() readOnlyFields := []string{ emailClaimField, nameClaimField, @@ -235,6 +240,7 @@ func TestValidateUpdateRequest(t *testing.T) { }) t.Run("oidc write only at create fields", func(t *testing.T) { + t.Parallel() readOnlyFields := []string{ issuerField, subjectField, diff --git a/internal/servers/controller/handlers/managed_groups/managed_group_service.go b/internal/servers/controller/handlers/managed_groups/managed_group_service.go new file mode 100644 index 000000000..37b94d089 --- /dev/null +++ b/internal/servers/controller/handlers/managed_groups/managed_group_service.go @@ -0,0 +1,652 @@ +package managed_groups + +import ( + "context" + "fmt" + + "github.com/hashicorp/boundary/globals" + "github.com/hashicorp/boundary/internal/auth" + "github.com/hashicorp/boundary/internal/auth/oidc" + oidcstore "github.com/hashicorp/boundary/internal/auth/oidc/store" + "github.com/hashicorp/boundary/internal/errors" + pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/managedgroups" + pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" + "github.com/hashicorp/boundary/internal/perms" + "github.com/hashicorp/boundary/internal/requests" + "github.com/hashicorp/boundary/internal/servers/controller/common" + "github.com/hashicorp/boundary/internal/servers/controller/handlers" + "github.com/hashicorp/boundary/internal/types/action" + "github.com/hashicorp/boundary/internal/types/resource" + "github.com/hashicorp/go-bexpr" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +const ( + // oidc field names + attrFilterField = "attributes.filter" +) + +var ( + oidcMaskManager handlers.MaskManager + + // IdActions contains the set of actions that can be performed on + // individual resources + IdActions = map[auth.Subtype]action.ActionSet{ + auth.OidcSubtype: { + action.NoOp, + action.Read, + action.Update, + action.Delete, + }, + } + + // CollectionActions contains the set of actions that can be performed on + // this collection + CollectionActions = action.ActionSet{ + action.Create, + action.List, + } +) + +func init() { + var err error + if oidcMaskManager, err = handlers.NewMaskManager(&oidcstore.ManagedGroup{}, &pb.ManagedGroup{}, &pb.OidcManagedGroupAttributes{}); err != nil { + panic(err) + } +} + +// Service handles request as described by the pbs.ManagedGroupServiceServer interface. +type Service struct { + pbs.UnimplementedManagedGroupServiceServer + + oidcRepoFn common.OidcAuthRepoFactory +} + +// NewService returns a managed group service which handles managed group related requests to boundary. +func NewService(oidcRepo common.OidcAuthRepoFactory) (Service, error) { + const op = "managed_groups.NewService" + if oidcRepo == nil { + return Service{}, errors.New(errors.InvalidParameter, op, "missing oidc repository provided") + } + return Service{oidcRepoFn: oidcRepo}, nil +} + +var _ pbs.ManagedGroupServiceServer = Service{} + +// ListManagedGroups implements the interface pbs.ManagedGroupsServiceServer. +func (s Service) ListManagedGroups(ctx context.Context, req *pbs.ListManagedGroupsRequest) (*pbs.ListManagedGroupsResponse, error) { + if err := validateListRequest(req); err != nil { + return nil, err + } + _, authResults := s.parentAndAuthResult(ctx, req.GetAuthMethodId(), action.List) + if authResults.Error != nil { + return nil, authResults.Error + } + ul, err := s.listFromRepo(ctx, req.GetAuthMethodId()) + if err != nil { + return nil, err + } + if len(ul) == 0 { + return &pbs.ListManagedGroupsResponse{}, nil + } + + filter, err := handlers.NewFilter(req.GetFilter()) + if err != nil { + return nil, err + } + finalItems := make([]*pb.ManagedGroup, 0, len(ul)) + + res := perms.Resource{ + ScopeId: authResults.Scope.Id, + Type: resource.ManagedGroup, + Pin: req.GetAuthMethodId(), + } + for _, mg := range ul { + res.Id = mg.GetPublicId() + authorizedActions := authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())], auth.WithResource(&res)).Strings() + if len(authorizedActions) == 0 { + continue + } + + outputFields := authResults.FetchOutputFields(res, action.List).SelfOrDefaults(authResults.UserId) + outputOpts := make([]handlers.Option, 0, 3) + outputOpts = append(outputOpts, handlers.WithOutputFields(&outputFields)) + if outputFields.Has(globals.ScopeField) { + outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) + } + if outputFields.Has(globals.AuthorizedActionsField) { + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authorizedActions)) + } + + item, err := toProto(ctx, mg, outputOpts...) + if err != nil { + return nil, err + } + + // This comes last so that we can use item fields in the filter after + // the allowed fields are populated above + if filter.Match(item) { + finalItems = append(finalItems, item) + } + } + return &pbs.ListManagedGroupsResponse{Items: finalItems}, nil +} + +// GetManagedGroup implements the interface pbs.ManagedGroupServiceServer. +func (s Service) GetManagedGroup(ctx context.Context, req *pbs.GetManagedGroupRequest) (*pbs.GetManagedGroupResponse, error) { + const op = "managed_groups.(Service).GetManagedGroup" + + if err := validateGetRequest(req); err != nil { + return nil, err + } + + _, authResults := s.parentAndAuthResult(ctx, req.GetId(), action.Read) + if authResults.Error != nil { + return nil, authResults.Error + } + mg, err := s.getFromRepo(ctx, req.GetId()) + if err != nil { + return nil, err + } + + outputFields, ok := requests.OutputFields(ctx) + if !ok { + return nil, errors.New(errors.Internal, op, "no request context found") + } + + outputOpts := make([]handlers.Option, 0, 3) + outputOpts = append(outputOpts, handlers.WithOutputFields(&outputFields)) + if outputFields.Has(globals.ScopeField) { + outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) + } + if outputFields.Has(globals.AuthorizedActionsField) { + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())]).Strings())) + } + + item, err := toProto(ctx, mg, outputOpts...) + if err != nil { + return nil, err + } + + return &pbs.GetManagedGroupResponse{Item: item}, nil +} + +// CreateManagedGroup implements the interface pbs.ManagedGroupServiceServer. +func (s Service) CreateManagedGroup(ctx context.Context, req *pbs.CreateManagedGroupRequest) (*pbs.CreateManagedGroupResponse, error) { + const op = "managed_groups.(Service).CreateManagedGroup" + + if err := validateCreateRequest(req); err != nil { + return nil, err + } + + authMeth, authResults := s.parentAndAuthResult(ctx, req.GetItem().GetAuthMethodId(), action.Create) + if authResults.Error != nil { + return nil, authResults.Error + } + mg, err := s.createInRepo(ctx, authMeth, req.GetItem()) + if err != nil { + return nil, err + } + + outputFields, ok := requests.OutputFields(ctx) + if !ok { + return nil, errors.New(errors.Internal, op, "no request context found") + } + + outputOpts := make([]handlers.Option, 0, 3) + outputOpts = append(outputOpts, handlers.WithOutputFields(&outputFields)) + if outputFields.Has(globals.ScopeField) { + outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) + } + if outputFields.Has(globals.AuthorizedActionsField) { + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())]).Strings())) + } + + item, err := toProto(ctx, mg, outputOpts...) + if err != nil { + return nil, err + } + + return &pbs.CreateManagedGroupResponse{Item: item, Uri: fmt.Sprintf("managed-groups/%s", item.GetId())}, nil +} + +// UpdateManagedGroup implements the interface pbs.ManagedGroupServiceServer. +func (s Service) UpdateManagedGroup(ctx context.Context, req *pbs.UpdateManagedGroupRequest) (*pbs.UpdateManagedGroupResponse, error) { + const op = "managed_groups.(Service).UpdateManagedGroup" + + if err := validateUpdateRequest(req); err != nil { + return nil, err + } + + authMeth, authResults := s.parentAndAuthResult(ctx, req.GetId(), action.Update) + if authResults.Error != nil { + return nil, authResults.Error + } + mg, err := s.updateInRepo(ctx, authResults.Scope.GetId(), authMeth.GetPublicId(), req) + if err != nil { + return nil, err + } + + outputFields, ok := requests.OutputFields(ctx) + if !ok { + return nil, errors.New(errors.Internal, op, "no request context found") + } + + outputOpts := make([]handlers.Option, 0, 3) + outputOpts = append(outputOpts, handlers.WithOutputFields(&outputFields)) + if outputFields.Has(globals.ScopeField) { + outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) + } + if outputFields.Has(globals.AuthorizedActionsField) { + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())]).Strings())) + } + + item, err := toProto(ctx, mg, outputOpts...) + if err != nil { + return nil, err + } + + return &pbs.UpdateManagedGroupResponse{Item: item}, nil +} + +// DeleteManagedGroup implements the interface pbs.ManagedGroupServiceServer. +func (s Service) DeleteManagedGroup(ctx context.Context, req *pbs.DeleteManagedGroupRequest) (*pbs.DeleteManagedGroupResponse, error) { + if err := validateDeleteRequest(req); err != nil { + return nil, err + } + _, authResults := s.parentAndAuthResult(ctx, req.GetId(), action.Delete) + if authResults.Error != nil { + return nil, authResults.Error + } + _, err := s.deleteFromRepo(ctx, authResults.Scope.GetId(), req.GetId()) + if err != nil { + return nil, err + } + return nil, nil +} + +func (s Service) getFromRepo(ctx context.Context, id string) (auth.ManagedGroup, error) { + var out auth.ManagedGroup + switch auth.SubtypeFromId(id) { + case auth.OidcSubtype: + repo, err := s.oidcRepoFn() + if err != nil { + return nil, err + } + mg, err := repo.LookupManagedGroup(ctx, id) + if err != nil { + if errors.IsNotFoundError(err) { + return nil, handlers.NotFoundErrorf("ManagedGroup %q doesn't exist.", id) + } + return nil, err + } + out = mg + default: + return nil, handlers.NotFoundErrorf("Unrecognized id.") + } + return out, nil +} + +func (s Service) createOidcInRepo(ctx context.Context, am auth.AuthMethod, item *pb.ManagedGroup) (*oidc.ManagedGroup, error) { + const op = "managed_groups.(Service).createOidcInRepo" + if item == nil { + return nil, errors.New(errors.InvalidParameter, op, "missing item") + } + var opts []oidc.Option + if item.GetName() != nil { + opts = append(opts, oidc.WithName(item.GetName().GetValue())) + } + if item.GetDescription() != nil { + opts = append(opts, oidc.WithDescription(item.GetDescription().GetValue())) + } + attrs := &pb.OidcManagedGroupAttributes{} + if err := handlers.StructToProto(item.GetAttributes(), attrs); err != nil { + return nil, handlers.InvalidArgumentErrorf("Error in provided request.", + map[string]string{"attributes": "Attribute fields do not match the expected format."}) + } + mg, err := oidc.NewManagedGroup(am.GetPublicId(), attrs.GetFilter(), opts...) + if err != nil { + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build user for creation: %v.", err) + } + repo, err := s.oidcRepoFn() + if err != nil { + return nil, err + } + + out, err := repo.CreateManagedGroup(ctx, am.GetScopeId(), mg) + if err != nil { + return nil, errors.Wrap(err, op, errors.WithMsg("unable to create managed group")) + } + if out == nil { + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create managed group but no error returned from repository.") + } + return out, nil +} + +func (s Service) createInRepo(ctx context.Context, am auth.AuthMethod, item *pb.ManagedGroup) (auth.ManagedGroup, error) { + const op = "managed_groups.(Service).createInRepo" + if item == nil { + return nil, errors.New(errors.InvalidParameter, op, "missing item") + } + var out auth.ManagedGroup + switch auth.SubtypeFromId(am.GetPublicId()) { + case auth.OidcSubtype: + am, err := s.createOidcInRepo(ctx, am, item) + if err != nil { + return nil, errors.Wrap(err, op) + } + if am == nil { + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create managed group but no error returned from repository.") + } + out = am + } + return out, nil +} + +func (s Service) updateOidcInRepo(ctx context.Context, scopeId, amId, id string, mask []string, item *pb.ManagedGroup) (*oidc.ManagedGroup, error) { + const op = "managed_groups.(Service).updateOidcInRepo" + if item == nil { + return nil, errors.New(errors.InvalidParameter, op, "nil managed group.") + } + mg := oidc.AllocManagedGroup() + mg.PublicId = id + if item.GetName() != nil { + mg.Name = item.GetName().GetValue() + } + if item.GetDescription() != nil { + mg.Description = item.GetDescription().GetValue() + } + if apiAttr := item.GetAttributes(); apiAttr != nil { + attrs := &pb.OidcManagedGroupAttributes{} + if err := handlers.StructToProto(apiAttr, attrs); err != nil { + return nil, handlers.InvalidArgumentErrorf("Error in provided request.", + map[string]string{globals.AttributesField: "Attribute fields do not match the expected format."}) + } + // Set this regardless; it'll only take effect if the masks contain the value + mg.Filter = attrs.Filter + } + + version := item.GetVersion() + + dbMask := oidcMaskManager.Translate(mask) + if len(dbMask) == 0 { + return nil, handlers.InvalidArgumentErrorf("No valid fields included in the update mask.", map[string]string{"update_mask": "No valid fields provided in the update mask."}) + } + repo, err := s.oidcRepoFn() + if err != nil { + return nil, errors.Wrap(err, op) + } + out, rowsUpdated, err := repo.UpdateManagedGroup(ctx, scopeId, mg, version, dbMask) + if err != nil { + return nil, errors.Wrap(err, op, errors.WithMsg("unable to update managed group")) + } + if rowsUpdated == 0 { + return nil, handlers.NotFoundErrorf("Managed Group %q doesn't exist or incorrect version provided.", id) + } + return out, nil +} + +func (s Service) updateInRepo(ctx context.Context, scopeId, authMethodId string, req *pbs.UpdateManagedGroupRequest) (auth.ManagedGroup, error) { + const op = "managed_groups.(Service).updateInRepo" + var out auth.ManagedGroup + switch auth.SubtypeFromId(req.GetId()) { + case auth.OidcSubtype: + mg, err := s.updateOidcInRepo(ctx, scopeId, authMethodId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) + if err != nil { + return nil, errors.Wrap(err, op) + } + if mg == nil { + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to update managed group but no error returned from repository.") + } + out = mg + } + return out, nil +} + +func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, error) { + const op = "managed_groups.(Service).deleteFromRepo" + var rows int + var err error + switch auth.SubtypeFromId(id) { + case auth.OidcSubtype: + repo, iErr := s.oidcRepoFn() + if iErr != nil { + return false, iErr + } + rows, err = repo.DeleteManagedGroup(ctx, scopeId, id) + } + if err != nil { + if errors.IsNotFoundError(err) { + return false, nil + } + return false, errors.Wrap(err, op) + } + return rows > 0, nil +} + +func (s Service) listFromRepo(ctx context.Context, authMethodId string) ([]auth.ManagedGroup, error) { + const op = "managed_groups.(Service).listFromRepo" + + var outUl []auth.ManagedGroup + switch auth.SubtypeFromId(authMethodId) { + case auth.OidcSubtype: + oidcRepo, err := s.oidcRepoFn() + if err != nil { + return nil, errors.Wrap(err, op) + } + oidcl, err := oidcRepo.ListManagedGroups(ctx, authMethodId) + if err != nil { + return nil, errors.Wrap(err, op) + } + for _, a := range oidcl { + outUl = append(outUl, a) + } + } + return outUl, nil +} + +func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Type) (auth.AuthMethod, auth.VerifyResults) { + res := auth.VerifyResults{} + oidcRepo, err := s.oidcRepoFn() + if err != nil { + res.Error = err + return nil, res + } + + var parentId string + opts := []auth.Option{auth.WithType(resource.ManagedGroup), auth.WithAction(a)} + switch a { + case action.List, action.Create: + parentId = id + default: + switch auth.SubtypeFromId(id) { + case auth.OidcSubtype: + acct, err := oidcRepo.LookupManagedGroup(ctx, id) + if err != nil { + res.Error = err + return nil, res + } + if acct == nil { + res.Error = handlers.NotFoundError() + return nil, res + } + parentId = acct.GetAuthMethodId() + } + opts = append(opts, auth.WithId(id)) + } + + var authMeth auth.AuthMethod + switch auth.SubtypeFromId(parentId) { + case auth.OidcSubtype: + am, err := oidcRepo.LookupAuthMethod(ctx, parentId) + if err != nil { + res.Error = err + return nil, res + } + if am == nil { + res.Error = handlers.NotFoundError() + return nil, res + } + authMeth = am + } + opts = append(opts, auth.WithScopeId(authMeth.GetScopeId()), auth.WithPin(parentId)) + return authMeth, auth.Verify(ctx, opts...) +} + +func toProto(ctx context.Context, in auth.ManagedGroup, opt ...handlers.Option) (*pb.ManagedGroup, error) { + opts := handlers.GetOpts(opt...) + if opts.WithOutputFields == nil { + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "output fields not found when building managed group proto") + } + outputFields := *opts.WithOutputFields + + out := pb.ManagedGroup{} + if outputFields.Has(globals.IdField) { + out.Id = in.GetPublicId() + } + if outputFields.Has(globals.AuthMethodIdField) { + out.AuthMethodId = in.GetAuthMethodId() + } + if outputFields.Has(globals.DescriptionField) && in.GetDescription() != "" { + out.Description = &wrapperspb.StringValue{Value: in.GetDescription()} + } + if outputFields.Has(globals.NameField) && in.GetName() != "" { + out.Name = &wrapperspb.StringValue{Value: in.GetName()} + } + if outputFields.Has(globals.CreatedTimeField) { + out.CreatedTime = in.GetCreateTime().GetTimestamp() + } + if outputFields.Has(globals.UpdatedTimeField) { + out.UpdatedTime = in.GetUpdateTime().GetTimestamp() + } + if outputFields.Has(globals.VersionField) { + out.Version = in.GetVersion() + } + if outputFields.Has(globals.ScopeField) { + out.Scope = opts.WithScope + } + if outputFields.Has(globals.AuthorizedActionsField) { + out.AuthorizedActions = opts.WithAuthorizedActions + } + switch i := in.(type) { + case *oidc.ManagedGroup: + if outputFields.Has(globals.TypeField) { + out.Type = auth.OidcSubtype.String() + } + if !outputFields.Has(globals.AttributesField) { + break + } + attrs := &pb.OidcManagedGroupAttributes{ + Filter: i.GetFilter(), + } + st, err := handlers.ProtoToStruct(attrs) + if err != nil { + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building oidc attribute struct: %v", err) + } + out.Attributes = st + } + return &out, nil +} + +// A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce +// requirements on the structure of the request. They verify that: +// * The path passed in is correctly formatted +// * All required parameters are set +// * There are no conflicting parameters provided +func validateGetRequest(req *pbs.GetManagedGroupRequest) error { + const op = "managed_groups.validateGetRequest" + if req == nil { + return errors.New(errors.InvalidParameter, op, "nil request") + } + return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, oidc.ManagedGroupPrefix) +} + +func validateCreateRequest(req *pbs.CreateManagedGroupRequest) error { + const op = "managed_groups.validateCreateRequest" + if req == nil { + return errors.New(errors.InvalidParameter, op, "nil request") + } + return handlers.ValidateCreateRequest(req.GetItem(), func() map[string]string { + badFields := map[string]string{} + if req.GetItem().GetAuthMethodId() == "" { + badFields[globals.AuthMethodIdField] = "This field is required." + } + switch auth.SubtypeFromId(req.GetItem().GetAuthMethodId()) { + case auth.OidcSubtype: + if req.GetItem().GetType() != "" && req.GetItem().GetType() != auth.OidcSubtype.String() { + badFields[globals.TypeField] = "Doesn't match the parent resource's type." + } + attrs := &pb.OidcManagedGroupAttributes{} + if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { + badFields[globals.AttributesField] = "Attribute fields do not match the expected format." + } + if attrs.Filter == "" { + badFields[attrFilterField] = "This field is required." + } else { + if _, err := bexpr.CreateEvaluator(attrs.Filter); err != nil { + badFields[attrFilterField] = fmt.Sprintf("Error evaluating submitted filter expression: %v.", err) + } + } + default: + badFields[globals.AuthMethodIdField] = "Unknown auth method type from ID." + } + return badFields + }) +} + +func validateUpdateRequest(req *pbs.UpdateManagedGroupRequest) error { + const op = "managed_groups.validateUpdateRequest" + if req == nil { + return errors.New(errors.InvalidParameter, op, "nil request") + } + return handlers.ValidateUpdateRequest(req, req.GetItem(), func() map[string]string { + badFields := map[string]string{} + switch auth.SubtypeFromId(req.GetId()) { + case auth.OidcSubtype: + if req.GetItem().GetType() != "" && req.GetItem().GetType() != auth.OidcSubtype.String() { + badFields[globals.TypeField] = "Cannot modify the resource type." + } + attrs := &pb.OidcManagedGroupAttributes{} + if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { + badFields[globals.AttributesField] = "Attribute fields do not match the expected format." + } + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), attrFilterField) { + if attrs.Filter == "" { + badFields[attrFilterField] = "Field cannot be empty." + } else { + if _, err := bexpr.CreateEvaluator(attrs.Filter); err != nil { + badFields[attrFilterField] = fmt.Sprintf("Error evaluating submitted filter expression: %v.", err) + } + } + } + } + return badFields + }, oidc.ManagedGroupPrefix) +} + +func validateDeleteRequest(req *pbs.DeleteManagedGroupRequest) error { + const op = "managed_groups.validateDeleteRequest" + if req == nil { + return errors.New(errors.InvalidParameter, op, "nil request") + } + return handlers.ValidateDeleteRequest(handlers.NoopValidatorFn, req, oidc.ManagedGroupPrefix) +} + +func validateListRequest(req *pbs.ListManagedGroupsRequest) error { + const op = "managed_groups.validateListRequest" + if req == nil { + return errors.New(errors.InvalidParameter, op, "nil request") + } + badFields := map[string]string{} + if !handlers.ValidId(handlers.Id(req.GetAuthMethodId()), oidc.AuthMethodPrefix) { + badFields[globals.AuthMethodIdField] = "Invalid formatted identifier." + } + if _, err := handlers.NewFilter(req.GetFilter()); err != nil { + badFields[globals.FilterField] = fmt.Sprintf("This field could not be parsed. %v", err) + } + if len(badFields) > 0 { + return handlers.InvalidArgumentErrorf("Error in provided request.", badFields) + } + return nil +} diff --git a/internal/servers/controller/handlers/managed_groups/managed_group_service_test.go b/internal/servers/controller/handlers/managed_groups/managed_group_service_test.go new file mode 100644 index 000000000..1b7b42274 --- /dev/null +++ b/internal/servers/controller/handlers/managed_groups/managed_group_service_test.go @@ -0,0 +1,987 @@ +package managed_groups_test + +import ( + "context" + "errors" + "fmt" + "sort" + "strconv" + "strings" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/hashicorp/boundary/globals" + "github.com/hashicorp/boundary/internal/auth" + "github.com/hashicorp/boundary/internal/auth/oidc" + "github.com/hashicorp/boundary/internal/authtoken" + "github.com/hashicorp/boundary/internal/db" + pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/managedgroups" + scopepb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/scopes" + pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" + "github.com/hashicorp/boundary/internal/iam" + "github.com/hashicorp/boundary/internal/kms" + "github.com/hashicorp/boundary/internal/servers/controller/common" + "github.com/hashicorp/boundary/internal/servers/controller/handlers" + "github.com/hashicorp/boundary/internal/servers/controller/handlers/managed_groups" + "github.com/hashicorp/boundary/internal/types/action" + "github.com/hashicorp/boundary/internal/types/scope" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/genproto/protobuf/field_mask" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/structpb" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +var oidcAuthorizedActions = []string{ + action.NoOp.String(), + action.Read.String(), + action.Update.String(), + action.Delete.String(), +} + +const testFakeManagedGroupFilter = `"/foo" == "bar"` + +func TestNewService(t *testing.T) { + conn, _ := db.TestSetup(t, "postgres") + rw := db.New(conn) + wrap := db.TestWrapper(t) + kmsCache := kms.TestKms(t, conn, wrap) + oidcRepoFn := func() (*oidc.Repository, error) { + return oidc.NewRepository(rw, rw, kmsCache) + } + + cases := []struct { + name string + oidcRepo common.OidcAuthRepoFactory + wantErr bool + }{ + { + name: "nil-oidc-repo", + wantErr: true, + }, + { + name: "success", + oidcRepo: oidcRepoFn, + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + _, err := managed_groups.NewService(tc.oidcRepo) + if tc.wantErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) + } +} + +func TestGet(t *testing.T) { + ctx := context.Background() + conn, _ := db.TestSetup(t, "postgres") + rw := db.New(conn) + wrap := db.TestWrapper(t) + kmsCache := kms.TestKms(t, conn, wrap) + oidcRepoFn := func() (*oidc.Repository, error) { + return oidc.NewRepository(rw, rw, kmsCache) + } + iamRepoFn := func() (*iam.Repository, error) { + return iam.NewRepository(rw, rw, kmsCache) + } + + s, err := managed_groups.NewService(oidcRepoFn) + require.NoError(t, err, "Couldn't create new managed groups service.") + + org, _ := iam.TestScopes(t, iam.TestRepo(t, conn, wrap)) + + databaseWrapper, err := kmsCache.GetWrapper(ctx, org.PublicId, kms.KeyPurposeDatabase) + require.NoError(t, err) + oidcAm := oidc.TestAuthMethod( + t, conn, databaseWrapper, org.PublicId, oidc.ActivePrivateState, + "alice-rp", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.alice.com")[0]), + oidc.WithSigningAlgs(oidc.RS256), + oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0]), + ) + omg := oidc.TestManagedGroup(t, conn, oidcAm, testFakeManagedGroupFilter) + + oidcWireManagedGroup := pb.ManagedGroup{ + Id: omg.GetPublicId(), + AuthMethodId: omg.GetAuthMethodId(), + CreatedTime: omg.GetCreateTime().GetTimestamp(), + UpdatedTime: omg.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: org.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: "oidc", + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{"filter": structpb.NewStringValue(omg.GetFilter())}}, + AuthorizedActions: oidcAuthorizedActions, + } + + cases := []struct { + name string + req *pbs.GetManagedGroupRequest + res *pbs.GetManagedGroupResponse + err error + }{ + { + name: "Get an oidc managed group", + req: &pbs.GetManagedGroupRequest{Id: oidcWireManagedGroup.GetId()}, + res: &pbs.GetManagedGroupResponse{Item: &oidcWireManagedGroup}, + }, + { + name: "Get a non existing oidc managed group", + req: &pbs.GetManagedGroupRequest{Id: oidc.ManagedGroupPrefix + "_DoesntExis"}, + res: nil, + err: handlers.ApiErrorWithCode(codes.NotFound), + }, + { + name: "Wrong id prefix", + req: &pbs.GetManagedGroupRequest{Id: "j_1234567890"}, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "space in id", + req: &pbs.GetManagedGroupRequest{Id: authtoken.AuthTokenPrefix + "_1 23456789"}, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + got, gErr := s.GetManagedGroup(auth.DisabledAuthTestContext(iamRepoFn, org.GetPublicId()), tc.req) + if tc.err != nil { + require.Error(gErr) + assert.True(errors.Is(gErr, tc.err), "GetManagedGroup(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) + return + } + require.NoError(gErr) + assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "GetManagedGroup(%q) got response %q, wanted %q", tc.req, got, tc.res) + }) + } +} + +func TestListOidc(t *testing.T) { + ctx := context.Background() + conn, _ := db.TestSetup(t, "postgres") + rw := db.New(conn) + wrap := db.TestWrapper(t) + kmsCache := kms.TestKms(t, conn, wrap) + oidcRepoFn := func() (*oidc.Repository, error) { + return oidc.NewRepository(rw, rw, kmsCache) + } + iamRepoFn := func() (*iam.Repository, error) { + return iam.NewRepository(rw, rw, kmsCache) + } + + o, _ := iam.TestScopes(t, iam.TestRepo(t, conn, wrap)) + databaseWrapper, err := kmsCache.GetWrapper(ctx, o.PublicId, kms.KeyPurposeDatabase) + require.NoError(t, err) + amNoManagedGroups := oidc.TestAuthMethod(t, conn, databaseWrapper, o.PublicId, oidc.ActivePrivateState, "noManagedGroups", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.nomanagedgroups.com")[0]), oidc.WithSigningAlgs(oidc.RS256), oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0])) + amSomeManagedGroups := oidc.TestAuthMethod(t, conn, databaseWrapper, o.PublicId, oidc.ActivePrivateState, "someManagedGroups", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.somemanagedgroups.com")[0]), oidc.WithSigningAlgs(oidc.RS256), oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0])) + amOtherManagedGroups := oidc.TestAuthMethod(t, conn, databaseWrapper, o.PublicId, oidc.ActivePrivateState, "otherManagedGroups", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.othermanagedgroups.com")[0]), oidc.WithSigningAlgs(oidc.RS256), oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0])) + + var wantSomeManagedGroups []*pb.ManagedGroup + for i := 0; i < 3; i++ { + mg := oidc.TestManagedGroup(t, conn, amSomeManagedGroups, testFakeManagedGroupFilter, oidc.WithName(strconv.Itoa(i))) + wantSomeManagedGroups = append(wantSomeManagedGroups, &pb.ManagedGroup{ + Id: mg.GetPublicId(), + AuthMethodId: mg.GetAuthMethodId(), + Name: wrapperspb.String(strconv.Itoa(i)), + CreatedTime: mg.GetCreateTime().GetTimestamp(), + UpdatedTime: mg.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: auth.OidcSubtype.String(), + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue(testFakeManagedGroupFilter), + }}, + AuthorizedActions: oidcAuthorizedActions, + }) + } + + var wantOtherManagedGroups []*pb.ManagedGroup + for i := 0; i < 3; i++ { + mg := oidc.TestManagedGroup(t, conn, amOtherManagedGroups, testFakeManagedGroupFilter, oidc.WithName(strconv.Itoa(i))) + wantOtherManagedGroups = append(wantOtherManagedGroups, &pb.ManagedGroup{ + Id: mg.GetPublicId(), + AuthMethodId: mg.GetAuthMethodId(), + Name: wrapperspb.String(strconv.Itoa(i)), + CreatedTime: mg.GetCreateTime().GetTimestamp(), + UpdatedTime: mg.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: auth.OidcSubtype.String(), + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue(testFakeManagedGroupFilter), + }}, + AuthorizedActions: oidcAuthorizedActions, + }) + } + + cases := []struct { + name string + req *pbs.ListManagedGroupsRequest + res *pbs.ListManagedGroupsResponse + err error + skipAnon bool + }{ + { + name: "List Some ManagedGroups", + req: &pbs.ListManagedGroupsRequest{AuthMethodId: amSomeManagedGroups.GetPublicId()}, + res: &pbs.ListManagedGroupsResponse{Items: wantSomeManagedGroups}, + }, + { + name: "List Other ManagedGroups", + req: &pbs.ListManagedGroupsRequest{AuthMethodId: amOtherManagedGroups.GetPublicId()}, + res: &pbs.ListManagedGroupsResponse{Items: wantOtherManagedGroups}, + }, + { + name: "List No ManagedGroups", + req: &pbs.ListManagedGroupsRequest{AuthMethodId: amNoManagedGroups.GetPublicId()}, + res: &pbs.ListManagedGroupsResponse{}, + }, + { + name: "Unfound Auth Method", + req: &pbs.ListManagedGroupsRequest{AuthMethodId: oidc.AuthMethodPrefix + "_DoesntExis"}, + err: handlers.ApiErrorWithCode(codes.NotFound), + }, + { + name: "Filter Some ManagedGroups", + req: &pbs.ListManagedGroupsRequest{ + AuthMethodId: amSomeManagedGroups.GetPublicId(), + Filter: fmt.Sprintf(`"/item/name"==%q`, wantSomeManagedGroups[1].Name.GetValue()), + }, + res: &pbs.ListManagedGroupsResponse{Items: wantSomeManagedGroups[1:2]}, + skipAnon: true, + }, + { + name: "Filter All ManagedGroups", + req: &pbs.ListManagedGroupsRequest{ + AuthMethodId: amSomeManagedGroups.GetPublicId(), + Filter: `"/item/id"=="noManagedGroupmatchesthis"`, + }, + res: &pbs.ListManagedGroupsResponse{}, + }, + { + name: "Filter Bad Format", + req: &pbs.ListManagedGroupsRequest{AuthMethodId: amSomeManagedGroups.GetPublicId(), Filter: `"//id/"=="bad"`}, + err: handlers.InvalidArgumentErrorf("bad format", nil), + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + s, err := managed_groups.NewService(oidcRepoFn) + require.NoError(err, "Couldn't create new managed group service.") + + got, gErr := s.ListManagedGroups(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), tc.req) + if tc.err != nil { + require.Error(gErr) + assert.True(errors.Is(gErr, tc.err), "ListManagedGroups() with auth method %q got error %v, wanted %v", tc.req, gErr, tc.err) + return + } else { + require.NoError(gErr) + } + sort.Slice(got.Items, func(i, j int) bool { + return strings.Compare(got.Items[i].GetName().GetValue(), + got.Items[j].GetName().GetValue()) < 0 + }) + assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "ListManagedGroups() with scope %q got response %q, wanted %q", tc.req, got, tc.res) + + // Now test with anon + if tc.skipAnon { + return + } + got, gErr = s.ListManagedGroups(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId(), auth.WithUserId(auth.AnonymousUserId)), tc.req) + require.NoError(gErr) + assert.Len(got.Items, len(tc.res.Items)) + for _, g := range got.GetItems() { + assert.Nil(g.Attributes) + assert.Nil(g.CreatedTime) + assert.Nil(g.UpdatedTime) + assert.Empty(g.Version) + } + }) + } +} + +func TestDelete(t *testing.T) { + ctx := context.Background() + conn, _ := db.TestSetup(t, "postgres") + rw := db.New(conn) + wrap := db.TestWrapper(t) + kmsCache := kms.TestKms(t, conn, wrap) + oidcRepoFn := func() (*oidc.Repository, error) { + return oidc.NewRepository(rw, rw, kmsCache) + } + iamRepoFn := func() (*iam.Repository, error) { + return iam.NewRepository(rw, rw, kmsCache) + } + + o, _ := iam.TestScopes(t, iam.TestRepo(t, conn, wrap)) + + databaseWrapper, err := kmsCache.GetWrapper(ctx, o.PublicId, kms.KeyPurposeDatabase) + require.NoError(t, err) + oidcAm := oidc.TestAuthMethod( + t, conn, databaseWrapper, o.PublicId, oidc.ActivePrivateState, + "alice-rp", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.alice.com")[0]), + oidc.WithSigningAlgs(oidc.RS256), + oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0]), + ) + oidcMg := oidc.TestManagedGroup(t, conn, oidcAm, testFakeManagedGroupFilter) + + s, err := managed_groups.NewService(oidcRepoFn) + require.NoError(t, err, "Error when getting new user service.") + + cases := []struct { + name string + scope string + req *pbs.DeleteManagedGroupRequest + res *pbs.DeleteManagedGroupResponse + err error + }{ + { + name: "Delete an existing oidc managed group", + req: &pbs.DeleteManagedGroupRequest{ + Id: oidcMg.GetPublicId(), + }, + }, + { + name: "Delete bad oidc managed group id", + req: &pbs.DeleteManagedGroupRequest{ + Id: oidc.ManagedGroupPrefix + "_doesntexis", + }, + err: handlers.ApiErrorWithCode(codes.NotFound), + }, + { + name: "Bad managed group id formatting", + req: &pbs.DeleteManagedGroupRequest{ + Id: "bad_format", + }, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + got, gErr := s.DeleteManagedGroup(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), tc.req) + if tc.err != nil { + require.Error(gErr) + assert.True(errors.Is(gErr, tc.err), "DeleteManagedGroup(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) + } + assert.EqualValuesf(tc.res, got, "DeleteManagedGroup(%q) got response %q, wanted %q", tc.req, got, tc.res) + }) + } +} + +func TestDelete_twice(t *testing.T) { + assert, require := assert.New(t), require.New(t) + conn, _ := db.TestSetup(t, "postgres") + wrap := db.TestWrapper(t) + rw := db.New(conn) + kmsCache := kms.TestKms(t, conn, wrap) + + oidcRepoFn := func() (*oidc.Repository, error) { + return oidc.NewRepository(rw, rw, kmsCache) + } + iamRepoFn := func() (*iam.Repository, error) { + return iam.NewRepository(rw, rw, kmsCache) + } + + o, _ := iam.TestScopes(t, iam.TestRepo(t, conn, wrap)) + + databaseWrapper, err := kmsCache.GetWrapper(context.Background(), o.PublicId, kms.KeyPurposeDatabase) + + oidcAm := oidc.TestAuthMethod( + t, conn, databaseWrapper, o.PublicId, oidc.ActivePrivateState, + "alice-rp", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.alice.com")[0]), + oidc.WithSigningAlgs(oidc.RS256), + oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0]), + ) + oidcMg := oidc.TestManagedGroup(t, conn, oidcAm, testFakeManagedGroupFilter) + + s, err := managed_groups.NewService(oidcRepoFn) + require.NoError(err, "Error when getting new user service") + req := &pbs.DeleteManagedGroupRequest{ + Id: oidcMg.GetPublicId(), + } + _, gErr := s.DeleteManagedGroup(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), req) + assert.NoError(gErr, "First attempt") + _, gErr = s.DeleteManagedGroup(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), req) + assert.Error(gErr, "Second attempt") + assert.True(errors.Is(gErr, handlers.ApiErrorWithCode(codes.NotFound)), "Expected not found for the second delete.") +} + +func TestCreateOidc(t *testing.T) { + ctx := context.Background() + conn, _ := db.TestSetup(t, "postgres") + rw := db.New(conn) + wrap := db.TestWrapper(t) + kmsCache := kms.TestKms(t, conn, wrap) + oidcRepoFn := func() (*oidc.Repository, error) { + return oidc.NewRepository(rw, rw, kmsCache) + } + iamRepoFn := func() (*iam.Repository, error) { + return iam.NewRepository(rw, rw, kmsCache) + } + + s, err := managed_groups.NewService(oidcRepoFn) + require.NoError(t, err, "Error when getting new managed group service.") + + o, _ := iam.TestScopes(t, iam.TestRepo(t, conn, wrap)) + databaseWrapper, err := kmsCache.GetWrapper(ctx, o.PublicId, kms.KeyPurposeDatabase) + require.NoError(t, err) + am := oidc.TestAuthMethod( + t, conn, databaseWrapper, o.PublicId, oidc.ActivePrivateState, + "alice-rp", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.alice.com")[0]), + oidc.WithSigningAlgs(oidc.RS256), + oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0]), + ) + + createAttr := func() *structpb.Struct { + attr := &pb.OidcManagedGroupAttributes{Filter: testFakeManagedGroupFilter} + ret, err := handlers.ProtoToStruct(attr) + require.NoError(t, err, "Error converting proto to struct.") + return ret + } + + cases := []struct { + name string + req *pbs.CreateManagedGroupRequest + res *pbs.CreateManagedGroupResponse + err error + }{ + { + name: "Create a valid ManagedGroup", + req: &pbs.CreateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Type: auth.OidcSubtype.String(), + Attributes: createAttr(), + }, + }, + res: &pbs.CreateManagedGroupResponse{ + Uri: fmt.Sprintf("managed-groups/%s_", oidc.ManagedGroupPrefix), + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: auth.OidcSubtype.String(), + Attributes: func() *structpb.Struct { + a := createAttr() + a.Fields["filter"] = structpb.NewStringValue(testFakeManagedGroupFilter) + return a + }(), + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + { + name: "Create a valid ManagedGroup without type defined", + req: &pbs.CreateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Attributes: createAttr(), + }, + }, + res: &pbs.CreateManagedGroupResponse{ + Uri: fmt.Sprintf("managed-groups/%s_", oidc.ManagedGroupPrefix), + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: auth.OidcSubtype.String(), + Attributes: func() *structpb.Struct { + a := createAttr() + a.Fields["filter"] = structpb.NewStringValue(testFakeManagedGroupFilter) + return a + }(), + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + { + name: "Cant specify mismatching type", + req: &pbs.CreateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Type: auth.PasswordSubtype.String(), + Attributes: createAttr(), + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Can't specify Id", + req: &pbs.CreateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Id: oidc.ManagedGroupPrefix + "_notallowed", + Type: auth.OidcSubtype.String(), + Attributes: createAttr(), + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Can't specify Created Time", + req: &pbs.CreateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + CreatedTime: timestamppb.Now(), + Type: auth.OidcSubtype.String(), + Attributes: createAttr(), + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Can't specify Update Time", + req: &pbs.CreateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + UpdatedTime: timestamppb.Now(), + Type: auth.OidcSubtype.String(), + Attributes: createAttr(), + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Can't specify bad filter", + req: &pbs.CreateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + UpdatedTime: timestamppb.Now(), + Type: auth.OidcSubtype.String(), + Attributes: func() *structpb.Struct { + a := createAttr() + a.Fields["filter"] = structpb.NewStringValue("foobar") + return a + }(), + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + got, gErr := s.CreateManagedGroup(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), tc.req) + if tc.err != nil { + require.Error(gErr) + assert.True(errors.Is(gErr, tc.err), "CreateManagedGroup(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) + return + } + require.NoError(gErr) + if got != nil { + assert.Contains(got.GetUri(), tc.res.Uri) + assert.True(strings.HasPrefix(got.GetItem().GetId(), oidc.ManagedGroupPrefix+"_")) + // Clear all values which are hard to compare against. + got.Uri, tc.res.Uri = "", "" + got.Item.Id, tc.res.Item.Id = "", "" + got.Item.CreatedTime, got.Item.UpdatedTime, tc.res.Item.CreatedTime, tc.res.Item.UpdatedTime = nil, nil, nil, nil + } + assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "CreateManagedGroup(%q) got response %q, wanted %q", tc.req, got, tc.res) + }) + } +} + +func TestUpdateOidc(t *testing.T) { + ctx := context.Background() + conn, _ := db.TestSetup(t, "postgres") + rw := db.New(conn) + wrap := db.TestWrapper(t) + kmsCache := kms.TestKms(t, conn, wrap) + oidcRepoFn := func() (*oidc.Repository, error) { + return oidc.NewRepository(rw, rw, kmsCache) + } + iamRepoFn := func() (*iam.Repository, error) { + return iam.NewRepository(rw, rw, kmsCache) + } + + o, _ := iam.TestScopes(t, iam.TestRepo(t, conn, wrap)) + + databaseWrapper, err := kmsCache.GetWrapper(ctx, o.PublicId, kms.KeyPurposeDatabase) + require.NoError(t, err) + am := oidc.TestAuthMethod( + t, conn, databaseWrapper, o.PublicId, oidc.ActivePrivateState, + "alice-rp", "fido", + oidc.WithIssuer(oidc.TestConvertToUrls(t, "https://www.alice.com")[0]), + oidc.WithSigningAlgs(oidc.RS256), + oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0])) + + tested, err := managed_groups.NewService(oidcRepoFn) + require.NoError(t, err, "Error when getting new managed_groups service.") + + defaultScopeInfo := &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()} + defaultAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue(testFakeManagedGroupFilter), + }} + + modifiedFilter := `"/token/zip" == "zap"` + modifiedAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue(modifiedFilter), + }} + + badFilter := `"foobar"` + badAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue(badFilter), + }} + + freshManagedGroup := func(t *testing.T) (*oidc.ManagedGroup, func()) { + t.Helper() + mg := oidc.TestManagedGroup(t, conn, am, testFakeManagedGroupFilter, oidc.WithName("default"), oidc.WithDescription("default")) + + clean := func() { + _, err := tested.DeleteManagedGroup(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), + &pbs.DeleteManagedGroupRequest{Id: mg.GetPublicId()}) + require.NoError(t, err) + } + + return mg, clean + } + + cases := []struct { + name string + req *pbs.UpdateManagedGroupRequest + res *pbs.UpdateManagedGroupResponse + err error + }{ + { + name: "Update an Existing AuthMethod", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{globals.NameField, globals.DescriptionField}, + }, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Type: auth.OidcSubtype.String(), + }, + }, + res: &pbs.UpdateManagedGroupResponse{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Type: auth.OidcSubtype.String(), + Attributes: defaultAttributes, + Scope: defaultScopeInfo, + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + { + name: "Multiple Paths in single string", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{"name,description"}, + }, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Type: auth.OidcSubtype.String(), + }, + }, + res: &pbs.UpdateManagedGroupResponse{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Type: auth.OidcSubtype.String(), + Attributes: defaultAttributes, + Scope: defaultScopeInfo, + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + { + name: "No Update Mask", + req: &pbs.UpdateManagedGroupRequest{ + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "updated name"}, + Description: &wrapperspb.StringValue{Value: "updated desc"}, + Attributes: modifiedAttributes, + }, + }, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Cant change type", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{globals.NameField}, + }, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: ""}, + Type: "oidc", + }, + }, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "No Paths in Mask", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{Paths: []string{}}, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "updated name"}, + Description: &wrapperspb.StringValue{Value: "updated desc"}, + Attributes: modifiedAttributes, + }, + }, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Only non-existant paths in Mask", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{Paths: []string{"nonexistant_field"}}, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "updated name"}, + Description: &wrapperspb.StringValue{Value: "updated desc"}, + Attributes: modifiedAttributes, + }, + }, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Unset Name", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{globals.NameField}, + }, + Item: &pb.ManagedGroup{ + Description: &wrapperspb.StringValue{Value: "ignored"}, + Attributes: modifiedAttributes, + }, + }, + res: &pbs.UpdateManagedGroupResponse{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Description: &wrapperspb.StringValue{Value: "default"}, + Type: auth.OidcSubtype.String(), + Attributes: defaultAttributes, + Scope: defaultScopeInfo, + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + { + name: "Update Only Name", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{globals.NameField}, + }, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "updated"}, + Description: &wrapperspb.StringValue{Value: "ignored"}, + Attributes: modifiedAttributes, + }, + }, + res: &pbs.UpdateManagedGroupResponse{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "updated"}, + Description: &wrapperspb.StringValue{Value: "default"}, + Type: auth.OidcSubtype.String(), + Attributes: defaultAttributes, + Scope: defaultScopeInfo, + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + { + name: "Update Only Description", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{globals.DescriptionField}, + }, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "ignored"}, + Description: &wrapperspb.StringValue{Value: "notignored"}, + Attributes: modifiedAttributes, + }, + }, + res: &pbs.UpdateManagedGroupResponse{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "default"}, + Description: &wrapperspb.StringValue{Value: "notignored"}, + Type: auth.OidcSubtype.String(), + Attributes: defaultAttributes, + Scope: defaultScopeInfo, + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + { + name: "Update a Non Existing ManagedGroup", + req: &pbs.UpdateManagedGroupRequest{ + Id: oidc.ManagedGroupPrefix + "_DoesntExis", + UpdateMask: &field_mask.FieldMask{ + Paths: []string{globals.DescriptionField}, + }, + Item: &pb.ManagedGroup{ + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + }, + }, + err: handlers.ApiErrorWithCode(codes.NotFound), + }, + { + name: "Cant change Id", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{"id"}, + }, + Item: &pb.ManagedGroup{ + Id: oidc.ManagedGroupPrefix + "_somethinge", + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "new desc"}, + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Cant specify Created Time", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{"created_time"}, + }, + Item: &pb.ManagedGroup{ + CreatedTime: timestamppb.Now(), + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Cant specify Updated Time", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{"updated_time"}, + }, + Item: &pb.ManagedGroup{ + UpdatedTime: timestamppb.Now(), + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Cant specify Type", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{"type"}, + }, + Item: &pb.ManagedGroup{ + Type: "oidc", + }, + }, + res: nil, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Update Filter with Bad Value", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{"attributes.filter"}, + }, + Item: &pb.ManagedGroup{ + Attributes: badAttributes, + }, + }, + err: handlers.ApiErrorWithCode(codes.InvalidArgument), + }, + { + name: "Update Filter With Good Value", + req: &pbs.UpdateManagedGroupRequest{ + UpdateMask: &field_mask.FieldMask{ + Paths: []string{"attributes.filter"}, + }, + Item: &pb.ManagedGroup{ + Attributes: modifiedAttributes, + }, + }, + res: &pbs.UpdateManagedGroupResponse{ + Item: &pb.ManagedGroup{ + AuthMethodId: am.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "default"}, + Description: &wrapperspb.StringValue{Value: "default"}, + Type: auth.OidcSubtype.String(), + Attributes: modifiedAttributes, + Scope: defaultScopeInfo, + AuthorizedActions: oidcAuthorizedActions, + }, + }, + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + mg, cleanup := freshManagedGroup(t) + defer cleanup() + + tc.req.Item.Version = 1 + + if tc.req.GetId() == "" { + tc.req.Id = mg.GetPublicId() + } + + if tc.res != nil && tc.res.Item != nil { + tc.res.Item.Id = mg.GetPublicId() + tc.res.Item.CreatedTime = mg.GetCreateTime().GetTimestamp() + } + + got, gErr := tested.UpdateManagedGroup(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), tc.req) + if tc.err != nil { + require.Error(gErr) + assert.True(errors.Is(gErr, tc.err), "UpdateManagedGroup(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) + } + + if tc.res == nil { + require.Nil(got) + } + + if got != nil { + assert.NotNilf(tc.res, "Expected UpdateManagedGroup response to be nil, but was %v", got) + gotUpdateTime := got.GetItem().GetUpdatedTime() + require.NoError(err, "Error converting proto to timestamp") + + created := mg.GetCreateTime().GetTimestamp() + require.NoError(err, "Error converting proto to timestamp") + + // Verify it is a auth_method updated after it was created + assert.True(gotUpdateTime.AsTime().After(created.AsTime()), "Updated account should have been updated after it's creation. Was updated %v, which is after %v", gotUpdateTime, created) + + // Clear all values which are hard to compare against. + got.Item.UpdatedTime, tc.res.Item.UpdatedTime = nil, nil + + assert.EqualValues(2, got.Item.Version) + tc.res.Item.Version = 2 + } + assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "UpdateManagedGroup(%q) got response %q, wanted %q", tc.req, got, tc.res) + }) + } +} diff --git a/internal/servers/controller/handlers/managed_groups/validate_test.go b/internal/servers/controller/handlers/managed_groups/validate_test.go new file mode 100644 index 000000000..0ef710844 --- /dev/null +++ b/internal/servers/controller/handlers/managed_groups/validate_test.go @@ -0,0 +1,146 @@ +package managed_groups + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/boundary/globals" + "github.com/hashicorp/boundary/internal/auth" + "github.com/hashicorp/boundary/internal/auth/oidc" + pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/managedgroups" + pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/fieldmaskpb" + "google.golang.org/protobuf/types/known/structpb" +) + +func fieldError(field, details string) string { + return fmt.Sprintf(`{name: %q, desc: %q}`, field, details) +} + +func TestValidateCreateRequest(t *testing.T) { + t.Parallel() + cases := []struct { + name string + item *pb.ManagedGroup + errContains string + }{ + { + name: "unrecognized authmethod prefix", + item: &pb.ManagedGroup{ + AuthMethodId: "anything_1234567890", + }, + errContains: fieldError(globals.AuthMethodIdField, "Unknown auth method type from ID."), + }, + { + name: "mismatched oidc authmethod pw type", + item: &pb.ManagedGroup{ + Type: "ldap", + AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", + }, + errContains: fieldError(globals.TypeField, "Doesn't match the parent resource's type."), + }, + { + name: "missing oidc attributes", + item: &pb.ManagedGroup{ + Type: auth.OidcSubtype.String(), + AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{}}, + }, + errContains: fieldError(attrFilterField, "This field is required."), + }, + { + name: "bad oidc attributes", + item: &pb.ManagedGroup{ + Type: auth.OidcSubtype.String(), + AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue("foobar"), + }}, + }, + errContains: "Error evaluating submitted filter", + }, + { + name: "no oidc errors", + item: &pb.ManagedGroup{ + Type: auth.OidcSubtype.String(), + AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue(`"/foo/bar" == "zipzap"`), + }}, + }, + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + req := &pbs.CreateManagedGroupRequest{Item: tc.item} + err := validateCreateRequest(req) + if tc.errContains == "" { + require.NoError(t, err) + return + } + assert.True(t, strings.Contains(err.Error(), tc.errContains), + "%q wasn't contained in %q", tc.errContains, err.Error()) + }) + } +} + +func TestValidateUpdateRequest(t *testing.T) { + t.Parallel() + cases := []struct { + name string + req *pbs.UpdateManagedGroupRequest + errContains string + }{ + { + name: "oidc to password change type", + req: &pbs.UpdateManagedGroupRequest{ + Id: oidc.ManagedGroupPrefix + "_1234567890", + Item: &pb.ManagedGroup{ + Type: auth.PasswordSubtype.String(), + }, + }, + errContains: fieldError(globals.TypeField, "Cannot modify the resource type."), + }, + { + name: "oidc bad attributes", + req: &pbs.UpdateManagedGroupRequest{ + Id: oidc.ManagedGroupPrefix + "_1234567890", + Item: &pb.ManagedGroup{ + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ + "test": structpb.NewStringValue("something"), + }}, + }, + }, + errContains: fieldError(globals.AttributesField, "Attribute fields do not match the expected format."), + }, + { + name: "no error", + req: &pbs.UpdateManagedGroupRequest{ + Id: oidc.ManagedGroupPrefix + "_1234567890", + UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{}}, + Item: &pb.ManagedGroup{ + Version: 1, + Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ + "filter": structpb.NewStringValue(`"/foo/bar" == "zipzap"`), + }}, + }, + }, + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + err := validateUpdateRequest(tc.req) + if tc.errContains == "" { + require.NoError(t, err) + return + } + assert.True(t, strings.Contains(err.Error(), tc.errContains), + "%q wasn't contained in %q", tc.errContains, err.Error()) + }) + } +} diff --git a/internal/servers/controller/handlers/option_test.go b/internal/servers/controller/handlers/option_test.go index 2e806db12..cdeecfbe2 100644 --- a/internal/servers/controller/handlers/option_test.go +++ b/internal/servers/controller/handlers/option_test.go @@ -60,4 +60,16 @@ func Test_GetOpts(t *testing.T) { require.NotNil(opts.WithOutputFields) assert.Nil(*opts.WithOutputFields) }) + t.Run("WithManagedGroupIds", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + opts := GetOpts() + assert.Nil(opts.WithManagedGroupIds) + + out := []string{"foobar"} + + opts = GetOpts(WithManagedGroupIds(out)) + require.Equal(out, opts.WithManagedGroupIds) + }) } diff --git a/internal/servers/controller/handlers/options.go b/internal/servers/controller/handlers/options.go index 50265a352..59af1ed97 100644 --- a/internal/servers/controller/handlers/options.go +++ b/internal/servers/controller/handlers/options.go @@ -30,6 +30,7 @@ type options struct { WithScope *scopes.ScopeInfo WithAuthorizedActions []string WithAuthorizedCollectionActions map[string]*structpb.ListValue + WithManagedGroupIds []string } func getDefaultOptions() options { @@ -91,3 +92,11 @@ func WithAuthorizedCollectionActions(colActs map[string]*structpb.ListValue) Opt o.WithAuthorizedCollectionActions = colActs } } + +// WithManagedGroupIds provides an option when creating responses to include the given +// managed group IDs if allowed +func WithManagedGroupIds(ids []string) Option { + return func(o *options) { + o.WithManagedGroupIds = ids + } +} diff --git a/internal/types/resource/resource.go b/internal/types/resource/resource.go index b7d3f38c1..834e0b567 100644 --- a/internal/types/resource/resource.go +++ b/internal/types/resource/resource.go @@ -4,22 +4,23 @@ package resource type Type uint const ( - Unknown Type = 0 - All Type = 1 - Scope Type = 2 - User Type = 3 - Group Type = 4 - Role Type = 5 - AuthMethod Type = 6 - Account Type = 7 - AuthToken Type = 8 - HostCatalog Type = 9 - HostSet Type = 10 - Host Type = 11 - Target Type = 12 - Controller Type = 13 - Worker Type = 14 - Session Type = 15 + Unknown Type = 0 + All Type = 1 + Scope Type = 2 + User Type = 3 + Group Type = 4 + Role Type = 5 + AuthMethod Type = 6 + Account Type = 7 + AuthToken Type = 8 + HostCatalog Type = 9 + HostSet Type = 10 + Host Type = 11 + Target Type = 12 + Controller Type = 13 + Worker Type = 14 + Session Type = 15 + ManagedGroup Type = 16 ) func (r Type) String() string { @@ -40,24 +41,26 @@ func (r Type) String() string { "controller", "worker", "session", + "managed-group", }[r] } var Map = map[string]Type{ - Unknown.String(): Unknown, - All.String(): All, - Scope.String(): Scope, - User.String(): User, - Group.String(): Group, - Role.String(): Role, - AuthMethod.String(): AuthMethod, - Account.String(): Account, - AuthToken.String(): AuthToken, - HostCatalog.String(): HostCatalog, - HostSet.String(): HostSet, - Host.String(): Host, - Target.String(): Target, - Controller.String(): Controller, - Worker.String(): Worker, - Session.String(): Session, + Unknown.String(): Unknown, + All.String(): All, + Scope.String(): Scope, + User.String(): User, + Group.String(): Group, + Role.String(): Role, + AuthMethod.String(): AuthMethod, + Account.String(): Account, + AuthToken.String(): AuthToken, + HostCatalog.String(): HostCatalog, + HostSet.String(): HostSet, + Host.String(): Host, + Target.String(): Target, + Controller.String(): Controller, + Worker.String(): Worker, + Session.String(): Session, + ManagedGroup.String(): ManagedGroup, } diff --git a/internal/types/resource/resource_test.go b/internal/types/resource/resource_test.go index 9f242d2bd..b7485a8f3 100644 --- a/internal/types/resource/resource_test.go +++ b/internal/types/resource/resource_test.go @@ -75,6 +75,10 @@ func Test_Resource(t *testing.T) { typeString: "session", want: Session, }, + { + typeString: "managed-group", + want: ManagedGroup, + }, } for _, tt := range tests { t.Run(tt.typeString, func(t *testing.T) { diff --git a/internal/website/permstable/permstable.go b/internal/website/permstable/permstable.go index a57834434..9dbff369e 100644 --- a/internal/website/permstable/permstable.go +++ b/internal/website/permstable/permstable.go @@ -70,6 +70,7 @@ func main() { host, hostCatalog, hostSet, + managedGroup, role, scope, session, @@ -190,11 +191,11 @@ func (e *Endpoint) Marshal() (ret []string) { for _, v := range sortedKeys(e.Params) { ret = append(ret, fmt.Sprintf(`%s
  • %s
  • `, indent(10), v), - fmt.Sprintf(`%s`, indent(12)), + fmt.Sprintf(`%s`, indent(10)), ) } @@ -212,15 +213,17 @@ func (e *Endpoint) Marshal() (ret []string) { fmt.Sprintf(`%s`, indent(10)), ) ret = append(ret, - fmt.Sprintf(`%s`, indent(10)), ) } @@ -522,7 +525,7 @@ var hostSet = &Resource{ Actions: clActions("a host set"), }, { - Path: "/targets/", + Path: "/host-sets/", Params: map[string]string{ "ID": "", "Type": "host-set", @@ -559,6 +562,29 @@ var hostSet = &Resource{ }, } +var managedGroup = &Resource{ + Type: "Managed Group", + Scopes: iamScopes, + Endpoints: []*Endpoint{ + { + Path: "/managed-groups", + Params: map[string]string{ + "Type": "managed-group", + }, + Actions: clActions("a managed group"), + }, + { + Path: "/managed-groups/", + Params: map[string]string{ + "ID": "", + "Type": "managed-group", + "Pin": "", + }, + Actions: rudActions("a managed group", true), + }, + }, +} + var role = &Resource{ Type: "Role", Scopes: append(iamScopes, infraScope...), diff --git a/website/content/docs/concepts/security/permissions.mdx b/website/content/docs/concepts/security/permissions.mdx index d8d866a1e..9af023072 100644 --- a/website/content/docs/concepts/security/permissions.mdx +++ b/website/content/docs/concepts/security/permissions.mdx @@ -1017,7 +1017,7 @@ documentation](https://www.boundaryproject.io/api-docs) for guidance. - /targets/<id> + /host-sets/<id>
      @@ -1112,6 +1112,112 @@ documentation](https://www.boundaryproject.io/api-docs) for guidance.
    + + Managed Group + +
      +
    • Global
    • +
    • Org
    • +
    + + + /managed-groups + + +
      +
    • Type
    • +
        +
      • + managed-group +
      • +
      +
    + + +
      +
    • + create: Create a managed group +
    • +
        +
      • + type=<type>;actions=create +
      • +
      +
    • + list: List managed groups +
    • +
        +
      • + type=<type>;actions=list +
      • +
      +
    + + + + + /managed-groups/<id> + + +
      +
    • ID
    • +
        +
      • + <id> +
      • +
      +
    • Pin
    • +
        +
      • + <auth-method-id> +
      • +
      +
    • Type
    • +
        +
      • + managed-group +
      • +
      +
    + + +
      +
    • + read: Read a managed group +
    • +
        +
      • + id=<id>;actions=read +
      • +
      • + id=<pin>;type=<type>;actions=read +
      • +
      +
    • + update: Update a managed group +
    • +
        +
      • + id=<id>;actions=update +
      • +
      • + id=<pin>;type=<type>;actions=update +
      • +
      +
    • + delete: Delete a managed group +
    • +
        +
      • + id=<id>;actions=delete +
      • +
      • + id=<pin>;type=<type>;actions=delete +
      • +
      +
    + + Role